ChenSammi commented on code in PR #9904:
URL: https://github.com/apache/ozone/pull/9904#discussion_r2958756722
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/metadata/AbstractRDBStore.java:
##########
@@ -143,8 +143,11 @@ public BatchOperationHandler getBatchHandler() {
}
@Override
- public void close() {
- this.store.close();
+ public synchronized void close() {
+ if (this.store != null) {
+ this.store.close();
+ this.store = null;
Review Comment:
We should not set the store to null, as if there is thread holding the db
instance and call any API, it will throw NPE if store is set to null, currently
it will throw "org.apache.hadoop.hdds.utils.db.RocksDatabaseException: Rocks
Database is closed"
Double close store is not a problem, it's has been welly addressed in
RocksDatabase.
And it's better for stop() and close() to have the same implementation, as
both are called to close the DB.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]