wu-sheng commented on code in PR #10544:
URL: https://github.com/apache/skywalking/pull/10544#discussion_r1139944026


##########
oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/common/TableHelper.java:
##########
@@ -54,6 +58,16 @@ public class TableHelper {
     @Getter(lazy = true, value = AccessLevel.PRIVATE)
     private final ConfigService configService = 
moduleManager.find(CoreModule.NAME).provider().getService(ConfigService.class);
 
+    private final LoadingCache<String, Boolean> tableExistence =
+        CacheBuilder.newBuilder()
+                    .expireAfterWrite(10, TimeUnit.MINUTES)
+                    .build(new CacheLoader<>() {
+                        @Override
+                        public @NonNull Boolean load(@NonNull String 
tableName) throws Exception {
+                            return jdbcClient.tableExists(tableName);
+                        }
+                    });

Review Comment:
   > Sounds like you want to capture the "table not found SQL exception", if 
that's the case, we don't even need a loading cache, we just use a plain cache 
(HashMap), and query the database for the first time, since then we only remove 
the cache when captured the exception, and the cache won't never expire unless 
exception is caught. Capturing such exception requires string manipulation 
though.
   
   Make sense. Map could be easier to archive this than cache.



-- 
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]

Reply via email to