Skip to content

Commit

Permalink
[bugfix]Add logs to track sequence of events for table creation (apac…
Browse files Browse the repository at this point in the history
…he#11946)

* Added logs to track sequence of events for table creation

* modified the logs

* modified log alignment

* changed wordings

* adressed PR comments

* rephrased a log line
  • Loading branch information
aishikbh authored Nov 6, 2023
1 parent baea4a2 commit 6638d4e
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1562,6 +1562,8 @@ public void addUser(UserConfig userConfig)
public void addTable(TableConfig tableConfig)
throws IOException {
String tableNameWithType = tableConfig.getTableName();
LOGGER.info("Adding table {}: Start", tableNameWithType);

if (getTableConfig(tableNameWithType) != null) {
throw new TableAlreadyExistsException("Table config for " + tableNameWithType
+ " already exists. If this is unexpected, try deleting the table to remove all metadata associated"
Expand All @@ -1573,6 +1575,8 @@ public void addTable(TableConfig tableConfig)
+ "If the external view is not removed after a long time, try restarting the servers showing up in the "
+ "external view");
}

LOGGER.info("Adding table {}: Validate table configs", tableNameWithType);
validateTableTenantConfig(tableConfig);

IdealState idealState =
Expand All @@ -1587,26 +1591,31 @@ public void addTable(TableConfig tableConfig)
"Invalid table type: %s", tableType);

// Add table config
LOGGER.info("Adding table {}: Creating table config in the property store", tableNameWithType);
if (!ZKMetadataProvider.createTableConfig(_propertyStore, tableConfig)) {
throw new RuntimeException("Failed to create table config for table: " + tableNameWithType);
}
try {
// Assign instances
assignInstances(tableConfig, true);
LOGGER.info("Adding table {}: Assigned instances", tableNameWithType);

if (tableType == TableType.OFFLINE) {
// Add ideal state
_helixAdmin.addResource(_helixClusterName, tableNameWithType, idealState);
LOGGER.info("Adding table {}: Added ideal state for offline table", tableNameWithType);
} else {
// Add ideal state with the first CONSUMING segment
_pinotLLCRealtimeSegmentManager.setUpNewTable(tableConfig, idealState);
LOGGER.info("Adding table {}: Added ideal state with first consuming segment", tableNameWithType);
}
} catch (Exception e) {
LOGGER.error("Caught exception during offline table setup. Cleaning up table {}", tableNameWithType, e);
deleteTable(tableNameWithType, tableType, null);
throw e;
}

LOGGER.info("Updating BrokerResource for table: {}", tableNameWithType);
LOGGER.info("Adding table {}: Updating BrokerResource for table", tableNameWithType);
List<String> brokers =
HelixHelper.getInstancesWithTag(_helixZkManager, TagNameUtils.extractBrokerTag(tableConfig.getTenantConfig()));
HelixHelper.updateIdealState(_helixZkManager, Helix.BROKER_RESOURCE_INSTANCE, is -> {
Expand All @@ -1616,7 +1625,7 @@ public void addTable(TableConfig tableConfig)
return is;
});

LOGGER.info("Successfully added table: {}", tableNameWithType);
LOGGER.info("Adding table {}: Successfully added table", tableNameWithType);
}

/**
Expand Down

0 comments on commit 6638d4e

Please sign in to comment.