-
Notifications
You must be signed in to change notification settings - Fork 331
Fix NPE in listCatalogs #1949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix NPE in listCatalogs #1949
Conversation
dimas-b
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix @andrew4699 ! PolarisAdminService changes LGTM, but I have some minor comments in test code :)
| "my-catalog-2"), | ||
| List.of()); | ||
|
|
||
| metaStoreManager.fakeEntityNotFoundIds.add(catalog1.getCatalog().getId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind making a setter/adder method for this as opposed to accessing a public field?
| * Intended to be a delegate to TransactionalMetaStoreManagerImpl with the ability to inject faults. | ||
| * Currently, you can force loadEntity() to return ENTITY_NOT_FOUND for a set of entity IDs. | ||
| */ | ||
| public class TestPolarisMetaStoreManager extends TransactionalMetaStoreManagerImpl { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not make it an inner class in ManagementServiceTest?
|
Updated! |
`PolarisAdminService` has multiple spots where it is working around the sub-optimal `PolarisMetaStoreManager` APIs. This results in multiple fixes like #1949 and #2258 While eventually the underlying APIs should be improved, for now we can make a single central workaround and clean up some redundant code. Also we can improve the return types as callers are not interested in details of the entity layer.
listCatalogs is non-atomic. It first atomically lists all entities and then iterates through each one and does an individual loadEntity call. This causes an NPE when calling
CatalogEntity::new.I don't think it's ever useful for listCatalogsUnsafe to return null since the caller isn't expecting a certain length of elements, so I just filtered it there.