kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jun...@apache.org
Subject [2/2] kafka git commit: KAFKA-2308: make MemoryRecords idempotent; reviewed by Guozhang Wang
Date Thu, 03 Sep 2015 00:21:55 GMT
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/fbfdc195
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/fbfdc195
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/fbfdc195

Branch: refs/heads/0.8.2
Commit: fbfdc195d40e43f54aa7809cd2a8bbaa314b4a5b
Parents: 30f1a44
Author: Gwen Shapira <cshapi@gmail.com>
Authored: Wed Jul 8 09:57:16 2015 -0700
Committer: Jun Rao <junrao@gmail.com>
Committed: Wed Sep 2 16:49:56 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/fbfdc195/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 040e5b9..1d9f894 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
@@ -116,9 +116,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