cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [9/10] git commit: delete hints from dropped ColumnFamilies on handoff instead of erroring out patch by jbellis; reviewed by brandonwilliams for CASSANDRA-3975
Date Wed, 29 Feb 2012 03:16:01 GMT
delete hints from dropped ColumnFamilies on handoff instead of erroring out
patch by jbellis; reviewed by brandonwilliams for CASSANDRA-3975


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

Branch: refs/heads/cassandra-1.1.0
Commit: 24a70804086a07409fef1303f7c53327661806bc
Parents: 4a49b9d
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Tue Feb 28 15:05:28 2012 -0600
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Tue Feb 28 21:13:43 2012 -0600

----------------------------------------------------------------------
 CHANGES.txt                                        |    2 +
 .../cassandra/db/ColumnFamilySerializer.java       |    5 +--
 .../apache/cassandra/db/HintedHandOffManager.java  |   18 +++++++-
 .../cassandra/db/UnknownColumnFamilyException.java |   33 +++++++++++++++
 .../db/UnserializableColumnFamilyException.java    |   33 ---------------
 .../apache/cassandra/db/commitlog/CommitLog.java   |    2 +-
 6 files changed, 52 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/24a70804/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 31ae77d..cb6c255 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,7 @@
 1.0.9
  * always compact away deleted hints immediately after handoff (CASSANDRA-3955)
+ * delete hints from dropped ColumnFamilies on handoff instead of
+   erroring out (CASSANDRA-3975)
 
 
 1.0.8

http://git-wip-us.apache.org/repos/asf/cassandra/blob/24a70804/src/java/org/apache/cassandra/db/ColumnFamilySerializer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnFamilySerializer.java b/src/java/org/apache/cassandra/db/ColumnFamilySerializer.java
index 7f11948..abfe76c 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamilySerializer.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilySerializer.java
@@ -24,17 +24,14 @@ package org.apache.cassandra.db;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
-import java.io.RandomAccessFile;
 import java.util.Collection;
 
 import org.apache.cassandra.config.Schema;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.io.IColumnSerializer;
 import org.apache.cassandra.io.ISerializer;
-import org.apache.cassandra.io.sstable.SSTableMetadata;
 
 public class ColumnFamilySerializer implements ISerializer<ColumnFamily>
 {
@@ -126,7 +123,7 @@ public class ColumnFamilySerializer implements ISerializer<ColumnFamily>
         // create a ColumnFamily based on the cf id
         int cfId = dis.readInt();
         if (Schema.instance.getCF(cfId) == null)
-            throw new UnserializableColumnFamilyException("Couldn't find cfId=" + cfId, cfId);
+            throw new UnknownColumnFamilyException("Couldn't find cfId=" + cfId, cfId);
         ColumnFamily cf = ColumnFamily.create(cfId, factory);
         deserializeFromSSTableNoColumns(cf, dis);
         deserializeColumns(dis, cf, flag);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/24a70804/src/java/org/apache/cassandra/db/HintedHandOffManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/HintedHandOffManager.java b/src/java/org/apache/cassandra/db/HintedHandOffManager.java
index ca416d7..a9f979f 100644
--- a/src/java/org/apache/cassandra/db/HintedHandOffManager.java
+++ b/src/java/org/apache/cassandra/db/HintedHandOffManager.java
@@ -349,13 +349,25 @@ public class HintedHandOffManager implements HintedHandOffManagerMBean
                 assert keyColumn != null;
                 assert mutationColumn != null;
                 DataInputStream in = new DataInputStream(ByteBufferUtil.inputStream(mutationColumn.value()));
-                RowMutation rm = RowMutation.serializer().deserialize(in, ByteBufferUtil.toInt(versionColumn.value()));
+                RowMutation rm;
+                try
+                {
+                    rm = RowMutation.serializer().deserialize(in, ByteBufferUtil.toInt(versionColumn.value()));
+                }
+                catch (UnknownColumnFamilyException e)
+                {
+                    logger_.debug("Skipping delivery of hint for deleted columnfamily", e);
+                    rm = null;
+                }
 
                 try
                 {
-                    sendMutation(endpoint, rm);
+                    if (rm != null)
+                    {
+                        sendMutation(endpoint, rm);
+                        rowsReplayed++;
+                    }
                     deleteHint(tokenBytes, hint.name(), hint.maxTimestamp());
-                    rowsReplayed++;
                 }
                 catch (TimeoutException e)
                 {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/24a70804/src/java/org/apache/cassandra/db/UnknownColumnFamilyException.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/UnknownColumnFamilyException.java b/src/java/org/apache/cassandra/db/UnknownColumnFamilyException.java
new file mode 100644
index 0000000..e371262
--- /dev/null
+++ b/src/java/org/apache/cassandra/db/UnknownColumnFamilyException.java
@@ -0,0 +1,33 @@
+package org.apache.cassandra.db;
+
+import java.io.IOException;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+public class UnknownColumnFamilyException extends IOException
+{
+    public final int cfId;
+    
+    public UnknownColumnFamilyException(String msg, int cfId)
+    {
+        super(msg);
+        this.cfId = cfId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cassandra/blob/24a70804/src/java/org/apache/cassandra/db/UnserializableColumnFamilyException.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/UnserializableColumnFamilyException.java b/src/java/org/apache/cassandra/db/UnserializableColumnFamilyException.java
deleted file mode 100644
index df46b28..0000000
--- a/src/java/org/apache/cassandra/db/UnserializableColumnFamilyException.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.apache.cassandra.db;
-
-import java.io.IOException;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-public class UnserializableColumnFamilyException extends IOException
-{
-    public final int cfId;
-    
-    public UnserializableColumnFamilyException(String msg, int cfId)
-    {
-        super(msg);
-        this.cfId = cfId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cassandra/blob/24a70804/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 c4942d2..1a5509e 100644
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
@@ -285,7 +285,7 @@ public class CommitLog implements CommitLogMBean
                         // the current version.  so do make sure the CL is drained prior
to upgrading a node.
                         rm = RowMutation.serializer().deserialize(new DataInputStream(bufIn),
MessagingService.version_, IColumnSerializer.Flag.LOCAL);
                     }
-                    catch (UnserializableColumnFamilyException ex)
+                    catch (UnknownColumnFamilyException ex)
                     {
                         AtomicInteger i = invalidMutations.get(ex.cfId);
                         if (i == null)


Mime
View raw message