jacek-lewandowski commented on code in PR #2830:
URL: https://github.com/apache/cassandra/pull/2830#discussion_r1374389102


##########
src/java/org/apache/cassandra/db/rows/AbstractCell.java:
##########
@@ -114,14 +119,44 @@ public Cell<?> clone(ByteBufferCloner cloner)
     // note: while the cell returned may be different, the value is the same, 
so if the value is offheap it must be referenced inside a guarded context (or 
copied)
     public Cell<?> updateAllTimestamp(long newTimestamp)
     {
-        return new BufferCell(column, isTombstone() ? newTimestamp - 1 : 
newTimestamp, ttl(), localDeletionTime(), buffer(), path());
+        CellPath newPath = null;
+        if (path() != null) {
+            byte[] newUUID = nextTimeUUIDAsBytes(newTimestamp);
+            newPath = CellPath.create(ByteBuffer.wrap(newUUID));
+            logger.debug("timestamp: {}    newPath: {}", newTimestamp, 
newPath.get(0));
+        }
+        return new BufferCell(column, isTombstone() ? newTimestamp - 1 : 
newTimestamp, ttl(), localDeletionTime(), buffer(), newPath);
     }
 
     @Override
     public ColumnData updateAllTimestampAndLocalDeletionTime(long 
newTimestamp, int newLocalDeletionTime)
     {
-        long localDeletionTime = localDeletionTime() != NO_DELETION_TIME ? 
newLocalDeletionTime : NO_DELETION_TIME;
-        return new BufferCell(column, isTombstone() ? newTimestamp - 1 : 
newTimestamp, ttl(), localDeletionTime, buffer(), path());
+        // Fun fact: The two parameters are actually redundant: One is a 
function of the other.
+        // ...of course, the whole business of deriving the legacy timestamps 
from Accord executeAt is a bridge to the past anyway.
+        assert newTimestamp/1000000 == newLocalDeletionTime;
+
+        final long newts = isTombstone() ? newTimestamp - 1 : newTimestamp;
+        final long localDeletionTime = localDeletionTime() != NO_DELETION_TIME 
? newLocalDeletionTime : NO_DELETION_TIME;
+
+        // In addition to updating the timestamps for each row and partition, 
it turns out the elements of a ListType
+        // are keyed with a TimeUUID, which is based on the Cassandra 
timestamp. We want these to now also adhere to
+        // the accord executeAt timestamps, so that they are ordered the same 
as the transactions that wrote them.
+        // As an example, if a set of accord transactions all append an 
element to a list, then the order of the elements
+        // in the list should map to the order that the transactions were 
executed in.
+        CellPath newPath = null;
+        if (path() != null) {
+            // We need to use a next*() function, so that we get a new 
timestamp for each ListType element, in case
+            // one transaction would write several list elements. (Including 
writing into more than one list<> column
+            // within the same write.)
+            byte[] newUUID = nextTimeUUIDAsBytes(newTimestamp);

Review Comment:
   I'm wondering if this wouldn't make the same list items have different paths 
on each replica? After all, the `nextTimeUUIDAsBytes` function is not pure, is 
it?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to