jiacai2050 commented on code in PR #140: URL: https://github.com/apache/horaedb-docs/pull/140#discussion_r1805968756
########## content/cn/docs/design/wal_on_disk.md: ########## @@ -0,0 +1,140 @@ +--- +title: "基于本地磁盘的 WAL" +--- + +## 架构 + +本节将介绍基于本地磁盘的单机版 WAL(Write-Ahead Log,以下简称日志)的实现。在此实现中,日志按 region 级别进行管理。 + +``` + ┌────────────────────────────┐ + │ HoraeDB │ + │ │ + │ ┌────────────────────────┐ │ + │ │ WAL │ │ ┌────────────────────────┐ + │ │ │ │ │ │ + │ │ ...... │ │ │ File System │ + │ │ │ │ │ │ + │ │ ┌────────────────────┐ │ │ manage │ ┌────────────────────┐ │ + Write ─────┼─┼─► Region ├─┼─┼─────────┼─► Region Dir │ │ + │ │ │ │ │ │ │ │ │ │ + Read ─────┼─┼─► ┌────────────┐ │ │ │ mmap │ │ ┌────────────────┐ │ │ + │ │ │ │ Segment 0 ├───┼─┼─┼─────────┼─┼─► Segment File 0 │ │ │ + │ │ │ └────────────┘ │ │ │ │ │ └────────────────┘ │ │ +Delete ─────┼─┼─► ┌────────────┐ │ │ │ mmap │ │ ┌────────────────┐ │ │ + │ │ │ │ Segment 1 ├───┼─┼─┼─────────┼─┼─► SegmenteFile 1 │ │ │ + │ │ │ └────────────┘ │ │ │ │ │ └────────────────┘ │ │ + │ │ │ ┌────────────┐ │ │ │ mmap │ │ ┌────────────────┐ │ │ + │ │ │ │ Segment 2 ├───┼─┼─┼─────────┼─┼─► SegmenteFile 2 │ │ │ + │ │ │ └────────────┘ │ │ │ │ │ └────────────────┘ │ │ + │ │ │ ...... │ │ │ │ │ ...... │ │ + │ │ └────────────────────┘ │ │ │ └────────────────────┘ │ + │ │ ...... │ │ │ ...... │ + │ └────────────────────────┘ │ └────────────────────────┘ + └────────────────────────────┘ +``` + +## 数据模型 + +### 文件路径 + +每个 region 都拥有一个目录,用于管理该 region 的所有 segment。目录名为 region 的 ID。每个 segment 的命名方式为 `segment_<id>.wal`,ID 从 0 开始递增。 Review Comment: ```suggestion 每个 region 都拥有一个目录,用于管理该 region 的所有 segment。目录名为 region 的 ID。每个 segment 的命名方式为 `seg_<id>`,ID 从 0 开始递增。 ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
