adoroszlai commented on code in PR #5745:
URL: https://github.com/apache/ozone/pull/5745#discussion_r1447476466
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -336,19 +337,38 @@ public OmMetadataManagerImpl(OzoneConfiguration conf,
OMConfigKeys.OZONE_OM_RATIS_ENABLE_KEY,
OMConfigKeys.OZONE_OM_RATIS_ENABLE_DEFAULT);
this.omEpoch = OmUtils.getOMEpoch(isRatisEnabled);
+ this.perfMetrics = ozoneManager.getPerfMetrics();
// For test purpose only
ignorePipelineinKey = conf.getBoolean(
"ozone.om.ignore.pipeline", Boolean.TRUE);
start(conf);
}
+ public OmMetadataManagerImpl(OzoneConfiguration conf,
+ OzoneManager ozoneManager,
+ OMPerformanceMetrics perfMetrics)
+ throws IOException {
+ this.ozoneManager = ozoneManager;
+ this.lock = new OzoneManagerLock(conf);
+ isRatisEnabled = conf.getBoolean(
+ OMConfigKeys.OZONE_OM_RATIS_ENABLE_KEY,
+ OMConfigKeys.OZONE_OM_RATIS_ENABLE_DEFAULT);
+ this.omEpoch = OmUtils.getOMEpoch(isRatisEnabled);
+ this.perfMetrics = perfMetrics;
+ // For test purpose only
+ ignorePipelineinKey = conf.getBoolean(
+ "ozone.om.ignore.pipeline", Boolean.TRUE);
+ start(conf);
+ }
Review Comment:
Please don't duplicate code from the other constructor.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -336,19 +337,38 @@ public OmMetadataManagerImpl(OzoneConfiguration conf,
OMConfigKeys.OZONE_OM_RATIS_ENABLE_KEY,
OMConfigKeys.OZONE_OM_RATIS_ENABLE_DEFAULT);
this.omEpoch = OmUtils.getOMEpoch(isRatisEnabled);
+ this.perfMetrics = ozoneManager.getPerfMetrics();
Review Comment:
I think this causes NPE in some tests, e.g.:
```
Error: org.apache.hadoop.ozone.fsck.TestContainerMapper.testContainerMapper
-- Time elapsed: 0.029 s <<< ERROR!
java.lang.NullPointerException
at
org.apache.hadoop.ozone.om.OmMetadataManagerImpl.<init>(OmMetadataManagerImpl.java:340)
at
org.apache.hadoop.ozone.fsck.ContainerMapper.parseOmDB(ContainerMapper.java:80)
```
```
Error:
org.apache.hadoop.fs.ozone.TestOzoneFileSystemPrefixParser.testPrefixParsePath
-- Time elapsed: 4.110 s <<< ERROR!
java.lang.NullPointerException
at
org.apache.hadoop.ozone.om.OmMetadataManagerImpl.<init>(OmMetadataManagerImpl.java:340)
at
org.apache.hadoop.ozone.debug.PrefixParser.parse(PrefixParser.java:132)
at
org.apache.hadoop.fs.ozone.TestOzoneFileSystemPrefixParser.verifyPrefixParsePath(TestOzoneFileSystemPrefixParser.java:164)
at
org.apache.hadoop.fs.ozone.TestOzoneFileSystemPrefixParser.testPrefixParsePath(TestOzoneFileSystemPrefixParser.java:106)
```
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/response/bucket/TestOMBucketDeleteResponse.java:
##########
@@ -99,8 +101,8 @@ public void testAddToDBBatch() throws Exception {
// Do manual commit and see whether addToBatch is successful or not.
omMetadataManager.getStore().commitBatchOperation(batchOperation);
- assertNull(omMetadataManager.getBucketTable().get(
- omMetadataManager.getBucketKey(volumeName, bucketName)));
+ assertEquals(null, omMetadataManager.getBucketTable().get(
+ omMetadataManager.getBucketKey(volumeName, bucketName)));
Review Comment:
Let's keep `assertNull`.
--
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]