jon-wei commented on a change in pull request #11788:
URL: https://github.com/apache/druid/pull/11788#discussion_r727326421
##########
File path:
indexing-service/src/main/java/org/apache/druid/indexing/common/actions/TimeChunkLockTryAcquireAction.java
##########
@@ -67,21 +66,21 @@ public Interval getInterval()
}
@Override
- public TypeReference<TaskLock> getReturnTypeReference()
+ public TypeReference<LockResult> getReturnTypeReference()
{
- return new TypeReference<TaskLock>()
+ return new TypeReference<LockResult>()
{
};
}
@Override
- public TaskLock perform(Task task, TaskActionToolbox toolbox)
+ public LockResult perform(Task task, TaskActionToolbox toolbox)
Review comment:
I changed the action to return a TaskLock again, and had TaskLockbox
return the TaskLock with a revoked result, so that tasks can check the
isRevoked status on the TaskLock itself. With middle managers upgraded first,
this should avoid any issues with backwards compatibility
##########
File path:
indexing-service/src/main/java/org/apache/druid/indexing/common/actions/TimeChunkLockTryAcquireAction.java
##########
@@ -81,7 +81,8 @@ public TaskLock perform(Task task, TaskActionToolbox toolbox)
task,
new TimeChunkLockRequest(type, task, interval, null)
);
- return result.isOk() ? result.getTaskLock() : null;
+
+ return result.getTaskLock();
Review comment:
Good call, I updated `TimeChunkLockAcquireAction` and usages to check
for lock revocation
##########
File path:
indexing-service/src/main/java/org/apache/druid/indexing/common/task/AbstractBatchIndexTask.java
##########
@@ -404,6 +405,9 @@ protected boolean tryTimeChunkLock(TaskActionClient client,
List<Interval> inter
if (lock == null) {
return false;
}
+ if (lock.isRevoked()) {
Review comment:
Hm, I had similar concerns, I think we're good:
for `TaskLockbox.tryLock` called by itself:
- `SegmentAllocateAction` already checks `isRevoked()` and `isOk()` on the
`LockResult`
- `SegmentLockTryAcquireAction` usages check `isOk()` on the result
- `TimeChunkLockTryAcquireAction` usages are adjusted in this PR
for `TaskLockbox.lock` calls:
- `SegmentLockAcquireAction` usages check `isOk()` on the result
- `TimeChunkLockAcquireAction` usages are adjusted in this PR
--
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]