chore(deps): bump go.etcd.io/bbolt from 1.4.2 to 1.4.3

Bumps [go.etcd.io/bbolt](https://github.com/etcd-io/bbolt) from 1.4.2 to 1.4.3.
- [Release notes](https://github.com/etcd-io/bbolt/releases)
- [Commits](https://github.com/etcd-io/bbolt/compare/v1.4.2...v1.4.3)

---
updated-dependencies:
- dependency-name: go.etcd.io/bbolt
  dependency-version: 1.4.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot]
2025-08-20 07:45:50 +00:00
committed by GitHub
parent c5ce30dae9
commit 955efd6256
5 changed files with 59 additions and 19 deletions

View File

@@ -1 +1 @@
1.23.10
1.23.12

68
vendor/go.etcd.io/bbolt/tx.go generated vendored
View File

@@ -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
View File

@@ -468,7 +468,7 @@ github.com/vanng822/go-premailer/premailer
# github.com/x448/float16 v0.8.4
## explicit; go 1.11
github.com/x448/float16
# 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