tkalkirill commented on code in PR #1938:
URL: https://github.com/apache/ignite-3/pull/1938#discussion_r1169538660


##########
modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/TxManagerImpl.java:
##########
@@ -74,27 +86,45 @@ public TxManagerImpl(ReplicaService replicaService, 
LockManager lockManager, Hyb
         this.clock = clock;
     }
 
-    /** {@inheritDoc} */
     @Override
     public InternalTransaction begin() {
         return begin(false);
     }
 
-    /** {@inheritDoc} */
     @Override
     public InternalTransaction begin(boolean readOnly) {
         UUID txId = Timestamp.nextVersion().toUuid();
 
-        return readOnly ? new ReadOnlyTransactionImpl(this, txId, clock.now()) 
: new ReadWriteTransactionImpl(this, txId);
+        if (!readOnly) {
+            return new ReadWriteTransactionImpl(this, txId);
+        }
+
+        HybridTimestamp readTimestamp = clock.now();
+
+        readOnlyTxFutureByReadTs.compute(readTimestamp, (timestamp, 
readOnlyTxFuture) -> {
+            assert readOnlyTxFuture == null : "previous transaction has not 
completed yet: " + readTimestamp;
+
+            HybridTimestamp lowerBound = 
lowerBoundTsToStartNewReadOnlyTx.get();
+
+            if (lowerBound != null && readTimestamp.compareTo(lowerBound) <= 
0) {
+                throw new IgniteInternalException(
+                        TX_READ_ONLY_CREATING_ERR,
+                        "Timestamp read-only transaction must be greater than 
the lower bound: [txTimestamp={}, lowerBound={}]",
+                        readTimestamp, lowerBound
+                );

Review Comment:
   You're right, for some reason I relied on the internal logic of the 
`ConcurrentSkipListMap` that it would be blocked on new keys, fixed 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]

Reply via email to