adelapena commented on code in PR #1891:
URL: https://github.com/apache/cassandra/pull/1891#discussion_r1106947399


##########
src/java/org/apache/cassandra/db/rows/Cell.java:
##########
@@ -108,7 +127,7 @@ public ByteBuffer buffer()
      * @return the cell local deletion time, or {@code NO_DELETION_TIME} if 
the cell is neither
      * a tombstone nor an expiring one.
      */
-    public abstract int localDeletionTime();
+    public abstract long localDeletionTime();

Review Comment:
   All the implementations of `Cell#localDeletionTime` are wrapped in a call to 
`Cell.deletionTimeGuavaUintToLong`:
   * ArrayCell: `return 
deletionTimeGuavaUintToLong(localDeletionTimeGuavaUint);`
   * BufferCell: `return 
deletionTimeGuavaUintToLong(localDeletionTimeGuavaUint);`
   * NativeCell: `return deletionTimeGuavaUintToLong(MemoryUtil.getInt(peer + 
DELETION));`
   
   If we put that call in a common implementation of `Cell#localDeletionTime` 
and add an abstract `localDeletionTimeAsUnsignedInt ` method, the 
implementations would be simplified to:
   * ArrayCell: `return localDeletionTimeGuavaUint;`
   * BufferCell: `return localDeletionTimeGuavaUint;`
   * NativeCell: `return MemoryUtil.getInt(peer + DELETION);`
   
   More importantly, we could use that `Cell#localDeletionTimeAsUnsignedInt` 
method to avoid pointless conversions in `NativeCell(NativeAllocator, 
OpOrder.Group, Cell<?>)`. At the moment that method calls 
`Cell#localDeletionTime`, which does a uint->long conversion. That long is 
passed to the next constructor, that immediately does the reverse long->uint 
conversion. We can avoid that with the `localDeletionTimeAsUnsignedInt` method 
shown in the code snippet shown in my previous comment.



-- 
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