bbolt
bbolt copied to clipboard
Compact: runtime error: slice bounds out of range
Hi guys! I have a problem with Compact function.
My bolt.db file is 2.02Gb and when I try to compact it I catch this panic:
runtime error: slice bounds out of range [::2166032459] with length 2147483647
runtime.gopanic
/usr/local/go/src/runtime/panic.go:969
runtime.goPanicSlice3Alen
/usr/local/go/src/runtime/panic.go:126
go.etcd.io/bbolt.unsafeByteSlice
/vendor/go.etcd.io/bbolt/unsafe.go:27
go.etcd.io/bbolt.(*leafPageElement).value
/vendor/go.etcd.io/bbolt/page.go:133
go.etcd.io/bbolt.(*Cursor).keyValue
/vendor/go.etcd.io/bbolt/cursor.go:350
go.etcd.io/bbolt.(*Cursor).next
/vendor/go.etcd.io/bbolt/cursor.go:242
go.etcd.io/bbolt.(*Cursor).Next
/vendor/go.etcd.io/bbolt/cursor.go:75
go.etcd.io/bbolt.(*Bucket).ForEach
/vendor/go.etcd.io/bbolt/bucket.go:389
go.etcd.io/bbolt.walkBucket
/vendor/go.etcd.io/bbolt/compact.go:107
go.etcd.io/bbolt.walk.func1.1
/vendor/go.etcd.io/bbolt/compact.go:89
go.etcd.io/bbolt.(*Tx).ForEach.func1
/vendor/go.etcd.io/bbolt/tx.go:129
go.etcd.io/bbolt.(*Bucket).ForEach
/vendor/go.etcd.io/bbolt/bucket.go:390
go.etcd.io/bbolt.(*Tx).ForEach
/vendor/go.etcd.io/bbolt/tx.go:128
go.etcd.io/bbolt.walk.func1
/vendor/go.etcd.io/bbolt/compact.go:88
go.etcd.io/bbolt.(*DB).View
/vendor/go.etcd.io/bbolt/db.go:772
go.etcd.io/bbolt.walk
/vendor/go.etcd.io/bbolt/compact.go:87
go.etcd.io/bbolt.Compact
/vendor/go.etcd.io/bbolt/compact.go:17
I tried setting thetxMaxSize to 512Mb but it didn't help.
I figured it out. The reason was I tried to store a huge value for one key around 2Gb and exceeded maxAllocSize limit.