mirror of https://github.com/apache/cassandra
Revert "CASSANDRA-370 avoid opening multiple writers for the current file; the buffered nature of the global logWriter_ could cause problems"
git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@807381 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
12cbf75280
commit
39d97f3892
|
|
@ -246,6 +246,16 @@ public class CommitLog
|
|||
return CommitLogHeader.serializer().deserialize(new DataInputStream(byteStream));
|
||||
}
|
||||
|
||||
/*
|
||||
* Write the serialized commit log header into the specified commit log.
|
||||
*/
|
||||
private static void writeCommitLogHeader(String commitLogFileName, byte[] bytes) throws IOException
|
||||
{
|
||||
RandomAccessFile logWriter = CommitLog.createWriter(commitLogFileName);
|
||||
writeCommitLogHeader(logWriter, bytes);
|
||||
logWriter.close();
|
||||
}
|
||||
|
||||
/*
|
||||
* This is invoked on startup via the ctor. It basically
|
||||
* writes a header with all bits set to zero.
|
||||
|
|
@ -499,7 +509,7 @@ public class CommitLog
|
|||
* perform & operation and then turn on with the new position.
|
||||
*/
|
||||
commitLogHeader.turnOn(id, cLogCtx.position);
|
||||
writeCommitLogHeader(logWriter_, commitLogHeader.toByteArray());
|
||||
writeCommitLogHeader(cLogCtx.file, commitLogHeader.toByteArray());
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
|
@ -515,9 +525,7 @@ public class CommitLog
|
|||
}
|
||||
else
|
||||
{
|
||||
RandomAccessFile logWriter = CommitLog.createWriter(oldFile);
|
||||
writeCommitLogHeader(logWriter, oldCommitLogHeader.toByteArray());
|
||||
logWriter.close();
|
||||
writeCommitLogHeader(oldFile, oldCommitLogHeader.toByteArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue