kfaraz commented on code in PR #16162:
URL: https://github.com/apache/druid/pull/16162#discussion_r1538528485
##########
server/src/main/java/org/apache/druid/segment/realtime/appenderator/SegmentsAndCommitMetadata.java:
##########
@@ -20,28 +20,50 @@
package org.apache.druid.segment.realtime.appenderator;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
import org.apache.druid.segment.SegmentUtils;
import org.apache.druid.timeline.DataSegment;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
+import java.util.Set;
public class SegmentsAndCommitMetadata
{
private static final SegmentsAndCommitMetadata NIL = new
SegmentsAndCommitMetadata(Collections.emptyList(), null);
private final Object commitMetadata;
private final ImmutableList<DataSegment> segments;
+ private final ImmutableSet<DataSegment> upgradedSegments;
Review Comment:
Why does this class need to distinguish between upgraded segments and root
ones? From the POV of this class, all of these segments were committed and thus
should all be handed off.
##########
server/src/main/java/org/apache/druid/segment/realtime/appenderator/BaseAppenderatorDriver.java:
##########
@@ -697,7 +703,7 @@ ListenableFuture<SegmentsAndCommitMetadata>
publishInBackground(
Throwables.propagateIfPossible(e);
throw new RuntimeException(e);
}
- return segmentsAndCommitMetadata;
+ return
segmentsAndCommitMetadata.withUpgradedSegments(upgradedSegments);
Review Comment:
We shouldn't have to distinguish between upgraded and other segments here.
Instead of creating a new `SegmentsAndCommitMetadata` with upgraded segments,
we should create a new `SegmentsAndCommitMetadata` which has a single set
containing all the segments (upgraded and otherwise) which were committed and
thus must be handed off.
```suggestion
return new SegmentsAndCommitMetadata(publishResult.getSegments(), metadata);
```
So, essentially, the original `segmentsAndCommitMetadata` object passed in
to this method represents segments we wanted to commit and the new object would
represent segments that were actually committed.
--
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]