cecemei commented on code in PR #19059:
URL: https://github.com/apache/druid/pull/19059#discussion_r2907196575


##########
server/src/main/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinator.java:
##########
@@ -1959,9 +1972,35 @@ private Set<DataSegmentPlus> 
createNewIdsOfAppendSegmentsAfterReplace(
               oldSegmentMetadata.getIndexingStateFingerprint()
           )
       );
+      segmentsToInsert.add(dataSegment);
     }
 
-    return upgradedSegments;
+    return segmentsToInsert.stream().map(segment -> {
+      // update corePartitions in shard spec
+      Integer partitionNum = 
intervalToCurrentPartitionNum.get(segment.getInterval());
+      if (!segment.isTombstone() && 
!numChunkNotSupported.contains(segment.getInterval()) && partitionNum != null) {
+        return 
segment.withShardSpec(segment.getShardSpec().withCorePartitions(partitionNum + 
1));

Review Comment:
   `intervalToCurrentPartitionNum` keeps track of the highest partition num 
we've seen in replaceSegments, in each upgrade segment, we increment the 
partitionNum in the map and use it as the partitionNum in the upgrade segment, 
so it's effectively `replaceSegments + upgradedSegments`. 



-- 
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]

Reply via email to