bharatviswa504 commented on a change in pull request #1598:
URL: https://github.com/apache/ozone/pull/1598#discussion_r525595043
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/response/file/OMFileCreateResponse.java
##########
@@ -23,15 +23,20 @@
import org.apache.hadoop.ozone.om.helpers.OmBucketInfo;
import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
import org.apache.hadoop.ozone.om.helpers.OmVolumeArgs;
+import org.apache.hadoop.ozone.om.response.CleanupTableInfo;
import org.apache.hadoop.ozone.om.response.key.OMKeyCreateResponse;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
.OMResponse;
import java.util.List;
+import static org.apache.hadoop.ozone.om.OmMetadataManagerImpl.KEY_TABLE;
+import static org.apache.hadoop.ozone.om.OmMetadataManagerImpl.OPEN_KEY_TABLE;
+
/**
* Response for crate file request.
*/
+@CleanupTableInfo(cleanupTables = {KEY_TABLE, OPEN_KEY_TABLE})
Review comment:
KEY_TABLE is needed for KeyCreate also, as when
ozone.om.enable.filesystem.paths is true.
##########
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:
Here we have checked only tables which are not part of
FileCreateResponse cleanupTable annotation.
Do we want to check tables which are affected also.
Just a question, not got what these lines are testing? (Is it just to see
any tables which are not affected have same size in Cache) But how this is
verifying fix, not sure if i am missing something basic here.
----------------------------------------------------------------
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]