Skip to content
This repository has been archived by the owner on Aug 4, 2024. It is now read-only.

Commit

Permalink
fix: TransactionIter seek duplicate value
Browse files Browse the repository at this point in the history
  • Loading branch information
KKould committed Sep 7, 2023
1 parent 2a1d86c commit 89f0e8e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "kip_db"
version = "0.1.2-alpha.11"
version = "0.1.2-alpha.12"
edition = "2021"
authors = ["Kould <[email protected]>"]
description = "轻量级、异步 基于LSM Leveled Compaction K-V数据库"
Expand Down
13 changes: 10 additions & 3 deletions src/kernel/lsm/mvcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,17 @@ impl Transaction {

match min {
Bound::Included(key) => {
seek_buf = version_iter.seek(Seek::Backward(key))?;
let ver_seek_option = version_iter.seek(Seek::Backward(key))?;
unsafe {
if !ptr.0.as_ref().is_empty() && key == ptr.0.as_ref()[0].0.as_ref() {
seek_buf = None;
let op = |option_a: Option<&KeyValue>, option_b: Option<&KeyValue>| {
match (option_a, option_b) {
(Some(a), Some(b)) => a.0 == b.0,
_ => false,
}
};

if !op(ver_seek_option.as_ref(), ptr.0.as_ref().first()) {
seek_buf = ver_seek_option;
}
}
}
Expand Down

0 comments on commit 89f0e8e

Please sign in to comment.