Jibing-Li commented on code in PR #38990:
URL: https://github.com/apache/doris/pull/38990#discussion_r1706481515


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalRowCountCache.java:
##########
@@ -86,56 +86,50 @@ protected Optional<Long> doLoad(RowCountKey rowCountKey) {
                 TableIf table = 
StatisticsUtil.findTable(rowCountKey.catalogId, rowCountKey.dbId, 
rowCountKey.tableId);
                 return Optional.of(table.fetchRowCount());
             } catch (Exception e) {
-                LOG.warn("Failed to get table with catalogId {}, dbId {}, 
tableId {}", rowCountKey.catalogId,
-                        rowCountKey.dbId, rowCountKey.tableId);
-                return Optional.empty();
+                LOG.warn("Failed to get table row count with catalogId {}, 
dbId {}, tableId {}. Reason {}",
+                        rowCountKey.catalogId, rowCountKey.dbId, 
rowCountKey.tableId, e.getMessage());
+                LOG.debug(e);
+                return null;

Review Comment:
   Return Optional.empty() will cache this empty value in memory, so we can't 
try to load the row count until the cache expire. Null may raise NPE, but that 
is expected, we catch that NPE and return a default value -1 without keep the 
default value or Optinal.empty() in cache, so we can trigger the load function 
to fetch row count again next time after exception happened.



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to