소스 검색

HDDS-1037. Fix the block discard logic in Ozone client. Contributed by Shashikant Banerjee.

Shashikant Banerjee 6 년 전
부모
커밋
4123353151
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 2
      hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyOutputStream.java

+ 3 - 2
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyOutputStream.java

@@ -338,8 +338,9 @@ public class KeyOutputStream extends OutputStream {
       ListIterator<BlockOutputStreamEntry> streamEntryIterator =
           streamEntries.listIterator(currentStreamIndex);
       while (streamEntryIterator.hasNext()) {
-        if (streamEntryIterator.next().getBlockID().getContainerID()
-            == containerID) {
+        BlockOutputStreamEntry streamEntry = streamEntryIterator.next();
+        if (streamEntry.getBlockID().getContainerID()
+            == containerID && streamEntry.getCurrentPosition() == 0) {
           streamEntryIterator.remove();
         }
       }