You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sn...@apache.org on 2016/05/24 07:49:16 UTC
[01/10] cassandra git commit: Possible memory leak in
NIODataInputStream
Repository: cassandra
Updated Branches:
refs/heads/cassandra-2.2 d6ffa4b7d -> ffd10a9b9
refs/heads/cassandra-3.0 d572ab0ac -> 361c4e4c7
refs/heads/cassandra-3.7 b2a9c5634 -> 075403c78
refs/heads/trunk 59896cb82 -> cfe11585f
Possible memory leak in NIODataInputStream
patch by Robert Stupp; reviewed by Stefania for CASSANDRA-11867
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ffd10a9b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ffd10a9b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ffd10a9b
Branch: refs/heads/cassandra-2.2
Commit: ffd10a9b9a391f6bb55daa7e9365bff34f945f73
Parents: d6ffa4b
Author: Robert Stupp <sn...@snazy.de>
Authored: Tue May 24 09:41:04 2016 +0200
Committer: Robert Stupp <sn...@snazy.de>
Committed: Tue May 24 09:41:04 2016 +0200
----------------------------------------------------------------------
CHANGES.txt | 1 +
src/java/org/apache/cassandra/io/util/NIODataInputStream.java | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/ffd10a9b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index af97cd1..d7ca9e5 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.2.7
+ * Possible memory leak in NIODataInputStream (CASSANDRA-11867)
* Fix commit log replay after out-of-order flush completion (CASSANDRA-9669)
* Add seconds to cqlsh tracing session duration (CASSANDRA-11753)
* Prohibit Reverse Counter type as part of the PK (CASSANDRA-9395)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/ffd10a9b/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/util/NIODataInputStream.java b/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
index 94ba9ed..ebeb8ba 100644
--- a/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
+++ b/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
@@ -44,7 +44,7 @@ import com.google.common.base.Preconditions;
public class NIODataInputStream extends InputStream implements DataInput, Closeable
{
private final ReadableByteChannel rbc;
- private final ByteBuffer buf;
+ private ByteBuffer buf;
public NIODataInputStream(ReadableByteChannel rbc, int bufferSize)
@@ -277,7 +277,9 @@ public class NIODataInputStream extends InputStream implements DataInput, Closea
@Override
public void close() throws IOException
{
- rbc.close();
+ rbc.close();
+ FileUtils.clean(buf);
+ buf = null;
}
@Override
[05/10] cassandra git commit: Merge branch 'cassandra-2.2' into
cassandra-3.0
Posted by sn...@apache.org.
Merge branch 'cassandra-2.2' into cassandra-3.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/361c4e4c
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/361c4e4c
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/361c4e4c
Branch: refs/heads/cassandra-3.7
Commit: 361c4e4c7000bcfded4ea81f6ebd59eeed42ab31
Parents: d572ab0 ffd10a9
Author: Robert Stupp <sn...@snazy.de>
Authored: Tue May 24 09:42:43 2016 +0200
Committer: Robert Stupp <sn...@snazy.de>
Committed: Tue May 24 09:48:03 2016 +0200
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../apache/cassandra/io/util/NIODataInputStream.java | 12 ++++--------
2 files changed, 5 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/361c4e4c/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 69e8c5d,d7ca9e5..ac5321d
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,38 -1,8 +1,39 @@@
-2.2.7
+3.0.7
+ * Use CFS.initialDirectories when clearing snapshots (CASSANDRA-11705)
+ * Allow compaction strategies to disable early open (CASSANDRA-11754)
+ * Refactor Materialized View code (CASSANDRA-11475)
+ * Update Java Driver (CASSANDRA-11615)
+Merged from 2.2:
+ * Possible memory leak in NIODataInputStream (CASSANDRA-11867)
- * Fix commit log replay after out-of-order flush completion (CASSANDRA-9669)
+ * Add message dropped tasks to nodetool netstats (CASSANDRA-11855)
* Add seconds to cqlsh tracing session duration (CASSANDRA-11753)
- * Prohibit Reverse Counter type as part of the PK (CASSANDRA-9395)
+ * Prohibit Reversed Counter type as part of the PK (CASSANDRA-9395)
+Merged from 2.1:
+ * Avoid holding SSTableReaders for duration of incremental repair (CASSANDRA-11739)
+
+
+3.0.6
+ * Disallow creating view with a static column (CASSANDRA-11602)
+ * Reduce the amount of object allocations caused by the getFunctions methods (CASSANDRA-11593)
+ * Potential error replaying commitlog with smallint/tinyint/date/time types (CASSANDRA-11618)
+ * Fix queries with filtering on counter columns (CASSANDRA-11629)
+ * Improve tombstone printing in sstabledump (CASSANDRA-11655)
+ * Fix paging for range queries where all clustering columns are specified (CASSANDRA-11669)
+ * Don't require HEAP_NEW_SIZE to be set when using G1 (CASSANDRA-11600)
+ * Fix sstabledump not showing cells after tombstone marker (CASSANDRA-11654)
+ * Ignore all LocalStrategy keyspaces for streaming and other related
+ operations (CASSANDRA-11627)
+ * Ensure columnfilter covers indexed columns for thrift 2i queries (CASSANDRA-11523)
+ * Only open one sstable scanner per sstable (CASSANDRA-11412)
+ * Option to specify ProtocolVersion in cassandra-stress (CASSANDRA-11410)
+ * ArithmeticException in avgFunctionForDecimal (CASSANDRA-11485)
+ * LogAwareFileLister should only use OLD sstable files in current folder to determine disk consistency (CASSANDRA-11470)
+ * Notify indexers of expired rows during compaction (CASSANDRA-11329)
+ * Properly respond with ProtocolError when a v1/v2 native protocol
+ header is received (CASSANDRA-11464)
+ * Validate that num_tokens and initial_token are consistent with one another (CASSANDRA-10120)
+Merged from 2.2:
+ * Fix commit log replay after out-of-order flush completion (CASSANDRA-9669)
* cqlsh: correctly handle non-ascii chars in error messages (CASSANDRA-11626)
* Exit JVM if JMX server fails to startup (CASSANDRA-11540)
* Produce a heap dump when exiting on OOM (CASSANDRA-9861)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/361c4e4c/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/io/util/NIODataInputStream.java
index e599a69,ebeb8ba..c75d44f
--- a/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
+++ b/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
@@@ -17,8 -17,12 +17,7 @@@
*/
package org.apache.cassandra.io.util;
--import java.io.Closeable;
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.EOFException;
import java.io.IOException;
-import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.SeekableByteChannel;
@@@ -37,48 -41,251 +36,45 @@@ import com.google.common.base.Precondit
*
* NIODataInputStream is not thread safe.
*/
-public class NIODataInputStream extends InputStream implements DataInput, Closeable
+public class NIODataInputStream extends RebufferingInputStream
{
- private final ReadableByteChannel rbc;
- private ByteBuffer buf;
+ protected final ReadableByteChannel channel;
-
- public NIODataInputStream(ReadableByteChannel rbc, int bufferSize)
- {
- Preconditions.checkNotNull(rbc);
- Preconditions.checkArgument(bufferSize >= 8, "Buffer size must be large enough to accomadate a long/double");
- this.rbc = rbc;
- buf = ByteBuffer.allocateDirect(bufferSize);
- buf.position(0);
- buf.limit(0);
- }
-
- @Override
- public void readFully(byte[] b) throws IOException
- {
- readFully(b, 0, b.length);
- }
-
-
- @Override
- public void readFully(byte[] b, int off, int len) throws IOException
- {
- int copied = 0;
- while (copied < len)
- {
- int read = read(b, off + copied, len - copied);
- if (read < 0)
- throw new EOFException();
- copied += read;
- }
- }
-
- @Override
- public int read(byte b[], int off, int len) throws IOException {
- if (b == null)
- throw new NullPointerException();
-
- // avoid int overflow
- if (off < 0 || off > b.length || len < 0
- || len > b.length - off)
- throw new IndexOutOfBoundsException();
-
- if (len == 0)
- return 0;
-
- int copied = 0;
- while (copied < len)
- {
- if (buf.hasRemaining())
- {
- int toCopy = Math.min(len - copied, buf.remaining());
- buf.get(b, off + copied, toCopy);
- copied += toCopy;
- }
- else
- {
- int read = readNext();
- if (read < 0 && copied == 0) return -1;
- if (read <= 0) return copied;
- }
- }
-
- return copied;
- }
-
- /*
- * Refill the buffer, preserving any unread bytes remaining in the buffer
- */
- private int readNext() throws IOException
- {
- Preconditions.checkState(buf.remaining() != buf.capacity());
- assert(buf.remaining() < 8);
-
- /*
- * If there is data already at the start of the buffer, move the position to the end
- * If there is data but not at the start, move it to the start
- * Otherwise move the position to 0 so writes start at the beginning of the buffer
- *
- * We go to the trouble of shuffling the bytes remaining for cases where the buffer isn't fully drained
- * while retrieving a multi-byte value while the position is in the middle.
- */
- if (buf.position() == 0 && buf.hasRemaining())
- {
- buf.position(buf.limit());
- }
- else if (buf.hasRemaining())
- {
- ByteBuffer dup = buf.duplicate();
- buf.clear();
- buf.put(dup);
- }
- else
- {
- buf.position(0);
- }
-
- buf.limit(buf.capacity());
-
- int read = 0;
- while ((read = rbc.read(buf)) == 0) {}
-
- buf.flip();
-
- return read;
- }
-
- /*
- * Read at least minimum bytes and throw EOF if that fails
- */
- private void readMinimum(int minimum) throws IOException
- {
- assert(buf.remaining() < 8);
- while (buf.remaining() < minimum)
- {
- int read = readNext();
- if (read == -1)
- {
- //DataInputStream consumes the bytes even if it doesn't get the entire value, match the behavior here
- buf.position(0);
- buf.limit(0);
- throw new EOFException();
- }
- }
- }
-
- /*
- * Ensure the buffer contains the minimum number of readable bytes
- */
- private void prepareReadPrimitive(int minimum) throws IOException
- {
- if (buf.remaining() < minimum) readMinimum(minimum);
- }
-
- @Override
- public int skipBytes(int n) throws IOException
- {
- int skipped = 0;
-
- while (skipped < n)
- {
- int skippedThisTime = (int)skip(n - skipped);
- if (skippedThisTime <= 0) break;
- skipped += skippedThisTime;
- }
-
- return skipped;
- }
-
- @Override
- public boolean readBoolean() throws IOException
- {
- prepareReadPrimitive(1);
- return buf.get() != 0;
- }
-
- @Override
- public byte readByte() throws IOException
- {
- prepareReadPrimitive(1);
- return buf.get();
- }
-
- @Override
- public int readUnsignedByte() throws IOException
- {
- prepareReadPrimitive(1);
- return buf.get() & 0xff;
- }
-
- @Override
- public short readShort() throws IOException
- {
- prepareReadPrimitive(2);
- return buf.getShort();
- }
-
- @Override
- public int readUnsignedShort() throws IOException
- {
- return readShort() & 0xFFFF;
- }
-
- @Override
- public char readChar() throws IOException
+ private static ByteBuffer makeBuffer(int bufferSize)
{
- prepareReadPrimitive(2);
- return buf.getChar();
- }
+ ByteBuffer buffer = ByteBuffer.allocateDirect(bufferSize);
+ buffer.position(0);
+ buffer.limit(0);
- @Override
- public int readInt() throws IOException
- {
- prepareReadPrimitive(4);
- return buf.getInt();
+ return buffer;
}
- public NIODataInputStream(ReadableByteChannel channel, ByteBuffer buffer)
- @Override
- public long readLong() throws IOException
++ public NIODataInputStream(ReadableByteChannel channel, int bufferSize)
{
- super(buffer);
- prepareReadPrimitive(8);
- return buf.getLong();
- }
++ super(makeBuffer(bufferSize));
- @Override
- public float readFloat() throws IOException
- {
- prepareReadPrimitive(4);
- return buf.getFloat();
+ Preconditions.checkNotNull(channel);
+ this.channel = channel;
}
- public NIODataInputStream(ReadableByteChannel channel, int bufferSize)
- {
- this(channel, makeBuffer(bufferSize));
- }
-
@Override
- public double readDouble() throws IOException
+ protected void reBuffer() throws IOException
{
- prepareReadPrimitive(8);
- return buf.getDouble();
- }
+ Preconditions.checkState(buffer.remaining() == 0);
+ buffer.clear();
- @Override
- public String readLine() throws IOException
- {
- throw new UnsupportedOperationException();
- }
+ while ((channel.read(buffer)) == 0) {}
- @Override
- public String readUTF() throws IOException
- {
- return DataInputStream.readUTF(this);
+ buffer.flip();
}
@Override
public void close() throws IOException
{
- rbc.close();
- FileUtils.clean(buf);
- buf = null;
- }
-
- @Override
- public int read() throws IOException
- {
- return readUnsignedByte();
+ channel.close();
+ super.close();
++ FileUtils.clean(buffer);
++ buffer = null;
}
@Override
[09/10] cassandra git commit: Merge branch 'cassandra-3.0' into
cassandra-3.7
Posted by sn...@apache.org.
Merge branch 'cassandra-3.0' into cassandra-3.7
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/075403c7
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/075403c7
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/075403c7
Branch: refs/heads/trunk
Commit: 075403c787e44da09871a35130c3c67a2d07a7b9
Parents: b2a9c56 361c4e4
Author: Robert Stupp <sn...@snazy.de>
Authored: Tue May 24 09:48:08 2016 +0200
Committer: Robert Stupp <sn...@snazy.de>
Committed: Tue May 24 09:48:08 2016 +0200
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../apache/cassandra/io/util/NIODataInputStream.java | 12 ++++--------
2 files changed, 5 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/075403c7/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 15d5f2e,ac5321d..e7773e2
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -6,11 -4,10 +6,12 @@@ Merged from 3.0
* Refactor Materialized View code (CASSANDRA-11475)
* Update Java Driver (CASSANDRA-11615)
Merged from 2.2:
+ * Possible memory leak in NIODataInputStream (CASSANDRA-11867)
* Add message dropped tasks to nodetool netstats (CASSANDRA-11855)
* Add seconds to cqlsh tracing session duration (CASSANDRA-11753)
+ * Fix commit log replay after out-of-order flush completion (CASSANDRA-9669)
* Prohibit Reversed Counter type as part of the PK (CASSANDRA-9395)
+ * cqlsh: correctly handle non-ascii chars in error messages (CASSANDRA-11626)
Merged from 2.1:
* Avoid holding SSTableReaders for duration of incremental repair (CASSANDRA-11739)
[06/10] cassandra git commit: Merge branch 'cassandra-2.2' into
cassandra-3.0
Posted by sn...@apache.org.
Merge branch 'cassandra-2.2' into cassandra-3.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/361c4e4c
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/361c4e4c
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/361c4e4c
Branch: refs/heads/cassandra-3.0
Commit: 361c4e4c7000bcfded4ea81f6ebd59eeed42ab31
Parents: d572ab0 ffd10a9
Author: Robert Stupp <sn...@snazy.de>
Authored: Tue May 24 09:42:43 2016 +0200
Committer: Robert Stupp <sn...@snazy.de>
Committed: Tue May 24 09:48:03 2016 +0200
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../apache/cassandra/io/util/NIODataInputStream.java | 12 ++++--------
2 files changed, 5 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/361c4e4c/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 69e8c5d,d7ca9e5..ac5321d
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,38 -1,8 +1,39 @@@
-2.2.7
+3.0.7
+ * Use CFS.initialDirectories when clearing snapshots (CASSANDRA-11705)
+ * Allow compaction strategies to disable early open (CASSANDRA-11754)
+ * Refactor Materialized View code (CASSANDRA-11475)
+ * Update Java Driver (CASSANDRA-11615)
+Merged from 2.2:
+ * Possible memory leak in NIODataInputStream (CASSANDRA-11867)
- * Fix commit log replay after out-of-order flush completion (CASSANDRA-9669)
+ * Add message dropped tasks to nodetool netstats (CASSANDRA-11855)
* Add seconds to cqlsh tracing session duration (CASSANDRA-11753)
- * Prohibit Reverse Counter type as part of the PK (CASSANDRA-9395)
+ * Prohibit Reversed Counter type as part of the PK (CASSANDRA-9395)
+Merged from 2.1:
+ * Avoid holding SSTableReaders for duration of incremental repair (CASSANDRA-11739)
+
+
+3.0.6
+ * Disallow creating view with a static column (CASSANDRA-11602)
+ * Reduce the amount of object allocations caused by the getFunctions methods (CASSANDRA-11593)
+ * Potential error replaying commitlog with smallint/tinyint/date/time types (CASSANDRA-11618)
+ * Fix queries with filtering on counter columns (CASSANDRA-11629)
+ * Improve tombstone printing in sstabledump (CASSANDRA-11655)
+ * Fix paging for range queries where all clustering columns are specified (CASSANDRA-11669)
+ * Don't require HEAP_NEW_SIZE to be set when using G1 (CASSANDRA-11600)
+ * Fix sstabledump not showing cells after tombstone marker (CASSANDRA-11654)
+ * Ignore all LocalStrategy keyspaces for streaming and other related
+ operations (CASSANDRA-11627)
+ * Ensure columnfilter covers indexed columns for thrift 2i queries (CASSANDRA-11523)
+ * Only open one sstable scanner per sstable (CASSANDRA-11412)
+ * Option to specify ProtocolVersion in cassandra-stress (CASSANDRA-11410)
+ * ArithmeticException in avgFunctionForDecimal (CASSANDRA-11485)
+ * LogAwareFileLister should only use OLD sstable files in current folder to determine disk consistency (CASSANDRA-11470)
+ * Notify indexers of expired rows during compaction (CASSANDRA-11329)
+ * Properly respond with ProtocolError when a v1/v2 native protocol
+ header is received (CASSANDRA-11464)
+ * Validate that num_tokens and initial_token are consistent with one another (CASSANDRA-10120)
+Merged from 2.2:
+ * Fix commit log replay after out-of-order flush completion (CASSANDRA-9669)
* cqlsh: correctly handle non-ascii chars in error messages (CASSANDRA-11626)
* Exit JVM if JMX server fails to startup (CASSANDRA-11540)
* Produce a heap dump when exiting on OOM (CASSANDRA-9861)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/361c4e4c/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/io/util/NIODataInputStream.java
index e599a69,ebeb8ba..c75d44f
--- a/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
+++ b/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
@@@ -17,8 -17,12 +17,7 @@@
*/
package org.apache.cassandra.io.util;
--import java.io.Closeable;
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.EOFException;
import java.io.IOException;
-import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.SeekableByteChannel;
@@@ -37,48 -41,251 +36,45 @@@ import com.google.common.base.Precondit
*
* NIODataInputStream is not thread safe.
*/
-public class NIODataInputStream extends InputStream implements DataInput, Closeable
+public class NIODataInputStream extends RebufferingInputStream
{
- private final ReadableByteChannel rbc;
- private ByteBuffer buf;
+ protected final ReadableByteChannel channel;
-
- public NIODataInputStream(ReadableByteChannel rbc, int bufferSize)
- {
- Preconditions.checkNotNull(rbc);
- Preconditions.checkArgument(bufferSize >= 8, "Buffer size must be large enough to accomadate a long/double");
- this.rbc = rbc;
- buf = ByteBuffer.allocateDirect(bufferSize);
- buf.position(0);
- buf.limit(0);
- }
-
- @Override
- public void readFully(byte[] b) throws IOException
- {
- readFully(b, 0, b.length);
- }
-
-
- @Override
- public void readFully(byte[] b, int off, int len) throws IOException
- {
- int copied = 0;
- while (copied < len)
- {
- int read = read(b, off + copied, len - copied);
- if (read < 0)
- throw new EOFException();
- copied += read;
- }
- }
-
- @Override
- public int read(byte b[], int off, int len) throws IOException {
- if (b == null)
- throw new NullPointerException();
-
- // avoid int overflow
- if (off < 0 || off > b.length || len < 0
- || len > b.length - off)
- throw new IndexOutOfBoundsException();
-
- if (len == 0)
- return 0;
-
- int copied = 0;
- while (copied < len)
- {
- if (buf.hasRemaining())
- {
- int toCopy = Math.min(len - copied, buf.remaining());
- buf.get(b, off + copied, toCopy);
- copied += toCopy;
- }
- else
- {
- int read = readNext();
- if (read < 0 && copied == 0) return -1;
- if (read <= 0) return copied;
- }
- }
-
- return copied;
- }
-
- /*
- * Refill the buffer, preserving any unread bytes remaining in the buffer
- */
- private int readNext() throws IOException
- {
- Preconditions.checkState(buf.remaining() != buf.capacity());
- assert(buf.remaining() < 8);
-
- /*
- * If there is data already at the start of the buffer, move the position to the end
- * If there is data but not at the start, move it to the start
- * Otherwise move the position to 0 so writes start at the beginning of the buffer
- *
- * We go to the trouble of shuffling the bytes remaining for cases where the buffer isn't fully drained
- * while retrieving a multi-byte value while the position is in the middle.
- */
- if (buf.position() == 0 && buf.hasRemaining())
- {
- buf.position(buf.limit());
- }
- else if (buf.hasRemaining())
- {
- ByteBuffer dup = buf.duplicate();
- buf.clear();
- buf.put(dup);
- }
- else
- {
- buf.position(0);
- }
-
- buf.limit(buf.capacity());
-
- int read = 0;
- while ((read = rbc.read(buf)) == 0) {}
-
- buf.flip();
-
- return read;
- }
-
- /*
- * Read at least minimum bytes and throw EOF if that fails
- */
- private void readMinimum(int minimum) throws IOException
- {
- assert(buf.remaining() < 8);
- while (buf.remaining() < minimum)
- {
- int read = readNext();
- if (read == -1)
- {
- //DataInputStream consumes the bytes even if it doesn't get the entire value, match the behavior here
- buf.position(0);
- buf.limit(0);
- throw new EOFException();
- }
- }
- }
-
- /*
- * Ensure the buffer contains the minimum number of readable bytes
- */
- private void prepareReadPrimitive(int minimum) throws IOException
- {
- if (buf.remaining() < minimum) readMinimum(minimum);
- }
-
- @Override
- public int skipBytes(int n) throws IOException
- {
- int skipped = 0;
-
- while (skipped < n)
- {
- int skippedThisTime = (int)skip(n - skipped);
- if (skippedThisTime <= 0) break;
- skipped += skippedThisTime;
- }
-
- return skipped;
- }
-
- @Override
- public boolean readBoolean() throws IOException
- {
- prepareReadPrimitive(1);
- return buf.get() != 0;
- }
-
- @Override
- public byte readByte() throws IOException
- {
- prepareReadPrimitive(1);
- return buf.get();
- }
-
- @Override
- public int readUnsignedByte() throws IOException
- {
- prepareReadPrimitive(1);
- return buf.get() & 0xff;
- }
-
- @Override
- public short readShort() throws IOException
- {
- prepareReadPrimitive(2);
- return buf.getShort();
- }
-
- @Override
- public int readUnsignedShort() throws IOException
- {
- return readShort() & 0xFFFF;
- }
-
- @Override
- public char readChar() throws IOException
+ private static ByteBuffer makeBuffer(int bufferSize)
{
- prepareReadPrimitive(2);
- return buf.getChar();
- }
+ ByteBuffer buffer = ByteBuffer.allocateDirect(bufferSize);
+ buffer.position(0);
+ buffer.limit(0);
- @Override
- public int readInt() throws IOException
- {
- prepareReadPrimitive(4);
- return buf.getInt();
+ return buffer;
}
- public NIODataInputStream(ReadableByteChannel channel, ByteBuffer buffer)
- @Override
- public long readLong() throws IOException
++ public NIODataInputStream(ReadableByteChannel channel, int bufferSize)
{
- super(buffer);
- prepareReadPrimitive(8);
- return buf.getLong();
- }
++ super(makeBuffer(bufferSize));
- @Override
- public float readFloat() throws IOException
- {
- prepareReadPrimitive(4);
- return buf.getFloat();
+ Preconditions.checkNotNull(channel);
+ this.channel = channel;
}
- public NIODataInputStream(ReadableByteChannel channel, int bufferSize)
- {
- this(channel, makeBuffer(bufferSize));
- }
-
@Override
- public double readDouble() throws IOException
+ protected void reBuffer() throws IOException
{
- prepareReadPrimitive(8);
- return buf.getDouble();
- }
+ Preconditions.checkState(buffer.remaining() == 0);
+ buffer.clear();
- @Override
- public String readLine() throws IOException
- {
- throw new UnsupportedOperationException();
- }
+ while ((channel.read(buffer)) == 0) {}
- @Override
- public String readUTF() throws IOException
- {
- return DataInputStream.readUTF(this);
+ buffer.flip();
}
@Override
public void close() throws IOException
{
- rbc.close();
- FileUtils.clean(buf);
- buf = null;
- }
-
- @Override
- public int read() throws IOException
- {
- return readUnsignedByte();
+ channel.close();
+ super.close();
++ FileUtils.clean(buffer);
++ buffer = null;
}
@Override
[07/10] cassandra git commit: Merge branch 'cassandra-2.2' into
cassandra-3.0
Posted by sn...@apache.org.
Merge branch 'cassandra-2.2' into cassandra-3.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/361c4e4c
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/361c4e4c
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/361c4e4c
Branch: refs/heads/trunk
Commit: 361c4e4c7000bcfded4ea81f6ebd59eeed42ab31
Parents: d572ab0 ffd10a9
Author: Robert Stupp <sn...@snazy.de>
Authored: Tue May 24 09:42:43 2016 +0200
Committer: Robert Stupp <sn...@snazy.de>
Committed: Tue May 24 09:48:03 2016 +0200
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../apache/cassandra/io/util/NIODataInputStream.java | 12 ++++--------
2 files changed, 5 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/361c4e4c/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 69e8c5d,d7ca9e5..ac5321d
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,38 -1,8 +1,39 @@@
-2.2.7
+3.0.7
+ * Use CFS.initialDirectories when clearing snapshots (CASSANDRA-11705)
+ * Allow compaction strategies to disable early open (CASSANDRA-11754)
+ * Refactor Materialized View code (CASSANDRA-11475)
+ * Update Java Driver (CASSANDRA-11615)
+Merged from 2.2:
+ * Possible memory leak in NIODataInputStream (CASSANDRA-11867)
- * Fix commit log replay after out-of-order flush completion (CASSANDRA-9669)
+ * Add message dropped tasks to nodetool netstats (CASSANDRA-11855)
* Add seconds to cqlsh tracing session duration (CASSANDRA-11753)
- * Prohibit Reverse Counter type as part of the PK (CASSANDRA-9395)
+ * Prohibit Reversed Counter type as part of the PK (CASSANDRA-9395)
+Merged from 2.1:
+ * Avoid holding SSTableReaders for duration of incremental repair (CASSANDRA-11739)
+
+
+3.0.6
+ * Disallow creating view with a static column (CASSANDRA-11602)
+ * Reduce the amount of object allocations caused by the getFunctions methods (CASSANDRA-11593)
+ * Potential error replaying commitlog with smallint/tinyint/date/time types (CASSANDRA-11618)
+ * Fix queries with filtering on counter columns (CASSANDRA-11629)
+ * Improve tombstone printing in sstabledump (CASSANDRA-11655)
+ * Fix paging for range queries where all clustering columns are specified (CASSANDRA-11669)
+ * Don't require HEAP_NEW_SIZE to be set when using G1 (CASSANDRA-11600)
+ * Fix sstabledump not showing cells after tombstone marker (CASSANDRA-11654)
+ * Ignore all LocalStrategy keyspaces for streaming and other related
+ operations (CASSANDRA-11627)
+ * Ensure columnfilter covers indexed columns for thrift 2i queries (CASSANDRA-11523)
+ * Only open one sstable scanner per sstable (CASSANDRA-11412)
+ * Option to specify ProtocolVersion in cassandra-stress (CASSANDRA-11410)
+ * ArithmeticException in avgFunctionForDecimal (CASSANDRA-11485)
+ * LogAwareFileLister should only use OLD sstable files in current folder to determine disk consistency (CASSANDRA-11470)
+ * Notify indexers of expired rows during compaction (CASSANDRA-11329)
+ * Properly respond with ProtocolError when a v1/v2 native protocol
+ header is received (CASSANDRA-11464)
+ * Validate that num_tokens and initial_token are consistent with one another (CASSANDRA-10120)
+Merged from 2.2:
+ * Fix commit log replay after out-of-order flush completion (CASSANDRA-9669)
* cqlsh: correctly handle non-ascii chars in error messages (CASSANDRA-11626)
* Exit JVM if JMX server fails to startup (CASSANDRA-11540)
* Produce a heap dump when exiting on OOM (CASSANDRA-9861)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/361c4e4c/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/io/util/NIODataInputStream.java
index e599a69,ebeb8ba..c75d44f
--- a/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
+++ b/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
@@@ -17,8 -17,12 +17,7 @@@
*/
package org.apache.cassandra.io.util;
--import java.io.Closeable;
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.EOFException;
import java.io.IOException;
-import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.SeekableByteChannel;
@@@ -37,48 -41,251 +36,45 @@@ import com.google.common.base.Precondit
*
* NIODataInputStream is not thread safe.
*/
-public class NIODataInputStream extends InputStream implements DataInput, Closeable
+public class NIODataInputStream extends RebufferingInputStream
{
- private final ReadableByteChannel rbc;
- private ByteBuffer buf;
+ protected final ReadableByteChannel channel;
-
- public NIODataInputStream(ReadableByteChannel rbc, int bufferSize)
- {
- Preconditions.checkNotNull(rbc);
- Preconditions.checkArgument(bufferSize >= 8, "Buffer size must be large enough to accomadate a long/double");
- this.rbc = rbc;
- buf = ByteBuffer.allocateDirect(bufferSize);
- buf.position(0);
- buf.limit(0);
- }
-
- @Override
- public void readFully(byte[] b) throws IOException
- {
- readFully(b, 0, b.length);
- }
-
-
- @Override
- public void readFully(byte[] b, int off, int len) throws IOException
- {
- int copied = 0;
- while (copied < len)
- {
- int read = read(b, off + copied, len - copied);
- if (read < 0)
- throw new EOFException();
- copied += read;
- }
- }
-
- @Override
- public int read(byte b[], int off, int len) throws IOException {
- if (b == null)
- throw new NullPointerException();
-
- // avoid int overflow
- if (off < 0 || off > b.length || len < 0
- || len > b.length - off)
- throw new IndexOutOfBoundsException();
-
- if (len == 0)
- return 0;
-
- int copied = 0;
- while (copied < len)
- {
- if (buf.hasRemaining())
- {
- int toCopy = Math.min(len - copied, buf.remaining());
- buf.get(b, off + copied, toCopy);
- copied += toCopy;
- }
- else
- {
- int read = readNext();
- if (read < 0 && copied == 0) return -1;
- if (read <= 0) return copied;
- }
- }
-
- return copied;
- }
-
- /*
- * Refill the buffer, preserving any unread bytes remaining in the buffer
- */
- private int readNext() throws IOException
- {
- Preconditions.checkState(buf.remaining() != buf.capacity());
- assert(buf.remaining() < 8);
-
- /*
- * If there is data already at the start of the buffer, move the position to the end
- * If there is data but not at the start, move it to the start
- * Otherwise move the position to 0 so writes start at the beginning of the buffer
- *
- * We go to the trouble of shuffling the bytes remaining for cases where the buffer isn't fully drained
- * while retrieving a multi-byte value while the position is in the middle.
- */
- if (buf.position() == 0 && buf.hasRemaining())
- {
- buf.position(buf.limit());
- }
- else if (buf.hasRemaining())
- {
- ByteBuffer dup = buf.duplicate();
- buf.clear();
- buf.put(dup);
- }
- else
- {
- buf.position(0);
- }
-
- buf.limit(buf.capacity());
-
- int read = 0;
- while ((read = rbc.read(buf)) == 0) {}
-
- buf.flip();
-
- return read;
- }
-
- /*
- * Read at least minimum bytes and throw EOF if that fails
- */
- private void readMinimum(int minimum) throws IOException
- {
- assert(buf.remaining() < 8);
- while (buf.remaining() < minimum)
- {
- int read = readNext();
- if (read == -1)
- {
- //DataInputStream consumes the bytes even if it doesn't get the entire value, match the behavior here
- buf.position(0);
- buf.limit(0);
- throw new EOFException();
- }
- }
- }
-
- /*
- * Ensure the buffer contains the minimum number of readable bytes
- */
- private void prepareReadPrimitive(int minimum) throws IOException
- {
- if (buf.remaining() < minimum) readMinimum(minimum);
- }
-
- @Override
- public int skipBytes(int n) throws IOException
- {
- int skipped = 0;
-
- while (skipped < n)
- {
- int skippedThisTime = (int)skip(n - skipped);
- if (skippedThisTime <= 0) break;
- skipped += skippedThisTime;
- }
-
- return skipped;
- }
-
- @Override
- public boolean readBoolean() throws IOException
- {
- prepareReadPrimitive(1);
- return buf.get() != 0;
- }
-
- @Override
- public byte readByte() throws IOException
- {
- prepareReadPrimitive(1);
- return buf.get();
- }
-
- @Override
- public int readUnsignedByte() throws IOException
- {
- prepareReadPrimitive(1);
- return buf.get() & 0xff;
- }
-
- @Override
- public short readShort() throws IOException
- {
- prepareReadPrimitive(2);
- return buf.getShort();
- }
-
- @Override
- public int readUnsignedShort() throws IOException
- {
- return readShort() & 0xFFFF;
- }
-
- @Override
- public char readChar() throws IOException
+ private static ByteBuffer makeBuffer(int bufferSize)
{
- prepareReadPrimitive(2);
- return buf.getChar();
- }
+ ByteBuffer buffer = ByteBuffer.allocateDirect(bufferSize);
+ buffer.position(0);
+ buffer.limit(0);
- @Override
- public int readInt() throws IOException
- {
- prepareReadPrimitive(4);
- return buf.getInt();
+ return buffer;
}
- public NIODataInputStream(ReadableByteChannel channel, ByteBuffer buffer)
- @Override
- public long readLong() throws IOException
++ public NIODataInputStream(ReadableByteChannel channel, int bufferSize)
{
- super(buffer);
- prepareReadPrimitive(8);
- return buf.getLong();
- }
++ super(makeBuffer(bufferSize));
- @Override
- public float readFloat() throws IOException
- {
- prepareReadPrimitive(4);
- return buf.getFloat();
+ Preconditions.checkNotNull(channel);
+ this.channel = channel;
}
- public NIODataInputStream(ReadableByteChannel channel, int bufferSize)
- {
- this(channel, makeBuffer(bufferSize));
- }
-
@Override
- public double readDouble() throws IOException
+ protected void reBuffer() throws IOException
{
- prepareReadPrimitive(8);
- return buf.getDouble();
- }
+ Preconditions.checkState(buffer.remaining() == 0);
+ buffer.clear();
- @Override
- public String readLine() throws IOException
- {
- throw new UnsupportedOperationException();
- }
+ while ((channel.read(buffer)) == 0) {}
- @Override
- public String readUTF() throws IOException
- {
- return DataInputStream.readUTF(this);
+ buffer.flip();
}
@Override
public void close() throws IOException
{
- rbc.close();
- FileUtils.clean(buf);
- buf = null;
- }
-
- @Override
- public int read() throws IOException
- {
- return readUnsignedByte();
+ channel.close();
+ super.close();
++ FileUtils.clean(buffer);
++ buffer = null;
}
@Override
[08/10] cassandra git commit: Merge branch 'cassandra-3.0' into
cassandra-3.7
Posted by sn...@apache.org.
Merge branch 'cassandra-3.0' into cassandra-3.7
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/075403c7
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/075403c7
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/075403c7
Branch: refs/heads/cassandra-3.7
Commit: 075403c787e44da09871a35130c3c67a2d07a7b9
Parents: b2a9c56 361c4e4
Author: Robert Stupp <sn...@snazy.de>
Authored: Tue May 24 09:48:08 2016 +0200
Committer: Robert Stupp <sn...@snazy.de>
Committed: Tue May 24 09:48:08 2016 +0200
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../apache/cassandra/io/util/NIODataInputStream.java | 12 ++++--------
2 files changed, 5 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/075403c7/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 15d5f2e,ac5321d..e7773e2
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -6,11 -4,10 +6,12 @@@ Merged from 3.0
* Refactor Materialized View code (CASSANDRA-11475)
* Update Java Driver (CASSANDRA-11615)
Merged from 2.2:
+ * Possible memory leak in NIODataInputStream (CASSANDRA-11867)
* Add message dropped tasks to nodetool netstats (CASSANDRA-11855)
* Add seconds to cqlsh tracing session duration (CASSANDRA-11753)
+ * Fix commit log replay after out-of-order flush completion (CASSANDRA-9669)
* Prohibit Reversed Counter type as part of the PK (CASSANDRA-9395)
+ * cqlsh: correctly handle non-ascii chars in error messages (CASSANDRA-11626)
Merged from 2.1:
* Avoid holding SSTableReaders for duration of incremental repair (CASSANDRA-11739)
[03/10] cassandra git commit: Possible memory leak in
NIODataInputStream
Posted by sn...@apache.org.
Possible memory leak in NIODataInputStream
patch by Robert Stupp; reviewed by Stefania for CASSANDRA-11867
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ffd10a9b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ffd10a9b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ffd10a9b
Branch: refs/heads/cassandra-3.7
Commit: ffd10a9b9a391f6bb55daa7e9365bff34f945f73
Parents: d6ffa4b
Author: Robert Stupp <sn...@snazy.de>
Authored: Tue May 24 09:41:04 2016 +0200
Committer: Robert Stupp <sn...@snazy.de>
Committed: Tue May 24 09:41:04 2016 +0200
----------------------------------------------------------------------
CHANGES.txt | 1 +
src/java/org/apache/cassandra/io/util/NIODataInputStream.java | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/ffd10a9b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index af97cd1..d7ca9e5 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.2.7
+ * Possible memory leak in NIODataInputStream (CASSANDRA-11867)
* Fix commit log replay after out-of-order flush completion (CASSANDRA-9669)
* Add seconds to cqlsh tracing session duration (CASSANDRA-11753)
* Prohibit Reverse Counter type as part of the PK (CASSANDRA-9395)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/ffd10a9b/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/util/NIODataInputStream.java b/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
index 94ba9ed..ebeb8ba 100644
--- a/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
+++ b/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
@@ -44,7 +44,7 @@ import com.google.common.base.Preconditions;
public class NIODataInputStream extends InputStream implements DataInput, Closeable
{
private final ReadableByteChannel rbc;
- private final ByteBuffer buf;
+ private ByteBuffer buf;
public NIODataInputStream(ReadableByteChannel rbc, int bufferSize)
@@ -277,7 +277,9 @@ public class NIODataInputStream extends InputStream implements DataInput, Closea
@Override
public void close() throws IOException
{
- rbc.close();
+ rbc.close();
+ FileUtils.clean(buf);
+ buf = null;
}
@Override
[02/10] cassandra git commit: Possible memory leak in
NIODataInputStream
Posted by sn...@apache.org.
Possible memory leak in NIODataInputStream
patch by Robert Stupp; reviewed by Stefania for CASSANDRA-11867
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ffd10a9b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ffd10a9b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ffd10a9b
Branch: refs/heads/cassandra-3.0
Commit: ffd10a9b9a391f6bb55daa7e9365bff34f945f73
Parents: d6ffa4b
Author: Robert Stupp <sn...@snazy.de>
Authored: Tue May 24 09:41:04 2016 +0200
Committer: Robert Stupp <sn...@snazy.de>
Committed: Tue May 24 09:41:04 2016 +0200
----------------------------------------------------------------------
CHANGES.txt | 1 +
src/java/org/apache/cassandra/io/util/NIODataInputStream.java | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/ffd10a9b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index af97cd1..d7ca9e5 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.2.7
+ * Possible memory leak in NIODataInputStream (CASSANDRA-11867)
* Fix commit log replay after out-of-order flush completion (CASSANDRA-9669)
* Add seconds to cqlsh tracing session duration (CASSANDRA-11753)
* Prohibit Reverse Counter type as part of the PK (CASSANDRA-9395)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/ffd10a9b/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/util/NIODataInputStream.java b/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
index 94ba9ed..ebeb8ba 100644
--- a/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
+++ b/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
@@ -44,7 +44,7 @@ import com.google.common.base.Preconditions;
public class NIODataInputStream extends InputStream implements DataInput, Closeable
{
private final ReadableByteChannel rbc;
- private final ByteBuffer buf;
+ private ByteBuffer buf;
public NIODataInputStream(ReadableByteChannel rbc, int bufferSize)
@@ -277,7 +277,9 @@ public class NIODataInputStream extends InputStream implements DataInput, Closea
@Override
public void close() throws IOException
{
- rbc.close();
+ rbc.close();
+ FileUtils.clean(buf);
+ buf = null;
}
@Override
[10/10] cassandra git commit: Merge branch 'cassandra-3.7' into trunk
Posted by sn...@apache.org.
Merge branch 'cassandra-3.7' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/cfe11585
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/cfe11585
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/cfe11585
Branch: refs/heads/trunk
Commit: cfe11585f33987ab11a485b183dcfcd8c7fb69b6
Parents: 59896cb 075403c
Author: Robert Stupp <sn...@snazy.de>
Authored: Tue May 24 09:48:18 2016 +0200
Committer: Robert Stupp <sn...@snazy.de>
Committed: Tue May 24 09:48:18 2016 +0200
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../apache/cassandra/io/util/NIODataInputStream.java | 12 ++++--------
2 files changed, 5 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/cfe11585/CHANGES.txt
----------------------------------------------------------------------
[04/10] cassandra git commit: Possible memory leak in
NIODataInputStream
Posted by sn...@apache.org.
Possible memory leak in NIODataInputStream
patch by Robert Stupp; reviewed by Stefania for CASSANDRA-11867
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ffd10a9b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ffd10a9b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ffd10a9b
Branch: refs/heads/trunk
Commit: ffd10a9b9a391f6bb55daa7e9365bff34f945f73
Parents: d6ffa4b
Author: Robert Stupp <sn...@snazy.de>
Authored: Tue May 24 09:41:04 2016 +0200
Committer: Robert Stupp <sn...@snazy.de>
Committed: Tue May 24 09:41:04 2016 +0200
----------------------------------------------------------------------
CHANGES.txt | 1 +
src/java/org/apache/cassandra/io/util/NIODataInputStream.java | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/ffd10a9b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index af97cd1..d7ca9e5 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.2.7
+ * Possible memory leak in NIODataInputStream (CASSANDRA-11867)
* Fix commit log replay after out-of-order flush completion (CASSANDRA-9669)
* Add seconds to cqlsh tracing session duration (CASSANDRA-11753)
* Prohibit Reverse Counter type as part of the PK (CASSANDRA-9395)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/ffd10a9b/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/util/NIODataInputStream.java b/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
index 94ba9ed..ebeb8ba 100644
--- a/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
+++ b/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
@@ -44,7 +44,7 @@ import com.google.common.base.Preconditions;
public class NIODataInputStream extends InputStream implements DataInput, Closeable
{
private final ReadableByteChannel rbc;
- private final ByteBuffer buf;
+ private ByteBuffer buf;
public NIODataInputStream(ReadableByteChannel rbc, int bufferSize)
@@ -277,7 +277,9 @@ public class NIODataInputStream extends InputStream implements DataInput, Closea
@Override
public void close() throws IOException
{
- rbc.close();
+ rbc.close();
+ FileUtils.clean(buf);
+ buf = null;
}
@Override