cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marc...@apache.org
Subject [03/10] cassandra git commit: Properly release sstable reference when doing offline scrub
Date Thu, 11 Feb 2016 07:30:31 GMT
Properly release sstable reference when doing offline scrub

Patch by marcuse; reviewed by Stefania for CASSANDRA-10697


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

Branch: refs/heads/cassandra-3.0
Commit: 96549946fe994ea8311e72e5bf6f51c2124f7bb4
Parents: 6c6b7e4
Author: Marcus Eriksson <marcuse@apache.org>
Authored: Tue Feb 9 09:53:59 2016 +0100
Committer: Marcus Eriksson <marcuse@apache.org>
Committed: Thu Feb 11 08:20:47 2016 +0100

----------------------------------------------------------------------
 CHANGES.txt                                         |   1 +
 .../apache/cassandra/db/compaction/Scrubber.java    |   4 ++++
 .../apache/cassandra/tools/StandaloneScrubber.java  |   5 ++++-
 .../Keyspace1-Standard3-jb-1-Summary.db             | Bin 63 -> 75 bytes
 .../Keyspace1-StandardInteger1-ka-2-Summary.db      | Bin 80 -> 112 bytes
 5 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/96549946/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 3bbef11..9f51291 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.14
+ * Properly release sstable ref when doing offline scrub (CASSANDRA-10697)
  * Improve nodetool status performance for large cluster (CASSANDRA-7238)
  * Make it clear what DTCS timestamp_resolution is used for (CASSANDRA-11041)
  * Gossiper#isEnabled is not thread safe (CASSANDRA-11116)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/96549946/src/java/org/apache/cassandra/db/compaction/Scrubber.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/Scrubber.java b/src/java/org/apache/cassandra/db/compaction/Scrubber.java
index e02f901..8bfd37b 100644
--- a/src/java/org/apache/cassandra/db/compaction/Scrubber.java
+++ b/src/java/org/apache/cassandra/db/compaction/Scrubber.java
@@ -300,6 +300,8 @@ public class Scrubber implements Closeable
                 newInOrderSstable = inOrderWriter.closeAndOpenReader(sstable.maxDataAge);
                 if (!isOffline)
                     cfs.getDataTracker().addSSTables(Collections.singleton(newInOrderSstable));
+                else if (newInOrderSstable != null)
+                    newInOrderSstable.selfRef().release();
                 outputHandler.warn(String.format("%d out of order rows found while scrubbing
%s; Those have been written (in order) to a new sstable (%s)", outOfOrderRows.size(), sstable,
newInOrderSstable));
             }
 
@@ -318,6 +320,8 @@ public class Scrubber implements Closeable
         finally
         {
             controller.close();
+            if (isOffline && newSstable != null)
+                newSstable.selfRef().release();
         }
 
         if (newSstable == null)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/96549946/src/java/org/apache/cassandra/tools/StandaloneScrubber.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/StandaloneScrubber.java b/src/java/org/apache/cassandra/tools/StandaloneScrubber.java
index 79ba0bd..fdf6c8d 100644
--- a/src/java/org/apache/cassandra/tools/StandaloneScrubber.java
+++ b/src/java/org/apache/cassandra/tools/StandaloneScrubber.java
@@ -122,13 +122,16 @@ public class StandaloneScrubber
 
                         // Remove the sstable (it's been copied by scrub and snapshotted)
                         sstable.markObsolete(null);
-                        sstable.selfRef().release();
                     }
                     catch (Exception e)
                     {
                         System.err.println(String.format("Error scrubbing %s: %s", sstable,
e.getMessage()));
                         e.printStackTrace(System.err);
                     }
+                    finally
+                    {
+                        sstable.selfRef().release();
+                    }
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/96549946/test/data/corrupt-sstables/Keyspace1-Standard3-jb-1-Summary.db
----------------------------------------------------------------------
diff --git a/test/data/corrupt-sstables/Keyspace1-Standard3-jb-1-Summary.db b/test/data/corrupt-sstables/Keyspace1-Standard3-jb-1-Summary.db
index 7621f07..6eb7650 100644
Binary files a/test/data/corrupt-sstables/Keyspace1-Standard3-jb-1-Summary.db and b/test/data/corrupt-sstables/Keyspace1-Standard3-jb-1-Summary.db
differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/96549946/test/data/corrupt-sstables/Keyspace1-StandardInteger1-ka-2-Summary.db
----------------------------------------------------------------------
diff --git a/test/data/corrupt-sstables/Keyspace1-StandardInteger1-ka-2-Summary.db b/test/data/corrupt-sstables/Keyspace1-StandardInteger1-ka-2-Summary.db
index 22cfa6a..190922a 100644
Binary files a/test/data/corrupt-sstables/Keyspace1-StandardInteger1-ka-2-Summary.db and b/test/data/corrupt-sstables/Keyspace1-StandardInteger1-ka-2-Summary.db
differ


Mime
View raw message