arjunashok commented on code in PR #360:
URL: https://github.com/apache/cassandra-sidecar/pull/360#discussion_r3554488148
##########
server/src/main/java/org/apache/cassandra/sidecar/job/OperationalJobManager.java:
##########
@@ -99,19 +107,60 @@ public void trySubmitJob(OperationalJob job,
try
{
checkConflict(job);
-
- // New job is submitted for all cases when we do not have a
corresponding downstream job
- jobTracker.computeIfAbsent(job.jobId(), jobId -> {
- internalExecutorPool.executeBlocking(job::execute);
- return job;
- });
}
catch (OperationalJobConflictException oje)
{
onComplete.accept(job, oje);
return;
}
+ if (!job.requiresCoordination())
+ {
+ trackAndExecute(job, onComplete, serviceExecutorPool, waitTime);
+ return;
+ }
+
+ // Acquiring the active operation lock might perform blocking storage
I/O so it must
+ // run off the event loop
+ acquireActiveOperationLock(job)
+ .onComplete(ar ->
+ {
+ if (ar.succeeded() && Boolean.TRUE.equals(ar.result()))
+ {
+ job.asyncResult().onComplete(result ->
releaseActiveOperationLock(job));
Review Comment:
`requiresCoordination()` is a clean job-level flag the manager just reads.
The release side isn't symmetric though, as `trySubmitJob` always
auto-releases on local completion, with no way for a job to opt out. That's
right for today's single-node jobs, but doesn't match clearActive's javadoc
(orchestration-layer clearing for jobs that finish elsewhere).
Rather than just documenting that gap, could we add a parallel hook for
release?
e.g. releasesOnCompletion(), default true; the manager just reads it
instead of special-casing job types, so a future distributed job can skip the
automatic release without any change to `OperationalJobManager`.
--
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]