vaijosh commented on code in PR #3164:
URL: https://github.com/apache/hugegraph/pull/3164#discussion_r4035330032


##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/business/BusinessHandlerImpl.java:
##########
@@ -1190,15 +1212,36 @@ public boolean cleanPartition(String graph, int partId, 
long startKey, long endK
         taskManager.putAsyncTask(cleanTask);
 
         Utils.runInThread(() -> {
-            cleanPartition(partition, code -> {
-                // in range
-                boolean flag = code >= startKey && code < endKey;
-                return (cleanType == CleanType.CLEAN_TYPE_KEEP_RANGE) == flag;
-            });
-            // May have been destroyed.
-            if (HgStoreEngine.getInstance().getPartitionEngine(partId) != 
null) {
-                taskManager.updateAsyncTaskState(partId, graph, 
cleanTask.getId(),
-                                                 AsyncTaskState.SUCCESS);
+            ReentrantLock rangeLock =
+                    compactionRangeLock.computeIfAbsent(partId, k -> new 
ReentrantLock());
+            boolean rangeLocked = false;
+            try {
+                rangeLocked = rangeLock.tryLock(compactionRangeLockWaitMillis,

Review Comment:
   Addressed



##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/raft/PartitionStateMachine.java:
##########
@@ -198,7 +198,13 @@ public void onSnapshotSave(final SnapshotWriter writer, 
final Closure done) {
                 done.run(Status.OK());
             } catch (HgStoreException e) {
                 log.error(String.format("Raft %s onSnapshotSave failed. {}", 
groupId), e);
-                done.run(new Status(RaftError.EIO, e.toString()));
+                // A busy compaction-range lock is transient: jRaft's snapshot 
scheduler
+                // retries independently, so report EBUSY rather than EIO to 
avoid
+                // escalating to reportError()/restartRaftNode() (see 
SnapshotExecutorImpl
+                // #onSnapshotSaveDone, which only escalates on EIO).
+                RaftError raftError = e.getCode() == 
HgStoreException.EC_RKDB_SNAPSHOT_SAVE_BUSY_FAIL ?

Review Comment:
   Addressed



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