Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-3997

Querying a Cassandra table on a server with query cache enabled is likely to cause problems

    Details

      Description

      Since Cassandra is by nature a shared storage which can be accessed (and modified) through different Cassandra SE tables, doing it from a server where query cache is enabled is likely to produce wrong results. Of course, the workaround is to use SQL_NO_CACHE in a query, but it's error-prone. Besides, generally a user would have no way to know whether the storage gets updated or not, so they'll have to set SQL_NO_CACHE every time; and if so, it makes sense to either force disabling query cache for Cassandra tables, or to provide a system-wide parameter for doing so.

      Example of the problem:

      cqlsh:manual_test> create columnfamily cf1 ( rowkey int primary key, a int );
      
      drop table if exists t1, t2;
      create table t1 (rowkey int primary key, a int) engine=cassandra keyspace='manual_test' column_family='cf1';
      create table t2 like t1;
      
      set global query_cache_size=1024*1024;
      
      select * from t1;
      # Empty set (0.01 sec)
      
      insert into t2 values (1,1);
      
      select * from t1;
      # Empty set (0.00 sec)
      
      select sql_no_cache * from t1;
      # +--------+------+
      # | rowkey | a    |
      # +--------+------+
      # |      1 |    1 |
      # +--------+------+
      # 1 row in set (0.01 sec)
      
      
      revision-id: psergey@askmonty.org-20121224043622-xn8g8y3vhtu1lb3w
      revno: 3459
      branch: 10.0-base-cassandra
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              psergey Sergei Petrunia added a comment -

              Discussed with Sanja: it seems, query cache should be disabled for cassandra tables. This can be achieved like this:

              ha_cassandra::table_cache_type()

              { return HA_CACHE_TBL_NOCACHE; }
              Show
              psergey Sergei Petrunia added a comment - Discussed with Sanja: it seems, query cache should be disabled for cassandra tables. This can be achieved like this: ha_cassandra::table_cache_type() { return HA_CACHE_TBL_NOCACHE; }
              Hide
              psergey Sergei Petrunia added a comment -

              Disabled query cache for cassandra tables.

              Show
              psergey Sergei Petrunia added a comment - Disabled query cache for cassandra tables.

                People

                • Assignee:
                  psergey Sergei Petrunia
                  Reporter:
                  elenst Elena Stepanova
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - 0 minutes
                    0m
                    Logged:
                    Time Spent - 1 hour
                    1h