tkalkirill commented on code in PR #1938:
URL: https://github.com/apache/ignite-3/pull/1938#discussion_r1169561870
##########
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;
Review Comment:
As you mentioned below, in the future it will be possible to run RO
transactions at any point in time, so validation is needed.
This particular check is purely technical.
--
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]