Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-9272

Atomic Batch Statements Fail to Execute on Some Coordinators

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Not A Problem
    • None
    • None
    • None
    • Normal

    Description

      Install and configure a three-node Cassandra cluster spread across two data centers (DCs). Place two Cassandra instances in DC1 and one Cassandra instance in DC2. (We have designated one node as a seed in each data center.)

      Gracefully shut down any one Cassandra instance in DC1. This can be done by running 'kill <process_id>' in Linux.

      Open a CQL Shell connection to the remaining node in DC1.

      Create the following keyspace: CREATE KEYSPACE batch_test WITH replication = {'class': 'NetworkTopologyStrategy', 'DC1': '2', 'DC2':'1'};

      Create the following table: CREATE TABLE batch_test.batch_table ( partition_key TEXT PRIMARY KEY );

      Execute the following atomic batch query: BEGIN BATCH INSERT INTO batch_test.batch_table (partition_key) VALUES ('a'); INSERT INTO batch_test.batch_table (partition_key) VALUES ('b'); APPLY BATCH;

      Observe an availability-related error, despite a sufficient number of nodes available to service the query. The trace below shows sample results from our cluster:

      DC1


      cqlsh> CONSISTENCY
      Current consistency level is ONE.
      cqlsh> BEGIN BATCH INSERT INTO batch_test.batch_table (partition_key) VALUES ('a'); INSERT INTO batch_test.batch_table (partition_key) VALUES ('b'); APPLY BATCH;
      Unable to complete request: one or more nodes were unavailable.
      cqlsh> CONSISTENCY QUORUM
      Consistency level set to QUORUM.
      cqlsh> BEGIN BATCH INSERT INTO batch_test.batch_table (partition_key) VALUES ('a'); INSERT INTO batch_test.batch_table (partition_key) VALUES ('b'); APPLY BATCH;
      Unable to complete request: one or more nodes were unavailable.
      cqlsh> BEGIN UNLOGGED BATCH INSERT INTO batch_test.batch_table (partition_key) VALUES ('a'); INSERT INTO batch_test.batch_table (partition_key) VALUES ('b'); APPLY BATCH;
      cqlsh>
      

      Note: an UNLOGGED BATCH executes successfully. A regular BATCH also executes successfully if it only contains one INSERT query.

      We now show a similar trace using a CQL Shell connected to the Cassandra instance in DC2:

      DC2

      cqlsh> CONSISTENCY
      Current consistency level is ONE.
      cqlsh> BEGIN BATCH INSERT INTO batch_test.batch_table (partition_key) VALUES ('a'); INSERT INTO batch_test.batch_table (partition_key) VALUES ('b'); APPLY BATCH;
      cqlsh> CONSISTENCY QUORUM
      Consistency level set to QUORUM.
      cqlsh> BEGIN BATCH INSERT INTO batch_test.batch_table (partition_key) VALUES ('a'); INSERT INTO batch_test.batch_table (partition_key) VALUES ('b'); APPLY BATCH;
      cqlsh> BEGIN UNLOGGED BATCH INSERT INTO batch_test.batch_table (partition_key) VALUES ('a'); INSERT INTO batch_test.batch_table (partition_key) VALUES ('b'); APPLY BATCH;
      cqlsh>
      

      All queries execute successfully using the DC2 Cassandra instance as a coordinator.

      Attachments

        Activity

          People

            carlyeks Carl Yeksigian
            jgray Jonathan Gray
            Carl Yeksigian
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: