From 4aceaa739ff4237599322f3ec4df7603d1622ba1 Mon Sep 17 00:00:00 2001 From: gyfffffff <0707charon@gmail.com> Date: Sat, 2 Nov 2024 13:34:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=B0=8F=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/version_set.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db/version_set.cc b/db/version_set.cc index 90276d5..c9dd8a0 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -107,7 +107,7 @@ int FindFile(const InternalKeyComparator& icmp, } while(right < files.size()) { - printf("file ind %d num %d largest deadtime %d parsed deadtime %d\n", + printf("file ind %d num %lu largest deadtime %lu parsed deadtime %lu\n", right,files[right]->number,files[right]->largest_deadtime,parsed.deadTime); if(files[right]->largest_deadtime >= parsed.deadTime) { break; @@ -303,7 +303,7 @@ void Version::ForEachOverlapping(Slice user_key, Slice internal_key, void* arg, const Comparator* ucmp = vset_->icmp_.user_comparator(); ParsedInternalKey parsed; ParseInternalKey(internal_key,&parsed); - printf("parsed lookup deadtime : %d\n",parsed.deadTime); + printf("parsed lookup deadtime : %lu\n",parsed.deadTime); // Search level-0 in order from newest to oldest. std::vector tmp; tmp.reserve(files_[0].size()); @@ -380,7 +380,7 @@ Status Version::Get(const ReadOptions& options, const LookupKey& k, state->s = state->vset->table_cache_->Get(*state->options, f->number, f->file_size, state->ikey, &state->saver, SaveValue); - printf("file level %d num %d\n",level,f->number); + printf("file level %d num %lu\n", level, f->number); std::cout<<"state->s ->saver.state: "<s.ok()<<" "<saver.state<s.ok()) { state->found = true; From 028f65641a7959fa1bc7faa56dbc93e70e324d2d Mon Sep 17 00:00:00 2001 From: augurier <14434658+augurier@user.noreply.gitee.com> Date: Wed, 6 Nov 2024 22:11:08 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=B4=B4=E4=B8=8A=E5=8E=9F=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 4b0ea1a..ebb3435 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # 实验报告 - +仓库地址 https://gitea.shuishan.net.cn/10225501448/leveldb_ttl/src/branch/main ## 1. 设计思路和实现过程 ### 1.1 实验总体流程介绍 @@ -16,8 +16,6 @@ lookup key一定需要一个当前时间在查询中进行比较,因此不再 ![alt text](pics/f535cd48ec424ab7e91e200092b3bb0.png) 为了便于对于新编码的操作,我们也修改了相应的`ParsedInternalKey`结构体和`parseInternalKey`函数等。 -//这里或许可以多贴一点代码 - ### 1.3 写入 新的put接口多了一个默认参数ttl,当调用时不加这个参数,则这一次写入没有ttl,与原来的leveldb写入逻辑一致。否则需要进行两处的修改: