imbajin commented on code in PR #815:
URL:
https://github.com/apache/hugegraph-toolchain/pull/815#discussion_r4264342440
##########
hugegraph-loader/src/main/java/org/apache/hugegraph/loader/executor/LoadContext.java:
##########
@@ -211,6 +215,27 @@ public void updateSchemaCache() {
@SneakyThrows
public synchronized void setLoadingMode() {
String graph = this.client.graph().graph();
+ if (this.loadingOwnerReleased) {
+ throw new LoadException("Loading owner has already been released;
create a new context");
+ }
+ if (this.loadingOwner == null) {
+ try {
+ this.loadingOwner =
this.client.graphs().newLoadingOwner(graph);
+ } catch (ServerException e) {
+ if (e.status() != 404 || !"HTTP 404 Not
Found".equals(e.getMessage()) ||
+ !("jakarta.ws.rs.NotFoundException".equals(e.exception())
||
+ "javax.ws.rs.NotFoundException".equals(e.exception()) ||
+ "class
jakarta.ws.rs.NotFoundException".equals(e.exception()) ||
+ "class
javax.ws.rs.NotFoundException".equals(e.exception()))) {
+ throw e;
+ }
+ LOG.warn("Server has no loading-owner endpoint; use legacy
mode without concurrent-import protection");
+ }
+ }
+ if (this.loadingOwner != null) {
+ this.client.graphs().acquireLoadingOwner(graph, this.loadingOwner);
Review Comment:
The README now explicitly requires NONE or owner-held LOADING for ordinary
imports on a protocol-1 Server. It documents stopping all imports/writes and
draining requests before administrator recovery using the current instance,
epoch, and revision; it does not automatically overwrite RESTORING. A
Client/LoadContext rejection regression verifies there is no enum fallback. The
real paired Server/Loader run verifies restore leaves RESTORING, controlled
recovery restores NONE, and a subsequent ordinary import succeeds. Real Server
1.7 ordinary/restore behavior remains unchanged.
##########
hugegraph-loader/src/main/java/org/apache/hugegraph/loader/executor/LoadContext.java:
##########
@@ -211,6 +215,27 @@ public void updateSchemaCache() {
@SneakyThrows
public synchronized void setLoadingMode() {
String graph = this.client.graph().graph();
+ if (this.loadingOwnerReleased) {
+ throw new LoadException("Loading owner has already been released;
create a new context");
+ }
+ if (this.loadingOwner == null) {
+ try {
+ this.loadingOwner =
this.client.graphs().newLoadingOwner(graph);
Review Comment:
We addressed lost-handle recovery through the paired privileged Server
recovery endpoint rather than publishing the owner token. Pre-acquire
diagnostics record the non-secret instance and epoch, and
LoadingModeOwner.toString now omits the token. The README describes exact
instance/epoch/revision recovery after an administrator stops and drains all
imports and writes; no original token is required. The real paired run verifies
this recovery and rejects late reuse of the old Loader handle without an
automatic new-token or enum fallback.
--
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]