[
https://issues.apache.org/jira/browse/CASSANDRA-2256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13001625#comment-13001625
]
Pavel Yaskevich commented on CASSANDRA-2256:
--------------------------------------------
Seems that we don't understand each other here :)
seek method will look like this:
{code}
public void seek(long newPosition) throws IOException
{
if (newPosition < 0)
throw new IllegalArgumentException("new position should not be
negative");
if (fileLength != -1 && newPosition > fileLength)
throw new EOFException("unable to seek past the end of the file in
read-only mode.");
current = newPosition;
if (newPosition >= bufferOffset + validBufferBytes || newPosition <
bufferOffset)
reBuffer(); // this will set bufferEnd for us
}
{code}
We set fileLength = -1 for "rw" mode and caching fileLength = channel.size()
for "r" mode files, so condition "fileLength != -1 && newPosition > fileLength"
will allow us to block seeking past the end of the file in "r" mode leaving
"rw" untouched (which makes a good sense even if it's unused right now and lets
us avoid calling length() for every seek()).
> BRAF assertion error
> --------------------
>
> Key: CASSANDRA-2256
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2256
> Project: Cassandra
> Issue Type: Bug
> Components: Core
> Affects Versions: 0.7.3
> Reporter: Jonathan Ellis
> Assignee: Pavel Yaskevich
> Fix For: 0.7.4
>
> Attachments: CASSANDRA-2256.patch
>
>
> While investigating CASSANDRA-2240 I ran into this:
> {noformat}
> java.lang.AssertionError
> at
> org.apache.cassandra.io.util.BufferedRandomAccessFile.read(BufferedRandomAccessFile.java\
> :230)
> at java.io.RandomAccessFile.readByte(RandomAccessFile.java:589)
> at
> org.apache.cassandra.utils.ByteBufferUtil.readShortLength(ByteBufferUtil.java:273)
> at
> org.apache.cassandra.utils.ByteBufferUtil.readWithShortLength(ByteBufferUtil.java:284)
> at
> org.apache.cassandra.db.CompactionManager.doScrub(CompactionManager.java:539)
> {noformat}
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira