You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2011/02/22 19:40:32 UTC
svn commit: r1073451 - in /cassandra/branches/cassandra-0.7: CHANGES.txt
src/java/org/apache/cassandra/io/util/BufferedRandomAccessFile.java
Author: jbellis
Date: Tue Feb 22 18:40:32 2011
New Revision: 1073451
URL: http://svn.apache.org/viewvc?rev=1073451&view=rev
Log:
fix BRAF performancewhen seeking toEOF
patch by Ivan Georgiev; reviewed by tjake for CASSANDRA-2218
Modified:
cassandra/branches/cassandra-0.7/CHANGES.txt
cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/util/BufferedRandomAccessFile.java
Modified: cassandra/branches/cassandra-0.7/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/CHANGES.txt?rev=1073451&r1=1073450&r2=1073451&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.7/CHANGES.txt Tue Feb 22 18:40:32 2011
@@ -17,6 +17,7 @@
sstable (CASSANDRA-2211, -2216)
* fix sstable2json large-row pagination (CASSANDRA-2188)
* fix EOFing on requests for the last bytes in a file (CASSANDRA-2213)
+ * fix BRAF performance when seeking to EOF (CASSANDRA-2218)
0.7.2
Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/util/BufferedRandomAccessFile.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/util/BufferedRandomAccessFile.java?rev=1073451&r1=1073450&r2=1073451&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/util/BufferedRandomAccessFile.java (original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/util/BufferedRandomAccessFile.java Tue Feb 22 18:40:32 2011
@@ -53,9 +53,10 @@ public class BufferedRandomAccessFile ex
// buffer which will cache file blocks
private ByteBuffer buffer;
- // `current` as current position in file
- // `bufferOffset` is the offset of the beginning of the buffer
+ // `current` is the current user-visible position in in the file, i.e., corresponding to getFilePointer() or seek()
+ // `bufferOffset` is the position in the file of the beginning of the buffer
// `bufferEnd` is `bufferOffset` + count of bytes read from file, i.e. the lowest position we can't read from the buffer
+ // (NOT the same as bufferOffset + buffer.length since buffer may not be completely full)
private long bufferOffset, bufferEnd, current = 0;
// max buffer size is set according to (int size) parameter in the
@@ -196,12 +197,11 @@ public class BufferedRandomAccessFile ex
buffer.clear();
bufferOffset = current;
- if (bufferOffset > channel.size())
+ if (bufferOffset >= channel.size())
{
buffer.rewind();
bufferEnd = bufferOffset;
hitEOF = true;
-
return 0;
}