imbajin commented on code in PR #525:
URL: https://github.com/apache/hugegraph-doc/pull/525#discussion_r4286147679
##########
content/en/docs/quickstart/toolchain/hugegraph-loader.md:
##########
@@ -986,6 +989,38 @@ bin/hugegraph-loader.sh \
Expected result: two vertices and zero edges imported. This example uses
dedicated schema names to avoid conflicts with a preloaded `person` label. In
Hubble, run `g.V().hasLabel('docs_smoke_person').values('docs_name')` to
confirm `docs-smoke-alice` and `docs-smoke-bob`.
+#### 3.4.6 Concurrent imports and LOADING ownership {#loading-ownership}
+
+Starting with HugeGraph 1.8.0, Loader supports concurrent import protection
via the LOADING ownership protocol.
+
+```mermaid
+graph TD
+ A["Graph Mode: NONE"] -->|First Loader acquires owner| B["LOADING Mode
(Acquires Token)"]
+ B -->|Concurrent Loaders join| B
+ B -->|Loader finishes & releases| B
+ B -->|Last Loader releases| C["Restores to NONE"]
+ B -.->|Abnormal exit / kill -9| D["Manual REST API Release / Restart"]
+ D -.-> A
+```
+
+1. **Probe and Acquire**: Loader probes `/mode/owners`. The first Loader
obtains an ownership handle (`instance/epoch/token`),
+ transitioning graph mode from `NONE` to `LOADING`; concurrent Loaders can
join.
+2. **Data Import**: Loaders holding valid handles execute concurrent imports
safely.
+3. **Graceful Release**: When an import completes, Loader drains its workers
and releases its handle. When the last owner releases,
+ graph mode automatically returns to `NONE`.
+4. **Failure Recovery**: If abnormal exit (e.g. `kill -9`) leaves an orphaned
owner, release it manually via the
+ [RESTful API release
endpoint](/docs/clients/restful-api/graphs/#loading-ownership) or
reopen/restart the graph.
+{.steps}
+
+> [!NOTE]
+> **Compatibility and Operational Notes**
+> - **Legacy Compatibility**: During ordinary imports, only a `404` status on
`/mode/owners` falls back to the legacy enum `LOADING`/`NONE` flow
+> (maintains compatibility with Server 1.7, without multi-loader
protection). Network or permission errors do not trigger fallback.
+> - **Restore and Graph Source Imports**: Retain the `RESTORING` flow without
ownership probes or automatic resets. After a restore import completes,
+> manually reset graph mode to `NONE` before starting ordinary imports.
+> - **Scope & Lifecycle**: Ownership is bound to the target Server instance
without cross-node synchronization or automatic lease expiry.
+> For programmatic integrations, invoke `HugeGraphLoader.shutdown()` to
ensure proper cleanup.
Review Comment:
Clarified in both languages that embedded callers must invoke
HugeGraphLoader.shutdown() for a single release attempt; if release fails, it
does not retry, leaving the owner active on the Server until administrator
recovery.
--
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]