diff --git a/db/vlog_cache.h b/db/vlog_cache.h index 5a3577c..f6b3276 100644 --- a/db/vlog_cache.h +++ b/db/vlog_cache.h @@ -5,10 +5,9 @@ #ifndef LEVELDB_VLOG_CACHE_H #define LEVELDB_VLOG_CACHE_H - -#include #include - +#include +#include #define BLOCK_SIZE 4096 diff --git a/pic/test_accuracy.png b/pic/test_accuracy.png new file mode 100644 index 0000000..3d4ae67 Binary files /dev/null and b/pic/test_accuracy.png differ diff --git a/report.md b/report.md index fa48e46..355ecd2 100644 --- a/report.md +++ b/report.md @@ -324,10 +324,7 @@ struct executor_param { 4. 实例化 slot_content 结构体 sc; 5. 调用 put_value 函数,以 sc 中的 vlog_num(vlog编号) 和 value_offset(在vlog中的偏移量) 为参数,将字符串 serialized_value 写入 vlog 中; 6. 调用 set_slot 函数,将 slot_content 中的内容赋值给 slot_num; -7. 将 slot_num 作为 value 写入数据库中; - -相关函数调用链: -`DBImpl::Put_Fields` +7. 将 slot_num 作为 value 写入数据库中。 **代码实现:** ```` @@ -409,7 +406,8 @@ size_t alloc_slot() { 5. 设置槽位内容:调用 set_slot 函数设置槽位内容 6. 更新访问时间和脏标志:增加访问时间并标记为脏数据 7. 解锁:释放锁 - **具体实现如下:** + +**具体实现如下:** ```` void set_slot(size_t slot_num, struct slot_content *sc) { auto block_num = slotnum_hash2_blocknum(slot_num); @@ -444,7 +442,8 @@ void set_slot(size_t slot_num, struct slot_content *sc) { 5. 根据 vlog 编号获取 vlog 处理器; 6. 如果 vlog 无效或者正在进行GC,则使用 vlog_num_for_gc; 7. 调用 write_vlog_value 函数,将字符串 serialized_value 写入 vlog 中 - **具体实现如下:** + +**具体实现如下:** ```` void VlogSet::put_value(struct slot_content &sc, size_t slot_num, const leveldb::Slice &value) { mtx.lock(); @@ -813,6 +812,8 @@ void VlogSet::mark_del_value(const struct slot_content &sc) { mtx.unlock(); } ```` + + ## 3. 功能测试 ### 3.1 在 LevelDB 的 value 中实现字段功能 1. 以字段形式插入,读取数据 @@ -898,29 +899,19 @@ int main(int argc, char** argv) { } ```` **测试结果:** - -### 3.2 -### 3.3 测试并发插入和读取数据 -### 3.4 测试 GC -### 3.5 测试 -单元测试: -1. 测试插入超过初始slot_page等slot数量之后,是否还能正常插入,检查slot_page文件等线性可扩展性 -2. 测试插入后,进行删除,等待GC完成后再读取value和vlog的大小,看看GC过程是否正常进行。 +![image](/pic/test_accuracy.png) +### 3.2 测试并发插入和读取数据 +### 3.3 测试 GC ## 4. 性能测试: -### 4.1 测试吞吐量 -### 4.2 测试延迟 -### 4.3 测试写放大 +### 4.1 测试吞吐量和延迟 +#### +### 4.2 测试写放大 -吞吐率下降很多 -写放大下降很多 ### 5. 实验中遇到的问题和解决方案 ### 6. 现有优化手段的分析与可能的优化 -### 7. 可能遇到的挑战与解决方案 -列出实现过程中可能遇到的技术难题及其解决思路,如如何处理GC开销、数据同步、索引原子更新等问题。 -各种参数的设置,比如vlog的容量上限,以及slot_page的bitmap管理方式是否足够高效?以及在GC过程中如果对被GC中的vlog进行写入该让用户线程和后台线程以什么样的方式进行同步?slot_page的读写放大也是一个重要的问题。 -### 8. 分工和进度安排 +### 7. 分工和进度安排 | 功能 | 完成日期 | 分工 | |----------------------|-------|----------|