aboutsummaryrefslogtreecommitdiffstats
path: root/docs/research/073-single-file-persistent-tree.md
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-26 07:12:17 +0100
committereunhhu <[email protected]>2026-09-26 07:12:17 +0100
commit46fd0601c89a535a6501b475ff08ae11b3137ea9 (patch)
treebc44aa8b4f0fcdc42583d50869bb9c0969f32728 /docs/research/073-single-file-persistent-tree.md
parentd6c67de580fb7ec2b75ec73a14a7cbb551b93099 (diff)
downloadpure-46fd0601c89a535a6501b475ff08ae11b3137ea9.tar.gz
pure-46fd0601c89a535a6501b475ff08ae11b3137ea9.zip
Make a tree store commit durable with one sync
A commit used to sync its nodes, then write the head and sync again: the order of writes was forced by syncs. Now the head carries where the commit's bytes start and their digest, and one fdatasync makes the bytes and the head durable together. A crash during it can leave a head whose bytes did not all reach the device; its digest then fails and the older slot stands, which is safe because a writer only builds on a durable head. Commits overwrite written zeros kept after the published end, so the sync changes neither the size nor the block map and needs no journal commit. On the SD card this is 2.4 ms per commit against 9.1 ms for two syncs; the store commits 289-304 times a second instead of 94-109, and pure-serve answers 2,012-2,611 durable PUTs a second against 583 for crash-safe axum. A process remembers the heads it published or checked, so it reads a commit's bytes at most once and never its own. Its readers pass over the head it is still making durable and so never answer with a commit a crash could take back. Head slots get a block each and the format becomes PURETRE2; a handle's refresh reads the slots through its mapping.
Diffstat (limited to 'docs/research/073-single-file-persistent-tree.md')
-rw-r--r--docs/research/073-single-file-persistent-tree.md2
1 files changed, 2 insertions, 0 deletions
diff --git a/docs/research/073-single-file-persistent-tree.md b/docs/research/073-single-file-persistent-tree.md
index 092b6ad..13884e3 100644
--- a/docs/research/073-single-file-persistent-tree.md
+++ b/docs/research/073-single-file-persistent-tree.md
@@ -36,6 +36,8 @@
- 커밋: 새 노드 추가 → `fsync` → 오래된 head 슬롯에 새 head → `fsync`. OK는 두 번째 동기화 뒤다.
복구는 유효한 슬롯 중 순번이 큰 쪽을 쓰고, 그 끝 뒤의 바이트는 확인받지 않은 커밋이라
다음 writer가 잘라낸다. 쓰기 중 고장 단계는 기존 저장소와 같은 결과(오류 또는 결과 불명)를 낸다.
+ (2026-09-26: 동기화 한 번으로 바뀌었다. head가 커밋 바이트의 다이제스트를 갖고, 커밋은 0을 써 둔 꼬리를
+ 덮어쓴다 — [076](076-one-sync-commit.md).)
- 압축: 공개 크기의 증가가 `4 × 압축 후 크기 + 1 MiB`를 넘으면 도달 가능한 노드만 새 파일에 쓰고
교체한다. 이미 읽은 쪽은 이전 파일의 매핑을 계속 사용한다.
- 읽기: 한 leaf 안의 범위는 파일을 그대로 매핑한다(기본 저장소와 같은 무복사). 여러 leaf에