dcapwell commented on code in PR #2830:
URL: https://github.com/apache/cassandra/pull/2830#discussion_r1387243016
##########
src/java/org/apache/cassandra/db/rows/AbstractCell.java:
##########
@@ -114,14 +119,45 @@ 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 (column.isList() && 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 = path();
Review Comment:
I have to check again but don't think this is an isolated problem, so might
have to think about how best to handle this...
--
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]