Skip to content

DynamoDB (atomic) persistence backend [draft/showcase] - #5694

Draft
ZephyrYWZhou wants to merge 3 commits into
apache:mainfrom
ZephyrYWZhou:dynamodb-atomic-draft
Draft

ZephyrYWZhou wants to merge 3 commits into
apache:mainfrom
ZephyrYWZhou:dynamodb-atomic-draft

Conversation

@ZephyrYWZhou

Copy link
Copy Markdown
Contributor

What

Draft showcase of a full DynamoDB persistence backend for Polaris, built on the AtomicOperationMetaStoreManager (the same approach as relational-jdbc). Posted per the discussion on #5622 to show the end-to-end shape before the skeleton lands.

Builds on the skeleton module in #5622. Related discussion: #5615.

Implemented

  • BasePersistence — entities, grants, lookups, listing
    • per-entity entityVersion + grantRecordsVersion CAS
    • atomic name-uniqueness via a name-sentinel item inside the same TransactWriteItems as the entity write
    • multi-entity writes, rename/re-parent, realm teardown
    • keyset pagination (reuses core EntityIdToken, id-ordered)
  • IntegrationPersistence — principal-secret CRUD (hashes+salt only; CAS rotation); storage-integration hooks are OSS no-ops (JDBC parity)
  • PolicyMappingPersistence — policy mappings as a strongly-consistent adjacency list (target-side + policy-side items written atomically)
  • hasOverlappingSiblings — location-overlap detection

Single-table layout

One table, realmId as a key prefix; two sparse GSIs (by-name, by-grantee). Entity PK = realmId#id; grants co-located under the securable; a name sentinel enforces uniqueness.

Status

Work in progress — not for merge. No tests yet; the intended test is the shared persistence conformance suite against DynamoDB-Local (testcontainers), mirroring the JDBC backend. Opening as a draft to showcase the fundamental code.

First step toward an optional DynamoDB persistence backend (apache#5615): adds the
persistence/dynamodb Gradle module (wired into the build and the published BOM)
with the DynamoDbConfiguration interface. No logic and no behavior change;
the factory and adapter land in subsequent PRs.
Address review feedback on apache#5622:
- Rename polaris-persistence-dynamodb -> polaris-persistence-dynamodb-atomic
  (persistence/dynamodb -> persistence/dynamodb-atomic) to distinguish it from the
  parallel NoSQL-framework DynamoDB effort. This module implements the Atomic
  (per-entity compare-and-set) approach under AtomicOperationMetaStoreManager.
- Add a module README marking it work in progress.

Updates the project mapping and published BOM reference accordingly. No behavior change.
Implements BasePersistence, IntegrationPersistence, and PolicyMappingPersistence for the dynamodb-atomic module on the single-table layout: per-entity entityVersion CAS, atomic name-sentinel uniqueness, TransactWriteItems multi-entity writes, GSI-backed listing and grant lookups, principal-secret CRUD, policy-mapping adjacency list, and location-overlap detection.

Draft to showcase the end-to-end shape; no tests yet.
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions Bot added the stale label Nov 5, 2026
@ZephyrYWZhou

Copy link
Copy Markdown
Contributor Author

This PR is not for merging purpose but will serve as a display for anyone who is interested in the high level idea of this proposal. It will be closed when incremental PRs are finished.

@dimas-b

dimas-b commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

@ZephyrYWZhou : Thanks for submitting this PR! Its purpose is clear. Even if it gets closed by the github bot, it's not a problem. It will still serve its purpose since the diff will remain accessible to readers.

@github-actions github-actions Bot removed the stale label Nov 7, 2026

This branch has not been deployed

No deployments
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.

2 participants