You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "smiklosovic (via GitHub)" <gi...@apache.org> on 2023/03/27 08:12:27 UTC
[GitHub] [cassandra] smiklosovic commented on a diff in pull request #2233: [CASSANDRA-18153-5.0] Save host id to system.local and flush immediately after startup
smiklosovic commented on code in PR #2233:
URL: https://github.com/apache/cassandra/pull/2233#discussion_r1148943464
##########
src/java/org/apache/cassandra/db/compaction/CompactionManager.java:
##########
@@ -269,6 +269,27 @@ public boolean isCompacting(Iterable<ColumnFamilyStore> cfses, Predicate<SSTable
return false;
}
+ @VisibleForTesting
+ public boolean hasOngoingOrPendingTasks()
+ {
+ if (!active.getCompactions().isEmpty() || !compactingCF.isEmpty())
+ return true;
+
+ int pendingTasks = executor.getPendingTaskCount() +
+ validationExecutor.getPendingTaskCount() +
+ viewBuildExecutor.getPendingTaskCount() +
+ cacheCleanupExecutor.getPendingTaskCount() +
+ secondaryIndexExecutor.getPendingTaskCount();
+
+ int activeTasks = executor.getActiveTaskCount() +
+ validationExecutor.getActiveTaskCount() +
+ viewBuildExecutor.getActiveTaskCount() +
+ cacheCleanupExecutor.getActiveTaskCount() +
+ secondaryIndexExecutor.getActiveTaskCount();
+
+ return pendingTasks > 0 || activeTasks > 0;
Review Comment:
if `pendingTasks > 0`, we do not need to compute `activeTasks`, no? We can `return` after computing `pendingTasks` already.
int pendingTasks = executor.getPendingTaskCount() +
validationExecutor.getPendingTaskCount() +
viewBuildExecutor.getPendingTaskCount() +
cacheCleanupExecutor.getPendingTaskCount() +
secondaryIndexExecutor.getPendingTaskCount();
if (pendingTasks > 0)
return true;
int activeTasks = executor.getActiveTaskCount() +
validationExecutor.getActiveTaskCount() +
viewBuildExecutor.getActiveTaskCount() +
cacheCleanupExecutor.getActiveTaskCount() +
secondaryIndexExecutor.getActiveTaskCount();
return activeTasks > 0;
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org