Repository navigation
refactor(server): close retained graphs on shutdown - #3347
Conversation
- retry retained graph closes before task DB shutdown - preserve event delivery until cleanup completes - cover pending tasks and explicit close retries
- treat terminated cron as a completed dispatch barrier - preserve ordered waits on explicit shutdown retries - cover distributed owner and interrupted timeout retries
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3347 +/- ##
============================================
+ Coverage 54.31% 57.21% +2.90%
+ Complexity 2250 130 -2120
============================================
Files 770 514 -256
Lines 67952 49733 -18219
Branches 9213 7206 -2007
============================================
- Hits 36905 28454 -8451
+ Misses 27470 18405 -9065
+ Partials 3577 2874 -703
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
[P2] Final distributed close can lose its cancellation executor If a busy cron operation makes both early graph-close attempts time out while a schema/OLAP task is still active, the final close still needs to cancel that task. However, TaskManager.close() has already terminated distributedSchedulerExecutor. DistributedTaskScheduler.close() passes the terminated barrier, then cancelOwned() submits cancellation back to that executor and gets RejectedExecutionException before interrupting the task. An explicit retry repeats this until the task finishes independently. Please keep a valid path for these owned cancellation callbacks during final graph cleanup, while retaining the task DB executor until owner release. Add a delayed-cron-barrier + active interruptible schema/OLAP worker regression. A Java 17 extracted-method/latch probe reproduced two rejected retries and recovery after external task completion; this is a remaining recovery gap, not a new regression or evidence of data loss. Score for reviewed head: 8.0/10. |
Purpose of the PR
A background task can outlive both Gremlin and REST graph-close attempts during Server shutdown. Previously, shutdown then stopped the task database worker while the graph and its transaction were still retained. This follows up on the shutdown lifecycle review and ASF #3302.
Org staging PR: hugegraph#316.
Main Changes
After task workers drain, retry retained graph closes through the existing scheduler registry before stopping task database and event workers. Treat an already terminated cron executor as a completed dispatch barrier. Each executor wait checks actual termination on explicit retry; a failed or interrupted wait stops the later shutdown stages.
A graph-close failure still attempts cleanup of other graphs and leaves the task database executor available for an explicit retry. Store-close notifications finish before the shared event executor stops.
Verifying these changes
HugeGraphServer.stop()before the fix. The regression now verifies task completion persistence, retained graph and scheduler closure, task database owner release, and store-close event delivery.HugeFactoryTest,StandardTaskAdmissionTestandDistributedTaskAdmissionTest,mvn editorconfig:format, rootmvn clean compile -Dmaven.javadoc.skip=true, andgit diff --check.Does this PR potentially affect the following parts?
Documentation Status
Doc - TODO: required documentation is pending; complete it before merging.Doc - Done: documentation is included here or linked below.Doc - No Need: no user-visible documentation is affected.Documentation files in this PR:
docs/server-runtime.md.Conceptual overview
Conceptual diagram; not runtime test evidence. The remaining cancellation-callback limitation is documented in the follow-up review.