kfaraz commented on code in PR #16393:
URL: https://github.com/apache/druid/pull/16393#discussion_r1592623090
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentTransactionalReplaceAction.java:
##########
@@ -116,15 +120,24 @@ public TypeReference<SegmentPublishResult>
getReturnTypeReference()
@Override
public SegmentPublishResult perform(Task task, TaskActionToolbox toolbox)
{
- TaskLocks.checkLockCoversSegments(task, toolbox.getTaskLockbox(),
segments);
-
- // Find the active replace locks held only by this task
- final Set<ReplaceTaskLock> replaceLocksForTask
- = toolbox.getTaskLockbox().findReplaceLocksForTask(task);
-
- final SegmentPublishResult publishResult;
+ final TaskLockbox taskLockbox = toolbox.getTaskLockbox();
+ TaskLocks.checkLockCoversSegments(task, taskLockbox, segments);
+ for (TaskLock taskLock : taskLockbox.findLocksForTask(task)) {
+ if (taskLock.getType() != TaskLockType.REPLACE) {
+ throw DruidException.defensive(
+ "All the locks must be of type REPLACE for
segmentTransactionalReplace. Found lock of type[%s] for task[%s].",
+ taskLock.getType(),
+ task.getId()
+ );
Review Comment:
Let's align the exception type and message with what we had originally in
append action.
--
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]