Skip to content

Commit

Permalink
Bug Fix: When moving a move key, don't recursively add the badgerMove…
Browse files Browse the repository at this point in the history
… prefix.
  • Loading branch information
manishrjain committed May 25, 2018
1 parent 744717d commit 2e3a32f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions value.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,13 @@ func (vlog *valueLog) rewrite(f *logFile, tr trace.Trace) error {
// allowed to rewrite an older version of key in the LSM tree, because then this older
// version would be at the top of the LSM tree. To work correctly, reads expect the
// latest versions to be at the top, and the older versions at the bottom.
ne.Key = append(badgerMove, e.Key...)
if bytes.HasPrefix(e.Key, badgerMove) {
ne.Key = append([]byte{}, e.Key...)
} else {
ne.Key = append(badgerMove, e.Key...)
}

ne.Value = make([]byte, len(e.Value))
copy(ne.Value, e.Value)
ne.Value = append([]byte{}, e.Value...)
wb = append(wb, ne)
size += int64(e.estimateSize(vlog.opt.ValueThreshold))
if size >= 64*mi {
Expand Down

0 comments on commit 2e3a32f

Please sign in to comment.