imbajin commented on code in PR #3164:
URL: https://github.com/apache/hugegraph/pull/3164#discussion_r4002175679
##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/business/BusinessHandlerImpl.java:
##########
@@ -1415,10 +1438,28 @@ public boolean dbCompaction(String graphName, int id,
String tableName) {
log.info("Partition {} dbCompaction started", id);
if (tableName.isEmpty()) {
lock(path);
- setState(id, doing);
- log.info("Partition {}-{} got lock, dbCompaction
start", id, path);
- op.compactRange();
- setState(id, compactionDone);
+ ReentrantLock rangeLock =
+ compactionRangeLock.computeIfAbsent(id,
+ k ->
new ReentrantLock());
+ if
(!rangeLock.tryLock(compactionRangeLockWaitMillis,
Review Comment:
⚠️ Blocking: no. `tryLock(long, TimeUnit)` is interruptible, but this task
has already changed `pathLock` to `doing` in `lock(path)`. An interrupt
therefore jumps to the outer catch at lines 1484-1485 without calling
`unlock(path)`; later compactions for this partition wait until the six-hour
`timeoutMillis` expires. Please handle `InterruptedException` with an
abort/finally cleanup that releases `path`, while keeping the path lock held
for the successful compaction-to-blank-task handoff.
--
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]