Update BuntDB

This commit is contained in:
tidwall 2021-04-01 12:30:59 -07:00
parent 5e440b621b
commit 5a1275bac2
4 changed files with 23 additions and 5 deletions

2
go.mod
View File

@ -14,7 +14,7 @@ require (
github.com/peterh/liner v1.2.1 github.com/peterh/liner v1.2.1
github.com/streadway/amqp v1.0.0 github.com/streadway/amqp v1.0.0
github.com/tidwall/btree v0.4.2 github.com/tidwall/btree v0.4.2
github.com/tidwall/buntdb v1.2.2 github.com/tidwall/buntdb v1.2.3
github.com/tidwall/geoindex v1.4.3 github.com/tidwall/geoindex v1.4.3
github.com/tidwall/geojson v1.2.7 github.com/tidwall/geojson v1.2.7
github.com/tidwall/gjson v1.7.4 github.com/tidwall/gjson v1.7.4

4
go.sum
View File

@ -116,8 +116,8 @@ github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/tidwall/btree v0.4.2 h1:aLwwJlG+InuFzdAPuBf9YCAR1LvSQ9zhC5aorFPlIPs= github.com/tidwall/btree v0.4.2 h1:aLwwJlG+InuFzdAPuBf9YCAR1LvSQ9zhC5aorFPlIPs=
github.com/tidwall/btree v0.4.2/go.mod h1:huei1BkDWJ3/sLXmO+bsCNELL+Bp2Kks9OLyQFkzvA8= github.com/tidwall/btree v0.4.2/go.mod h1:huei1BkDWJ3/sLXmO+bsCNELL+Bp2Kks9OLyQFkzvA8=
github.com/tidwall/buntdb v1.2.2 h1:46G3ulKw8NYo0JAvsZkf7Xq1c8OHOPRuHQVTfL6z+lE= github.com/tidwall/buntdb v1.2.3 h1:AoGVe4yrhKmnEPHrPrW5EUOATHOCIk4VtFvd8xn/ZtU=
github.com/tidwall/buntdb v1.2.2/go.mod h1:+i/gBwYOHWG19wLgwMXFLkl00twh9+VWkkaOhuNQ4PA= github.com/tidwall/buntdb v1.2.3/go.mod h1:+i/gBwYOHWG19wLgwMXFLkl00twh9+VWkkaOhuNQ4PA=
github.com/tidwall/cities v0.1.0 h1:CVNkmMf7NEC9Bvokf5GoSsArHCKRMTgLuubRTHnH0mE= github.com/tidwall/cities v0.1.0 h1:CVNkmMf7NEC9Bvokf5GoSsArHCKRMTgLuubRTHnH0mE=
github.com/tidwall/cities v0.1.0/go.mod h1:lV/HDp2gCcRcHJWqgt6Di54GiDrTZwh1aG2ZUPNbqa4= github.com/tidwall/cities v0.1.0/go.mod h1:lV/HDp2gCcRcHJWqgt6Di54GiDrTZwh1aG2ZUPNbqa4=
github.com/tidwall/geoindex v1.4.3 h1:zowx7LtzibIE6JPbL6CRgVgw9qp13dJ8Pzfa4/f+4us= github.com/tidwall/geoindex v1.4.3 h1:zowx7LtzibIE6JPbL6CRgVgw9qp13dJ8Pzfa4/f+4us=

View File

@ -1176,7 +1176,25 @@ func (tx *Tx) Commit() error {
// Flushing the buffer only once per transaction. // Flushing the buffer only once per transaction.
// If this operation fails then the write did failed and we must // If this operation fails then the write did failed and we must
// rollback. // rollback.
if _, err = tx.db.file.Write(tx.db.buf); err != nil { var n int
n, err = tx.db.file.Write(tx.db.buf)
if err != nil {
if n > 0 {
// There was a partial write to disk.
// We are possibly out of disk space.
// Delete the partially written bytes from the data file by
// seeking to the previously known position and performing
// a truncate operation.
// At this point a syscall failure is fatal and the process
// should be killed to avoid corrupting the file.
pos, err := tx.db.file.Seek(-int64(n), 1)
if err != nil {
panic(err)
}
if err := tx.db.file.Truncate(pos); err != nil {
panic(err)
}
}
tx.rollbackInner() tx.rollbackInner()
} }
if tx.db.config.SyncPolicy == Always { if tx.db.config.SyncPolicy == Always {

2
vendor/modules.txt vendored
View File

@ -117,7 +117,7 @@ github.com/streadway/amqp
# github.com/tidwall/btree v0.4.2 # github.com/tidwall/btree v0.4.2
## explicit ## explicit
github.com/tidwall/btree github.com/tidwall/btree
# github.com/tidwall/buntdb v1.2.2 # github.com/tidwall/buntdb v1.2.3
## explicit ## explicit
github.com/tidwall/buntdb github.com/tidwall/buntdb
# github.com/tidwall/cities v0.1.0 # github.com/tidwall/cities v0.1.0