fapifta commented on a change in pull request #1598:
URL: https://github.com/apache/ozone/pull/1598#discussion_r525614720



##########
File path: 
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/response/TestCleanupTableInfo.java
##########
@@ -66,4 +105,188 @@ public void checkAnnotationAndTableName() throws Exception 
{
       }
     });
   }
+
+  @Test
+  public void testHDDS4478() throws Exception {
+    HddsProtos.BlockID blockID = new BlockID(1, 1).getProtobuf();
+    String volume = "testVol";
+    String bucket = "testBuck";
+    String key = "/foo/bar/baz/key";
+
+
+    OMFileCreateRequest request =
+        anOmFileCreateRequest(blockID, volume, bucket, key);
+
+    OMMetadataManager omMetaMgr = createOMMetadataManagerSpy();
+    OMMetrics omMetrics = mock(OMMetrics.class);
+    OzoneManager om =
+        createOzoneManagerMock(volume, bucket, request, omMetaMgr, omMetrics);
+
+    OmVolumeArgs volumeArgs = aVolumeArgs(volume);
+    OmBucketInfo bucketInfo = aBucketInfo(volume, bucket);
+    addVolumeToMetaTable(volume, volumeArgs, omMetaMgr);
+    addBucketToMetaTable(volume, bucket, bucketInfo, omMetaMgr);
+
+    OzoneManagerDoubleBufferHelper dbh =
+        mock(OzoneManagerDoubleBufferHelper.class);
+
+    Map<String, Integer> cacheItemCount = new HashMap<>();
+    for (String tableName : omMetaMgr.listTableNames()){
+      cacheItemCount.put(tableName,
+          Iterators.size(omMetaMgr.getTable(tableName).cacheIterator()));
+    }
+
+
+    request.validateAndUpdateCache(om, 1, dbh);
+
+
+    CleanupTableInfo ann =
+        OMFileCreateResponse.class.getAnnotation(CleanupTableInfo.class);
+    List<String> cleanup = Arrays.asList(ann.cleanupTables());
+    for (String tableName : omMetaMgr.listTableNames()) {
+      if (!cleanup.contains(tableName)) {

Review comment:
       Yes, the test does what you have summarized.
   The basic idea is the following:
   The issue is that we have certain epochs that are pushing entries to 
unexpected table caches. Unexpected in a way that eviction for those epochs on 
particular tables is not called when the DoubleBuffer flushes, because of the 
missing table name in the annotation.
   I think it is sufficient to check whether we have added any unexpected cache 
entries to any other table's cache during applyTransaction. I might be wrong on 
this one, or there might be an easier way though.




----------------------------------------------------------------
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to