kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guozh...@apache.org
Subject kafka git commit: KAFKA-2308: make MemoryRecords idempotent; reviewed by Guozhang Wang
Date Wed, 08 Jul 2015 16:57:37 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 4204f4a06 -> 67b6b9a45


KAFKA-2308: make MemoryRecords idempotent; reviewed by Guozhang Wang


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/67b6b9a4
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/67b6b9a4
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/67b6b9a4

Branch: refs/heads/trunk
Commit: 67b6b9a45ba6f096645f4f344dfdcf1df1e50dd6
Parents: 4204f4a
Author: Gwen Shapira <cshapi@gmail.com>
Authored: Wed Jul 8 09:57:16 2015 -0700
Committer: Guozhang Wang <wangguoz@gmail.com>
Committed: Wed Jul 8 09:57:16 2015 -0700

----------------------------------------------------------------------
 .../java/org/apache/kafka/common/record/MemoryRecords.java   | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/67b6b9a4/clients/src/main/java/org/apache/kafka/common/record/MemoryRecords.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/common/record/MemoryRecords.java b/clients/src/main/java/org/apache/kafka/common/record/MemoryRecords.java
index b2db240..5f1b45c 100644
--- a/clients/src/main/java/org/apache/kafka/common/record/MemoryRecords.java
+++ b/clients/src/main/java/org/apache/kafka/common/record/MemoryRecords.java
@@ -115,9 +115,11 @@ public class MemoryRecords implements Records {
      * Close this batch for no more appends
      */
     public void close() {
-        compressor.close();
-        writable = false;
-        buffer = compressor.buffer();
+        if (writable) {
+            compressor.close();
+            writable = false;
+            buffer = compressor.buffer();
+        }
     }
 
     /** Write the records in this set to the given channel */


Mime
View raw message