imbajin opened a new pull request, #3340: URL: https://github.com/apache/hugegraph/pull/3340
## Purpose of the PR Cancelling a task can close the caller thread's existing graph transaction and discard unrelated, uncommitted graph changes. The default completion callback can do the same when cancellation invokes it on the caller thread. This independently fixes the caller transaction issue tracked in [the loading-mode review](https://github.com/hugegraph/hugegraph/pull/304#discussion_r4254652504). ## Main Changes Preserve an existing caller transaction during Standard and Distributed scheduler cancellation, and let cancelled tasks leave worker cleanup to their execution path. Keep normal worker completion and task ownership fencing in place. Before: write uncommitted data → cancel another task → that data is rolled back. After: write uncommitted data → cancel another task → the caller can still commit or roll back its own data. Document transaction ownership in `docs/server-runtime.md`. Update the missing-retry test fixture to provide the transaction interface that cancellation now inspects. ## Verifying these changes - [ ] Trivial rework / code cleanup without any test coverage. (No Need) - [ ] Already covered by existing tests. - [x] Need tests and can be verified as follows: - Real graph transactions reproduce the loss with the original code and preserve caller data after queued, running, completed, direct and failed cancellation. Separate worker controls verify cleanup and owner fencing. - Relevant tests, formatting and root compilation passed. The full unit suite passed with the canonical snapshot test fixture from [#3339](https://github.com/apache/hugegraph/pull/3339); production classes were unchanged by that test-only overlay, and existing environment assumptions remain. - Three independent reviewers checked the final change. Current org/ASF CI will be verified on the submitted head. ## Does this PR potentially affect the following parts? - [ ] Dependencies (add/update license info) - [ ] Modify configurations - [ ] The public API - [x] Other affects: task cancellation and thread-local transaction ownership - [ ] Nope ## Documentation Status - [ ] `Doc - TODO`: required documentation is pending; complete it before merging. - [x] `Doc - Done`: documentation is included here or linked below. - [ ] `Doc - No Need`: no user-visible documentation is affected. Documentation files in this PR or paired hugegraph-doc PR: `docs/server-runtime.md`. -- 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]
