Conversation
dropEntity needs to know only whether a catalog holds more than one catalog role, and it asked listFullEntities for that with a page size of 2. listFullEntities applies its page size to a post-fetch Java predicate, so it deliberately issues no LIMIT and selects every column: the query returned every catalog role in the catalog, both JSON property blobs included, to answer a yes/no question. Its javadoc already points the other way -- "If only the entity name/id/type is required, use listEntities instead". listEntities is bounded and projected, so the count now reads at most two rows of six columns. The single remaining role is then looked up by id to drop it, which also handles it having been dropped concurrently.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The remaining request is a minor regression-test nit, with no approval-blocking issues.
Pull request overview
Bounds catalog-role lookups during catalog deletion and avoids loading unnecessary full records.
Changes:
- Uses projected, limited role listing.
- Reloads the remaining role before deletion.
- Adds regression coverage for the bounded lookup.
File summaries
| File | Description |
|---|---|
polaris-core/src/test/java/org/apache/polaris/core/persistence/PolarisTreeMapAtomicOperationMetaStoreManagerTest.java |
Verifies the role listing uses a page size of two. |
polaris-core/src/main/java/org/apache/polaris/core/persistence/AtomicOperationMetaStoreManager.java |
Implements bounded role listing and lookup. |
Review details
Suppressed comments (1)
polaris-core/src/main/java/org/apache/polaris/core/persistence/AtomicOperationMetaStoreManager.java:1188
- Please add a regression test for the new concurrent-drop path. The added test only captures the page size and never exercises
lookupEntityreturningnull; a future change could reintroduce a failure when the single role disappears between listing and lookup while this test still passes. Stub one role record, make the role lookup returnnull, and assert that dropping the catalog completes successfully.
// null means it was dropped concurrently, which leaves nothing to do
if (catalogRoleToDrop != null) {
this.dropEntity(callCtx, ms, catalogRoleToDrop);
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
iprithv
approved these changes
Sep 15, 2026
flyingImer
approved these changes
Sep 15, 2026
flyingImer
left a comment
Collaborator
There was a problem hiding this comment.
LGTM. The bounded catalog-role lookup makes sense.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dropping a catalog needs to answer one question — does it still hold more than one catalog role? — and it asked
listFullEntitiesfor that with a page size of2:polaris/polaris-core/src/main/java/org/apache/polaris/core/persistence/AtomicOperationMetaStoreManager.java
Lines 1160 to 1171 in 3029551
So the drop issued an unbounded
SELECTof all16columns — bothJSONproperty blobs included — returning every catalog role in the catalog, to answer ayes/noquestion.The method's own javadoc already points the other way:
polaris/polaris-core/src/main/java/org/apache/polaris/core/persistence/BasePersistence.java
Lines 301 to 303 in 3029551
Only the identity of at most two roles is needed here, so this switches to
listEntities, which is projected (ENTITY_LOOKUP_COLUMNS) and does apply the limit. The single remaining role is then looked up byidin order to drop it, which also covers it having been dropped concurrently.Checklist
CHANGELOG.md(if needed)site/content/in-dev/unreleased(if needed)