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 2014/09/30 21:11:19 UTC
[3/6] git commit: Archive any commitlog segments present at startup
patch by Sam Tunnicliffe; reviewed by bes and jbellis for CASSANDRA-6904
Archive any commitlog segments present at startup
patch by Sam Tunnicliffe; reviewed by bes and jbellis for CASSANDRA-6904
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/7bff1835
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/7bff1835
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/7bff1835
Branch: refs/heads/trunk
Commit: 7bff18357e1e9227c13016b1c5b5e1a71db4f811
Parents: aa7794c
Author: Jonathan Ellis <jb...@apache.org>
Authored: Tue Sep 30 14:08:16 2014 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Tue Sep 30 14:08:16 2014 -0500
----------------------------------------------------------------------
CHANGES.txt | 4 ++++
.../apache/cassandra/db/commitlog/CommitLog.java | 17 +++++++++++++----
2 files changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/7bff1835/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 5902d75..6f59a29 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,7 @@
+2.0.12:
+ * Archive any commitlog segments present at startup (CASSANDRA-6904)
+
+
2.0.11:
* Ignore fat clients when checking for endpoint collision (CASSANDRA-7939)
* CrcCheckChance should adjust based on live CFMetadata not
http://git-wip-us.apache.org/repos/asf/cassandra/blob/7bff1835/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLog.java b/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
index 4bab83f..0e2f5bf 100644
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
@@ -106,9 +106,7 @@ public class CommitLog implements CommitLogMBean
*/
public int recover() throws IOException
{
- archiver.maybeRestoreArchive();
-
- File[] files = new File(DatabaseDescriptor.getCommitLogLocation()).listFiles(new FilenameFilter()
+ FilenameFilter unmanagedFilesFilter = new FilenameFilter()
{
public boolean accept(File dir, String name)
{
@@ -117,8 +115,19 @@ public class CommitLog implements CommitLogMBean
// ahead and allow writes before recover(), and just skip active segments when we do.
return CommitLogDescriptor.isValid(name) && !instance.allocator.manages(name);
}
- });
+ };
+
+ // submit all existing files in the commit log dir for archiving prior to recovery - CASSANDRA-6904
+ for (File file : new File(DatabaseDescriptor.getCommitLogLocation()).listFiles(unmanagedFilesFilter))
+ {
+ archiver.maybeArchive(file.getPath(), file.getName());
+ archiver.maybeWaitForArchiving(file.getName());
+ }
+
+ assert archiver.archivePending.isEmpty() : "Not all commit log archive tasks were completed before restore";
+ archiver.maybeRestoreArchive();
+ File[] files = new File(DatabaseDescriptor.getCommitLogLocation()).listFiles(unmanagedFilesFilter);
int replayed = 0;
if (files.length == 0)
{