flyrain commented on code in PR #3415:
URL: https://github.com/apache/polaris/pull/3415#discussion_r2697170818
##########
runtime/service/src/main/java/org/apache/polaris/service/task/TableCleanupTaskHandler.java:
##########
@@ -209,7 +263,28 @@ private Stream<TaskEntity> getMetadataTaskStream(
CallContext callContext) {
PolarisCallContext polarisCallContext =
callContext.getPolarisCallContext();
int batchSize =
callContext.getRealmConfig().getConfig(BATCH_SIZE_CONFIG_KEY, 10);
- return getMetadataFileBatches(tableMetadata, batchSize).stream()
+
+ // Stream all metadata files without materializing them all at once
Review Comment:
The main change is that `stream().toList()` has been removed to avoid fully
materializing the results in memory. Instead, an iterator is used together with
a configurable batch size (`taskPersistenceBatchSize`) to read and process
items incrementally. This bounds memory usage, as shown in lines 169 to 175.
--
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]