Skip to content

Remove unused IdempotencyStore and idempotency_records table#5086

Merged
flyrain merged 2 commits into
apache:mainfrom
huaxingao:remove-idempotency-records-store
Jul 18, 2026
Merged

Remove unused IdempotencyStore and idempotency_records table#5086
flyrain merged 2 commits into
apache:mainfrom
huaxingao:remove-idempotency-records-store

Conversation

@huaxingao

@huaxingao huaxingao commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Removes the unused durable-replay idempotency implementation:

  • IdempotencyStore / IdempotencyRecord / IdempotencyPersistenceException (polaris-core)
  • RelationalJdbcIdempotencyStore / ModelIdempotencyRecord and its Postgres IT
  • The idempotency_records table + index from the postgres/cockroachdb/h2 schema-v4.sql
  • The two QueryGenerator extended overloads (only used by the store) and their tests

This code is superseded by the shipped entity-property idempotency (createTable/updateTable).

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)
  • [ ]

Copilot AI review requested due to automatic review settings July 17, 2026 18:25
@github-project-automation github-project-automation Bot moved this to PRs In Progress in Basic Kanban Board Jul 17, 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

This PR removes the durable-replay, key-based idempotency implementation (store interface + JDBC backend + schema table) that is described as unused and superseded by entity-property idempotency in the wider Polaris codebase.

Changes:

  • Removed IdempotencyStore/IdempotencyRecord/IdempotencyPersistenceException from polaris-core.
  • Removed the relational-JDBC idempotency store implementation and its Postgres integration test.
  • Removed the idempotency_records table/index from the v4 SQL schemas and deleted the now-unused QueryGenerator extended overloads and related tests.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
polaris-core/src/main/java/org/apache/polaris/core/persistence/IdempotencyStore.java Removed the core idempotency persistence abstraction.
polaris-core/src/main/java/org/apache/polaris/core/persistence/IdempotencyPersistenceException.java Removed store-specific persistence exception type.
polaris-core/src/main/java/org/apache/polaris/core/entity/IdempotencyRecord.java Removed the core domain record for durable-replay idempotency.
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/idempotency/RelationalJdbcIdempotencyStore.java Removed the JDBC-backed IdempotencyStore implementation.
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/models/ModelIdempotencyRecord.java Removed the JDBC model mapping for idempotency_records.
persistence/relational-jdbc/src/test/java/org/apache/polaris/persistence/relational/jdbc/idempotency/RelationalJdbcIdempotencyStorePostgresIT.java Removed Postgres IT coverage for the deleted store.
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/QueryGenerator.java Removed extended DELETE/UPDATE overloads that were only used by the deleted store.
persistence/relational-jdbc/src/test/java/org/apache/polaris/persistence/relational/jdbc/QueryGeneratorTest.java Removed tests that exercised the deleted extended overloads.
persistence/relational-jdbc/src/main/resources/postgres/schema-v4.sql Removed idempotency_records DDL from Postgres v4 schema script.
persistence/relational-jdbc/src/main/resources/h2/schema-v4.sql Removed idempotency_records DDL from H2 v4 schema script.
persistence/relational-jdbc/src/main/resources/cockroachdb/schema-v4.sql Removed idempotency_records DDL from CockroachDB v4 schema script.

Comment on lines 209 to 230
/**
* Builds an UPDATE query.
*
* @param allColumns Columns to update.
* @param tableName Target table.
* @param values New values (must match columns in order).
* @param whereClause Conditions for filtering rows to update.
* @return UPDATE query with parameter values.
*/
public static PreparedQuery generateUpdateQuery(
@NonNull List<String> allColumns,
@NonNull String tableName,
@NonNull List<Object> values,
@NonNull Map<String, Object> whereClause) {
List<Object> bindingParams = new ArrayList<>(values);
QueryFragment where = generateWhereClause(new HashSet<>(allColumns), whereClause, Map.of());
String setClause = allColumns.stream().map(c -> c + " = ?").collect(Collectors.joining(", "));
String sql =
"UPDATE " + getFullyQualifiedTableName(tableName) + " SET " + setClause + where.sql();
bindingParams.addAll(where.parameters());
return new PreparedQuery(sql, bindingParams);
}

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

+1 to remove unused tables with one schema management comment below.

PRIMARY KEY (event_id)
);

CREATE TABLE IF NOT EXISTS idempotency_records (

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

Schema v4 is part of the 1.6.0 release. I think its DDL should be immutable now.

Let's switch to v5 and not have idempotency tables there.

@github-project-automation github-project-automation Bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board Jul 17, 2026
@dimas-b
dimas-b requested review from flyrain and singhpk234 July 17, 2026 20:22
@flyrain
flyrain merged commit 7f05287 into apache:main Jul 18, 2026
25 checks passed
@github-project-automation github-project-automation Bot moved this from Ready to merge to Done in Basic Kanban Board Jul 18, 2026
@huaxingao
huaxingao deleted the remove-idempotency-records-store branch July 18, 2026 04:17
@huaxingao

Copy link
Copy Markdown
Contributor Author

Thanks @flyrain @dimas-b

cobed95 added a commit to cobed95/polaris that referenced this pull request Jul 19, 2026
Upstream introduced schema v5 as the new latest version (apache#5086), which
makes v4 a legacy version. Per the review agreement to leave legacy
schema versions untouched, the v4 scripts are restored to their original
form and the new v5 scripts drop the CREATE SCHEMA / SET search_path
header instead, so the configurable schema name applies to the current
schema version.
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