jackjlli commented on a change in pull request #8422: URL: https://github.com/apache/pinot/pull/8422#discussion_r839007738
########## File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java ########## @@ -2053,6 +2062,35 @@ public boolean updateZkMetadata(String tableNameWithType, SegmentZKMetadata segm return ZKMetadataProvider.setSegmentZKMetadata(_propertyStore, tableNameWithType, segmentZKMetadata); } + /** + * Delete the table on servers by sending table deletion message + */ + private void deleteTableOnServer(String tableNameWithType) { + LOGGER.info("Sending delete table message for table: {}", tableNameWithType); + Criteria recipientCriteria = new Criteria(); + recipientCriteria.setRecipientInstanceType(InstanceType.PARTICIPANT); + recipientCriteria.setInstanceName("%"); + recipientCriteria.setResource(tableNameWithType); + recipientCriteria.setSessionSpecific(true); + TableDeletionMessage tableDeletionMessage = new TableDeletionMessage(tableNameWithType); + ClusterMessagingService messagingService = _helixZkManager.getMessagingService(); + + // Externalview can be null for newly created table, skip sending the message + if (_helixZkManager.getHelixDataAccessor() + .getProperty(_helixZkManager.getHelixDataAccessor().keyBuilder().externalView(tableNameWithType)) == null) { + LOGGER.warn("No delete table message sent for newly created table: {}", tableNameWithType); Review comment: `No delete table message sent for newly created table: {} as the exiernalview is null.` ########## File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java ########## @@ -1757,6 +1758,10 @@ public void deleteOfflineTable(String tableName) { HelixHelper.removeResourceFromBrokerIdealState(_helixZkManager, offlineTableName); LOGGER.info("Deleting table {}: Removed from broker resource", offlineTableName); + // Drop the table on servers + deleteTableOnServer(offlineTableName); + LOGGER.info("Deleting table {}: Sent table deletion message to servers", offlineTableName); Review comment: Same here. ########## File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java ########## @@ -1800,6 +1805,10 @@ public void deleteRealtimeTable(String tableName) { HelixHelper.removeResourceFromBrokerIdealState(_helixZkManager, realtimeTableName); LOGGER.info("Deleting table {}: Removed from broker resource", realtimeTableName); + // Drop the table on servers + deleteTableOnServer(realtimeTableName); + LOGGER.info("Deleting table {}: Sent table deletion message to servers", realtimeTableName); Review comment: We may not need to print this message as there is a similar message printed inside `deleteTableOnServer` method already. Plus, even inside the `deleteTableOnServer` method there is still some scenarios that the message doesn't need to be sent. So I'd suggest skipping this log here. ########## File path: pinot-server/src/main/java/org/apache/pinot/server/starter/helix/SegmentMessageHandlerFactory.java ########## @@ -144,6 +147,28 @@ public HelixTaskResult handleMessage() } } + private class TableDeletionMessageHandler extends DefaultMessageHandler { + TableDeletionMessageHandler(TableDeletionMessage tableDeletionMessage, ServerMetrics metrics, + NotificationContext context) { + super(tableDeletionMessage, metrics, context); + } + + @Override + public HelixTaskResult handleMessage() + throws InterruptedException { + HelixTaskResult helixTaskResult = new HelixTaskResult(); + _logger.info("Handling message: {}", _message); + try { + _instanceDataManager.deleteTable(_tableNameWithType); + helixTaskResult.setSuccess(true); + } catch (Exception e) { + _metrics.addMeteredTableValue(_tableNameWithType, ServerMeter.DELETE_TABLE_FAILURES, 1); + Utils.rethrowException(e); Review comment: Will it print out the exception in the log? -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org