kerneltime commented on a change in pull request #2594:
URL: https://github.com/apache/ozone/pull/2594#discussion_r697973812
##########
File path:
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/utils/ContainerCache.java
##########
@@ -227,9 +246,68 @@ private boolean cleanupDb(ReferenceCountedDB db) {
public void addDB(String containerDBPath, ReferenceCountedDB db) {
lock.lock();
try {
- this.putIfAbsent(containerDBPath, db);
+ openContainerCache.putIfAbsent(containerDBPath, db);
+ metrics.incNumOpenContainerInserts();
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ public void markContainerClosed(String containerPath) {
+ lock.lock();
+ try {
+ ReferenceCountedDB db = openContainerCache.remove(containerPath);
+ Preconditions.checkNotNull(db, "Container not found in open cache:" +
+ containerPath);
+ closeContainerCache.putIfAbsent(containerPath, db);
+ metrics.incNumOpenContainerRemoves();
} finally {
lock.unlock();
}
}
+
+ public boolean isContainerOpen(State state) {
Review comment:
Would a better separation between the container states be
`isContainerWritable`? Open is becoming an over loaded term.
--
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]