nsivabalan commented on a change in pull request #4363:
URL: https://github.com/apache/hudi/pull/4363#discussion_r771772587



##########
File path: 
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/TransactionManager.java
##########
@@ -55,28 +55,32 @@ public void beginTransaction() {
 
   public void beginTransaction(Option<HoodieInstant> currentTxnOwnerInstant,
                                Option<HoodieInstant> 
lastCompletedTxnOwnerInstant) {
-    if (supportsOptimisticConcurrency) {
+    if (isOptimisticConcurrencyControlEnabled) {
       LOG.info("Transaction starting for " + currentTxnOwnerInstant
           + "with latest completed transaction instant " + 
lastCompletedTxnOwnerInstant);
       lockManager.lock();
-      this.currentTxnOwnerInstant = currentTxnOwnerInstant;
-      this.lastCompletedTxnOwnerInstant = lastCompletedTxnOwnerInstant;
+      reset(currentTxnOwnerInstant, lastCompletedTxnOwnerInstant);
       LOG.info("Transaction started for " + currentTxnOwnerInstant
           + "with latest completed transaction instant " + 
lastCompletedTxnOwnerInstant);
     }
   }
 
   public void endTransaction() {
-    if (supportsOptimisticConcurrency) {
+    if (isOptimisticConcurrencyControlEnabled) {

Review comment:
       help me understand something. lets say writer1 acquires the lock and 
takes lot of time to release. writer2 tries to acquire the lock, but times out. 
In finally block of any transaction handling code, we do end transaction right. 
In this case when writer2 fails to acquire, will end transaction be called? 
   if yes, wouldn't writer2 resets the transaction owner at L 71




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