mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-04 11:19:39 -06:00
Merge pull request #1463 from opencloud-eu/dependabot/go_modules/go.etcd.io/bbolt-1.4.3
build(deps): bump go.etcd.io/bbolt from 1.4.2 to 1.4.3
This commit is contained in:
2
go.mod
2
go.mod
@@ -93,7 +93,7 @@ require (
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.1
|
||||
github.com/xhit/go-simple-mail/v2 v2.16.0
|
||||
go-micro.dev/v4 v4.11.0
|
||||
go.etcd.io/bbolt v1.4.2
|
||||
go.etcd.io/bbolt v1.4.3
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0
|
||||
go.opentelemetry.io/contrib/zpages v0.62.0
|
||||
|
||||
4
go.sum
4
go.sum
@@ -1220,8 +1220,8 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t
|
||||
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
|
||||
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||
go.etcd.io/bbolt v1.4.2 h1:IrUHp260R8c+zYx/Tm8QZr04CX+qWS5PGfPdevhdm1I=
|
||||
go.etcd.io/bbolt v1.4.2/go.mod h1:Is8rSHO/b4f3XigBC0lL0+4FwAQv3HXEEIgFMuKHceM=
|
||||
go.etcd.io/bbolt v1.4.3 h1:dEadXpI6G79deX5prL3QRNP6JB8UxVkqo4UPnHaNXJo=
|
||||
go.etcd.io/bbolt v1.4.3/go.mod h1:tKQlpPaYCVFctUIgFKFnAlvbmB3tpy1vkTnDWohtc0E=
|
||||
go.etcd.io/etcd/api/v3 v3.6.4 h1:7F6N7toCKcV72QmoUKa23yYLiiljMrT4xCeBL9BmXdo=
|
||||
go.etcd.io/etcd/api/v3 v3.6.4/go.mod h1:eFhhvfR8Px1P6SEuLT600v+vrhdDTdcfMzmnxVXXSbk=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.6.4 h1:9HBYrjppeOfFjBjaMTRxT3R7xT0GLK8EJMVC4xg6ok0=
|
||||
|
||||
2
vendor/go.etcd.io/bbolt/.go-version
generated
vendored
2
vendor/go.etcd.io/bbolt/.go-version
generated
vendored
@@ -1 +1 @@
|
||||
1.23.10
|
||||
1.23.12
|
||||
|
||||
68
vendor/go.etcd.io/bbolt/tx.go
generated
vendored
68
vendor/go.etcd.io/bbolt/tx.go
generated
vendored
@@ -387,16 +387,43 @@ func (tx *Tx) Copy(w io.Writer) error {
|
||||
// WriteTo writes the entire database to a writer.
|
||||
// If err == nil then exactly tx.Size() bytes will be written into the writer.
|
||||
func (tx *Tx) WriteTo(w io.Writer) (n int64, err error) {
|
||||
// Attempt to open reader with WriteFlag
|
||||
f, err := tx.db.openFile(tx.db.path, os.O_RDONLY|tx.WriteFlag, 0)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
defer func() {
|
||||
if cerr := f.Close(); err == nil {
|
||||
err = cerr
|
||||
var f *os.File
|
||||
// There is a risk that between the time a read-only transaction
|
||||
// is created and the time the file is actually opened, the
|
||||
// underlying db file at tx.db.path may have been replaced
|
||||
// (e.g. via rename). In that case, opening the file again would
|
||||
// unexpectedly point to a different file, rather than the one
|
||||
// the transaction was based on.
|
||||
//
|
||||
// To overcome this, we reuse the already opened file handle when
|
||||
// WritFlag not set. When the WriteFlag is set, we reopen the file
|
||||
// but verify that it still refers to the same underlying file
|
||||
// (by device and inode). If it does not, we fall back to
|
||||
// reusing the existing already opened file handle.
|
||||
if tx.WriteFlag != 0 {
|
||||
// Attempt to open reader with WriteFlag
|
||||
f, err = tx.db.openFile(tx.db.path, os.O_RDONLY|tx.WriteFlag, 0)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}()
|
||||
|
||||
if ok, err := sameFile(tx.db.file, f); !ok {
|
||||
lg := tx.db.Logger()
|
||||
if cerr := f.Close(); cerr != nil {
|
||||
lg.Errorf("failed to close the file (%s): %v", tx.db.path, cerr)
|
||||
}
|
||||
lg.Warningf("The underlying file has changed, so reuse the already opened file (%s): %v", tx.db.path, err)
|
||||
f = tx.db.file
|
||||
} else {
|
||||
defer func() {
|
||||
if cerr := f.Close(); err == nil {
|
||||
err = cerr
|
||||
}
|
||||
}()
|
||||
}
|
||||
} else {
|
||||
f = tx.db.file
|
||||
}
|
||||
|
||||
// Generate a meta page. We use the same page data for both meta pages.
|
||||
buf := make([]byte, tx.db.pageSize)
|
||||
@@ -423,13 +450,13 @@ func (tx *Tx) WriteTo(w io.Writer) (n int64, err error) {
|
||||
return n, fmt.Errorf("meta 1 copy: %s", err)
|
||||
}
|
||||
|
||||
// Move past the meta pages in the file.
|
||||
if _, err := f.Seek(int64(tx.db.pageSize*2), io.SeekStart); err != nil {
|
||||
return n, fmt.Errorf("seek: %s", err)
|
||||
}
|
||||
// Copy data pages using a SectionReader to avoid affecting f's offset.
|
||||
dataOffset := int64(tx.db.pageSize * 2)
|
||||
dataSize := tx.Size() - dataOffset
|
||||
sr := io.NewSectionReader(f, dataOffset, dataSize)
|
||||
|
||||
// Copy data pages.
|
||||
wn, err := io.CopyN(w, f, tx.Size()-int64(tx.db.pageSize*2))
|
||||
wn, err := io.CopyN(w, sr, dataSize)
|
||||
n += wn
|
||||
if err != nil {
|
||||
return n, err
|
||||
@@ -438,6 +465,19 @@ func (tx *Tx) WriteTo(w io.Writer) (n int64, err error) {
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func sameFile(f1, f2 *os.File) (bool, error) {
|
||||
fi1, err := f1.Stat()
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("failed to get fileInfo of the first file (%s): %w", f1.Name(), err)
|
||||
}
|
||||
fi2, err := f2.Stat()
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("failed to get fileInfo of the second file (%s): %w", f2.Name(), err)
|
||||
}
|
||||
|
||||
return os.SameFile(fi1, fi2), nil
|
||||
}
|
||||
|
||||
// CopyFile copies the entire database to file at the given path.
|
||||
// A reader transaction is maintained during the copy so it is safe to continue
|
||||
// using the database while a copy is in progress.
|
||||
|
||||
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@@ -2112,7 +2112,7 @@ go-micro.dev/v4/util/ring
|
||||
go-micro.dev/v4/util/signal
|
||||
go-micro.dev/v4/util/socket
|
||||
go-micro.dev/v4/util/tls
|
||||
# go.etcd.io/bbolt v1.4.2
|
||||
# go.etcd.io/bbolt v1.4.3
|
||||
## explicit; go 1.23
|
||||
go.etcd.io/bbolt
|
||||
go.etcd.io/bbolt/errors
|
||||
|
||||
Reference in New Issue
Block a user