You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "ayushtkn (via GitHub)" <gi...@apache.org> on 2026/08/05 05:40:54 UTC
[PR] NoSQL: Fix NPE when an entity that is not catalog content carries a location property [polaris]
ayushtkn opened a new pull request, #5241:
URL: https://github.com/apache/polaris/pull/5241
`NoSQL` persistence keeps a locations index only for catalog content
(namespaces, tables/views, policies). For every other entity type โ
catalog, catalog role, principal, principal role, task โ
`NoSqlMetaStore.performEntityMutations` passes null for that index.
`MutationAttempt.updateLocationsIndex` dereferences it without a `null`
check, unlike the sibling changes index, which is guarded at all four
of its use sites in the same class. The method returns early when old
and new locations are equal, which is why this has gone unnoticed โ
but that only holds while the entity has no "location" property at
all. As soon as one carries it, the index is dereferenced and the
mutation fails with an `NPE`.
`PolarisEntityConstants.ENTITY_BASE_LOCATION` is the literal string
"location": an ordinary, user-settable property key.
`ReservedProperties` (default config) only strips the `polaris`. prefix,
so a client-supplied "location" reaches persistence verbatim. The
management API OpenAPI schemas expose open property bags on these
entity types, so this is reachable under default configuration.
Two ways it shows up
**1. Create fails with a 500 (recoverable)**
POST /api/management/v1/principal-roles (likewise /principals and
/catalogs/{catalogName}/catalog-roles) with "properties": {"location":
"s3://bucket/path/"} throws before anything is written:
```
java.lang.NullPointerException: Cannot invoke
"org.apache.polaris.persistence.nosql.api.index.UpdatableIndex.get(...IndexKey)"
because "locations" is null
at org.apache.polaris.persistence.nosql.metastore.mutation.MutationAttempt.updateLocationsIndex(MutationAttempt.java:567)
at org.apache.polaris.persistence.nosql.metastore.mutation.MutationAttempt.applyEntityCreateMutation(MutationAttempt.java:506)
at org.apache.polaris.persistence.nosql.metastore.mutation.MutationAttempt.apply(MutationAttempt.java:115)
at org.apache.polaris.persistence.nosql.metastore.NoSqlMetaStore.lambda$performEntityMutations$19(NoSqlMetaStore.java:616)
at org.apache.polaris.persistence.nosql.metastore.NoSqlMetaStore.performEntityMutations(NoSqlMetaStore.java:601)
at org.apache.polaris.persistence.nosql.metastore.NoSqlMetaStore.createOrUpdateEntity(NoSqlMetaStore.java:369)
at org.apache.polaris.persistence.nosql.metastore.NoSqlMetaStoreManager.createEntityIfNotExists(NoSqlMetaStoreManager.java:119)
```
Nothing is persisted, so the caller can retry without the property.
Annoying, but recoverable.
**2. A catalog is left stuck on the management API**
POST /api/management/v1/catalogs with the same property succeeds,
because createCatalog is a bespoke committer that never touches the
locations index. Every subsequent mutation of that catalog goes
through the generic path and fails:
Update (PUT /api/management/v1/catalogs/{catalogName}):
```
java.lang.NullPointerException: Cannot invoke
"org.apache.polaris.persistence.nosql.api.index.UpdatableIndex.get(...IndexKey)"
because "locations" is null
at org.apache.polaris.persistence.nosql.metastore.mutation.MutationAttempt.updateLocationsIndex(MutationAttempt.java:551)
at org.apache.polaris.persistence.nosql.metastore.mutation.MutationAttempt.applyEntityUpdateMutation(MutationAttempt.java:412)
at org.apache.polaris.persistence.nosql.metastore.mutation.MutationAttempt.apply(MutationAttempt.java:125)
at org.apache.polaris.persistence.nosql.metastore.NoSqlMetaStore.lambda$performEntityMutations$19(NoSqlMetaStore.java:616)
at org.apache.polaris.persistence.nosql.metastore.NoSqlMetaStore.performEntityMutations(NoSqlMetaStore.java:601)
at org.apache.polaris.persistence.nosql.metastore.NoSqlMetaStore.createOrUpdateEntity(NoSqlMetaStore.java:369)
```
Delete (DELETE /api/management/v1/catalogs/{catalogName}):
```
java.lang.NullPointerException: Cannot invoke
"org.apache.polaris.persistence.nosql.api.index.UpdatableIndex.get(...IndexKey)"
because "locations" is null
at org.apache.polaris.persistence.nosql.metastore.mutation.MutationAttempt.updateLocationsIndex(MutationAttempt.java:551)
at org.apache.polaris.persistence.nosql.metastore.mutation.MutationAttempt.applyEntityDeleteMutation(MutationAttempt.java:207)
at org.apache.polaris.persistence.nosql.metastore.mutation.MutationAttempt.apply(MutationAttempt.java:135)
at org.apache.polaris.persistence.nosql.metastore.NoSqlMetaStore.lambda$performEntityMutations$19(NoSqlMetaStore.java:616)
at org.apache.polaris.persistence.nosql.metastore.NoSqlMetaStore.performEntityMutations(NoSqlMetaStore.java:601)
```
The catalog record remains in the metastore but cannot be updated or
deleted via the management API until the stray "location" property is
removed (e.g. direct metastore edit). Catalog content operations
(namespaces, tables) may still work, since those use the
catalog-content path with a real locations index.
## 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)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NoSQL: Fix NPE when an entity that is not catalog content carries a location property [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b merged PR #5241:
URL: https://github.com/apache/polaris/pull/5241
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NoSQL: Fix NPE when an entity that is not catalog content carries a location property [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on PR #5241:
URL: https://github.com/apache/polaris/pull/5241#issuecomment-5209586916
Nice catch :+1: Thanks, @ayushtkn !
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org