Make FileHiveMetastore#get*Statistics methods synchronized
File system access is made from the synchronized blocks to ensure metadata integrity.
@@ -271,7 +271,7 @@ public class FileHiveMetastore
}
@Override
- public PartitionStatistics getTableStatistics(String databaseName, String tableName)
+ public synchronized PartitionStatistics getTableStatistics(String databaseName, String tableName)
{
Table table = getTable(databaseName, tableName)
.orElseThrow(() -> new TableNotFoundException(new SchemaTableName(databaseName, tableName)));
@@ -279,7 +279,7 @@ public class FileHiveMetastore
}
@Override
- public Map<String, PartitionStatistics> getPartitionStatistics(String databaseName, String tableName, Set<String> partitionNames)
+ public synchronized Map<String, PartitionStatistics> getPartitionStatistics(String databaseName, String tableName, Set<String> partitionNames)
{
ImmutableMap.Builder<String, PartitionStatistics> result = ImmutableMap.builder();
getPartitionsByNames(databaseName, tableName, ImmutableList.copyOf(partitionNames)).forEach((partitionName, optionalPartition) -> {
