Skip to content

Commit

Permalink
fix returned delete value
Browse files Browse the repository at this point in the history
Signed-off-by: you06 <[email protected]>
  • Loading branch information
you06 committed Mar 14, 2024
1 parent f2ac4de commit 04def50
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion txnkv/transaction/batch_getter.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,14 @@ func (b *BufferBatchGetter) BatchGet(ctx context.Context, keys [][]byte) (map[st
}
shrinkKeys := make([][]byte, 0, len(keys)-len(bufferValues))
for _, key := range keys {
_, ok := bufferValues[string(key)]
val, ok := bufferValues[string(key)]
if !ok {
shrinkKeys = append(shrinkKeys, key)
}
// the deleted key should be removed from the result, and also no need to snapshot read it again.
if len(val) == 0 {
delete(bufferValues, string(key))
}
}
storageValues, err := b.snapshot.BatchGet(ctx, shrinkKeys)
if err != nil {
Expand Down

0 comments on commit 04def50

Please sign in to comment.