freemandealer commented on code in PR #32030:
URL: https://github.com/apache/doris/pull/32030#discussion_r1519646289
##########
fe/fe-core/src/main/java/org/apache/doris/statistics/util/StatisticsUtil.java:
##########
@@ -974,4 +976,28 @@ public static boolean isMvColumn(TableIf table, String
columnName) {
||
columnName.startsWith(CreateMaterializedViewStmt.MATERIALIZED_VIEW_AGGREGATE_NAME_PREFIX);
}
+ public static boolean isEmptyTable(TableIf table,
AnalysisInfo.AnalysisMethod method) {
+ int waitRowCountReportedTime = 90;
+ if (!(table instanceof OlapTable) ||
method.equals(AnalysisInfo.AnalysisMethod.FULL)) {
+ return false;
+ }
+ OlapTable olapTable = (OlapTable) table;
+ for (int i = 0; i < waitRowCountReportedTime; i++) {
+ if (olapTable.getRowCount() > 0) {
+ return false;
+ }
+ // If visible version is 2, table is probably not empty. So we
wait row count to be reported.
+ // If visible version is not 2 and getRowCount return 0, we assume
it is an empty table.
+ if (olapTable.getVisibleVersion() !=
TableAttributes.TABLE_INIT_VERSION + 1) {
+ return true;
+ }
+ try {
+ Thread.sleep(1000);
Review Comment:
Will this waiting hold up the Worker thread? AFAIK, number of threads is
limited in the analysisTaskExecutor.
##########
fe/fe-core/src/main/java/org/apache/doris/statistics/util/StatisticsUtil.java:
##########
@@ -974,4 +976,28 @@ public static boolean isMvColumn(TableIf table, String
columnName) {
||
columnName.startsWith(CreateMaterializedViewStmt.MATERIALIZED_VIEW_AGGREGATE_NAME_PREFIX);
}
+ public static boolean isEmptyTable(TableIf table,
AnalysisInfo.AnalysisMethod method) {
+ int waitRowCountReportedTime = 90;
+ if (!(table instanceof OlapTable) ||
method.equals(AnalysisInfo.AnalysisMethod.FULL)) {
+ return false;
+ }
+ OlapTable olapTable = (OlapTable) table;
+ for (int i = 0; i < waitRowCountReportedTime; i++) {
+ if (olapTable.getRowCount() > 0) {
+ return false;
+ }
+ // If visible version is 2, table is probably not empty. So we
wait row count to be reported.
Review Comment:
Where does this assumption come from and why it is helpful to wait?
--
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]