Skip to content

Commit

Permalink
Log table config and schema updates (apache#13867)
Browse files Browse the repository at this point in the history
Adds logs whenever we create, update or delete table configs and schemas. Logs that create and update schema/tableConfig include the new value in the log.

This can be used to track changes in these important configurations
  • Loading branch information
yashmayya authored Aug 21, 2024
1 parent 692d78c commit 35f8082
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ private SuccessResponse addSchema(Schema schema, boolean override, boolean force
// Best effort notification. If controller fails at this point, no notification is given.
LOGGER.info("Notifying metadata event for adding new schema {}", schemaName);
_metadataEventNotifierFactory.create().notifyOnSchemaEvents(schema, SchemaEventType.CREATE);

LOGGER.info("Successfully added schema: {} with value: {}", schemaName, schema);
return new SuccessResponse(schemaName + " successfully added");
} catch (SchemaAlreadyExistsException e) {
_controllerMetrics.addMeteredGlobalValue(ControllerMeter.CONTROLLER_SCHEMA_UPLOAD_ERROR, 1L);
Expand Down Expand Up @@ -425,6 +425,7 @@ private SuccessResponse updateSchema(String schemaName, Schema schema, boolean r
// Best effort notification. If controller fails at this point, no notification is given.
LOGGER.info("Notifying metadata event for updating schema: {}", schemaName);
_metadataEventNotifierFactory.create().notifyOnSchemaEvents(schema, SchemaEventType.UPDATE);
LOGGER.info("Successfully updated schema: {} with new value: {}", schemaName, schema);
return new SuccessResponse(schema.getSchemaName() + " successfully added");
} catch (SchemaNotFoundException e) {
_controllerMetrics.addMeteredGlobalValue(ControllerMeter.CONTROLLER_SCHEMA_UPLOAD_ERROR, 1L);
Expand Down Expand Up @@ -524,7 +525,7 @@ private void deleteSchemaInternal(String schemaName) {
if (_pinotHelixResourceManager.deleteSchema(schemaName)) {
LOGGER.info("Notifying metadata event for deleting schema: {}", schemaName);
_metadataEventNotifierFactory.create().notifyOnSchemaEvents(schema, SchemaEventType.DELETE);
LOGGER.info("Success: Deleted schema {}", schemaName);
LOGGER.info("Successfully deleted schema: {}", schemaName);
} else {
throw new ControllerApplicationException(LOGGER, String.format("Failed to delete schema %s", schemaName),
Response.Status.INTERNAL_SERVER_ERROR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ public ConfigSuccessResponse addTable(String tableConfigStr,
// TODO: validate that table was created successfully
// (in realtime case, metadata might not have been created but would be created successfully in the next run of
// the validation manager)
LOGGER.info("Successfully added table: {} with config: {}", tableNameWithType, tableConfig);
return new ConfigSuccessResponse("Table " + tableNameWithType + " successfully added",
tableConfigAndUnrecognizedProperties.getRight());
} catch (Exception e) {
Expand Down Expand Up @@ -432,6 +433,7 @@ public SuccessResponse deleteTable(
}
}
if (!tablesDeleted.isEmpty()) {
tablesDeleted.forEach(deletedTableName -> LOGGER.info("Successfully deleted table: {}", deletedTableName));
return new SuccessResponse("Tables: " + tablesDeleted + " deleted");
}
} catch (Exception e) {
Expand Down Expand Up @@ -515,6 +517,7 @@ public ConfigSuccessResponse updateTableConfig(
_controllerMetrics.addMeteredGlobalValue(ControllerMeter.CONTROLLER_TABLE_UPDATE_ERROR, 1L);
throw e;
}
LOGGER.info("Successfully updated table: {} with new config: {}", tableNameWithType, tableConfig);
return new ConfigSuccessResponse("Table config updated for " + tableName,
tableConfigAndUnrecognizedProperties.getRight());
}
Expand Down

0 comments on commit 35f8082

Please sign in to comment.