Skip to content

Commit

Permalink
backup: break one key scan when met delete version (tikv#6655)
Browse files Browse the repository at this point in the history
Signed-off-by: luancheng <luancheng@pingcap.com>
  • Loading branch information
3pointer committed Feb 20, 2020
1 parent faa49ac commit 40534f5
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/storage/mvcc/reader/scanner/forward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,15 @@ impl<S: Snapshot> ScanPolicy<S> for LatestEntryPolicy {
write: entry_write,
});
}
WriteType::Delete if self.output_delete => {
break Some(TxnEntry::Commit {
default: (Vec::new(), Vec::new()),
write: (write_key.to_vec(), write_value.to_vec()),
});
WriteType::Delete => {
if self.output_delete {
break Some(TxnEntry::Commit {
default: (Vec::new(), Vec::new()),
write: (write_key.to_vec(), write_value.to_vec()),
});
} else {
break None;
}
}
_ => {}
}
Expand Down Expand Up @@ -1428,14 +1432,16 @@ mod latest_entry_tests {

// Scanning entries in (10, 15] should get None
check(15, 10, true, vec![]);
// Scanning entries without delete in (7, 10] should get None
// Scanning entries without delete in (7, 10] should get None
check(10, 7, false, vec![]);
// Scanning entries include delete in (7, 10] should get entry_b_10
// Scanning entries include delete in (7, 10] should get entry_b_10
check(10, 7, true, vec![&entry_b_10]);
// Scanning entries include delete in (3, 10] should get a_7 and b_10
check(10, 3, true, vec![&entry_a_7, &entry_b_10]);
// Scanning entries in (0, 5] should get a_3 and b_1
check(5, 0, true, vec![&entry_a_3, &entry_b_1]);
// Scanning entries without delete in (0, 10] should get a_7
check(10, 0, false, vec![&entry_a_7]);
}
}

Expand Down

0 comments on commit 40534f5

Please sign in to comment.