Skip to content

Extract IdempotencyRecord data-model change and JDBC schema v5#4431

Closed
huaxingao wants to merge 1 commit into
apache:mainfrom
huaxingao:idempotency-record-and-schema-v5
Closed

Extract IdempotencyRecord data-model change and JDBC schema v5#4431
huaxingao wants to merge 1 commit into
apache:mainfrom
huaxingao:idempotency-record-and-schema-v5

Conversation

@huaxingao

Copy link
Copy Markdown
Contributor

Prerequisite split out of #4269 per review feedback.

  • IdempotencyRecord: add principalHash, drop unused responseHeaders,
    remove redundant @Override accessors.
  • IdempotencyStore.finalizeRecord: drop the responseHeaders parameter.
  • JDBC schema v5: add principal_hash (NOT NULL) and drop response_headers
    on idempotency_records. Bumps schema version 4 → 5.

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)

@github-project-automation github-project-automation Bot moved this to PRs In Progress in Basic Kanban Board May 14, 2026
@huaxingao huaxingao closed this May 14, 2026
@github-project-automation github-project-automation Bot moved this from PRs In Progress to Done in Basic Kanban Board May 14, 2026
@huaxingao huaxingao reopened this May 14, 2026
@github-project-automation github-project-automation Bot moved this from Done to PRs In Progress in Basic Kanban Board May 14, 2026
@huaxingao

Copy link
Copy Markdown
Contributor Author

@dimas-b — this is the prerequisite PR split out of #4269 per your suggestion. It isolates the IdempotencyRecord data-model change and the JDBC schema v5 bump so they can be reviewed independently from the handler-level integration work. Once this lands I'll rebase #4269 on top. PTAL when you have a moment.

@huaxingao

Copy link
Copy Markdown
Contributor Author

also cc @flyrain @singhpk234

@dimas-b dimas-b requested review from flyrain and singhpk234 May 14, 2026 17:33

@dimas-b dimas-b 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.

No concerns from my side, but I'm not very familiar with the Idempotency impl. internals to approve 😅

@dimas-b dimas-b requested a review from dennishuo May 14, 2026 17:38

@dimas-b dimas-b 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.

Changes LGTM at high level.

Approving to unblock progress. I suppose merging on Mon is reasonable unless new review comments are posted.

idempotency_key TEXT NOT NULL,
operation_type TEXT NOT NULL,
resource_id TEXT NOT NULL, -- normalized request-derived resource identifier (not a generated entity id)
principal_hash TEXT NOT NULL, -- hash of caller principal + realm; checked on replay to prevent cross-principal cache hits

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 think it's fine to merge now, but actual implementation probably needs a more in-depth discussion. Do we have a doc/email about this that I missed 🤔

@github-project-automation github-project-automation Bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board May 15, 2026

@singhpk234 singhpk234 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.

LGTM too, thanks @huaxingao

Thread.currentThread()
.getContextClassLoader()
.getResourceAsStream("postgres/schema-v4.sql")) {
.getResourceAsStream("postgres/schema-v5.sql")) {

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.

orthogonal: we should make sure it run with all version shipped

Comment on lines +50 to +51
// Hash of caller principal identity bound to the reservation.
// Compared on replay to prevent cross-principal cache hits.

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 would rather just say authenticated {@PolarisPrincipal} associated with the idempotency record ... something.

Comment on lines -65 to 64
// Timestamp when the record was created.
String CREATED_AT = "created_at";
// Timestamp when the record was last updated.
String UPDATED_AT = "updated_at";
// Timestamp for the last heartbeat update (null if no heartbeat recorded).
String HEARTBEAT_AT = "heartbeat_at";
// Identifier of the executor that owns the in-progress record (null if not owned).
String EXECUTOR_ID = "executor_id";
// Expiration timestamp after which the record can be considered stale/purgeable.
String EXPIRES_AT = "expires_at";

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 are we removing this comments ?

@dimas-b dimas-b May 15, 2026

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 do not mind keeping or deleting these comments, but IMHO the value of these comments is pretty low: their meaning is deducible from field names.

Specifying behaviour here is not the ideal place, because there's no logic in this code area. Logic for processing the values for these columns exists somewhere else.

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.

Agree with @dimas-b that these comments are not quite valuable given the field names themselves are descriptive already. +1 on removing them.

@flyrain flyrain 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.

LGTM. Thanks @huaxingao !

Comment on lines -65 to 64
// Timestamp when the record was created.
String CREATED_AT = "created_at";
// Timestamp when the record was last updated.
String UPDATED_AT = "updated_at";
// Timestamp for the last heartbeat update (null if no heartbeat recorded).
String HEARTBEAT_AT = "heartbeat_at";
// Identifier of the executor that owns the in-progress record (null if not owned).
String EXECUTOR_ID = "executor_id";
// Expiration timestamp after which the record can be considered stale/purgeable.
String EXPIRES_AT = "expires_at";

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.

Agree with @dimas-b that these comments are not quite valuable given the field names themselves are descriptive already. +1 on removing them.

@dimas-b

dimas-b commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Is this PR superseded by #4659 ?

@huaxingao

Copy link
Copy Markdown
Contributor Author

Superseded by #4659

@huaxingao huaxingao closed this Jun 12, 2026
@github-project-automation github-project-automation Bot moved this from Ready to merge to Done in Basic Kanban Board Jun 12, 2026
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.

4 participants