Commit 61b4c68
committed
flush dc_lsn before persisting shard metablk in on_commit of sealing shard
fix Corner case:
Assume cp_lsn = dc_lsn = 10.
lsn 11: put_blob (blob -> pba in chunk-1)
lsn 12: seal_shard(shard-1, chunk-1)
1. Before crash, both lsn 11 and lsn 12 are committed.
blob -> pba(chunk-1) exists only in index-table WB cache
shard-1 superblk is persisted with state = SEALED
2. Crash and restart:
• blob -> pba(chunk-1) is lost (WB cache was not flushed)
• shard-1 remains SEALED (superblk is durable)
• with no OPEN shard in chunk-1, GC may move shard-1 data to chunk-2
and mark chunk-1 as reserved
3. Replay starts from dc_lsn = 10, so lsn 11 is committed again.
Since blob -> pba(chunk-1) is missing in pg-index-table,
on_blob_put_commit re-inserts it with a stale pba in chunk-1.
This is incorrect because shard-1 has already moved to chunk-2.
Fix:
Before persisting shard state transition to SEALED, persist repl_dev's dc_lsn.
This guarantees all logs before SEAL_SHARD are replay-committed before GC starts.1 parent a64afa0 commit 61b4c68
File tree
4 files changed
+70
-34
lines changed- src/lib/homestore_backend
4 files changed
+70
-34
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
| 66 | + | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | | - | |
| 103 | + | |
105 | 104 | | |
106 | 105 | | |
107 | 106 | | |
| |||
184 | 183 | | |
185 | 184 | | |
186 | 185 | | |
187 | | - | |
188 | | - | |
| 186 | + | |
189 | 187 | | |
190 | 188 | | |
191 | 189 | | |
| |||
776 | 774 | | |
777 | 775 | | |
778 | 776 | | |
779 | | - | |
| 777 | + | |
780 | 778 | | |
781 | 779 | | |
782 | 780 | | |
| |||
968 | 966 | | |
969 | 967 | | |
970 | 968 | | |
971 | | - | |
972 | 969 | | |
973 | 970 | | |
974 | 971 | | |
975 | | - | |
976 | 972 | | |
977 | 973 | | |
978 | 974 | | |
| |||
1132 | 1128 | | |
1133 | 1129 | | |
1134 | 1130 | | |
1135 | | - | |
1136 | 1131 | | |
1137 | 1132 | | |
1138 | 1133 | | |
1139 | 1134 | | |
1140 | 1135 | | |
1141 | 1136 | | |
1142 | | - | |
1143 | 1137 | | |
1144 | 1138 | | |
1145 | | - | |
1146 | 1139 | | |
1147 | 1140 | | |
1148 | 1141 | | |
| |||
1325 | 1318 | | |
1326 | 1319 | | |
1327 | 1320 | | |
| 1321 | + | |
1328 | 1322 | | |
1329 | 1323 | | |
1330 | 1324 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
254 | 262 | | |
255 | 263 | | |
256 | 264 | | |
| |||
349 | 357 | | |
350 | 358 | | |
351 | 359 | | |
352 | | - | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
353 | 374 | | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
| 375 | + | |
360 | 376 | | |
361 | 377 | | |
362 | 378 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
529 | 529 | | |
530 | 530 | | |
531 | 531 | | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
541 | 567 | | |
542 | 568 | | |
543 | 569 | | |
| |||
0 commit comments