[ 
https://issues.apache.org/jira/browse/CASSANDRA-9312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17884175#comment-17884175
 ] 

Benjamin Lerer commented on CASSANDRA-9312:
-------------------------------------------

An UPDATE will not set the row liveness info only the column timestamps. Only 
an INSERT does set it. If an INSERT does not set all the columns the columns 
set by an UPDATE older than the INSERT can be used. In which case the row 
timestamp might be younger than some of the columns timestamps.

The only difference between the primary key columns and the other columns is 
that you have to retrieve the timestamp from a different place (the Liveness 
Info) as described in the additional information.

> Provide a way to retrieve the write time of a CQL row
> -----------------------------------------------------
>
>                 Key: CASSANDRA-9312
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-9312
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: Legacy/CQL
>            Reporter: Nicolas Favre-Felix
>            Assignee: Yangyi Shi
>            Priority: Normal
>              Labels: lhf
>             Fix For: 5.x
>
>
> There is currently no way to retrieve the "writetime" of a CQL row. This is 
> an issue for tables in which all dimensions are part of the primary key.
> Since Cassandra already stores a cell for the CQL row, it would make sense to 
> provide a way to read its timestamp. This feature would be consistent with 
> the concept of a row as an entity containing a number of optional columns, 
> but able to exist on its own.
> +Additional information for newcomers+
> As [~slebresne] suggested in the comments, this functionality can be done by 
> allowing the {{writeTime}} and {{ttl}} methods on primary key columns. To do 
> that you will need to:
> * remove the check of {{Selectable.WritetimeOrTTL}} preventing the use of 
> {{writeTime}} and {{ttl}} methods on primary key columns
> * add a new method like {{add(ByteBuffer v, LivenessInfo livenessInfo, int 
> nowInSec)}} to {{ResultSetBuilder}} that method should populate the value as 
> well as the timestamps and ttls if needed
> * In {{SelectStatement.processPartition}} retrieve the row 
> primaryKeyLivenessInfo and call the new {{ResultSetBuilder}} method with 
> those information.
> * Adds some unit tests in {{SelectTest}}.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to