vaijosh commented on code in PR #3164:
URL: https://github.com/apache/hugegraph/pull/3164#discussion_r3896218859
##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/snapshot/SnapshotHandler.java:
##########
@@ -96,7 +96,9 @@ public void onSnapshotSave(final SnapshotWriter writer)
throws HgStoreException
Integer groupId = partitionEngine.getGroupId();
AtomicInteger state = businessHandler.getState(groupId);
if (state != null && state.get() == BusinessHandler.doing) {
- return;
+ throw new HgStoreException(
Review Comment:
Hi @bitflicker64 ,
Thank you for your valuable feedback. You have raised a valid concern.
But I believe "immediate throw" is the correct approach.
With the fix:
Snapshot during compaction → throw → RaftError.EIO → snapshot is not
committed.
Compaction finishes → SYNC_BLANK_TASK triggers the next valid snapshot
automatically.
SYNC_BLANK_TASK is submitted after compaction and, when applied,
doSnapshotSync() proceeds only when the state is compactionDone. This shows the
system already anticipates compaction/snapshot overlap and has a deterministic
recovery path.
Waiting for compaction instead would block shared thread-pool resources for
potentially 5–15 minutes and is timing-dependent. The temporary log growth from
an immediate failure is bounded by the compaction duration and is preferable to
the original silent corruption.
Since the probability of race condition in less, the immediate throw is
better trade-off. It prevents silent corruption, leverages the existing
recovery mechanism, avoids thread starvation, and requires no additional
timing/configuration.
--
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]