capistrant commented on code in PR #12599:
URL: https://github.com/apache/druid/pull/12599#discussion_r891701422


##########
server/src/main/java/org/apache/druid/metadata/SQLMetadataConnector.java:
##########
@@ -408,6 +447,50 @@ tableName, getSerialType(), getPayloadType()
     );
   }
 
+  /**
+   * Adds the last_used column to the Druid segment table.
+   *
+   * This is public due to allow the UpdateTables cli tool to use for upgrade 
prep.
+   */
+  @Override
+  public void alterSegmentTableAddLastUsed()
+  {
+    String tableName = tablesConfigSupplier.get().getSegmentsTable();
+    if (!tableHasColumn(tableName, "last_used")) {
+      log.info("Adding last_used column to %s", tableName);
+      alterTable(
+          tableName,
+          ImmutableList.of(
+              StringUtils.format(
+                  "ALTER TABLE %1$s \n"
+                  + "ADD last_used varchar(255)",
+                  tableName
+              )
+          )
+      );
+    } else {
+      log.info("%s already has last_used column", tableName);
+    }
+  }
+
+  /**
+   * Populates the last_used column for all unused segments in the Druid 
segment table.
+   *
+   * The current UTC timestamp string is used for the content of each column.
+   * This is public due to allow the UpdateTables cli tool to use in a 
optional post-upgrade action.
+   */
+  @Override
+  public void updateSegmentTablePopulateLastUsed()

Review Comment:
   I suspect we want an existence check on table



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