Skip to content

Commit

Permalink
added logging for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
patduin committed Nov 21, 2023
1 parent cebb3a9 commit a6a9072
Showing 1 changed file with 25 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@

import com.facebook.fb303.FacebookBase;
import com.facebook.fb303.fb_status;
import com.jcabi.aspects.Loggable;

import com.google.common.base.Stopwatch;
import com.hotels.bdp.waggledance.conf.WaggleDanceConfiguration;
import com.hotels.bdp.waggledance.mapping.model.DatabaseMapping;
import com.hotels.bdp.waggledance.mapping.service.MappingEventListener;
import com.hotels.bdp.waggledance.mapping.service.impl.NotifyingFederationService;
import com.hotels.bdp.waggledance.metrics.Monitored;
import com.jcabi.aspects.Loggable;

@Monitored
@Component
Expand Down Expand Up @@ -1371,7 +1371,7 @@ public void alter_partitions_with_environment_context(
mapping
.getClient()
.alter_partitions_with_environment_context(mapping.transformInboundDatabaseName(db_name), tbl_name,
mapping.transformInboundPartitions(new_parts), environment_context);
mapping.transformInboundPartitions(new_parts), environment_context);
}

@Override
Expand All @@ -1383,7 +1383,7 @@ public void alter_table_with_cascade(String dbname, String tbl_name, Table new_t
mapping
.getClient()
.alter_table_with_cascade(mapping.transformInboundDatabaseName(dbname), tbl_name,
mapping.transformInboundTable(new_tbl), cascade);
mapping.transformInboundTable(new_tbl), cascade);
}

@Override
Expand Down Expand Up @@ -1616,14 +1616,34 @@ public GetTableResult get_table_req(GetTableRequest req) throws MetaException, N
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public GetTablesResult get_table_objects_by_name_req(GetTablesRequest req)
throws MetaException, InvalidOperationException, UnknownDBException, TException {
StringBuilder message = new StringBuilder();
Stopwatch stopWatch = Stopwatch.createStarted();

message.append("get_table_objects_by_name_req: req=" + req.toString() + "\n");
DatabaseMapping mapping = databaseMappingService.databaseMapping(req.getDbName());
message.append(" databaseMapping took:" + stopWatch.elapsed().toMillis() + "\n");
stopWatch.reset().start();

List<String> filteredTables = databaseMappingService.filterTables(req.getDbName(), req.getTblNames(), mapping);
req.setTblNames(filteredTables);
message.append(" filtered tables 1st call took: " + stopWatch.elapsed().toMillis() + "\n");
stopWatch.reset().start();

GetTablesResult result = mapping
.getClient()
.get_table_objects_by_name_req(mapping.transformInboundGetTablesRequest(req));
message.append(" HMS call took: " + stopWatch.elapsed().toMillis() + "\n");
stopWatch.reset().start();

result.setTables(mapping.getMetastoreFilter().filterTables(result.getTables()));
return mapping.transformOutboundGetTablesResult(result);
message.append(" filtered tables 2nd call took: " + stopWatch.elapsed().toMillis() + "\n");
stopWatch.reset().start();

GetTablesResult getTablesResult = mapping.transformOutboundGetTablesResult(result);
message.append(" transform outbound took: " + stopWatch.elapsed().toMillis() + "\n");
stopWatch.stop();
LOG.error(message.toString());
return getTablesResult;
}

@Override
Expand Down

0 comments on commit a6a9072

Please sign in to comment.