Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ jobs:
with:
persist-credentials: false

- name: Set up Go 1.24
- name: Set up Go 1.25
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version: 1.24.x
go-version: 1.25.x
check-latest: true
cache: true

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ jobs:
fetch-depth: 0
persist-credentials: false

- name: Set up Go 1.24
- name: Set up Go 1.25
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version: 1.24.x
go-version: 1.25.x
check-latest: true
cache: false # don't save & restore build caches because golangci-lint action does it internally

Expand All @@ -62,10 +62,10 @@ jobs:
fetch-depth: 0
persist-credentials: false

- name: Set up Go 1.24
- name: Set up Go 1.25
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version: 1.24.x
go-version: 1.25.x
check-latest: true
cache: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version: 1.24.x
go-version: 1.25.x
check-latest: true
cache: true
- name: Run go list
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ before_install:
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.6.0

go:
- 1.24.x
- 1.25.x

script:
- go vet ./...
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Installation
Requirements
-----------

* Need at least `go1.24` or newer.
* Need at least `go1.25` or newer.

Usage
-----------
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/wavesplatform/goleveldb

go 1.24.0
go 1.25.0

require (
github.com/golang/snappy v1.0.0
Expand All @@ -18,9 +18,9 @@ require (
github.com/nxadm/tail v1.4.11 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/net v0.49.0 // indirect
golang.org/x/sys v0.40.0 // indirect
golang.org/x/text v0.33.0 // indirect
golang.org/x/net v0.52.0 // indirect
golang.org/x/sys v0.42.0 // indirect
golang.org/x/text v0.35.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
9 changes: 9 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,22 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c=
golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU=
golang.org/x/mod v0.33.0 h1:tHFzIWbBifEmbwtGz65eaWyGiGZatSrT9prnU8DbVL8=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o=
golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8=
golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0=
golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand All @@ -88,15 +92,20 @@ golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE=
golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8=
golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8=
golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.41.0 h1:a9b8iMweWG+S0OBnlU36rzLp20z1Rp10w+IY2czHTQc=
golang.org/x/tools v0.41.0/go.mod h1:XSY6eDqxVNiYgezAVqqCeihT4j1U2CCsqvH3WhQpnlg=
golang.org/x/tools v0.42.0 h1:uNgphsn75Tdz5Ji2q36v/nsFSfR/9BRFvqhGBaJGd5k=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
6 changes: 2 additions & 4 deletions leveldb/cache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,7 @@ func TestCacheMap(t *testing.T) {
objects := objects[id]
handles := handles[id]
for job := 0; job < param.concurrent; job++ {
wg.Add(1)
go func() {
defer wg.Done()
wg.Go(func() {

r := rand.New(rand.NewSource(time.Now().UnixNano()))
for j := len(objects) * param.repeat; j >= 0; j-- {
Expand All @@ -179,7 +177,7 @@ func TestCacheMap(t *testing.T) {
h.Release()
}
}
}()
})
}

// Randomly release handles at interval.
Expand Down
18 changes: 6 additions & 12 deletions leveldb/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2945,11 +2945,9 @@ func TestDB_GracefulClose(t *testing.T) {
for i := range 1000000 {
if !closing && h.totalTables() > 3 {
t.Logf("close db during write, index=%d", i)
closeWait.Add(1)
go func() {
closeWait.Go(func() {
h.closeDB()
closeWait.Done()
}()
})
closing = true
}
if err := h.db.Put(fmt.Appendf(nil, "%09d", i), fmt.Appendf(nil, "VAL-%09d", i), h.wo); err != nil {
Expand All @@ -2966,11 +2964,9 @@ func TestDB_GracefulClose(t *testing.T) {
for i := 0; i < n; i++ {
if !closing && i > n/2 {
t.Logf("close db during read, index=%d", i)
closeWait.Add(1)
go func() {
closeWait.Go(func() {
h.closeDB()
closeWait.Done()
}()
})
closing = true
}
if _, err := h.db.Get(fmt.Appendf(nil, "%09d", i), h.ro); err != nil {
Expand All @@ -2990,11 +2986,9 @@ func TestDB_GracefulClose(t *testing.T) {
}
if !closing {
t.Logf("close db during iter, index=%d", i)
closeWait.Add(1)
go func() {
closeWait.Go(func() {
h.closeDB()
closeWait.Done()
}()
})
closing = true
}
time.Sleep(time.Millisecond)
Expand Down
12 changes: 1 addition & 11 deletions leveldb/table/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,6 @@ func (e *ErrCorrupted) Error() string {
return fmt.Sprintf("leveldb/table: corruption on %s (pos=%d): %s", e.Kind, e.Pos, e.Reason)
}

func max(x, y int) int {
if x > y {
return x
}
return y
}

type block struct {
bpool *util.BufferPool
bh blockHandle
Expand All @@ -74,10 +67,7 @@ func (b *block) seek(cmp comparer.Comparer, rstart, rlimit int, key []byte) (ind
m := offset + n1 + n2
return cmp.Compare(b.data[m:m+int(v1)], key) > 0
}) + rstart - 1
if index < rstart {
// The smallest key is greater-than key sought.
index = rstart
}
index = max(index, rstart) // if index < rstart the smallest key is greater-than key sought.
offset = int(binary.LittleEndian.Uint32(b.data[b.restartsOffset+4*index:]))
return
}
Expand Down
10 changes: 7 additions & 3 deletions leveldb/testutil/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,12 +512,16 @@ func (s *Storage) ForceRename(oldfd, newfd storage.FileDesc) (err error) {
}

func (s *Storage) openFiles() string {
out := "Open files:"
var out strings.Builder
out.WriteString("Open files:")
for x, writer := range s.opens {
fd := unpackFile(x)
out += fmt.Sprintf("\n · fd=%s writer=%v", fd, writer)
_, err := fmt.Fprintf(&out, "\n · fd=%s writer=%v", fd, writer)
if err != nil {
panic(fmt.Errorf("failed to write to string builder: %w", err))
}
}
return out
return out.String()
}

func (s *Storage) CloseCheck() {
Expand Down
6 changes: 2 additions & 4 deletions leveldb/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,11 @@ func TestVersionReference(t *testing.T) {
var wg sync.WaitGroup
readN := rand.Intn(300)
for range readN {
wg.Add(1)
go func() {
wg.Go(func() {
v := s.version()
time.Sleep(time.Millisecond * time.Duration(rand.Intn(300)))
v.release()
wg.Done()
}()
})
}

v := s.version()
Expand Down
8 changes: 4 additions & 4 deletions manualtest/dbstress/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ var (
type arrayInt []int

func (a arrayInt) String() string {
var str string
var str strings.Builder
for i, n := range a {
if i > 0 {
str += ","
str.WriteString(",")
}
str += strconv.Itoa(n)
str.WriteString(strconv.Itoa(n))
}
return str
return str.String()
}

func (a *arrayInt) Set(str string) error {
Expand Down
Loading