You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ty...@apache.org on 2016/05/27 17:38:05 UTC

[1/2] cassandra git commit: Remove unneeded summary repair from CASSANDRA-8993

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.7 867a49009 -> a2dd00516


Remove unneeded summary repair from CASSANDRA-8993

Patch by Tyler Hobbs; review by Paulo Motta for CASSANDRA-11127


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

Branch: refs/heads/cassandra-3.7
Commit: 6f236c801be5b80fe18afc3ecebd4032c19b434d
Parents: 6f02446
Author: Tyler Hobbs <ty...@gmail.com>
Authored: Fri May 27 12:35:15 2016 -0500
Committer: Tyler Hobbs <ty...@gmail.com>
Committed: Fri May 27 12:35:15 2016 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 +
 .../io/sstable/format/SSTableReader.java        | 71 +-------------------
 2 files changed, 3 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6f236c80/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 3d166aa..103eff0 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
 3.0.7
+ * Remove unneeded code to repair index summaries that have
+   been improperly down-sampled (CASSANDRA-11127)
  * Avoid WriteTimeoutExceptions during commit log replay due to materialized
    view lock contention (CASSANDRA-11891)
  * Prevent OOM failures on SSTable corruption, improve tests for corruption detection (CASSANDRA-9530)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6f236c80/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java b/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java
index 9bb1767..9f2663e 100644
--- a/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java
+++ b/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java
@@ -744,30 +744,8 @@ public abstract class SSTableReader extends SSTable implements SelfRefCounted<SS
 
             dfile = dbuilder.buildData(descriptor, sstableMetadata);
 
-            // Check for an index summary that was downsampled even though the serialization format doesn't support
-            // that.  If it was downsampled, rebuild it.  See CASSANDRA-8993 for details.
-        if (!descriptor.version.hasSamplingLevel() && !builtSummary && !validateSummarySamplingLevel() && ifile != null)
-            {
-                indexSummary.close();
-                ifile.close();
-                dfile.close();
-
-                logger.info("Detected erroneously downsampled index summary; will rebuild summary at full sampling");
-                FileUtils.deleteWithConfirm(new File(descriptor.filenameFor(Component.SUMMARY)));
-
-                try(SegmentedFile.Builder ibuilderRebuild = SegmentedFile.getBuilder(DatabaseDescriptor.getIndexAccessMode(), false);
-                    SegmentedFile.Builder dbuilderRebuild = SegmentedFile.getBuilder(DatabaseDescriptor.getDiskAccessMode(), compression))
-                {
-                    buildSummary(false, ibuilderRebuild, dbuilderRebuild, false, Downsampling.BASE_SAMPLING_LEVEL);
-                    ifile = ibuilderRebuild.buildIndex(descriptor, indexSummary);
-                    dfile = dbuilderRebuild.buildData(descriptor, sstableMetadata);
-                    saveSummary(ibuilderRebuild, dbuilderRebuild);
-                }
-            }
-            else if (saveSummaryIfCreated && builtSummary)
-            {
+            if (saveSummaryIfCreated && builtSummary)
                 saveSummary(ibuilder, dbuilder);
-            }
         }
         catch (Throwable t)
         { // Because the tidier has not been set-up yet in SSTableReader.open(), we must release the files in case of error
@@ -901,53 +879,6 @@ public abstract class SSTableReader extends SSTable implements SelfRefCounted<SS
     }
 
     /**
-     * Validates that an index summary has full sampling, as expected when the serialization format does not support
-     * persisting the sampling level.
-     * @return true if the summary has full sampling, false otherwise
-     */
-    private boolean validateSummarySamplingLevel()
-    {
-        // We need to check index summary entries against the index to verify that none of them were dropped due to
-        // downsampling.  Downsampling can drop any of the first BASE_SAMPLING_LEVEL entries (repeating that drop pattern
-        // for the remainder of the summary).  Unfortunately, the first entry to be dropped is the entry at
-        // index (BASE_SAMPLING_LEVEL - 1), so we need to check a full set of BASE_SAMPLING_LEVEL entries.
-        if (ifile == null)
-            return false;
-
-        int i = 0;
-        int summaryEntriesChecked = 0;
-        int expectedIndexInterval = getMinIndexInterval();
-        String path = null;
-        try (FileDataInput in = ifile.createReader(0))
-        {
-            path = in.getPath();
-            while (!in.isEOF())
-            {
-                ByteBuffer indexKey = ByteBufferUtil.readWithShortLength(in);
-                if (i % expectedIndexInterval == 0)
-                {
-                    ByteBuffer summaryKey = ByteBuffer.wrap(indexSummary.getKey(i / expectedIndexInterval));
-                    if (!summaryKey.equals(indexKey))
-                        return false;
-                    summaryEntriesChecked++;
-
-                    if (summaryEntriesChecked == Downsampling.BASE_SAMPLING_LEVEL)
-                        return true;
-                }
-                RowIndexEntry.Serializer.skip(in, descriptor.version);
-                i++;
-            }
-        }
-        catch (IOException e)
-        {
-            markSuspect();
-            throw new CorruptSSTableException(e, path);
-        }
-
-        return true;
-    }
-
-    /**
      * Save index summary to Summary.db file.
      *
      * @param ibuilder


[2/2] cassandra git commit: Merge branch 'cassandra-3.0' into cassandra-3.7

Posted by ty...@apache.org.
Merge branch 'cassandra-3.0' into cassandra-3.7

Conflicts:
	CHANGES.txt
	src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java


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

Branch: refs/heads/cassandra-3.7
Commit: a2dd00516988147f3d8a1e01ce330aa93d0024c2
Parents: 867a490 6f236c8
Author: Tyler Hobbs <ty...@gmail.com>
Authored: Fri May 27 12:37:55 2016 -0500
Committer: Tyler Hobbs <ty...@gmail.com>
Committed: Fri May 27 12:37:55 2016 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 +
 .../io/sstable/format/SSTableReader.java        | 71 +-------------------
 2 files changed, 3 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/a2dd0051/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 2ceeea9,103eff0..0c447f5
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,6 -1,6 +1,8 @@@
 -3.0.7
 +3.7
 + * Don't use static dataDirectories field in Directories instances (CASSANDRA-11647)
 +Merged from 3.0:
+  * Remove unneeded code to repair index summaries that have
+    been improperly down-sampled (CASSANDRA-11127)
   * Avoid WriteTimeoutExceptions during commit log replay due to materialized
     view lock contention (CASSANDRA-11891)
   * Prevent OOM failures on SSTable corruption, improve tests for corruption detection (CASSANDRA-9530)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a2dd0051/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java
----------------------------------------------------------------------