cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcken...@apache.org
Subject [2/6] cassandra git commit: Fix assertion in LogFile when disk is full
Date Fri, 13 Nov 2015 15:04:03 GMT
Fix assertion in LogFile when disk is full

Patch by stefania; reviewed by aweisberg for CASSANDRA-10538


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/32239272
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/32239272
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/32239272

Branch: refs/heads/cassandra-3.1
Commit: 32239272924e3bf8053aa51adc86d83ceeb39268
Parents: cb102da
Author: Stefania Alborghetti <stefania.alborghetti@datastax.com>
Authored: Fri Nov 13 10:02:10 2015 -0500
Committer: Joshua McKenzie <jmckenzie@apache.org>
Committed: Fri Nov 13 10:02:10 2015 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/db/lifecycle/LogFile.java       | 7 ++++---
 .../org/apache/cassandra/db/lifecycle/LogTransaction.java     | 6 ++----
 2 files changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/32239272/src/java/org/apache/cassandra/db/lifecycle/LogFile.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/lifecycle/LogFile.java b/src/java/org/apache/cassandra/db/lifecycle/LogFile.java
index 4318f9c..8657869 100644
--- a/src/java/org/apache/cassandra/db/lifecycle/LogFile.java
+++ b/src/java/org/apache/cassandra/db/lifecycle/LogFile.java
@@ -274,11 +274,12 @@ final class LogFile
 
     private boolean addRecord(LogRecord record)
     {
-        if (!records.add(record))
+        if (records.contains(record))
             return false;
 
         replicas.append(record);
-        return true;
+
+        return records.add(record);
     }
 
     void remove(Type type, SSTable table)
@@ -286,8 +287,8 @@ final class LogFile
         LogRecord record = makeRecord(type, table);
         assert records.contains(record) : String.format("[%s] is not tracked by %s", record,
id);
 
-        records.remove(record);
         deleteRecordFiles(record);
+        records.remove(record);
     }
 
     boolean contains(Type type, SSTable table)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/32239272/src/java/org/apache/cassandra/db/lifecycle/LogTransaction.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/lifecycle/LogTransaction.java b/src/java/org/apache/cassandra/db/lifecycle/LogTransaction.java
index 8b82207..ce76165 100644
--- a/src/java/org/apache/cassandra/db/lifecycle/LogTransaction.java
+++ b/src/java/org/apache/cassandra/db/lifecycle/LogTransaction.java
@@ -367,14 +367,12 @@ class LogTransaction extends Transactional.AbstractTransactional implements
Tran
 
     protected Throwable doCommit(Throwable accumulate)
     {
-        txnFile.commit();
-        return complete(accumulate);
+        return complete(Throwables.perform(accumulate, txnFile::commit));
     }
 
     protected Throwable doAbort(Throwable accumulate)
     {
-        txnFile.abort();
-        return complete(accumulate);
+        return complete(Throwables.perform(accumulate, txnFile::abort));
     }
 
     protected void doPrepare() { }


Mime
View raw message