Skip to content

Core: Make REST scan planning poll retries configurable - #17846

Open
Bartekszost wants to merge 1 commit into
apache:mainfrom
Bartekszost:core-configurable-scan-poll-retries
Open

Core: Make REST scan planning poll retries configurable#17846
Bartekszost wants to merge 1 commit into
apache:mainfrom
Bartekszost:core-configurable-scan-poll-retries

Conversation

@Bartekszost

Copy link
Copy Markdown

Summary

  • Add a configurable rest-scan-planning.poll-num-retries catalog property that controls the maximum number of poll attempts when waiting for async scan planning results in RESTTableScan (default remains 10)
  • This complements the existing rest-scan-planning.poll-timeout-ms property from Core : Make REST scan planning poll timeout configurable #15863: the timeout bounds the total wait time, while this property bounds the number of poll retries. Together they let deployments that support longer-running server-side scan plans raise both limits so large plans are not cut off prematurely by a fixed retry count
  • Replace the previously hardcoded MAX_RETRIES constant in RESTTableScan with the configured value, and validate that the configured value is non-negative
  • Include the configured retry limit in the RemotePlanTimeoutException message so the failure is easier to diagnose

Test plan

  • asyncPlanningRespectsConfigurablePollRetries: sets a low poll-num-retries against a server that never completes and verifies the poll loop stops after exactly the configured number of retries
  • asyncPlanningSucceedsWithCustomRetries: sets an explicit poll-num-retries and verifies async planning completes successfully
  • asyncPlanningRejectsInvalidRetries: verifies negative poll-num-retries values are rejected with IllegalArgumentException

AI Disclosure

  • Model: Cursor Auto
  • Platform/Tool: Cursor
  • Human Oversight: partially reviewed
  • Prompt Summary: Make the REST scan planning poll retry count configurable via a catalog property, mirroring the existing configurable poll timeout, and add unit tests.

Allow catalogs to set rest-scan-planning.poll-num-retries so long-running remote plans are not stopped by the default retry count.

Generated-by: Cursor
Copilot AI lite review requested due to automatic review settings August 27, 2026 12:58
@github-actions github-actions Bot added the core label Aug 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Adds a new REST catalog property to make async REST scan planning poll retry count configurable, replacing a previously hardcoded retry limit and expanding tests around async planning behavior.

Changes:

  • Introduce rest-scan-planning.poll-num-retries (default 10) and validate it is non-negative.
  • Use the configured retry value in RESTTableScan polling and include it in timeout diagnostics.
  • Add unit tests covering configured retry behavior, success path, and invalid configuration.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
core/src/main/java/org/apache/iceberg/rest/RESTCatalogProperties.java Adds new catalog property constants for configurable poll retry count.
core/src/main/java/org/apache/iceberg/rest/RESTTableScan.java Reads/validates the new property, uses it in the poll loop, and improves timeout messaging.
core/src/test/java/org/apache/iceberg/rest/TestRESTScanPlanning.java Adds tests for honoring retry config, custom retries, and rejecting invalid values.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +1375 to +1387
catalogWithAdapter.catalog.initialize(
"test-custom-retries",
ImmutableMap.of(
CatalogProperties.FILE_IO_IMPL,
"org.apache.iceberg.inmemory.InMemoryFileIO",
RESTCatalogProperties.SCAN_PLANNING_MODE,
RESTCatalogProperties.ScanPlanningMode.SERVER.modeName(),
RESTCatalogProperties.REST_SCAN_PLANNING_POLL_NUM_RETRIES,
"10"));

RESTTable table = restTableFor(catalogWithAdapter.catalog, "custom_retries_success");
setParserContext(table);
assertThat(table.newScan().planFiles()).hasSize(1);
// With 0 retries and a server that never completes, planFiles should fail after one attempt
assertThatThrownBy(scan::planFiles)
.isInstanceOf(RemotePlanTimeoutException.class)
.hasMessageContaining("did not complete within configured limits");
@@ -58,6 +58,10 @@ private RESTCatalogProperties() {}
public static final long REST_SCAN_PLANNING_POLL_TIMEOUT_MS_DEFAULT =
TimeUnit.MINUTES.toMillis(5);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants