FrankChen021 commented on code in PR #19805:
URL: https://github.com/apache/druid/pull/19805#discussion_r3695812640


##########
server/src/main/java/org/apache/druid/metadata/SQLMetadataConnector.java:
##########
@@ -305,24 +305,30 @@ public void createPendingSegmentsTable(final String 
tableName)
                 + "  sequence_prev_id VARCHAR(255) NOT NULL,\n"
                 + "  sequence_name_prev_id_sha1 VARCHAR(255) NOT NULL,\n"
                 + "  payload %2$s NOT NULL,\n"
+                + "  upgraded_from_segment_id VARCHAR(255),\n"
+                + "  task_allocator_id VARCHAR(255),\n"
                 + "  PRIMARY KEY (id),\n"
                 + "  UNIQUE (sequence_name_prev_id_sha1)\n"
                 + ")",
                 tableName, getPayloadType(), getQuoteString(), getCollation()
             )
         )
     );
-    createIndex(
+    createIndexIfNotExists(
         tableName,
         "IDX_%S_DATASOURCE_END",
         List.of("dataSource", quoteColumn("end"))
     );
-    createIndex(
+    createIndexIfNotExists(
         tableName,
         "IDX_%S_DATASOURCE_SEQUENCE",
         List.of("dataSource", "sequence_name")
     );
-    alterPendingSegmentsTable(tableName);
+    createIndexIfNotExists(

Review Comment:
   Yes—the key is to preserve the migration behavior in this public overload. 
Since `alterPendingSegmentsTable(tableName)` already checks both columns 
idempotently and creates the allocator index afterward, the simplest fix is to 
call it at the end of `createPendingSegmentsTable(String)` (in place of the 
direct allocator-index call), then remove the extra call from the no-argument 
wrapper. A “freshly created” boolean is not needed; existing tables are 
precisely the ones that require the alter. The current head still has the 
original ordering, so this remains awaiting changes.
   
   Reviewed 6 of 6 changed files.



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