Bug: Flaky TestConsistency.test_13880
Status: Resolved
Priority: Normal
Resolution: Fixed
Created: 07/Jun/21 07:31
Resolved: 08/Jun/21 05:45

Flaky [TestConsistency.test_13880|https://ci-cassandra.apache.org/job/Cassandra-4.0.0/8/testReport/junit/dtest.consistency_test/TestConsistency/test_13880/]

{noformat}
Error Message

cassandra.Unavailable: Error from server: code=1000 [Unavailable exception] message="Cannot achieve consistency level ALL" info={'consistency': 'ALL', 'required_replicas': 2, 'alive_replicas': 1}

Stacktrace

self = <consistency_test.TestConsistency object at 0x7f9d2245d070>

    @since('3.0')
    @ported_to_in_jvm('4.0')
    def test_13880(self):
        """
            @jira_ticket CASSANDRA-13880
            """
        cluster = self.cluster
    
        # disable hinted handoff and set batch commit log so this doesn't interfere with the test
        cluster.set_configuration_options(values={'hinted_handoff_enabled': False})
        cluster.set_batch_commitlog(enabled=True)
    
        cluster.populate(2).start()
        node1, node2 = cluster.nodelist()
    
        session = self.patient_cql_connection(node1)
    
        query = "CREATE KEYSPACE IF NOT EXISTS test WITH replication = {'class': 'NetworkTopologyStrategy', 'datacenter1': 2};"
        session.execute(query)
    
        query = "CREATE TABLE IF NOT EXISTS test.test (id int PRIMARY KEY);"
        session.execute(query)
    
        stmt = SimpleStatement("INSERT INTO test.test (id) VALUES (0);",
                               consistency_level=ConsistencyLevel.ALL)
        session.execute(stmt)
    
        # with node2 down and hints disabled, delete the partition on node1
        node2.stop(wait_other_notice=True)
        session.execute("DELETE FROM test.test WHERE id = 0;")
        node2.start()
    
        # with both nodes up, do a CL.ALL query with per partition limit of 1;
        # prior to CASSANDRA-13880 this would cause short read protection to loop forever
>       assert_none(session, "SELECT DISTINCT id FROM test.test WHERE id = 0;", cl=ConsistencyLevel.ALL)

consistency_test.py:1170: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tools/assertions.py:147: in assert_none
    res = session.execute(simple_query)
../venv/src/cassandra-driver/cassandra/cluster.py:2618: in execute
    return self.execute_async(query, parameters, trace, custom_payload, timeout, execution_profile, paging_state, host, execute_as).result()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ResponseFuture: query='<SimpleStatement query="SELECT DISTINCT id FROM test.test WHERE id = 0;", consistency=ALL>' re...cy level ALL" info={'consistency': 'ALL', 'required_replicas': 2, 'alive_replicas': 1} coordinator_host=127.0.0.1:9042>

    def result(self):
        """
            Return the final result or raise an Exception if errors were
            encountered.  If the final result or error has not been set
            yet, this method will block until it is set, or the timeout
            set for the request expires.
    
            Timeout is specified in the Session request execution functions.
            If the timeout is exceeded, an :exc:`cassandra.OperationTimedOut` will be raised.
            This is a client-side timeout. For more information
            about server-side coordinator timeouts, see :class:`.policies.RetryPolicy`.
    
            Example usage::
    
                >>> future = session.execute_async("SELECT * FROM mycf")
                >>> # do other stuff...
    
                >>> try:
                ...     rows = future.result()
                ...     for row in rows:
                ...         ... # process results
                ... except Exception:
                ...     log.exception("Operation failed:")
    
            """
        self._event.wait()
        if self._final_result is not _NOT_SET:
            return ResultSet(self, self._final_result)
        else:
>           raise self._final_exception
E           cassandra.Unavailable: Error from server: code=1000 [Unavailable exception] message="Cannot achieve consistency level ALL" info={'consistency': 'ALL', 'required_replicas': 2, 'alive_replicas': 1}

../venv/src/cassandra-driver/cassandra/cluster.py:4894: Unavailable

REST API
CloudBees CI Client Master 2.263.4.2-rolling

    Documentation
    KnowledgeBase
    www.cloudbees.com
{noformat}