Fix Hive permission caching
@@ -430,6 +430,9 @@ public class CachingHiveMetastore
tableCache.invalidate(new HiveTableName(databaseName, tableName));
tableNamesCache.invalidate(databaseName);
viewNamesCache.invalidate(databaseName);
+ userTablePrivileges.asMap().keySet().stream()
+ .filter(userTableKey -> userTableKey.matches(databaseName, tableName))
+ .forEach(userTablePrivileges::invalidate);
invalidatePartitionCache(databaseName, tableName);
}
@@ -842,6 +845,11 @@ public class CachingHiveMetastore
return table;
}
+ public boolean matches(String databaseName, String tableName)
+ {
+ return this.database.equals(databaseName) && this.table.equals(tableName);
+ }
+
@Override
public boolean equals(Object o)
{
