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

TTL Reading And Writing is Asymmetric

Log workAgile BoardRank to TopRank to BottomAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 3.10
    • Legacy/CQL
    • None

    Description

      There is an inherent asymmetry in the way TTL's are read and Written.

      An `TTL` of 0 when written becomes a `null` in C*
      When read, this `TTL` becomes a `null`
      The `null` cannot be written back to C* as `TTL`

      This means that end users attempting to copy tables with TTL have to do manual mapping of the null TTL values to 0 to avoid NPE. This is a bit onerous when C* seems to have an internal logic that 0 == NULL. I don't think C* should return values which are not directly insertable back to C*.

      Even with the advent CASSANDRA-7304 this still remains a problem that the User needs to be aware of and take care of.

      The following prepared statement

      INSERT INTO test.table2 (k,v) (?,?) USING TTL: ? 
      

      Will throw NPEs unless we specifically check that the value to be bound to TTL is not null.

      I think we should discuss whether `null` should be treated as 0 in TTL for prepared statements.

      Attachments

        1. 12216-3.7.txt
          1 kB
          Russell Spitzer
        2. 12216-3.7-2.txt
          3 kB
          Russell Spitzer
        3. 12216-trunk.patch
          3 kB
          Russell Spitzer
        4. 12216-trunk-v2.txt
          8 kB
          Benjamin Lerer

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            rspitzer Russell Spitzer Assign to me
            rspitzer Russell Spitzer
            Russell Spitzer
            Benjamin Lerer
            Votes:
            1 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment