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

Can't truncate counter CFs via Thrift

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Normal
    • Resolution: Unresolved
    • None
    • None
    • Cassandra 3.11.2

    • Normal

    Description

      When connecting to Cassandra 3.11.2 using Thrift, attempting to truncate a CF with counters results in "invalid operation for commutative table [table name]".

      It appears that there was no checking re this prior to the materialized views work. The materialized views work added:

      CFMetaData metadata = ThriftValidation.validateColumnFamily(keyspace, cfname, true);

      This was changed to `..., false);`  in 3be99eeaa3546fecaf474d848eecca6aa0254a22, "ninja fix commutative op flag for truncate validation", but that fix (allowing truncation of CFs that do not include counters) breaks truncation of CFs that do contain counters.

      It's possible to truncate counter CFs via CQL, but that's no help re trying to get an application that uses Thrift to work, which needs to be able to truncate as part of its test suite.

      Because truncation via CQL works, or at least appears to work, would the appropriate fix be to change CassandraServer.truncate to use this function on ThriftValidation instead?:

      // To be used when the operation should be authorized whether this is a counter CF or not
      public static CFMetaData validateColumnFamily(String keyspaceName, String cfName) throws org.apache.cassandra.exceptions.InvalidRequestException
      {{{}}
      {{ return validateColumnFamilyWithCompactMode(keyspaceName, cfName, false);}}
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            eriksw Erik Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: