bitflicker64 commented on PR #3420:
URL: https://github.com/apache/hugegraph/pull/3420#issuecomment-6462587614

   ### HG review summary: round R9-native-open (head `ceec45a`)
   
   **Score: 9.5 / 10.** One Minor regression is confirmed. Nothing blocking was 
found.
   
   Lanes received: Codex and Claude (2 of 4; this summary is published at 
quorum). Lanes pending: Copilot and AGY. Late reports will update this comment.
   
   **Confirmed (Minor): the new pre-pass fails closed on a crash-truncated 
trailing segment that JRaft itself recovers**
   
   `RaftSegmentLogStorage.onInitLoaded()` calls `normalizeBlankSegments()` 
before `super.onInitLoaded()`. Any `N.s` whose size differs from 
`maxSegmentFileSize` is passed to `isBlank()`. That method throws when the 
header is short (`RaftSegmentLogStorage.java:147`) or has bad magic (`:155`), 
and the storage init then returns `false`.
   
   - **Trigger:** a crash or power loss while the background allocator is 
creating a segment can leave a 0-byte (or zero-header) last `N.s`. A 0-byte 
file never matches the configured size, so it always reaches `isBlank()`.
   - **Upstream behavior:** in JRaft 1.3.14, 
`RocksDBSegmentLogStorage.onInitLoaded` maps the file, fails the header decode, 
and passes it to `processCorruptedHeaderFiles`. That method renames it to 
`.corrupted` because it is the last sequence, and init succeeds.
   - **Base vs head:** in the base commit, segment storage was the default 
(`useRocksDBSegmentLogStorage=true`) and recovered this case. With this PR, 
that partition's Raft node does not start until an operator deletes the file.
   - **Evidence:** a reviewer's standalone repro gave plain JRaft `init=true` 
and this class `init=false`. I checked both code paths against the JRaft 1.3.14 
sources.
   - **Suggestion:** `testUnknownHeaderIsPreservedAndFailedInitReleasesLock` 
asserts this fail-closed behavior on purpose. Consider skipping (leaving to 
JRaft) a short or corrupt header on the highest-sequence file, and failing 
closed only for non-trailing files.
   
   **Checked, not defects:**
   - The effective default stays at 1 GiB. The base ignored the 64 MiB setting, 
and JRaft's default reads the same system property.
   - `AppConfig` → `HgStoreNodeService` → `PartitionEngine.createLogStorage` → 
builder wiring is correct.
   
   **Docs note:** isolated `.blank-*` files are never deleted. After a size 
change they cost roughly 2× the old segment size per partition, which is worth 
a line in `deployment-guide.md`.
   
   **Verification limits:** both lanes reviewed source statically, plus one 
standalone repro. Neither ran `PartitionLogStorageTest`, a Maven build of the 
store modules, a cluster, or fault injection.
   
   <sub>Automated multi-lane review (HugeGraph review squad); read-only, no 
approval.</sub>
   


-- 
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]

Reply via email to