cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [1/3] git commit: Workaround Netty bug by not use CompositeByteBuf
Date Wed, 13 Aug 2014 14:51:36 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk df8b5687f -> 231ad7a4e


Workaround Netty bug by not use CompositeByteBuf

Due a bug in Netty [1] using a CompositeByteBuf can lead to data-corruption when partial writes
happen on a socket. To workaround this bug we replaced the CompositeByteBuf usage (which was
caused by Unpooled.wrappedBuffer(...)).

Beside work around the Netty bug this also reduce the object creation and so should stay in
place even after Netty will be upgraded to 4.0.22.Final.

This commit also reverted the partial workaround that was in place before.

[1] https://github.com/netty/netty/issues/2761

patch by normanm; reviewed by tjake for CASSANDRA-7695


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

Branch: refs/heads/trunk
Commit: fe4c8c2c5709d1c909fcacd8af081a8394c99554
Parents: 397c0b7
Author: Norman Maurer <nmaurer@redhat.com>
Authored: Wed Aug 13 15:41:59 2014 +0200
Committer: Jake Luciani <jake@apache.org>
Committed: Wed Aug 13 10:48:34 2014 -0400

----------------------------------------------------------------------
 src/java/org/apache/cassandra/service/CassandraDaemon.java | 9 ---------
 src/java/org/apache/cassandra/transport/Frame.java         | 4 ++--
 2 files changed, 2 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/fe4c8c2c/src/java/org/apache/cassandra/service/CassandraDaemon.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/CassandraDaemon.java b/src/java/org/apache/cassandra/service/CassandraDaemon.java
index 5c88cb1..7c85f81 100644
--- a/src/java/org/apache/cassandra/service/CassandraDaemon.java
+++ b/src/java/org/apache/cassandra/service/CassandraDaemon.java
@@ -37,7 +37,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.addthis.metrics.reporter.config.ReporterConfig;
-import io.netty.util.internal.PlatformDependent;
 import org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutor;
 import org.apache.cassandra.concurrent.Stage;
 import org.apache.cassandra.concurrent.StageManager;
@@ -70,14 +69,6 @@ import org.apache.cassandra.utils.Pair;
  */
 public class CassandraDaemon
 {
-
-    //Workaround for netty issue
-    static 
-    {
-        System.setProperty("io.netty.noUnsafe","true");
-        assert !PlatformDependent.hasUnsafe();
-    }
-
     public static final String MBEAN_NAME = "org.apache.cassandra.db:type=NativeAccess";
 
     // Have a dedicated thread to call exit to avoid deadlock in the case where the thread
that wants to invoke exit

http://git-wip-us.apache.org/repos/asf/cassandra/blob/fe4c8c2c/src/java/org/apache/cassandra/transport/Frame.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/transport/Frame.java b/src/java/org/apache/cassandra/transport/Frame.java
index 7ca1115..01bee10 100644
--- a/src/java/org/apache/cassandra/transport/Frame.java
+++ b/src/java/org/apache/cassandra/transport/Frame.java
@@ -23,7 +23,6 @@ import java.util.EnumSet;
 import java.util.List;
 
 import io.netty.buffer.ByteBuf;
-import io.netty.buffer.Unpooled;
 import io.netty.channel.*;
 import io.netty.handler.codec.ByteToMessageDecoder;
 import io.netty.handler.codec.MessageToMessageDecoder;
@@ -296,7 +295,8 @@ public class Frame
             header.writeByte(type.opcode);
             header.writeInt(frame.body.readableBytes());
 
-            results.add(Unpooled.wrappedBuffer(header, frame.body));
+            results.add(header);
+            results.add(frame.body);
         }
     }
 


Mime
View raw message