cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject cassandra git commit: guard against legacy migration failure due to non-existent index name patch by dbrosius, reviewed by stunnicliffe for CASSANDRA-10966
Date Tue, 05 Jan 2016 12:38:09 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk bbaa88d68 -> 3962149ac


guard against legacy migration failure due to non-existent index name
patch by dbrosius, reviewed by stunnicliffe for CASSANDRA-10966


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

Branch: refs/heads/trunk
Commit: 3962149ac8a66083e8c0cdf9c1dab001b2b1d6dd
Parents: bbaa88d
Author: Dave Brosius <dbrosius@mebigfatguy.com>
Authored: Tue Jan 5 07:37:03 2016 -0500
Committer: Dave Brosius <dbrosius@mebigfatguy.com>
Committed: Tue Jan 5 07:37:03 2016 -0500

----------------------------------------------------------------------
 .../cassandra/schema/LegacySchemaMigrator.java  | 35 +++++++++++---------
 1 file changed, 20 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/3962149a/src/java/org/apache/cassandra/schema/LegacySchemaMigrator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/schema/LegacySchemaMigrator.java b/src/java/org/apache/cassandra/schema/LegacySchemaMigrator.java
index 9008cc8..de48256 100644
--- a/src/java/org/apache/cassandra/schema/LegacySchemaMigrator.java
+++ b/src/java/org/apache/cassandra/schema/LegacySchemaMigrator.java
@@ -628,21 +628,26 @@ public final class LegacySchemaMigrator
             if (row.has("index_options"))
                 indexOptions = fromJsonMap(row.getString("index_options"));
 
-            String indexName = null;
-            if (row.has("index_name"))
-                indexName = row.getString("index_name");
-
-            ColumnDefinition column = createColumnFromColumnRow(row,
-                                                                keyspace,
-                                                                table,
-                                                                rawComparator,
-                                                                rawSubComparator,
-                                                                isSuper,
-                                                                isCQLTable,
-                                                                isStaticCompactTable,
-                                                                needsUpgrade);
-
-            indexes.add(IndexMetadata.fromLegacyMetadata(cfm, column, indexName, kind, indexOptions));
+            if (row.has("index_name")) 
+            {
+                String indexName = row.getString("index_name");
+
+                ColumnDefinition column = createColumnFromColumnRow(row,
+                                                                    keyspace,
+                                                                    table,
+                                                                    rawComparator,
+                                                                    rawSubComparator,
+                                                                    isSuper,
+                                                                    isCQLTable,
+                                                                    isStaticCompactTable,
+                                                                    needsUpgrade);
+    
+                indexes.add(IndexMetadata.fromLegacyMetadata(cfm, column, indexName, kind,
indexOptions));
+            } 
+            else 
+            {
+                logger.error("Failed to find index name for legacy migration of index on
{}.{}", keyspace, table);
+            }
         }
 
         return indexes.build();


Mime
View raw message