imbajin commented on code in PR #814:
URL: 
https://github.com/apache/hugegraph-toolchain/pull/814#discussion_r4276443633


##########
hugegraph-hubble/hubble-be/src/main/java/org/apache/hugegraph/service/load/LoadTaskService.java:
##########
@@ -231,39 +410,93 @@ public List<LoadTask> batchTasks(int jobId) {
 
     public LoadTask start(GraphConnection connection, FileMapping fileMapping,
                           HugeClient client) {
-        LoadTask task = this.buildLoadTask(connection, fileMapping, client);
-        this.save(task);
-        this.executeAfterCommit(task);
-        return task;
+        synchronized (this.admissionLock) {
+            this.checkAcceptingLoads();
+        }
+        Integer jobId = fileMapping.getJobId();
+        Ex.check(jobId != null, "File mapping has no job id");
+        try (TaskReservation reservation = this.reserveJob(jobId)) {
+            this.ensureParentExists(jobId, connection.getGraphSpace(), 
connection.getGraph());
+            Ex.check(Objects.equals(fileMapping.getGraphSpace(), 
connection.getGraphSpace()) &&
+                     Objects.equals(fileMapping.getGraph(), 
connection.getGraph()),
+                     "File mapping does not belong to the load task graph");
+            FileMapping current = 
this.fileMappingMapper.selectById(fileMapping.getId());
+            Ex.check(current != null && Objects.equals(current.getJobId(), 
jobId) &&
+                     Objects.equals(current.getGraphSpace(), 
connection.getGraphSpace()) &&
+                     Objects.equals(current.getGraph(), connection.getGraph()),
+                     "File mapping does not belong to the load task job");
+            synchronized (this.admissionLock) {
+                this.checkAcceptingLoads();
+                LoadTask task = this.buildLoadTask(connection, current, 
client);

Review Comment:
   Confirmed from the current call chain: schema/version HTTP and Loader 
construction run under the shared admission monitor, so a slow bootstrap can 
delay other admission, callback release, delete and shutdown work. I have 
recorded this as a separate lock-granularity follow-up so the current 
checkpoint/cleanup change stays focused.
   
   The recorded default-30-second runtime result covers eight already-admitted 
imports and one queued import. It does not establish a bound for arbitrary slow 
Server bootstrap. This thread remains open for that follow-up.



-- 
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]

Reply via email to