mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 08:23:48 +03:00
update to latest bbolt (db library) v1.3.11
with a fix for releasing pages allocated during a transaction that was rolled back. also bumps required go version to go1.22
This commit is contained in:
parent
016fde8d78
commit
0bb4501472
10 changed files with 42 additions and 12 deletions
|
@ -99,7 +99,7 @@ for other platforms.
|
||||||
# Compiling
|
# Compiling
|
||||||
|
|
||||||
You can easily (cross) compile mox yourself. You need a recent Go toolchain
|
You can easily (cross) compile mox yourself. You need a recent Go toolchain
|
||||||
installed. Run `go version`, it must be >= 1.21. Download the latest version
|
installed. Run `go version`, it must be >= 1.22. Download the latest version
|
||||||
from https://go.dev/dl/ or see https://go.dev/doc/manage-install.
|
from https://go.dev/dl/ or see https://go.dev/doc/manage-install.
|
||||||
|
|
||||||
To download the source code of the latest release, and compile it to binary "mox":
|
To download the source code of the latest release, and compile it to binary "mox":
|
||||||
|
|
4
go.mod
4
go.mod
|
@ -1,6 +1,6 @@
|
||||||
module github.com/mjl-/mox
|
module github.com/mjl-/mox
|
||||||
|
|
||||||
go 1.21
|
go 1.22
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/mjl-/adns v0.0.0-20240509092456-2dc8715bf4af
|
github.com/mjl-/adns v0.0.0-20240509092456-2dc8715bf4af
|
||||||
|
@ -13,7 +13,7 @@ require (
|
||||||
github.com/mjl-/sherpats v0.0.6
|
github.com/mjl-/sherpats v0.0.6
|
||||||
github.com/prometheus/client_golang v1.18.0
|
github.com/prometheus/client_golang v1.18.0
|
||||||
github.com/russross/blackfriday/v2 v2.1.0
|
github.com/russross/blackfriday/v2 v2.1.0
|
||||||
go.etcd.io/bbolt v1.3.10
|
go.etcd.io/bbolt v1.3.11
|
||||||
golang.org/x/crypto v0.22.0
|
golang.org/x/crypto v0.22.0
|
||||||
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f
|
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f
|
||||||
golang.org/x/net v0.24.0
|
golang.org/x/net v0.24.0
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -68,8 +68,8 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
go.etcd.io/bbolt v1.3.10 h1:+BqfJTcCzTItrop8mq/lbzL8wSGtj94UO/3U31shqG0=
|
go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0=
|
||||||
go.etcd.io/bbolt v1.3.10/go.mod h1:bK3UQLPJZly7IlNmV7uVHJDxfe5aK9Ll93e/74Y9oEQ=
|
go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I=
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
|
2
vendor/go.etcd.io/bbolt/.go-version
generated
vendored
2
vendor/go.etcd.io/bbolt/.go-version
generated
vendored
|
@ -1 +1 @@
|
||||||
1.21.9
|
1.22.6
|
||||||
|
|
13
vendor/go.etcd.io/bbolt/Makefile
generated
vendored
13
vendor/go.etcd.io/bbolt/Makefile
generated
vendored
|
@ -41,6 +41,15 @@ coverage:
|
||||||
TEST_FREELIST_TYPE=array go test -v -timeout 30m \
|
TEST_FREELIST_TYPE=array go test -v -timeout 30m \
|
||||||
-coverprofile cover-freelist-array.out -covermode atomic
|
-coverprofile cover-freelist-array.out -covermode atomic
|
||||||
|
|
||||||
|
BOLT_CMD=bbolt
|
||||||
|
|
||||||
|
build:
|
||||||
|
go build -o bin/${BOLT_CMD} ./cmd/${BOLT_CMD}
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean: # Clean binaries
|
||||||
|
rm -f ./bin/${BOLT_CMD}
|
||||||
|
|
||||||
.PHONY: gofail-enable
|
.PHONY: gofail-enable
|
||||||
gofail-enable: install-gofail
|
gofail-enable: install-gofail
|
||||||
gofail enable .
|
gofail enable .
|
||||||
|
@ -61,3 +70,7 @@ test-failpoint:
|
||||||
@echo "[failpoint] array freelist test"
|
@echo "[failpoint] array freelist test"
|
||||||
TEST_FREELIST_TYPE=array go test -v ${TESTFLAGS} -timeout 30m ./tests/failpoint
|
TEST_FREELIST_TYPE=array go test -v ${TESTFLAGS} -timeout 30m ./tests/failpoint
|
||||||
|
|
||||||
|
.PHONY: test-robustness # Running robustness tests requires root permission
|
||||||
|
test-robustness:
|
||||||
|
go test -v ${TESTFLAGS} ./tests/dmflakey -test.root
|
||||||
|
go test -v ${TESTFLAGS} ./tests/robustness -test.root
|
||||||
|
|
8
vendor/go.etcd.io/bbolt/db.go
generated
vendored
8
vendor/go.etcd.io/bbolt/db.go
generated
vendored
|
@ -524,7 +524,7 @@ func (db *DB) munmap() error {
|
||||||
// gofail: var unmapError string
|
// gofail: var unmapError string
|
||||||
// return errors.New(unmapError)
|
// return errors.New(unmapError)
|
||||||
if err := munmap(db); err != nil {
|
if err := munmap(db); err != nil {
|
||||||
return fmt.Errorf("unmap error: " + err.Error())
|
return fmt.Errorf("unmap error: %v", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -571,7 +571,7 @@ func (db *DB) munlock(fileSize int) error {
|
||||||
// gofail: var munlockError string
|
// gofail: var munlockError string
|
||||||
// return errors.New(munlockError)
|
// return errors.New(munlockError)
|
||||||
if err := munlock(db, fileSize); err != nil {
|
if err := munlock(db, fileSize); err != nil {
|
||||||
return fmt.Errorf("munlock error: " + err.Error())
|
return fmt.Errorf("munlock error: %v", err.Error())
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -580,7 +580,7 @@ func (db *DB) mlock(fileSize int) error {
|
||||||
// gofail: var mlockError string
|
// gofail: var mlockError string
|
||||||
// return errors.New(mlockError)
|
// return errors.New(mlockError)
|
||||||
if err := mlock(db, fileSize); err != nil {
|
if err := mlock(db, fileSize); err != nil {
|
||||||
return fmt.Errorf("mlock error: " + err.Error())
|
return fmt.Errorf("mlock error: %v", err.Error())
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -1159,6 +1159,8 @@ func (db *DB) grow(sz int) error {
|
||||||
// https://github.com/boltdb/bolt/issues/284
|
// https://github.com/boltdb/bolt/issues/284
|
||||||
if !db.NoGrowSync && !db.readOnly {
|
if !db.NoGrowSync && !db.readOnly {
|
||||||
if runtime.GOOS != "windows" {
|
if runtime.GOOS != "windows" {
|
||||||
|
// gofail: var resizeFileError string
|
||||||
|
// return errors.New(resizeFileError)
|
||||||
if err := db.file.Truncate(int64(sz)); err != nil {
|
if err := db.file.Truncate(int64(sz)); err != nil {
|
||||||
return fmt.Errorf("file resize error: %s", err)
|
return fmt.Errorf("file resize error: %s", err)
|
||||||
}
|
}
|
||||||
|
|
8
vendor/go.etcd.io/bbolt/freelist.go
generated
vendored
8
vendor/go.etcd.io/bbolt/freelist.go
generated
vendored
|
@ -252,6 +252,14 @@ func (f *freelist) rollback(txid txid) {
|
||||||
}
|
}
|
||||||
// Remove pages from pending list and mark as free if allocated by txid.
|
// Remove pages from pending list and mark as free if allocated by txid.
|
||||||
delete(f.pending, txid)
|
delete(f.pending, txid)
|
||||||
|
|
||||||
|
// Remove pgids which are allocated by this txid
|
||||||
|
for pgid, tid := range f.allocs {
|
||||||
|
if tid == txid {
|
||||||
|
delete(f.allocs, pgid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
f.mergeSpans(m)
|
f.mergeSpans(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
7
vendor/go.etcd.io/bbolt/tx.go
generated
vendored
7
vendor/go.etcd.io/bbolt/tx.go
generated
vendored
|
@ -1,6 +1,7 @@
|
||||||
package bbolt
|
package bbolt
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
@ -185,6 +186,10 @@ func (tx *Tx) Commit() error {
|
||||||
|
|
||||||
// If the high water mark has moved up then attempt to grow the database.
|
// If the high water mark has moved up then attempt to grow the database.
|
||||||
if tx.meta.pgid > opgid {
|
if tx.meta.pgid > opgid {
|
||||||
|
_ = errors.New("")
|
||||||
|
// gofail: var lackOfDiskSpace string
|
||||||
|
// tx.rollback()
|
||||||
|
// return errors.New(lackOfDiskSpace)
|
||||||
if err := tx.db.grow(int(tx.meta.pgid+1) * tx.db.pageSize); err != nil {
|
if err := tx.db.grow(int(tx.meta.pgid+1) * tx.db.pageSize); err != nil {
|
||||||
tx.rollback()
|
tx.rollback()
|
||||||
return err
|
return err
|
||||||
|
@ -470,6 +475,7 @@ func (tx *Tx) write() error {
|
||||||
|
|
||||||
// Ignore file sync if flag is set on DB.
|
// Ignore file sync if flag is set on DB.
|
||||||
if !tx.db.NoSync || IgnoreNoSync {
|
if !tx.db.NoSync || IgnoreNoSync {
|
||||||
|
// gofail: var beforeSyncDataPages struct{}
|
||||||
if err := fdatasync(tx.db); err != nil {
|
if err := fdatasync(tx.db); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -507,6 +513,7 @@ func (tx *Tx) writeMeta() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !tx.db.NoSync || IgnoreNoSync {
|
if !tx.db.NoSync || IgnoreNoSync {
|
||||||
|
// gofail: var beforeSyncMetaPage struct{}
|
||||||
if err := fdatasync(tx.db); err != nil {
|
if err := fdatasync(tx.db); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
4
vendor/modules.txt
vendored
4
vendor/modules.txt
vendored
|
@ -61,8 +61,8 @@ github.com/prometheus/procfs/internal/util
|
||||||
# github.com/russross/blackfriday/v2 v2.1.0
|
# github.com/russross/blackfriday/v2 v2.1.0
|
||||||
## explicit
|
## explicit
|
||||||
github.com/russross/blackfriday/v2
|
github.com/russross/blackfriday/v2
|
||||||
# go.etcd.io/bbolt v1.3.10
|
# go.etcd.io/bbolt v1.3.11
|
||||||
## explicit; go 1.21
|
## explicit; go 1.22
|
||||||
go.etcd.io/bbolt
|
go.etcd.io/bbolt
|
||||||
# golang.org/x/crypto v0.22.0
|
# golang.org/x/crypto v0.22.0
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
|
|
|
@ -53,7 +53,7 @@ for other platforms.
|
||||||
## Compiling
|
## Compiling
|
||||||
|
|
||||||
You can easily (cross) compile mox yourself. You need a recent Go toolchain
|
You can easily (cross) compile mox yourself. You need a recent Go toolchain
|
||||||
installed. Run `go version`, it must be >= 1.21. Download the latest version
|
installed. Run `go version`, it must be >= 1.22. Download the latest version
|
||||||
from https://go.dev/dl/ or see https://go.dev/doc/manage-install.
|
from https://go.dev/dl/ or see https://go.dev/doc/manage-install.
|
||||||
|
|
||||||
To download the source code of the latest release, and compile it to binary "mox":
|
To download the source code of the latest release, and compile it to binary "mox":
|
||||||
|
|
Loading…
Reference in a new issue