veghlaci05 commented on code in PR #3864:
URL: https://github.com/apache/hive/pull/3864#discussion_r1068053535
##########
ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/MetaStoreCompactorThread.java:
##########
@@ -133,4 +141,27 @@ protected static long updateCycleDurationMetric(String
metric, long startedAt) {
}
return 0;
}
+
+ <T extends TBase<T,?>> T computeIfAbsent(String key, Callable<T> callable)
throws Exception {
+ if (metaCache.isPresent()) {
+ try {
+ return (T) metaCache.get().get(key, callable);
+ } catch (ExecutionException e) {
+ throw (Exception) e.getCause();
+ }
+ }
+ return callable.call();
+ }
+
+ Optional<Cache<String, TBase>> initializeCache(boolean tableCacheOn) {
+ if (tableCacheOn) {
+ metaCache = Optional.of(CacheBuilder.newBuilder().softValues().build());
+ }
+ return metaCache;
+ }
+
+ protected void invalidateMetaCache(){
Review Comment:
Is there a reason why this method has different access modifier than the
other two? In this case both default and protected works, but I would set the
same for all three.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]