From 35f80826ca2dd67642cfd73698312b7be64f8593 Mon Sep 17 00:00:00 2001 From: Yash Mayya Date: Wed, 21 Aug 2024 20:48:12 +0530 Subject: [PATCH] Log table config and schema updates (#13867) 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 --- .../controller/api/resources/PinotSchemaRestletResource.java | 5 +++-- .../controller/api/resources/PinotTableRestletResource.java | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSchemaRestletResource.java b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSchemaRestletResource.java index 876dd04be9f5..4b2c1e33c9d0 100644 --- a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSchemaRestletResource.java +++ b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSchemaRestletResource.java @@ -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); @@ -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); @@ -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); diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTableRestletResource.java b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTableRestletResource.java index 7a5fb1936bc6..bc7d16bde6ed 100644 --- a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTableRestletResource.java +++ b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTableRestletResource.java @@ -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) { @@ -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) { @@ -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()); }