Skip to content
Browse files
Revert "Revert "Add test_truncate_failure""
This restores test_truncate_failure.
This reverts commit 016a0eb.
  • Loading branch information
driftx committed Oct 21, 2020
1 parent cbb35e8 commit ded6a967601f554770c533984a42ae841a20943d
Showing 2 changed files with 41 additions and 0 deletions.
@@ -0,0 +1,8 @@
RULE Throw during truncate operation
CLASS org.apache.cassandra.db.ColumnFamilyStore
METHOD truncateBlocking()
throw new RuntimeException("Dummy failure");
@@ -1,4 +1,5 @@
import itertools
import re
import struct
import time
import pytest
@@ -764,6 +765,38 @@ def test_drop_compact_storage_flag(self):
[2, None, 2, None],
[3, None, 3, None]])

def test_truncate_failure(self):
@jira_ticket CASSANDRA-16208
Tests that if a TRUNCATE query fails on some replica, the coordinator will immediately return an error to the
client instead of waiting to time out because it couldn't get the necessary number of success acks.
cluster = self.cluster
cluster.populate(3, install_byteman=True).start()
node1, _, node3 = cluster.nodelist()

session = self.patient_exclusive_cql_connection(node1)
create_ks(session, 'ks', 3)

logger.debug("Creating data table")
session.execute("CREATE TABLE data (id int PRIMARY KEY, data text)")
session.execute("UPDATE data SET data = 'Awesome' WHERE id = 1")

self.fixture_dtest_setup.ignore_log_patterns = ['Dummy failure']
logger.debug("Truncating data table (error expected)")

thrown = False
exception = None
session.execute("TRUNCATE data")
except Exception as e:
exception = e
thrown = True

assert thrown, "No exception has been thrown"
assert"Truncate failed on replica /", str(exception)) is not None

class AbortedQueryTester(CQLTester):

0 comments on commit ded6a96

Please sign in to comment.