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

Cassandra does not expire data after setting timeToLive argument for each value

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 0.7 beta 1
    • None
    • None
    • Normal

    Description

      Hello,

      I downloaded latest cassandra source code from svn trunk. I wanted to test expire data functionality. Using Thrift API, I set timeToLive parameter for each fieldValue, however cassandra ignored it and did not expire any data.

      I debugged cassandra's source code and found a bug in src/java/org/apache/cassandra/db/RowMutation.java.

      In RowMutation.addColumnOrSuperColumnToRowMutation() method, QueryPath was not setting timeToLive argument. I updated RowMutation.java locally and tested it and then my data expired after 'n' number of seconds.

      I wanted to have this fix in the trunk also.

      Index: src/java/org/apache/cassandra/db/RowMutation.java
      ===================================================================
      — src/java/org/apache/cassandra/db/RowMutation.java (revision 946222)
      +++ src/java/org/apache/cassandra/db/RowMutation.java (working copy)
      @@ -295,12 +295,12 @@
      {
      for (org.apache.cassandra.thrift.Column column : cosc.super_column.columns)

      { - rm.add(new QueryPath(cfName, cosc.super_column.name, column.name), column.value, column.timestamp); + rm.add(new QueryPath(cfName, cosc.super_column.name, column.name), column.value, column.timestamp, column.ttl); }

      }
      else

      { - rm.add(new QueryPath(cfName, null, cosc.column.name), cosc.column.value, cosc.column.timestamp); + rm.add(new QueryPath(cfName, null, cosc.column.name), cosc.column.value, cosc.column.timestamp, cosc.column.ttl); }

      }

      Thanks,
      Jignesh

      Attachments

        1. 0001-System-test-for-1109.patch
          2 kB
          Sylvain Lebresne
        2. CASSANDRA-1109.patch
          0.9 kB
          Jignesh Dhruv

        Activity

          People

            jigneshdhruv Jignesh Dhruv
            jigneshdhruv Jignesh Dhruv
            Jignesh Dhruv
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: