ascherbakoff commented on code in PR #4700:
URL: https://github.com/apache/ignite-3/pull/4700#discussion_r1848624661


##########
modules/core/src/main/java/org/apache/ignite/internal/hlc/HybridClockImpl.java:
##########
@@ -107,33 +95,34 @@ private void notifyUpdateListeners(long newTs) {
     }
 
     @Override
-    public HybridTimestamp now() {
+    public final HybridTimestamp now() {
         return hybridTimestamp(nowLong());
     }
 
     @Override
-    public HybridTimestamp current() {
+    public final HybridTimestamp current() {
         return hybridTimestamp(currentLong());
     }
 
     /**
-     * Updates the clock in accordance with an external event timestamp. If 
the supplied timestamp is ahead of the
-     * current clock timestamp, the clock gets adjusted to make sure it never 
returns any timestamp before (or equal to)
-     * the supplied external timestamp.
+     * Updates the clock in accordance with an external event timestamp. If 
the supplied timestamp is ahead of the current clock timestamp,
+     * the clock gets adjusted to make sure it never returns any timestamp 
before (or equal to) the supplied external timestamp.
      *
      * @param requestTime Timestamp from request.
      * @return The resulting timestamp (guaranteed to exceed both previous 
clock 'currentTs' and the supplied external ts).
      */
     @Override
-    public HybridTimestamp update(HybridTimestamp requestTime) {
+    public final HybridTimestamp update(HybridTimestamp requestTime) {
         while (true) {
-            long now = currentTime();
+            long now = physicalTime() << LOGICAL_TIME_BITS_SIZE;
 
             // Read the latest time after accessing UTC time to reduce 
contention.
-            long oldLatestTime = this.latestTime;
+            long oldLatestTime = latestTime;
 
             long newLatestTime = max(requestTime.longValue() + 1, max(now, 
oldLatestTime + 1));
 
+            // TODO avoid CAS on lower value.

Review Comment:
   https://issues.apache.org/jira/browse/IGNITE-23707



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to