bitflicker64 commented on code in PR #3164:
URL: https://github.com/apache/hugegraph/pull/3164#discussion_r4014715233
##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/business/BusinessHandlerImpl.java:
##########
@@ -138,6 +143,12 @@ public class BusinessHandlerImpl implements
BusinessHandler {
private static final ConcurrentMap<String, AtomicInteger> pathLock = new
ConcurrentHashMap<>();
private static final ConcurrentMap<Integer, AtomicInteger> compactionState
=
new ConcurrentHashMap<>();
+ // Guards the compactRange() window specifically, so a snapshot save can
atomically
+ // check-and-reserve against a compaction that is actually running right
now. This is
+ // narrower than pathLock, which stays held through the post-compaction
blank-task
+ // snapshot and must not be reused here to avoid deadlocking that flow.
+ private static final ConcurrentMap<Integer, ReentrantLock>
compactionRangeLock =
Review Comment:
⚠️ This lock is described as guarding the compactRange() window, but
`cleanPartition` still compacts without it.
`private boolean cleanPartition(Partition, Function)` ends with an unguarded
`op.compactRange()` (line 1290 at this head) on the same partition's RocksDB
session. It is reachable from `DataManagerImpl.java:246` and
`DefaultDataMover.java:245` (cleanup after split/move), `CleanTask.java:63,68`,
`PartitionAPI.java:184` and `HgStoreWrapperEx.java:50`. None of them take
`compactionRangeLock`, so `onSnapshotSave` can still reserve the lock and
checkpoint while a full range compaction is running on that partition. The
`tryLockCompactionRange` contract ("returns false if a compaction is actively
running") does not hold for this path. It is the same kind of gap as the
table-specific branch at line 1441, at a different call site.
Requested change: run this `compactRange()` under the same per-partition
range lock and bounded wait. A single helper used by every compaction entry
point would cover this site and the `compactRange(tableName)` branch together.
--
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]