Skip to content

Commit

Permalink
Invalidate CachingHiveMetastore's table cache after DROP TABLE
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjo2144 authored and findepi committed Mar 15, 2022
1 parent d5e532b commit 7abed73
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ public void invalidateTable(String databaseName, String tableName)
.filter(userTableKey -> userTableKey.matches(databaseName, tableName))
.forEach(tablePrivilegesCache::invalidate);
invalidateTableStatisticsCache(databaseName, tableName);
invalidateTablesWithParameterCache(databaseName, tableName);
invalidatePartitionCache(databaseName, tableName);
}

Expand All @@ -604,6 +605,17 @@ private void invalidateTableStatisticsCache(String databaseName, String tableNam
.forEach(tableCache::invalidate);
}

private void invalidateTablesWithParameterCache(String databaseName, String tableName)
{
tablesWithParameterCache.asMap().keySet().stream()
.filter(cacheKey -> cacheKey.getDatabaseName().equals(databaseName))
.filter(cacheKey -> {
List<String> cacheValue = tablesWithParameterCache.getIfPresent(cacheKey);
return cacheValue != null && cacheValue.contains(tableName);
})
.forEach(tablesWithParameterCache::invalidate);
}

private Partition getExistingPartition(Table table, List<String> partitionValues)
{
return getPartition(table, partitionValues)
Expand Down

0 comments on commit 7abed73

Please sign in to comment.