Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[MINOR] improvement(log): add log for server (#3686)

mchadesbc4cd4ffd06b
diff --git a/server/src/main/java/com/datastrato/gravitino/server/web/rest/CatalogOperations.java b/server/src/main/java/com/datastrato/gravitino/server/web/rest/CatalogOperations.java
index 3abbeb20c5..e7b6bbb64b 100644
--- a/server/src/main/java/com/datastrato/gravitino/server/web/rest/CatalogOperations.java
+++ b/server/src/main/java/com/datastrato/gravitino/server/web/rest/CatalogOperations.java
@@ -59,6 +59,10 @@ public class CatalogOperations {
public Response listCatalogs(
@PathParam("metalake") String metalake,
@QueryParam("details") @DefaultValue("false") boolean verbose) {
+ LOG.info(
+ "Received list catalog {} request for metalake: {}, ",
+ verbose ? "infos" : "names",
+ metalake);
try {
return Utils.doAs(
httpRequest,
@@ -71,10 +75,15 @@ public class CatalogOperations {
() -> {
if (verbose) {
Catalog[] catalogs = catalogDispatcher.listCatalogsInfo(catalogNS);
- return Utils.ok(new CatalogListResponse(DTOConverters.toDTOs(catalogs)));
+ Response response =
+ Utils.ok(new CatalogListResponse(DTOConverters.toDTOs(catalogs)));
+ LOG.info("List {} catalogs info under metalake: {}", catalogs.length, metalake);
+ return response;
} else {
NameIdentifier[] idents = catalogDispatcher.listCatalogs(catalogNS);
- return Utils.ok(new EntityListResponse(idents));
+ Response response = Utils.ok(new EntityListResponse(idents));
+ LOG.info("List {} catalogs under metalake: {}", idents.length, metalake);
+ return response;
}
});
});
@@ -87,6 +96,7 @@ public class CatalogOperations {
@Produces("application/vnd.gravitino.v1+json")
public Response createCatalog(
@PathParam("metalake") String metalake, CatalogCreateRequest request) {
+ LOG.info("Received create catalog request for metalake: {}", metalake);
try {
return Utils.doAs(
httpRequest,
@@ -104,7 +114,9 @@ public class CatalogOperations {
request.getProvider(),
request.getComment(),
request.getProperties()));
- return Utils.ok(new CatalogResponse(DTOConverters.toDTO(catalog)));
+ Response response = Utils.ok(new CatalogResponse(DTOConverters.toDTO(catalog)));
+ LOG.info("Catalog created: {}.{}", metalake, catalog.name());
+ return response;
});
} catch (Exception e) {
@@ -118,12 +130,15 @@ public class CatalogOperations {
@Produces("application/vnd.gravitino.v1+json")
public Response loadCatalog(
@PathParam("metalake") String metalakeName, @PathParam("catalog") String catalogName) {
+ LOG.info("Received load catalog request for catalog: {}.{}", metalakeName, catalogName);
try {
NameIdentifier ident = NameIdentifier.ofCatalog(metalakeName, catalogName);
Catalog catalog =
TreeLockUtils.doWithTreeLock(
ident, LockType.READ, () -> catalogDispatcher.loadCatalog(ident));
- return Utils.ok(new CatalogResponse(DTOConverters.toDTO(catalog)));
+ Response response = Utils.ok(new CatalogResponse(DTOConverters.toDTO(catalog)));
+ LOG.info("Catalog loaded: {}.{}", metalakeName, catalogName);
+ return response;
} catch (Exception e) {
return ExceptionHandlers.handleCatalogException(
@@ -138,6 +153,7 @@ public class CatalogOperations {
@PathParam("metalake") String metalakeName,
@PathParam("catalog") String catalogName,
CatalogUpdatesRequest request) {
+ LOG.info("Received alter catalog request for catalog: {}.{}", metalakeName, catalogName);
try {
return Utils.doAs(
httpRequest,
@@ -153,7 +169,9 @@ public class CatalogOperations {
NameIdentifier.ofMetalake(metalakeName),
LockType.WRITE,
() -> catalogDispatcher.alterCatalog(ident, changes));
- return Utils.ok(new CatalogResponse(DTOConverters.toDTO(catalog)));
+ Response response = Utils.ok(new CatalogResponse(DTOConverters.toDTO(catalog)));
+ LOG.info("Catalog altered: {}.{}", metalakeName, catalog.name());
+ return response;
});
} catch (Exception e) {
@@ -167,6 +185,7 @@ public class CatalogOperations {
@Produces("application/vnd.gravitino.v1+json")
public Response dropCatalog(
@PathParam("metalake") String metalakeName, @PathParam("catalog") String catalogName) {
+ LOG.info("Received drop catalog request for catalog: {}.{}", metalakeName, catalogName);
try {
return Utils.doAs(
httpRequest,
@@ -181,7 +200,9 @@ public class CatalogOperations {
LOG.warn("Failed to drop catalog {} under metalake {}", catalogName, metalakeName);
}
- return Utils.ok(new DropResponse(dropped));
+ Response response = Utils.ok(new DropResponse(dropped));
+ LOG.info("Catalog dropped: {}.{}", metalakeName, catalogName);
+ return response;
});
} catch (Exception e) {
return ExceptionHandlers.handleCatalogException(
diff --git a/server/src/main/java/com/datastrato/gravitino/server/web/rest/FilesetOperations.java b/server/src/main/java/com/datastrato/gravitino/server/web/rest/FilesetOperations.java
index 1611422ae9..5345ddee53 100644
--- a/server/src/main/java/com/datastrato/gravitino/server/web/rest/FilesetOperations.java
+++ b/server/src/main/java/com/datastrato/gravitino/server/web/rest/FilesetOperations.java
@@ -60,6 +60,7 @@ public class FilesetOperations {
@PathParam("catalog") String catalog,
@PathParam("schema") String schema) {
try {
+ LOG.info("Received list filesets request for schema: {}.{}.{}", metalake, catalog, schema);
return Utils.doAs(
httpRequest,
() -> {
@@ -69,7 +70,14 @@ public class FilesetOperations {
NameIdentifier.of(metalake, catalog, schema),
LockType.READ,
() -> dispatcher.listFilesets(filesetNS));
- return Utils.ok(new EntityListResponse(idents));
+ Response response = Utils.ok(new EntityListResponse(idents));
+ LOG.info(
+ "List {} filesets under schema: {}.{}.{}",
+ idents.length,
+ metalake,
+ catalog,
+ schema);
+ return response;
});
} catch (Exception e) {
@@ -86,6 +94,12 @@ public class FilesetOperations {
@PathParam("catalog") String catalog,
@PathParam("schema") String schema,
FilesetCreateRequest request) {
+ LOG.info(
+ "Received create fileset request: {}.{}.{}.{}",
+ metalake,
+ catalog,
+ schema,
+ request.getName());
try {
return Utils.doAs(
httpRequest,
@@ -105,7 +119,9 @@ public class FilesetOperations {
Optional.ofNullable(request.getType()).orElse(Fileset.Type.MANAGED),
request.getStorageLocation(),
request.getProperties()));
- return Utils.ok(new FilesetResponse(DTOConverters.toDTO(fileset)));
+ Response response = Utils.ok(new FilesetResponse(DTOConverters.toDTO(fileset)));
+ LOG.info("Fileset created: {}.{}.{}.{}", metalake, catalog, schema, request.getName());
+ return response;
});
} catch (Exception e) {
@@ -124,6 +140,7 @@ public class FilesetOperations {
@PathParam("catalog") String catalog,
@PathParam("schema") String schema,
@PathParam("fileset") String fileset) {
+ LOG.info("Received load fileset request: {}.{}.{}.{}", metalake, catalog, schema, fileset);
try {
return Utils.doAs(
httpRequest,
@@ -132,7 +149,9 @@ public class FilesetOperations {
Fileset t =
TreeLockUtils.doWithTreeLock(
ident, LockType.READ, () -> dispatcher.loadFileset(ident));
- return Utils.ok(new FilesetResponse(DTOConverters.toDTO(t)));
+ Response response = Utils.ok(new FilesetResponse(DTOConverters.toDTO(t)));
+ LOG.info("Fileset loaded: {}.{}.{}.{}", metalake, catalog, schema, fileset);
+ return response;
});
} catch (Exception e) {
return ExceptionHandlers.handleFilesetException(OperationType.LOAD, fileset, schema, e);
@@ -150,6 +169,7 @@ public class FilesetOperations {
@PathParam("schema") String schema,
@PathParam("fileset") String fileset,
FilesetUpdatesRequest request) {
+ LOG.info("Received alter fileset request: {}.{}.{}.{}", metalake, catalog, schema, fileset);
try {
return Utils.doAs(
httpRequest,
@@ -165,7 +185,9 @@ public class FilesetOperations {
NameIdentifier.ofSchema(metalake, catalog, schema),
LockType.WRITE,
() -> dispatcher.alterFileset(ident, changes));
- return Utils.ok(new FilesetResponse(DTOConverters.toDTO(t)));
+ Response response = Utils.ok(new FilesetResponse(DTOConverters.toDTO(t)));
+ LOG.info("Fileset altered: {}.{}.{}.{}", metalake, catalog, schema, t.name());
+ return response;
});
} catch (Exception e) {
@@ -183,6 +205,7 @@ public class FilesetOperations {
@PathParam("catalog") String catalog,
@PathParam("schema") String schema,
@PathParam("fileset") String fileset) {
+ LOG.info("Received drop fileset request: {}.{}.{}.{}", metalake, catalog, schema, fileset);
try {
return Utils.doAs(
httpRequest,
@@ -197,7 +220,9 @@ public class FilesetOperations {
LOG.warn("Failed to drop fileset {} under schema {}", fileset, schema);
}
- return Utils.ok(new DropResponse(dropped));
+ Response response = Utils.ok(new DropResponse(dropped));
+ LOG.info("Fileset dropped: {}.{}.{}.{}", metalake, catalog, schema, fileset);
+ return response;
});
} catch (Exception e) {
diff --git a/server/src/main/java/com/datastrato/gravitino/server/web/rest/MetalakeOperations.java b/server/src/main/java/com/datastrato/gravitino/server/web/rest/MetalakeOperations.java
index b2037ee2b7..76eb0725a6 100644
--- a/server/src/main/java/com/datastrato/gravitino/server/web/rest/MetalakeOperations.java
+++ b/server/src/main/java/com/datastrato/gravitino/server/web/rest/MetalakeOperations.java
@@ -61,6 +61,7 @@ public class MetalakeOperations {
@Timed(name = "list-metalake." + MetricNames.HTTP_PROCESS_DURATION, absolute = true)
@ResponseMetered(name = "list-metalake", absolute = true)
public Response listMetalakes() {
+ LOG.info("Received list metalakes request.");
try {
return Utils.doAs(
httpRequest,
@@ -69,7 +70,9 @@ public class MetalakeOperations {
TreeLockUtils.doWithRootTreeLock(LockType.READ, metalakeDispatcher::listMetalakes);
MetalakeDTO[] metalakeDTOS =
Arrays.stream(metalakes).map(DTOConverters::toDTO).toArray(MetalakeDTO[]::new);
- return Utils.ok(new MetalakeListResponse(metalakeDTOS));
+ Response response = Utils.ok(new MetalakeListResponse(metalakeDTOS));
+ LOG.info("List {} metalakes in Gravitino", metalakeDTOS.length);
+ return response;
});
} catch (Exception e) {
@@ -83,6 +86,7 @@ public class MetalakeOperations {
@Timed(name = "create-metalake." + MetricNames.HTTP_PROCESS_DURATION, absolute = true)
@ResponseMetered(name = "create-metalake", absolute = true)
public Response createMetalake(MetalakeCreateRequest request) {
+ LOG.info("Received create metalake request for {}", request.getName());
try {
return Utils.doAs(
httpRequest,
@@ -95,7 +99,9 @@ public class MetalakeOperations {
() ->
metalakeDispatcher.createMetalake(
ident, request.getComment(), request.getProperties()));
- return Utils.ok(new MetalakeResponse(DTOConverters.toDTO(metalake)));
+ Response response = Utils.ok(new MetalakeResponse(DTOConverters.toDTO(metalake)));
+ LOG.info("Metalake created: {}", metalake.name());
+ return response;
});
} catch (Exception e) {
@@ -109,6 +115,7 @@ public class MetalakeOperations {
@Timed(name = "load-metalake." + MetricNames.HTTP_PROCESS_DURATION, absolute = true)
@ResponseMetered(name = "load-metalake", absolute = true)
public Response loadMetalake(@PathParam("name") String metalakeName) {
+ LOG.info("Received load metalake request for metalake: {}", metalakeName);
try {
return Utils.doAs(
httpRequest,
@@ -117,7 +124,9 @@ public class MetalakeOperations {
Metalake metalake =
TreeLockUtils.doWithTreeLock(
identifier, LockType.READ, () -> metalakeDispatcher.loadMetalake(identifier));
- return Utils.ok(new MetalakeResponse(DTOConverters.toDTO(metalake)));
+ Response response = Utils.ok(new MetalakeResponse(DTOConverters.toDTO(metalake)));
+ LOG.info("Metalake loaded: {}", metalake.name());
+ return response;
});
} catch (Exception e) {
@@ -132,6 +141,7 @@ public class MetalakeOperations {
@ResponseMetered(name = "alter-metalake", absolute = true)
public Response alterMetalake(
@PathParam("name") String metalakeName, MetalakeUpdatesRequest updatesRequest) {
+ LOG.info("Received alter metalake request for metalake: {}", metalakeName);
try {
return Utils.doAs(
httpRequest,
@@ -145,7 +155,10 @@ public class MetalakeOperations {
Metalake updatedMetalake =
TreeLockUtils.doWithRootTreeLock(
LockType.WRITE, () -> metalakeDispatcher.alterMetalake(identifier, changes));
- return Utils.ok(new MetalakeResponse(DTOConverters.toDTO(updatedMetalake)));
+ Response response =
+ Utils.ok(new MetalakeResponse(DTOConverters.toDTO(updatedMetalake)));
+ LOG.info("Metalake altered: {}", updatedMetalake.name());
+ return response;
});
} catch (Exception e) {
@@ -159,6 +172,7 @@ public class MetalakeOperations {
@Timed(name = "drop-metalake." + MetricNames.HTTP_PROCESS_DURATION, absolute = true)
@ResponseMetered(name = "drop-metalake", absolute = true)
public Response dropMetalake(@PathParam("name") String metalakeName) {
+ LOG.info("Received drop metalake request for metalake: {}", metalakeName);
try {
return Utils.doAs(
httpRequest,
@@ -171,7 +185,9 @@ public class MetalakeOperations {
LOG.warn("Failed to drop metalake by name {}", metalakeName);
}
- return Utils.ok(new DropResponse(dropped));
+ Response response = Utils.ok(new DropResponse(dropped));
+ LOG.info("Metalake dropped: {}", metalakeName);
+ return response;
});
} catch (Exception e) {
diff --git a/server/src/main/java/com/datastrato/gravitino/server/web/rest/PartitionOperations.java b/server/src/main/java/com/datastrato/gravitino/server/web/rest/PartitionOperations.java
index 3d30d6c3b3..46ab0169b8 100644
--- a/server/src/main/java/com/datastrato/gravitino/server/web/rest/PartitionOperations.java
+++ b/server/src/main/java/com/datastrato/gravitino/server/web/rest/PartitionOperations.java
@@ -61,6 +61,13 @@ public class PartitionOperations {
@PathParam("schema") String schema,
@PathParam("table") String table,
@QueryParam("details") @DefaultValue("false") boolean verbose) {
+ LOG.info(
+ "Received list partition {} request for table: {}.{}.{}.{}",
+ verbose ? "infos" : "names",
+ metalake,
+ catalog,
+ schema,
+ table);
try {
return Utils.doAs(
httpRequest,
@@ -72,10 +79,26 @@ public class PartitionOperations {
() -> {
if (verbose) {
Partition[] partitions = dispatcher.listPartitions(tableIdent);
- return Utils.ok(new PartitionListResponse(toDTOs(partitions)));
+ Response response = Utils.ok(new PartitionListResponse(toDTOs(partitions)));
+ LOG.info(
+ "List {} partitions in table {}.{}.{}.{}",
+ partitions.length,
+ metalake,
+ catalog,
+ schema,
+ table);
+ return response;
} else {
String[] partitionNames = dispatcher.listPartitionNames(tableIdent);
- return Utils.ok(new PartitionNameListResponse((partitionNames)));
+ Response response = Utils.ok(new PartitionNameListResponse((partitionNames)));
+ LOG.info(
+ "List {} partition names in table {}.{}.{}.{}",
+ partitionNames.length,
+ metalake,
+ catalog,
+ schema,
+ table);
+ return response;
}
});
});
@@ -95,6 +118,13 @@ public class PartitionOperations {
@PathParam("schema") String schema,
@PathParam("table") String table,
@PathParam("partition") String partition) {
+ LOG.info(
+ "Received get partition request for partition[{}] of table[{}.{}.{}.{}]",
+ partition,
+ metalake,
+ catalog,
+ schema,
+ table);
try {
return Utils.doAs(
httpRequest,
@@ -105,7 +135,15 @@ public class PartitionOperations {
LockType.READ,
() -> {
Partition p = dispatcher.getPartition(tableIdent, partition);
- return Utils.ok(new PartitionResponse(DTOConverters.toDTO(p)));
+ Response response = Utils.ok(new PartitionResponse(DTOConverters.toDTO(p)));
+ LOG.info(
+ "Got partition[{}] in table[{}.{}.{}.{}]",
+ partition,
+ metalake,
+ catalog,
+ schema,
+ table);
+ return response;
});
});
} catch (Exception e) {
@@ -123,6 +161,13 @@ public class PartitionOperations {
@PathParam("schema") String schema,
@PathParam("table") String table,
AddPartitionsRequest request) {
+ LOG.info(
+ "Received add {} partition(s) request for table {}.{}.{}.{} ",
+ request.getPartitions().length,
+ metalake,
+ catalog,
+ schema,
+ table);
Preconditions.checkArgument(
request.getPartitions().length == 1, "Only one partition is supported");
@@ -137,8 +182,17 @@ public class PartitionOperations {
() -> {
Partition p =
dispatcher.addPartition(tableIdent, fromDTO(request.getPartitions()[0]));
- return Utils.ok(
- new PartitionListResponse(new PartitionDTO[] {DTOConverters.toDTO(p)}));
+ Response response =
+ Utils.ok(
+ new PartitionListResponse(new PartitionDTO[] {DTOConverters.toDTO(p)}));
+ LOG.info(
+ "Added {} partition(s) to table {}.{}.{}.{} ",
+ 1,
+ metalake,
+ catalog,
+ schema,
+ table);
+ return response;
});
});
} catch (Exception e) {
@@ -158,6 +212,14 @@ public class PartitionOperations {
@PathParam("table") String table,
@PathParam("partition") String partition,
@QueryParam("purge") @DefaultValue("false") boolean purge) {
+ LOG.info(
+ "Received {} partition request for partition[{}] of table[{}.{}.{}.{}]",
+ purge ? "purge" : "drop",
+ partition,
+ metalake,
+ catalog,
+ schema,
+ table);
try {
return Utils.doAs(
httpRequest,
@@ -178,7 +240,16 @@ public class PartitionOperations {
table,
schema);
}
- return Utils.ok(new DropResponse(dropped));
+ Response response = Utils.ok(new DropResponse(dropped));
+ LOG.info(
+ "Partition {} {} in table {}.{}.{}.{}",
+ partition,
+ purge ? "purged" : "dropped",
+ metalake,
+ catalog,
+ schema,
+ table);
+ return response;
});
});
} catch (Exception e) {
diff --git a/server/src/main/java/com/datastrato/gravitino/server/web/rest/SchemaOperations.java b/server/src/main/java/com/datastrato/gravitino/server/web/rest/SchemaOperations.java
index ed68d2c14c..038603c434 100644
--- a/server/src/main/java/com/datastrato/gravitino/server/web/rest/SchemaOperations.java
+++ b/server/src/main/java/com/datastrato/gravitino/server/web/rest/SchemaOperations.java
@@ -62,6 +62,7 @@ public class SchemaOperations {
@ResponseMetered(name = "list-schema", absolute = true)
public Response listSchemas(
@PathParam("metalake") String metalake, @PathParam("catalog") String catalog) {
+ LOG.info("Received list schema request for catalog: {}.{}", metalake, catalog);
try {
return Utils.doAs(
httpRequest,
@@ -72,7 +73,9 @@ public class SchemaOperations {
NameIdentifier.of(metalake, catalog),
LockType.READ,
() -> dispatcher.listSchemas(schemaNS));
- return Utils.ok(new EntityListResponse(idents));
+ Response response = Utils.ok(new EntityListResponse(idents));
+ LOG.info("List {} schemas in catalog {}.{}", idents.length, metalake, catalog);
+ return response;
});
} catch (Exception e) {
return ExceptionHandlers.handleSchemaException(OperationType.LIST, "", catalog, e);
@@ -87,6 +90,7 @@ public class SchemaOperations {
@PathParam("metalake") String metalake,
@PathParam("catalog") String catalog,
SchemaCreateRequest request) {
+ LOG.info("Received create schema request: {}.{}.{}", metalake, catalog, request.getName());
try {
return Utils.doAs(
httpRequest,
@@ -100,7 +104,9 @@ public class SchemaOperations {
() ->
dispatcher.createSchema(
ident, request.getComment(), request.getProperties()));
- return Utils.ok(new SchemaResponse(DTOConverters.toDTO(schema)));
+ Response response = Utils.ok(new SchemaResponse(DTOConverters.toDTO(schema)));
+ LOG.info("Schema created: {}.{}.{}", metalake, catalog, schema.name());
+ return response;
});
} catch (Exception e) {
@@ -118,6 +124,7 @@ public class SchemaOperations {
@PathParam("metalake") String metalake,
@PathParam("catalog") String catalog,
@PathParam("schema") String schema) {
+ LOG.info("Received load schema request for schema: {}.{}.{}", metalake, catalog, schema);
try {
return Utils.doAs(
httpRequest,
@@ -126,7 +133,9 @@ public class SchemaOperations {
Schema s =
TreeLockUtils.doWithTreeLock(
ident, LockType.READ, () -> dispatcher.loadSchema(ident));
- return Utils.ok(new SchemaResponse(DTOConverters.toDTO(s)));
+ Response response = Utils.ok(new SchemaResponse(DTOConverters.toDTO(s)));
+ LOG.info("Schema loaded: {}.{}.{}", metalake, catalog, s.name());
+ return response;
});
} catch (Exception e) {
@@ -144,6 +153,7 @@ public class SchemaOperations {
@PathParam("catalog") String catalog,
@PathParam("schema") String schema,
SchemaUpdatesRequest request) {
+ LOG.info("Received alter schema request: {}.{}.{}", metalake, catalog, schema);
try {
return Utils.doAs(
httpRequest,
@@ -159,7 +169,9 @@ public class SchemaOperations {
NameIdentifier.ofCatalog(metalake, catalog),
LockType.WRITE,
() -> dispatcher.alterSchema(ident, changes));
- return Utils.ok(new SchemaResponse(DTOConverters.toDTO(s)));
+ Response response = Utils.ok(new SchemaResponse(DTOConverters.toDTO(s)));
+ LOG.info("Schema altered: {}.{}.{}", metalake, catalog, s.name());
+ return response;
});
} catch (Exception e) {
@@ -177,6 +189,7 @@ public class SchemaOperations {
@PathParam("catalog") String catalog,
@PathParam("schema") String schema,
@DefaultValue("false") @QueryParam("cascade") boolean cascade) {
+ LOG.info("Received drop schema request: {}.{}.{}", metalake, catalog, schema);
try {
return Utils.doAs(
httpRequest,
@@ -191,7 +204,9 @@ public class SchemaOperations {
LOG.warn("Fail to drop schema {} under namespace {}", schema, ident.namespace());
}
- return Utils.ok(new DropResponse(dropped));
+ Response response = Utils.ok(new DropResponse(dropped));
+ LOG.info("Schema dropped: {}.{}.{}", metalake, catalog, schema);
+ return response;
});
} catch (Exception e) {
return ExceptionHandlers.handleSchemaException(OperationType.DROP, schema, catalog, e);
diff --git a/server/src/main/java/com/datastrato/gravitino/server/web/rest/TableOperations.java b/server/src/main/java/com/datastrato/gravitino/server/web/rest/TableOperations.java
index d45017b767..5ac9ff4080 100644
--- a/server/src/main/java/com/datastrato/gravitino/server/web/rest/TableOperations.java
+++ b/server/src/main/java/com/datastrato/gravitino/server/web/rest/TableOperations.java
@@ -63,6 +63,7 @@ public class TableOperations {
@PathParam("metalake") String metalake,
@PathParam("catalog") String catalog,
@PathParam("schema") String schema) {
+ LOG.info("Received list tables request for schema: {}.{}.{}", metalake, catalog, schema);
try {
return Utils.doAs(
httpRequest,
@@ -73,7 +74,10 @@ public class TableOperations {
NameIdentifier.of(metalake, catalog, schema),
LockType.READ,
() -> dispatcher.listTables(tableNS));
- return Utils.ok(new EntityListResponse(idents));
+ Response response = Utils.ok(new EntityListResponse(idents));
+ LOG.info(
+ "List {} tables under schema: {}.{}.{}", idents.length, metalake, catalog, schema);
+ return response;
});
} catch (Exception e) {
@@ -90,6 +94,8 @@ public class TableOperations {
@PathParam("catalog") String catalog,
@PathParam("schema") String schema,
TableCreateRequest request) {
+ LOG.info(
+ "Received create table request: {}.{}.{}.{}", metalake, catalog, schema, request.getName());
try {
return Utils.doAs(
httpRequest,
@@ -112,7 +118,9 @@ public class TableOperations {
fromDTO(request.getDistribution()),
fromDTOs(request.getSortOrders()),
fromDTOs(request.getIndexes())));
- return Utils.ok(new TableResponse(DTOConverters.toDTO(table)));
+ Response response = Utils.ok(new TableResponse(DTOConverters.toDTO(table)));
+ LOG.info("Table created: {}.{}.{}.{}", metalake, catalog, schema, request.getName());
+ return response;
});
} catch (Exception e) {
@@ -131,6 +139,8 @@ public class TableOperations {
@PathParam("catalog") String catalog,
@PathParam("schema") String schema,
@PathParam("table") String table) {
+ LOG.info(
+ "Received load table request for table: {}.{}.{}.{}", metalake, catalog, schema, table);
try {
return Utils.doAs(
httpRequest,
@@ -139,7 +149,9 @@ public class TableOperations {
Table t =
TreeLockUtils.doWithTreeLock(
ident, LockType.READ, () -> dispatcher.loadTable(ident));
- return Utils.ok(new TableResponse(DTOConverters.toDTO(t)));
+ Response response = Utils.ok(new TableResponse(DTOConverters.toDTO(t)));
+ LOG.info("Table loaded: {}.{}.{}.{}", metalake, catalog, schema, table);
+ return response;
});
} catch (Exception e) {
return ExceptionHandlers.handleTableException(OperationType.LOAD, table, schema, e);
@@ -157,6 +169,7 @@ public class TableOperations {
@PathParam("schema") String schema,
@PathParam("table") String table,
TableUpdatesRequest request) {
+ LOG.info("Received alter table request: {}.{}.{}.{}", metalake, catalog, schema, table);
try {
return Utils.doAs(
httpRequest,
@@ -172,7 +185,9 @@ public class TableOperations {
NameIdentifier.of(metalake, catalog, schema),
LockType.WRITE,
() -> dispatcher.alterTable(ident, changes));
- return Utils.ok(new TableResponse(DTOConverters.toDTO(t)));
+ Response response = Utils.ok(new TableResponse(DTOConverters.toDTO(t)));
+ LOG.info("Table altered: {}.{}.{}.{}", metalake, catalog, schema, t.name());
+ return response;
});
} catch (Exception e) {
@@ -191,6 +206,13 @@ public class TableOperations {
@PathParam("schema") String schema,
@PathParam("table") String table,
@QueryParam("purge") @DefaultValue("false") boolean purge) {
+ LOG.info(
+ "Received {} table request: {}.{}.{}.{}",
+ purge ? "purge" : "drop",
+ metalake,
+ catalog,
+ schema,
+ table);
try {
return Utils.doAs(
httpRequest,
@@ -205,7 +227,15 @@ public class TableOperations {
LOG.warn("Failed to drop table {} under schema {}", table, schema);
}
- return Utils.ok(new DropResponse(dropped));
+ Response response = Utils.ok(new DropResponse(dropped));
+ LOG.info(
+ "Table {}: {}.{}.{}.{}",
+ purge ? "purge" : "drop",
+ metalake,
+ catalog,
+ schema,
+ table);
+ return response;
});
} catch (Exception e) {
diff --git a/server/src/main/java/com/datastrato/gravitino/server/web/rest/TopicOperations.java b/server/src/main/java/com/datastrato/gravitino/server/web/rest/TopicOperations.java
index bff22a9151..d12a811e3d 100644
--- a/server/src/main/java/com/datastrato/gravitino/server/web/rest/TopicOperations.java
+++ b/server/src/main/java/com/datastrato/gravitino/server/web/rest/TopicOperations.java
@@ -57,6 +57,7 @@ public class TopicOperations {
@PathParam("catalog") String catalog,
@PathParam("schema") String schema) {
try {
+ LOG.info("Received list topics request for schema: {}.{}.{}", metalake, catalog, schema);
return Utils.doAs(
httpRequest,
() -> {
@@ -67,7 +68,10 @@ public class TopicOperations {
NameIdentifier.of(metalake, catalog, schema),
LockType.READ,
() -> dispatcher.listTopics(topicNS));
- return Utils.ok(new EntityListResponse(topics));
+ Response response = Utils.ok(new EntityListResponse(topics));
+ LOG.info(
+ "List {} topics under schema: {}.{}.{}", topics.length, metalake, catalog, schema);
+ return response;
});
} catch (Exception e) {
return ExceptionHandlers.handleFilesetException(OperationType.LIST, "", schema, e);
@@ -83,6 +87,7 @@ public class TopicOperations {
@PathParam("catalog") String catalog,
@PathParam("schema") String schema,
TopicCreateRequest request) {
+ LOG.info("Received create topic request: {}.{}.{}", metalake, catalog, schema);
try {
return Utils.doAs(
httpRequest,
@@ -107,7 +112,9 @@ public class TopicOperations {
request.getComment(),
null /* dataLayout, always null because it's not supported yet.*/,
request.getProperties()));
- return Utils.ok(new TopicResponse(DTOConverters.toDTO(topic)));
+ Response response = Utils.ok(new TopicResponse(DTOConverters.toDTO(topic)));
+ LOG.info("Topic created: {}.{}.{}.{}", metalake, catalog, schema, topic.name());
+ return response;
});
} catch (Exception e) {
return ExceptionHandlers.handleTopicException(
@@ -125,6 +132,8 @@ public class TopicOperations {
@PathParam("catalog") String catalog,
@PathParam("schema") String schema,
@PathParam("topic") String topic) {
+ LOG.info(
+ "Received load topic request for topic: {}.{}.{}.{}", metalake, catalog, schema, topic);
try {
return Utils.doAs(
httpRequest,
@@ -134,7 +143,9 @@ public class TopicOperations {
Topic t =
TreeLockUtils.doWithTreeLock(
ident, LockType.READ, () -> dispatcher.loadTopic(ident));
- return Utils.ok(new TopicResponse(DTOConverters.toDTO(t)));
+ Response response = Utils.ok(new TopicResponse(DTOConverters.toDTO(t)));
+ LOG.info("Topic loaded: {}.{}.{}.{}", metalake, catalog, schema, topic);
+ return response;
});
} catch (Exception e) {
return ExceptionHandlers.handleTopicException(OperationType.LOAD, topic, schema, e);
@@ -152,6 +163,7 @@ public class TopicOperations {
@PathParam("schema") String schema,
@PathParam("topic") String topic,
TopicUpdatesRequest request) {
+ LOG.info("Received alter topic request: {}.{}.{}.{}", metalake, catalog, schema, topic);
try {
return Utils.doAs(
httpRequest,
@@ -169,7 +181,9 @@ public class TopicOperations {
NameIdentifier.ofSchema(metalake, catalog, schema),
LockType.WRITE,
() -> dispatcher.alterTopic(ident, changes));
- return Utils.ok(new TopicResponse(DTOConverters.toDTO(t)));
+ Response response = Utils.ok(new TopicResponse(DTOConverters.toDTO(t)));
+ LOG.info("Topic altered: {}.{}.{}.{}", metalake, catalog, schema, t.name());
+ return response;
});
} catch (Exception e) {
return ExceptionHandlers.handleTopicException(OperationType.ALTER, topic, schema, e);
@@ -186,6 +200,7 @@ public class TopicOperations {
@PathParam("catalog") String catalog,
@PathParam("schema") String schema,
@PathParam("topic") String topic) {
+ LOG.info("Received drop topic request: {}.{}.{}.{}", metalake, catalog, schema, topic);
try {
return Utils.doAs(
httpRequest,
@@ -202,7 +217,9 @@ public class TopicOperations {
LOG.warn("Failed to drop topic {} under schema {}", topic, schema);
}
- return Utils.ok(new DropResponse(dropped));
+ Response response = Utils.ok(new DropResponse(dropped));
+ LOG.info("Topic dropped: {}.{}.{}.{}", metalake, catalog, schema, topic);
+ return response;
});
} catch (Exception e) {
return ExceptionHandlers.handleTopicException(OperationType.DROP, topic, schema, e);