Skip to content

Commit

Permalink
Remove redundant asyncReloading CacheLoader wrapper
Browse files Browse the repository at this point in the history
The changed caches do not set `cacheBuilder.refreshAfterWrite` (since
3a1bf59), so the `asyncReloading`,
which changes `CacheLoader.reload`, and delegates the reset), was
redundant.
  • Loading branch information
findepi committed Jan 18, 2022
1 parent e23cdff commit 603ee68
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ protected CachingHiveMetastore(HiveMetastore delegate, Executor executor, Option

// disable refresh since it can't use the bulk loading and causes too many requests
partitionStatisticsCache = newCacheBuilder(expiresAfterWriteMillis, OptionalLong.empty(), maximumSize, statsRecording)
.build(asyncReloading(new CacheLoader<>()
.build(new CacheLoader<>()
{
@Override
public PartitionStatistics load(WithIdentity<HivePartitionName> key)
Expand All @@ -197,7 +197,7 @@ public Map<WithIdentity<HivePartitionName>, PartitionStatistics> loadAll(Iterabl
{
return loadPartitionColumnStatistics(keys);
}
}, executor));
});

tableCache = newCacheBuilder(expiresAfterWriteMillis, refreshMills, maximumSize, statsRecording)
.build(asyncReloading(CacheLoader.from(this::loadTable), executor));
Expand All @@ -210,7 +210,7 @@ public Map<WithIdentity<HivePartitionName>, PartitionStatistics> loadAll(Iterabl

// disable refresh since it can't use the bulk loading and causes too many requests
partitionCache = newCacheBuilder(expiresAfterWriteMillis, OptionalLong.empty(), maximumSize, statsRecording)
.build(asyncReloading(new CacheLoader<>()
.build(new CacheLoader<>()
{
@Override
public Optional<Partition> load(WithIdentity<HivePartitionName> partitionName)
Expand All @@ -223,7 +223,7 @@ public Map<WithIdentity<HivePartitionName>, Optional<Partition>> loadAll(Iterabl
{
return loadPartitionsByNames(partitionNames);
}
}, executor));
});

tablePrivilegesCache = newCacheBuilder(expiresAfterWriteMillis, refreshMills, maximumSize, statsRecording)
.build(asyncReloading(CacheLoader.from(key -> loadTablePrivileges(key.getDatabase(), key.getTable(), key.getOwner(), key.getPrincipal())), executor));
Expand Down

0 comments on commit 603ee68

Please sign in to comment.