AmatyaAvadhanula commented on code in PR #16393:
URL: https://github.com/apache/druid/pull/16393#discussion_r1592756871
##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java:
##########
@@ -1271,6 +1277,102 @@ public void remove(final Task task)
}
}
+ /**
+ * Acquire a read lock to perform the segment transactional append action
for a given datasource.
+ * Also verifies that all the locks are of the type APPEND for the task.
Review Comment:
Removed
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentTransactionalReplaceAction.java:
##########
@@ -140,26 +153,29 @@ public SegmentPublishResult perform(Task task,
TaskActionToolbox toolbox)
)
.build()
);
+
+ IndexTaskUtils.emitSegmentPublishMetrics(publishResult, task, toolbox);
+
+ // Upgrade any overlapping pending segments
+ // Do not perform upgrade in the same transaction as replace commit so
that
+ // failure to upgrade pending segments does not affect success of the
commit
+ if (publishResult.isSuccess() && toolbox.getSupervisorManager() != null)
{
+ try {
+ registerUpgradedPendingSegmentsOnSupervisor(task, toolbox,
publishResult.getUpgradedPendingSegments());
+ }
+ catch (Exception e) {
+ log.error(e, "Error while upgrading pending segments for task[%s]",
task.getId());
+ }
Review Comment:
Done
##########
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:
Done
--
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]