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/24 23:13:32 UTC
svn commit: r807381 -
/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java
Author: jbellis
Date: Mon Aug 24 21:13:32 2009
New Revision: 807381
URL: http://svn.apache.org/viewvc?rev=807381&view=rev
Log:
Revert "CASSANDRA-370 avoid opening multiple writers for the current file; the buffered nature of the global logWriter_ could cause problems"
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=807381&r1=807380&r2=807381&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 21:13:32 2009
@@ -247,6 +247,16 @@
}
/*
+ * 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 @@
* 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 @@
}
else
{
- RandomAccessFile logWriter = CommitLog.createWriter(oldFile);
- writeCommitLogHeader(logWriter, oldCommitLogHeader.toByteArray());
- logWriter.close();
+ writeCommitLogHeader(oldFile, oldCommitLogHeader.toByteArray());
}
}
}