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 2009/08/25 00:03:35 UTC
svn commit: r807399 -
/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java
Author: jbellis
Date: Mon Aug 24 22:03:35 2009
New Revision: 807399
URL: http://svn.apache.org/viewvc?rev=807399&view=rev
Log:
[fixed version] avoid opening multiple writers for the current file; the buffered nature of the global logWriter_ could cause problems
patch by jbellis; reviewed for CASSANDRA-370 by Sammy Yu
Modified:
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java?rev=807399&r1=807398&r2=807399&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java Mon Aug 24 22:03:35 2009
@@ -247,16 +247,6 @@
}
/*
- * 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.
*/
@@ -509,7 +499,7 @@
* perform & operation and then turn on with the new position.
*/
commitLogHeader.turnOn(id, cLogCtx.position);
- writeCommitLogHeader(cLogCtx.file, commitLogHeader.toByteArray());
+ seekAndWriteCommitLogHeader(commitLogHeader.toByteArray());
break;
}
else
@@ -525,7 +515,9 @@
}
else
{
- writeCommitLogHeader(oldFile, oldCommitLogHeader.toByteArray());
+ RandomAccessFile logWriter = CommitLog.createWriter(oldFile);
+ writeCommitLogHeader(logWriter, oldCommitLogHeader.toByteArray());
+ logWriter.close();
}
}
}