Skip to content

Idempotency: JDBC store implementation and SPI#3915

Open
huaxingao wants to merge 5 commits intoapache:mainfrom
huaxingao:split/idempotency-jdbc
Open

Idempotency: JDBC store implementation and SPI#3915
huaxingao wants to merge 5 commits intoapache:mainfrom
huaxingao:split/idempotency-jdbc

Conversation

@huaxingao
Copy link
Contributor

This PR introduces the persistence SPI for idempotency records and adds a relational-JDBC implementation.
This is split from #3803

Checklist

  • 🛡️ Don't disclose security issues! (contact security@apache.org)
  • 🔗 Clearly explained why the changes are needed, or linked related issues: Fixes #
  • 🧪 Added/updated tests with good coverage, or manually tested (and explained how)
  • 💡 Added comments for complex logic
  • 🧾 Updated CHANGELOG.md (if needed)
  • 📚 Updated documentation in site/content/in-dev/unreleased (if needed)

Introduce/extend the IdempotencyStore SPI and implement it for relational-jdbc,
including tests.

Made-with: Cursor
Copy link
Contributor

@dimas-b dimas-b left a comment

Choose a reason for hiding this comment

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

Thanks for your continuous work on this feature, @huaxingao ! Sorry about the delayed review.

@huaxingao
Copy link
Contributor Author

@dimas-b Thanks for your review! I have addressed you comments. Could you please take a look again when you have time?

@huaxingao
Copy link
Contributor Author

also cc @singhpk234 @flyrain @flyingImer

dimas-b
dimas-b previously approved these changes Mar 9, 2026
String errorSubtype = rs.getString(ERROR_SUBTYPE);
String responseSummary = rs.getString(RESPONSE_SUMMARY);
String responseHeaders = rs.getString(RESPONSE_HEADERS);
Map<String, List<String>> responseHeaders = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is Polaris is expected to have any old data for this value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I don't think so.

@github-project-automation github-project-automation bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board Mar 9, 2026
@dimas-b dimas-b requested a review from snazy March 9, 2026 21:04
Set.of());
datasourceOperations.executeUpdate(delete);
} catch (SQLException e) {
throw new IdempotencyPersistenceException(

Choose a reason for hiding this comment

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

I think there are two high-priority issues worth fixing before this moves forward. First, the Postgres IT still uses Map.of("Content-Type", "application/json") even though finalizeRecord() now expects Map<String, List<String>>, which looks like a straight compile/type mismatch. Second, the SPI docs describe cancelInProgressReservation() as best-effort and explicitly say failures should not affect the response path, but the JDBC impl now throws on cancel failure. Would it make sense to either make the JDBC path log-and-swallow here, or tighten the SPI contract + callers so the boundary is explicit?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants