Unverified Commit 018a0bb1 authored by qupeng's avatar qupeng Committed by GitHub

add `seqno` into iterator (#198)

parent ab0a8b90
...@@ -6,6 +6,9 @@ titandb_bench ...@@ -6,6 +6,9 @@ titandb_bench
titandb_stress titandb_stress
build/ build/
rocksdb
Makefile
*.cmake
.idea/ .idea/
.vscode/ .vscode/
cmake-build-debug/ cmake-build-debug/
...@@ -31,15 +31,16 @@ class TitanCompactionFilter final : public CompactionFilter { ...@@ -31,15 +31,16 @@ class TitanCompactionFilter final : public CompactionFilter {
const char *Name() const override { return filter_name_.c_str(); } const char *Name() const override { return filter_name_.c_str(); }
Decision FilterV2(int level, const Slice &key, ValueType value_type, Decision FilterV3(int level, const Slice &key, SequenceNumber seqno,
const Slice &value, std::string *new_value, ValueType value_type, const Slice &value,
std::string *new_value,
std::string *skip_until) const override { std::string *skip_until) const override {
if (skip_value_) { if (skip_value_) {
return original_filter_->FilterV2(level, key, value_type, Slice(), return original_filter_->FilterV3(level, key, seqno, value_type, Slice(),
new_value, skip_until); new_value, skip_until);
} }
if (value_type != kBlobIndex) { if (value_type != kBlobIndex) {
return original_filter_->FilterV2(level, key, value_type, value, return original_filter_->FilterV3(level, key, seqno, value_type, value,
new_value, skip_until); new_value, skip_until);
} }
...@@ -73,8 +74,8 @@ class TitanCompactionFilter final : public CompactionFilter { ...@@ -73,8 +74,8 @@ class TitanCompactionFilter final : public CompactionFilter {
// TODO(yiwu): Tell the two cases apart. // TODO(yiwu): Tell the two cases apart.
return Decision::kKeep; return Decision::kKeep;
} else if (s.ok()) { } else if (s.ok()) {
auto decision = original_filter_->FilterV2( auto decision = original_filter_->FilterV3(
level, key, kValue, record.value, new_value, skip_until); level, key, seqno, kValue, record.value, new_value, skip_until);
// It would be a problem if it change the value whereas the value_type // It would be a problem if it change the value whereas the value_type
// is still kBlobIndex. For now, just returns kKeep. // is still kBlobIndex. For now, just returns kKeep.
......
...@@ -116,6 +116,10 @@ class TitanDBIterator : public Iterator { ...@@ -116,6 +116,10 @@ class TitanDBIterator : public Iterator {
return record_.value; return record_.value;
} }
bool seqno(SequenceNumber* number) const override {
return iter_->seqno(number);
}
private: private:
bool ShouldGetBlobValue() { bool ShouldGetBlobValue() {
if (!iter_->Valid() || !iter_->IsBlob() || options_.key_only) { if (!iter_->Valid() || !iter_->IsBlob() || options_.key_only) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment