flyrain commented on code in PR #3415:
URL: https://github.com/apache/polaris/pull/3415#discussion_r2689036260
##########
runtime/service/src/main/java/org/apache/polaris/service/task/TableCleanupTaskHandler.java:
##########
@@ -150,6 +156,53 @@ public boolean handleTask(TaskEntity cleanupTask,
CallContext callContext) {
return false;
}
+ private int processTasks(
+ Stream<TaskEntity> taskStream,
+ int batchSize,
+ PolarisMetaStoreManager metaStoreManager,
+ PolarisCallContext polarisCallContext,
+ IcebergTableLikeEntity tableEntity) {
+ int totalCount = 0;
+ Iterator<TaskEntity> iterator = taskStream.iterator();
+ List<TaskEntity> batch = new ArrayList<>(batchSize);
+
+ while (iterator.hasNext()) {
+ batch.add(iterator.next());
+ if (batch.size() >= batchSize) {
+ createAndRegisterTasks(batch, metaStoreManager, polarisCallContext,
tableEntity);
+ totalCount += batch.size();
+ batch.clear();
+ }
+ }
+
+ // Create remaining tasks
+ if (!batch.isEmpty()) {
+ createAndRegisterTasks(batch, metaStoreManager, polarisCallContext,
tableEntity);
+ totalCount += batch.size();
+ }
+
Review Comment:
We could, but we don't have to, as this is the last batch.
--
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]