You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2020/07/16 15:19:57 UTC

[GitHub] [cassandra] smiklosovic opened a new pull request #681: CASSANDRA-15191 - stop gossip and transport on stop_paranoid disk failure policy - branch 3.11

smiklosovic opened a new pull request #681:
URL: https://github.com/apache/cassandra/pull/681


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] dcapwell commented on a change in pull request #681: CASSANDRA-15191 - stop gossip and transport on stop_paranoid disk failure policy - branch 3.11

Posted by GitBox <gi...@apache.org>.
dcapwell commented on a change in pull request #681:
URL: https://github.com/apache/cassandra/pull/681#discussion_r458267773



##########
File path: test/distributed/org/apache/cassandra/distributed/test/JVMStabilityInspectorCorruptSSTableExceptionTest.java
##########
@@ -0,0 +1,210 @@
+/*
+ * 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+package org.apache.cassandra.distributed.test;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.junit.Test;
+
+import junit.framework.Assert;
+import org.apache.cassandra.config.Config.DiskFailurePolicy;
+import org.apache.cassandra.db.ColumnFamilyStore;
+import org.apache.cassandra.db.DecoratedKey;
+import org.apache.cassandra.db.Keyspace;
+import org.apache.cassandra.db.RowIndexEntry;
+import org.apache.cassandra.db.Slices;
+import org.apache.cassandra.db.filter.ColumnFilter;
+import org.apache.cassandra.db.rows.UnfilteredRowIterator;
+import org.apache.cassandra.distributed.Cluster;
+import org.apache.cassandra.distributed.api.ConsistencyLevel;
+import org.apache.cassandra.distributed.api.IInvokableInstance;
+import org.apache.cassandra.distributed.api.IIsolatedExecutor.SerializableCallable;
+import org.apache.cassandra.distributed.shared.AbstractBuilder;
+import org.apache.cassandra.distributed.shared.NetworkTopology;
+import org.apache.cassandra.gms.Gossiper;
+import org.apache.cassandra.io.sstable.CorruptSSTableException;
+import org.apache.cassandra.io.sstable.format.ForwardingSSTableReader;
+import org.apache.cassandra.io.sstable.format.SSTableReader;
+import org.apache.cassandra.io.sstable.format.SSTableReadsListener;
+import org.apache.cassandra.io.util.FileDataInput;
+import org.apache.cassandra.io.util.FileUtils;
+import org.apache.cassandra.service.CassandraDaemon;
+import org.apache.cassandra.service.DefaultFSErrorHandler;
+import org.apache.cassandra.service.StorageService;
+
+import static org.apache.cassandra.distributed.api.Feature.GOSSIP;
+import static org.apache.cassandra.distributed.api.Feature.NATIVE_PROTOCOL;
+import static org.apache.cassandra.distributed.api.Feature.NETWORK;
+
+public class JVMStabilityInspectorCorruptSSTableExceptionTest extends TestBaseImpl
+{
+    @Test
+    public void testAbstractLocalAwareExecutorServiceOnIgnoredDiskFailurePolicy() throws Exception
+    {
+        test(DiskFailurePolicy.ignore, true, true);
+    }
+
+    @Test
+    public void testAbstractLocalAwareExecutorServiceOnStopParanoidDiskFailurePolicy() throws Exception
+    {
+        test(DiskFailurePolicy.stop_paranoid, false, false);
+    }
+
+    private static void test(DiskFailurePolicy policy, boolean expectNativeTransportRunning, boolean expectGossiperEnabled) throws Exception
+    {
+        String table = policy.name();
+        try (final Cluster cluster = init(getCluster(policy).start()))
+        {
+            IInvokableInstance node = cluster.get(1);
+
+            Boolean[] setup = node.callOnInstance((SerializableCallable<Boolean[]>) () -> {
+                CassandraDaemon instanceForTesting = CassandraDaemon.getInstanceForTesting();
+                instanceForTesting.completeSetup();
+                StorageService.instance.registerDaemon(instanceForTesting);
+                FileUtils.setFSErrorHandler(new DefaultFSErrorHandler());
+
+                return new Boolean[]{ StorageService.instance.isNativeTransportRunning(), Gossiper.instance.isEnabled() };
+            });
+
+            // make sure environment is setup propertly
+            Assert.assertTrue("Native support is not running, test is not ready!", setup[0]);
+            Assert.assertTrue("Gossiper is not running, test is not ready!", setup[1]);
+
+            cluster.schemaChange("CREATE TABLE " + KEYSPACE + '.' + table + " (id bigint PRIMARY KEY)");
+            node.executeInternal("INSERT INTO " + KEYSPACE + '.' + table + " (id) VALUES (?)", 0L);
+
+            corruptTable(node, KEYSPACE, table);
+
+            try
+            {
+                cluster.coordinator(1).execute("SELECT * FROM " + KEYSPACE + '.' + table + " WHERE id=?", ConsistencyLevel.ONE, 0L);
+                Assert.fail("Select should fail as we corrupted SSTable on purpose.");
+            }
+            catch (final Exception ex)
+            {
+                // we expect that above query fails as we corrupted an sstable
+            }
+
+            waitForStop(!expectGossiperEnabled, node, new SerializableCallable<Boolean>()
+            {
+                public Boolean call()
+                {
+                    return Gossiper.instance.isEnabled();
+                }
+            });
+
+            waitForStop(!expectNativeTransportRunning, node, new SerializableCallable<Boolean>()
+            {
+                public Boolean call()
+                {
+                    return StorageService.instance.isNativeTransportRunning();
+                }
+            });
+        }
+    }
+
+    private static void waitForStop(boolean shouldWaitForStop,
+                                    IInvokableInstance node,
+                                    SerializableCallable<Boolean> serializableCallable) throws Exception
+    {
+        int attempts = 3;
+        boolean running = true;
+
+        while (attempts > 0 && running)
+        {
+            try
+            {
+                running = node.callOnInstance(serializableCallable);
+                attempts--;
+            }
+            catch (final NoClassDefFoundError ex)

Review comment:
       these feel like jvm-dtest bugs, can you file a ticket for this?

##########
File path: test/distributed/org/apache/cassandra/distributed/test/JVMStabilityInspectorCorruptSSTableExceptionTest.java
##########
@@ -0,0 +1,210 @@
+/*
+ * 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+package org.apache.cassandra.distributed.test;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.junit.Test;
+
+import junit.framework.Assert;
+import org.apache.cassandra.config.Config.DiskFailurePolicy;
+import org.apache.cassandra.db.ColumnFamilyStore;
+import org.apache.cassandra.db.DecoratedKey;
+import org.apache.cassandra.db.Keyspace;
+import org.apache.cassandra.db.RowIndexEntry;
+import org.apache.cassandra.db.Slices;
+import org.apache.cassandra.db.filter.ColumnFilter;
+import org.apache.cassandra.db.rows.UnfilteredRowIterator;
+import org.apache.cassandra.distributed.Cluster;
+import org.apache.cassandra.distributed.api.ConsistencyLevel;
+import org.apache.cassandra.distributed.api.IInvokableInstance;
+import org.apache.cassandra.distributed.api.IIsolatedExecutor.SerializableCallable;
+import org.apache.cassandra.distributed.shared.AbstractBuilder;
+import org.apache.cassandra.distributed.shared.NetworkTopology;
+import org.apache.cassandra.gms.Gossiper;
+import org.apache.cassandra.io.sstable.CorruptSSTableException;
+import org.apache.cassandra.io.sstable.format.ForwardingSSTableReader;
+import org.apache.cassandra.io.sstable.format.SSTableReader;
+import org.apache.cassandra.io.sstable.format.SSTableReadsListener;
+import org.apache.cassandra.io.util.FileDataInput;
+import org.apache.cassandra.io.util.FileUtils;
+import org.apache.cassandra.service.CassandraDaemon;
+import org.apache.cassandra.service.DefaultFSErrorHandler;
+import org.apache.cassandra.service.StorageService;
+
+import static org.apache.cassandra.distributed.api.Feature.GOSSIP;
+import static org.apache.cassandra.distributed.api.Feature.NATIVE_PROTOCOL;
+import static org.apache.cassandra.distributed.api.Feature.NETWORK;
+
+public class JVMStabilityInspectorCorruptSSTableExceptionTest extends TestBaseImpl
+{
+    @Test
+    public void testAbstractLocalAwareExecutorServiceOnIgnoredDiskFailurePolicy() throws Exception
+    {
+        test(DiskFailurePolicy.ignore, true, true);
+    }
+
+    @Test
+    public void testAbstractLocalAwareExecutorServiceOnStopParanoidDiskFailurePolicy() throws Exception
+    {
+        test(DiskFailurePolicy.stop_paranoid, false, false);
+    }
+
+    private static void test(DiskFailurePolicy policy, boolean expectNativeTransportRunning, boolean expectGossiperEnabled) throws Exception
+    {
+        String table = policy.name();
+        try (final Cluster cluster = init(getCluster(policy).start()))
+        {
+            IInvokableInstance node = cluster.get(1);
+
+            Boolean[] setup = node.callOnInstance((SerializableCallable<Boolean[]>) () -> {
+                CassandraDaemon instanceForTesting = CassandraDaemon.getInstanceForTesting();
+                instanceForTesting.completeSetup();
+                StorageService.instance.registerDaemon(instanceForTesting);
+                FileUtils.setFSErrorHandler(new DefaultFSErrorHandler());

Review comment:
       was this needed?  I removed in trunk since jvm dtest adds this already




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] smiklosovic closed pull request #681: CASSANDRA-15191 - stop gossip and transport on stop_paranoid disk failure policy - branch 3.11

Posted by GitBox <gi...@apache.org>.
smiklosovic closed pull request #681:
URL: https://github.com/apache/cassandra/pull/681


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] smiklosovic commented on pull request #681: CASSANDRA-15191 - stop gossip and transport on stop_paranoid disk failure policy - branch 3.11

Posted by GitBox <gi...@apache.org>.
smiklosovic commented on pull request #681:
URL: https://github.com/apache/cassandra/pull/681#issuecomment-675986883


   closing as that is already merged


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org