Browse Source

添加合并逻辑

main
朱陈媛 3 weeks ago
parent
commit
68ade93903
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      leveldb_base/db/db_impl.cc

+ 5
- 5
leveldb_base/db/db_impl.cc View File

@ -11,7 +11,7 @@
#include <set>
#include <string>
#include <vector>
// 添加所需头文件-
// 添加所需头文件-朱陈媛
#include <iostream>
#include <sstream>
#include <iomanip>
@ -597,7 +597,7 @@ void DBImpl::CompactRange(const Slice* begin, const Slice* end) {
}
}
TEST_CompactMemTable(); // TODO(sanjay): Skip if memtable does not overlap
// 这个改成小于等于,test能过,但这不是改变原本的手动合并逻辑了吗?-
// 这个改成小于等于,test能过,但这不是改变原本的手动合并逻辑了吗?-朱陈媛
for (int level = 0; level <= max_level_with_files; level++) {
TEST_CompactRange(level, begin, end);
}
@ -955,7 +955,7 @@ Status DBImpl::DoCompactionWork(CompactionState* compact) {
// Handle key/value, add to state, etc.
bool drop = false;
// 检查数据是否过期-
// 检查数据是否过期-朱陈媛
Slice value = input->value();
std::string value_with_ttl(value.data(), value.size());
if (value_with_ttl.size() >= 19) {
@ -1228,7 +1228,7 @@ void DBImpl::ReleaseSnapshot(const Snapshot* snapshot) {
Status DBImpl::Put(const WriteOptions& o, const Slice& key, const Slice& val) {
return DB::Put(o, key, val);
}
// 添加ttl-
// 添加ttl-朱陈媛
// Convenience methods
Status DBImpl::Put(const WriteOptions& o, const Slice& key, const Slice& val, uint64_t ttl) {
return DB::Put(o, key, val, ttl);
@ -1527,7 +1527,7 @@ Status DB::Put(const WriteOptions& opt, const Slice& key, const Slice& value) {
return Write(opt, &batch);
}
// 添加ttl-
// 添加ttl-朱陈媛
Status DB::Put(const WriteOptions& opt, const Slice& key, const Slice& value, uint64_t ttl) {
WriteBatch batch;
batch.Put(key, value, ttl);

Loading…
Cancel
Save