yuqi1129 opened a new issue, #11406:
URL: https://github.com/apache/gravitino/issues/11406

   ### Version
   
   main branch
   
   ### Describe what's wrong
   
   `dropCatalog` can fail when `loadCatalogAndWrap` returns a cached 
`CatalogWrapper` whose underlying catalog has already been closed by cache 
invalidation/removal handling. In that state, `CatalogWrapper.catalog()` 
returns null and drop paths can throw a NullPointerException instead of 
reloading the catalog from the entity store.
   
   ### Error message and/or stacktrace
   
   Cannot invoke "org.apache.gravitino.connector.BaseCatalog.capability()" 
because "this.catalog" is null
   
   Observed from CI:
   
   ```text
   CatalogIT > testCreateCatalogWithoutProperties() FAILED
   java.lang.RuntimeException: Failed to operate object [...] operation [DROP] 
..., reason [Cannot invoke 
"org.apache.gravitino.connector.BaseCatalog.capability()" because 
"this.catalog" is null]
   ```
   
   ### How to reproduce
   
   A minimal unit reproduction is to cache a `CatalogWrapper`, close it, put it 
back into the cache, and then call `dropCatalog`. The current implementation 
reuses the closed wrapper and fails with a NullPointerException.
   
   ### Additional context
   
   `CatalogWrapper.close()` sets the wrapped catalog to null. 
`loadCatalogAndWrap` should defensively invalidate and reload if the cached 
wrapper has already been closed.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to