smengcl commented on code in PR #5968:
URL: https://github.com/apache/ozone/pull/5968#discussion_r1449095980
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotCache.java:
##########
@@ -296,105 +262,34 @@ private synchronized void cleanup() {
* TODO: [SNAPSHOT] Add new ozone debug CLI command to trigger this directly.
*/
private void cleanupInternal() {
- long numEntriesToEvict = (long) dbMap.size() - cacheSizeLimit;
- while (numEntriesToEvict > 0L && pendingEvictionList.size() > 0) {
- // Get the first instance in the clean up list
- ReferenceCounted<IOmMetadataReader, SnapshotCache> rcOmSnapshot =
- pendingEvictionList.iterator().next();
+ Iterator<Map.Entry<String, ReferenceCounted<IOmMetadataReader,
SnapshotCache>>> iterator =
+ dbMap.entrySet().iterator();
+ while (iterator.hasNext()) {
Review Comment:
I don't see a stopping condition other than reaching the end of the `Map`
entry set here. So it closes ALL snapshots with zero RC.
It works but it might be inefficient.
But adding back `numEntriesToEvict` would also cause fairness issue (plus it
also won't overcome the inefficiency issue if the LAST element in the `Map` has
zero RC).
Is there any plan to improve this later on?
--
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]