Skip to content

REST: Add Idempotency-Key support for scan planning endpoints#15096

Closed
huaxingao wants to merge 3 commits intoapache:mainfrom
huaxingao:idemp_plan
Closed

REST: Add Idempotency-Key support for scan planning endpoints#15096
huaxingao wants to merge 3 commits intoapache:mainfrom
huaxingao:idemp_plan

Conversation

@huaxingao
Copy link
Copy Markdown
Contributor

Follows OpenAPI spec update in #14730 to support Idempotency-Key on mutating scan planning endpoints.

@github-actions github-actions Bot added the core label Jan 20, 2026
@singhpk234 singhpk234 self-requested a review January 21, 2026 01:25
Comment on lines +242 to +262
private String planPath(TableIdentifier ident) {
return String.format(
"v1/namespaces/%s/tables/%s/plan",
RESTUtil.encodeNamespace(ident.namespace(), RESTUtil.NAMESPACE_SEPARATOR_URLENCODED_UTF_8),
RESTUtil.encodeString(ident.name()));
}

private String tasksPath(TableIdentifier ident) {
return String.format(
"v1/namespaces/%s/tables/%s/tasks",
RESTUtil.encodeNamespace(ident.namespace(), RESTUtil.NAMESPACE_SEPARATOR_URLENCODED_UTF_8),
RESTUtil.encodeString(ident.name()));
}

private String cancelPath(TableIdentifier ident, String planId) {
return String.format(
"v1/namespaces/%s/tables/%s/plan/%s",
RESTUtil.encodeNamespace(ident.namespace(), RESTUtil.NAMESPACE_SEPARATOR_URLENCODED_UTF_8),
RESTUtil.encodeString(ident.name()),
RESTUtil.encodeString(planId));
}
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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Thanks!

FetchScanTasksResponse.class,
ErrorHandlers.planTaskHandler());

// We cancel the planning state before this call, so a *fresh execution* of fetchScanTasks would
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.

Suggested change
// We cancel the planning state before this call, so a *fresh execution* of fetchScanTasks would
// We cancel the planning state before this call, so a fresh execution of fetchScanTasks would

??

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment on lines +1133 to +1142
List<PlanTableScanResponse> responses =
executeTwice(
HTTPRequest.HTTPMethod.POST,
planPath(ident),
headers,
request,
PlanTableScanResponse.class,
ErrorHandlers.tableErrorHandler());
PlanTableScanResponse first = responses.get(0);
PlanTableScanResponse second = responses.get(1);
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.

i am not sure if execute twice is getting something here we any ways are writing 2 loc to get the first and the second invocation ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed executeTwice doesn’t really reduce verbosity here. I’ve updated the test to use two explicit execute(...) calls for first and second to make the two invocations unambiguous

Comment on lines +1197 to +1198
// identifiers (data file locations) to the first response. Use order-insensitive comparison
// since task ordering isn't guaranteed.
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.

why isn't the task ordering gauranteed ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In CatalogHandlers.planFilesFor, we iterate scan.planFiles() and directly Iterables.partition(planTasks, tasksPerPlanTask) without sorting, so task order is whatever planFiles() yields and isn’t guaranteed.

@github-actions
Copy link
Copy Markdown

This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions.

@github-actions github-actions Bot added the stale label Feb 22, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 1, 2026

This pull request has been closed due to lack of activity. This is not a judgement on the merit of the PR in any way. It is just a way of keeping the PR queue manageable. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.

@github-actions github-actions Bot closed this Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants