Copilot commented on code in PR #2435:
URL: https://github.com/apache/phoenix/pull/2435#discussion_r4660822205


##########
phoenix-core-client/src/main/java/org/apache/phoenix/transaction/OmidTransactionContext.java:
##########
@@ -75,33 +79,39 @@ public OmidTransactionContext(PhoenixTransactionContext 
ctx, boolean subTask) {
     assert (ctx instanceof OmidTransactionContext);
     OmidTransactionContext omidTransactionContext = (OmidTransactionContext) 
ctx;
 
-    this.tm = omidTransactionContext.tm;
+    this.client = omidTransactionContext.client;
 
     if (subTask) {
       if (omidTransactionContext.isTransactionRunning()) {
         Transaction transaction = omidTransactionContext.getTransaction();
+        HBaseTransactionManager m = tm();
         this.tx = new HBaseTransaction(transaction.getTransactionId(), 
transaction.getEpoch(),
-          new HashSet<HBaseCellId>(), new HashSet<HBaseCellId>(), this.tm,
-          transaction.getReadTimestamp(), transaction.getWriteTimestamp(), 
tm.isLowLatency());
+          new HashSet<HBaseCellId>(), new HashSet<HBaseCellId>(), m, 
transaction.getReadTimestamp(),
+          transaction.getWriteTimestamp(), m != null && m.isLowLatency());
       } else {
         this.tx = null;
       }
 
-      this.tm = null;
+      this.client = null;
     } else {
       this.tx = omidTransactionContext.getTransaction();
     }
   }
 
+  private HBaseTransactionManager tm() {
+    return client == null ? null : client.getTransactionClient();

Review Comment:
   This PR adds no regression test for retaining a client and context across 
manager replacement, so reverting either lookup to a cached reference could go 
undetected. Please add a deterministic test that creates both under manager A, 
injects manager B before starting the next transaction, and verifies that the 
retained client's lookup and context's begin/commit/abort operations use B. 
Restore the singleton's test state in cleanup to avoid affecting other tests.



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