hemantk-12 commented on code in PR #6166:
URL: https://github.com/apache/ozone/pull/6166#discussion_r1478996319
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestContainerStateMachineFailures.java:
##########
@@ -735,21 +725,16 @@ public void testContainerStateMachineSingleFailureRetry()
OmKeyLocationInfo omKeyLocationInfo = locationInfoList.get(0);
induceFollowerFailure(omKeyLocationInfo, 2);
+ key.flush();
+ key.write("ratis".getBytes(UTF_8));
+ key.flush();
+ key.close();
Review Comment:
nit: should be in `finally` block or use `try-with-resources`.
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneClientRetriesOnExceptions.java:
##########
@@ -246,11 +245,7 @@ public void testMaxRetriesByOzoneClient() throws Exception
{
ioe = assertThrows(IOException.class, () -> key.flush());
assertThat(ioe.getMessage()).contains("Stream is closed");
- try {
- key.close();
- } catch (IOException e) {
- fail("Expected should not be thrown");
- }
+ key.close();
Review Comment:
nit: use `try-with-resources`.
##########
hadoop-ozone/interface-storage/src/test/java/org/apache/hadoop/ozone/om/helpers/TestRepeatedOmKeyInfoCodec.java:
##########
@@ -87,47 +86,40 @@ private OmKeyInfo getKeyInfo(int chunkNum) {
}
@Test
- public void test() throws InterruptedException {
+ void test() throws Exception {
threadSafety();
testWithoutPipeline(1);
testWithoutPipeline(2);
testCompatibility(1);
testCompatibility(2);
}
- public void testWithoutPipeline(int chunkNum) {
+ public void testWithoutPipeline(int chunkNum) throws IOException {
final Codec<RepeatedOmKeyInfo> codec = RepeatedOmKeyInfo.getCodec(true);
OmKeyInfo originKey = getKeyInfo(chunkNum);
RepeatedOmKeyInfo repeatedOmKeyInfo = new RepeatedOmKeyInfo(originKey);
- try {
- byte[] rawData = codec.toPersistedFormat(repeatedOmKeyInfo);
- RepeatedOmKeyInfo key = codec.fromPersistedFormat(rawData);
- System.out.println("Chunk number = " + chunkNum +
- ", Serialized key size without pipeline = " + rawData.length);
- assertNull(key.getOmKeyInfoList().get(0).getLatestVersionLocations()
- .getLocationList().get(0).getPipeline());
- } catch (IOException e) {
- fail("Should success");
- }
+
+ byte[] rawData = codec.toPersistedFormat(repeatedOmKeyInfo);
+ RepeatedOmKeyInfo key = codec.fromPersistedFormat(rawData);
+ System.out.println("Chunk number = " + chunkNum +
Review Comment:
nit: this can be removed.
##########
hadoop-ozone/interface-storage/src/test/java/org/apache/hadoop/ozone/om/helpers/TestRepeatedOmKeyInfoCodec.java:
##########
@@ -87,47 +86,40 @@ private OmKeyInfo getKeyInfo(int chunkNum) {
}
@Test
- public void test() throws InterruptedException {
+ void test() throws Exception {
threadSafety();
testWithoutPipeline(1);
testWithoutPipeline(2);
testCompatibility(1);
testCompatibility(2);
}
- public void testWithoutPipeline(int chunkNum) {
+ public void testWithoutPipeline(int chunkNum) throws IOException {
final Codec<RepeatedOmKeyInfo> codec = RepeatedOmKeyInfo.getCodec(true);
OmKeyInfo originKey = getKeyInfo(chunkNum);
RepeatedOmKeyInfo repeatedOmKeyInfo = new RepeatedOmKeyInfo(originKey);
- try {
- byte[] rawData = codec.toPersistedFormat(repeatedOmKeyInfo);
- RepeatedOmKeyInfo key = codec.fromPersistedFormat(rawData);
- System.out.println("Chunk number = " + chunkNum +
- ", Serialized key size without pipeline = " + rawData.length);
- assertNull(key.getOmKeyInfoList().get(0).getLatestVersionLocations()
- .getLocationList().get(0).getPipeline());
- } catch (IOException e) {
- fail("Should success");
- }
+
+ byte[] rawData = codec.toPersistedFormat(repeatedOmKeyInfo);
+ RepeatedOmKeyInfo key = codec.fromPersistedFormat(rawData);
+ System.out.println("Chunk number = " + chunkNum +
+ ", Serialized key size without pipeline = " + rawData.length);
+ assertNull(key.getOmKeyInfoList().get(0).getLatestVersionLocations()
+ .getLocationList().get(0).getPipeline());
}
- public void testCompatibility(int chunkNum) {
+ public void testCompatibility(int chunkNum) throws IOException {
final Codec<RepeatedOmKeyInfo> codecWithoutPipeline
= RepeatedOmKeyInfo.getCodec(true);
final Codec<RepeatedOmKeyInfo> codecWithPipeline
= RepeatedOmKeyInfo.getCodec(false);
OmKeyInfo originKey = getKeyInfo(chunkNum);
RepeatedOmKeyInfo repeatedOmKeyInfo = new RepeatedOmKeyInfo(originKey);
- try {
- byte[] rawData = codecWithPipeline.toPersistedFormat(repeatedOmKeyInfo);
- RepeatedOmKeyInfo key =
codecWithoutPipeline.fromPersistedFormat(rawData);
- System.out.println("Chunk number = " + chunkNum +
- ", Serialized key size with pipeline = " + rawData.length);
- assertNotNull(key.getOmKeyInfoList().get(0).getLatestVersionLocations()
- .getLocationList().get(0).getPipeline());
- } catch (IOException e) {
- fail("Should success");
- }
+ byte[] rawData = codecWithPipeline.toPersistedFormat(repeatedOmKeyInfo);
+ RepeatedOmKeyInfo key = codecWithoutPipeline.fromPersistedFormat(rawData);
+ System.out.println("Chunk number = " + chunkNum +
Review Comment:
same as previous.
--
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]