Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: etcd-io/bbolt
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5b80a56e640c870a0d064099c4a2dcd268c4635c
Choose a base ref
..
head repository: etcd-io/bbolt
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 415cfe31a15de7d716af3494db9003992776d902
Choose a head ref
Showing with 12 additions and 3 deletions.
  1. +1 −1 bucket.go
  2. +11 −2 tx.go
2 changes: 1 addition & 1 deletion bucket.go
Original file line number Diff line number Diff line change
@@ -379,7 +379,7 @@ func (b *Bucket) MoveBucket(key []byte, dstBucket *Bucket) (err error) {
return
}

// MoveBucket moves a sub-bucket from the source bucket to the destination bucket.
// moveBucket moves a sub-bucket from the source bucket to the destination bucket.
// Returns an error if
// 1. the sub-bucket cannot be found in the source bucket;
// 2. or the key already exists in the destination bucket;
13 changes: 11 additions & 2 deletions tx.go
Original file line number Diff line number Diff line change
@@ -177,8 +177,17 @@ func (tx *Tx) deleteBucket(name []byte) error {
// MoveBucket moves a sub-bucket from the source bucket to the destination bucket with slave.
func (tx *Tx) MoveBucket(child []byte, src *Bucket, dst *Bucket) error {
err := tx.moveBucket(child, src, dst)
if err == nil && src.slave != nil && src.slave != nil && tx.slave != nil {
err = tx.slave.moveBucket(child, src.slave, dst.slave)

if err == nil && tx.slave != nil {
if src != nil {
src = src.slave
}

if dst != nil {
dst = dst.slave
}

err = tx.slave.moveBucket(child, src, dst)
}

return err