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

Counter Tables should be more clearly identified

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Low
    • Resolution: Duplicate
    • None
    • None
    • None

    Description

      Counter tables are internally considered as a particular kind of table, different from the regular ones. This counter specific nature is implicitly defined by the fact that columns within a table have the counter data type. This nature turns out to be persistent over the time, that is if the user do the following:

      CREATE TABLE counttable (key uuid primary key, count counter);
      ALTER TABLE counttable DROP count;
      ALTER TABLE counttable ADD count2 int;
      

      The following error will be thrown:

      Cannot add a non counter column (count2) in a counter column family
      

      Even if the table doesn't have any counter column anymore. This implicit, persistent nature can be challenging to understand for users (and impossible to infer in the case above). For this reason a more explicit declaration of counter tables would be appropriate, as:

      CREATE COUNTER TABLE counttable (key uuid primary key, count counter);
      

      Besides that, adding a boolean counter_table column in the system.schema_columnfamilies table would allow external tools to easily differentiate a counter table from a regular one.

      Attachments

        Issue Links

          Activity

            People

              aleksey Aleksey Yeschenko
              mfiguiere Michaël Figuière
              Aleksey Yeschenko
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: