kfaraz commented on code in PR #16162:
URL: https://github.com/apache/druid/pull/16162#discussion_r1579335430
##########
server/src/main/java/org/apache/druid/segment/realtime/appenderator/StreamAppenderator.java:
##########
@@ -1396,12 +1429,50 @@ private Object bootstrapSinksFromDisk()
return committed.getMetadata();
}
+ /**
+ * Update the state of the appenderator when adding a sink.
+ *
+ * @param identifier sink identifier
+ * @param sink sink to be added
+ */
+ private void addSink(SegmentIdWithShardSpec identifier, Sink sink)
+ {
+ sinks.put(identifier, sink);
+ // Asoociate the base segment of a sink with its string identifier
+ // Needed to get the base segment using upgradedFromSegmentId of a pending
segment
+ idToPendingSegment.put(identifier.asSegmentId().toString(), identifier);
+
+ // The base segment is associated with itself in the maps to maintain all
the upgraded ids of a sink.
+ baseSegmentToUpgradedSegments.put(identifier, new HashSet<>());
+ baseSegmentToUpgradedSegments.get(identifier).add(identifier);
+ upgradedSegmentToBaseSegment.put(identifier, identifier);
+
+ sinkTimeline.add(
+ sink.getInterval(),
+ sink.getVersion(),
+ identifier.getShardSpec().createChunk(sink)
+ );
+ }
+
private ListenableFuture<?> abandonSegment(
Review Comment:
Could you add a javadoc to this method? When exactly is a segment abandoned?
--
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]