AmatyaAvadhanula commented on code in PR #14727:
URL: https://github.com/apache/druid/pull/14727#discussion_r1306881436


##########
server/src/main/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinator.java:
##########
@@ -1143,37 +1183,36 @@ private SegmentIdWithShardSpec createNewSegment(
                                  : PartitionIds.ROOT_GEN_START_PARTITION_ID;
 
       String version = newSegmentVersion == null ? existingVersion : 
newSegmentVersion;
-      return new SegmentIdWithShardSpec(
+      SegmentIdWithShardSpec segmentId = new SegmentIdWithShardSpec(
           dataSource,
           interval,
           version,
           partialShardSpec.complete(jsonMapper, newPartitionId, 0)
       );
+      return SegmentAllocateResult.success(segmentId);
     } else if (!overallMaxId.getInterval().equals(interval)
                || overallMaxId.getVersion().compareTo(existingVersion) > 0) {
-      log.warn(
-          "Cannot allocate new segment for dataSource[%s], interval[%s], 
existingVersion[%s]: conflicting segment[%s].",
-          dataSource,
-          interval,
-          existingVersion,
-          overallMaxId
+      return SegmentAllocateResult.failure(
+          "Segment[%s] in conflicting interval[%s] has higher version[%s].",
+          overallMaxId, overallMaxId.getInterval(), overallMaxId.getVersion()
       );
-      return null;
     } else if (committedMaxId != null
                && committedMaxId.getShardSpec().getNumCorePartitions()
                   == SingleDimensionShardSpec.UNKNOWN_NUM_CORE_PARTITIONS) {
       log.warn(

Review Comment:
   Is this log needed if the SegmentAllocationResult's failure logs the message 
as well?



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