class Replica extends HiveEndpoint {

  public void updateMetadata(
      String eventId,
      TableAndStatistics sourceTable,
      String replicaDatabaseName,
      String replicaTableName,
      ReplicaLocationManager locationManager) {
    try (CloseableMetaStoreClient client = getMetaStoreClientSupplier().get()) {
      Optional<Table> oldReplicaTable = updateTableMetadata(client, eventId, sourceTable, replicaDatabaseName,
          replicaTableName, locationManager.getTableLocation(), replicationMode);
      if (oldReplicaTable.isPresent()
          && LocationUtils.hasLocation(oldReplicaTable.get())
          && isUnpartitioned(oldReplicaTable.get())) {

        Path oldLocation = locationAsPath(oldReplicaTable.get());
        String oldEventId = oldReplicaTable.get().getParameters().get(REPLICATION_EVENT.parameterName());
        locationManager.addCleanUpLocation(oldEventId, oldLocation);
      }
    }
  }

    Replica(
      ReplicaCatalog replicaCatalog,
      HiveConf replicaHiveConf,
      Supplier<CloseableMetaStoreClient> replicaMetaStoreClientSupplier,
      ReplicaTableFactory replicaTableFactory,
      HousekeepingListener housekeepingListener,
      ReplicaCatalogListener replicaCatalogListener,
      TableReplication tableReplication,
      AlterTableService alterTableService);
  @VisibleForTesting  Replica(
      ReplicaCatalog replicaCatalog,
      HiveConf replicaHiveConf,
      Supplier<CloseableMetaStoreClient> replicaMetaStoreClientSupplier,
      ReplicaTableFactory replicaTableFactory,
      HousekeepingListener housekeepingListener,
      ReplicaCatalogListener replicaCatalogListener,
      TableReplication tableReplication,
      AlterTableService alterTableService,
      int partitionBatchSize);

}