You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by um...@apache.org on 2022/01/05 01:55:55 UTC
[ozone] branch HDDS-3816-ec updated: HDDS-6132: EC: HandleStripeFailure should not release the cachebuffers. (#2940)
This is an automated email from the ASF dual-hosted git repository.
umamahesh pushed a commit to branch HDDS-3816-ec
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/HDDS-3816-ec by this push:
new ba192b1 HDDS-6132: EC: HandleStripeFailure should not release the cachebuffers. (#2940)
ba192b1 is described below
commit ba192b1de119791b196a38f9715b067816dfdbf9
Author: Uma Maheswara Rao G <um...@apache.org>
AuthorDate: Tue Jan 4 17:55:42 2022 -0800
HDDS-6132: EC: HandleStripeFailure should not release the cachebuffers. (#2940)
Co-authored-by: Uma Maheswara Rao G <um...@cloudera.com>
---
.../ozone/client/io/ECBlockOutputStreamEntry.java | 3 +-
.../hadoop/ozone/client/io/ECKeyOutputStream.java | 1 -
.../hadoop/ozone/client/TestOzoneECClient.java | 32 ++++++++++++----------
3 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ECBlockOutputStreamEntry.java b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ECBlockOutputStreamEntry.java
index 3670231..69c3735 100644
--- a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ECBlockOutputStreamEntry.java
+++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ECBlockOutputStreamEntry.java
@@ -130,7 +130,8 @@ public class ECBlockOutputStreamEntry extends BlockOutputStreamEntry{
}
public void useNextBlockStream() {
- currentStreamIdx++;
+ currentStreamIdx =
+ (currentStreamIdx + 1) % replicationConfig.getRequiredNodes();
}
public void markFailed(Exception e) {
diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ECKeyOutputStream.java b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ECKeyOutputStream.java
index fd333e2..4e4886a 100644
--- a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ECKeyOutputStream.java
+++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ECKeyOutputStream.java
@@ -260,7 +260,6 @@ public class ECKeyOutputStream extends KeyOutputStream {
newBlockGroupStreamEntry
.updateBlockGroupToAckedPosition(failedStripeDataSize);
ecChunkBufferCache.clear(chunkSize);
- ecChunkBufferCache.release();
if (newBlockGroupStreamEntry.getRemaining() <= 0) {
// In most cases this should not happen except in the case stripe size and
diff --git a/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/TestOzoneECClient.java b/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/TestOzoneECClient.java
index c3c8c6d..ee19210 100644
--- a/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/TestOzoneECClient.java
+++ b/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/TestOzoneECClient.java
@@ -426,25 +426,24 @@ public class TestOzoneECClient {
@Test
public void testWriteShouldFailIfMoreThanParityNodesFail()
throws IOException {
- testNodeFailuresWhileWriting(3, 3);
+ testNodeFailuresWhileWriting(3, 3, 2);
}
@Test
public void testWriteShouldSuccessIfLessThanParityNodesFail()
throws IOException {
- testNodeFailuresWhileWriting(1, 2);
+ testNodeFailuresWhileWriting(1, 2, 2);
}
@Test
- public void testWriteShouldSuccessIf4NodesFailed()
- throws IOException {
- testNodeFailuresWhileWriting(4, 1);
+ public void testWriteShouldSuccessIf4NodesFailed() throws IOException {
+ testNodeFailuresWhileWriting(4, 1, 2);
}
@Test
- public void testWriteShouldSuccessIfAllNodesFailed()
+ public void testWriteShouldSuccessWithAdditional1BlockGroupAfterFailure()
throws IOException {
- testNodeFailuresWhileWriting(4, 1);
+ testNodeFailuresWhileWriting(4, 10, 3);
}
@Test
@@ -602,7 +601,8 @@ public class TestOzoneECClient {
}
public void testNodeFailuresWhileWriting(int numFailureToInject,
- int numChunksToWriteAfterFailure) throws IOException {
+ int numChunksToWriteAfterFailure, int numExpectedBlockGrps)
+ throws IOException {
store.createVolume(volumeName);
OzoneVolume volume = store.getVolume(volumeName);
volume.createBucket(bucketName);
@@ -628,15 +628,16 @@ public class TestOzoneECClient {
((MockXceiverClientFactory) factoryStub).setFailedStorages(failedDNs);
for (int i = 0; i < numChunksToWriteAfterFailure; i++) {
- out.write(inputChunks[i]);
+ out.write(inputChunks[i % dataBlocks]);
}
}
final OzoneKeyDetails key = bucket.getKey(keyName);
// Data supposed to store in single block group. Since we introduced the
// failures after first stripe, the second stripe data should have been
- // written into new blockgroup. So, we should have 2 block groups. That
- // means two keyLocations.
- Assert.assertEquals(2, key.getOzoneKeyLocations().size());
+ // written into new block group. So, we should have numExpectedBlockGrps.
+ // That means two keyLocations.
+ Assert
+ .assertEquals(numExpectedBlockGrps, key.getOzoneKeyLocations().size());
try (OzoneInputStream is = bucket.readKey(keyName)) {
byte[] fileContent = new byte[chunkSize];
for (int i = 0; i < dataBlocks; i++) {
@@ -646,10 +647,11 @@ public class TestOzoneECClient {
Arrays.equals(inputChunks[i], fileContent));
}
for (int i = 0; i < numChunksToWriteAfterFailure; i++) {
- Assert.assertEquals(inputChunks[i].length, is.read(fileContent));
- Assert.assertTrue("Expected: " + new String(inputChunks[i],
+ Assert.assertEquals(inputChunks[i % dataBlocks].length,
+ is.read(fileContent));
+ Assert.assertTrue("Expected: " + new String(inputChunks[i % dataBlocks],
UTF_8) + " \n " + "Actual: " + new String(fileContent, UTF_8),
- Arrays.equals(inputChunks[i], fileContent));
+ Arrays.equals(inputChunks[i % dataBlocks], fileContent));
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org