[ 
https://issues.apache.org/jira/browse/HIVE-24909?focusedWorklogId=577792&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-577792
 ]

ASF GitHub Bot logged work on HIVE-24909:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 06/Apr/21 17:52
            Start Date: 06/Apr/21 17:52
    Worklog Time Spent: 10m 
      Work Description: pkumarsinha commented on a change in pull request #2101:
URL: https://github.com/apache/hive/pull/2101#discussion_r608042947



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/Compiler.java
##########
@@ -265,7 +266,15 @@ private void openTransaction(TxnType txnType) throws 
LockException, CommandProce
     if (DriverUtils.checkConcurrency(driverContext) && 
startImplicitTxn(driverContext.getTxnManager()) &&
         !driverContext.getTxnManager().isTxnOpen() && txnType != 
TxnType.COMPACTION) {
       String userFromUGI = DriverUtils.getUserFromUGI(driverContext);
-      driverContext.getTxnManager().openTxn(context, userFromUGI, txnType);
+      boolean isHiveReplTxn = 
(driverContext.getQueryState().getHiveOperation() != null)

Review comment:
       (driverContext.getQueryState().getHiveOperation() != null) check is not 
needed

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
##########
@@ -958,6 +960,10 @@ private void deleteReplTxnMapEntry(Connection dbConn, long 
sourceTxnId, String r
   public void abortTxn(AbortTxnRequest rqst) throws NoSuchTxnException, 
MetaException, TxnAbortedException {
     long txnid = rqst.getTxnid();
     long sourceTxnId = -1;
+    boolean isReplayedReplTxn = rqst.isSetReplPolicy() && rqst.isSetTxn_type()

Review comment:
       rqst.isSetTxn_type() check isn't required

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
##########
@@ -8349,8 +8353,12 @@ public long get_latest_txnid_in_conflict(long txnId) 
throws MetaException {
 
   @Override
   public void commit_txn(CommitTxnRequest rqst) throws TException {
+    boolean isReplayedReplTxn = rqst.isSetReplPolicy() && rqst.isSetTxn_type() 
&&
+            rqst.getTxn_type() == TxnType.REPL_CREATED;
+    boolean isHiveReplTxn = rqst.isSetReplPolicy()
+            && (!rqst.isSetTxn_type() || (rqst.isSetTxn_type() && 
rqst.getTxn_type() != TxnType.REPL_CREATED));

Review comment:
       Could you please explain what are you trying to check?

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
##########
@@ -958,6 +960,10 @@ private void deleteReplTxnMapEntry(Connection dbConn, long 
sourceTxnId, String r
   public void abortTxn(AbortTxnRequest rqst) throws NoSuchTxnException, 
MetaException, TxnAbortedException {
     long txnid = rqst.getTxnid();
     long sourceTxnId = -1;
+    boolean isReplayedReplTxn = rqst.isSetReplPolicy() && rqst.isSetTxn_type()
+            && rqst.getTxn_type() == TxnType.REPL_CREATED;
+    boolean isHiveReplTxn = rqst.isSetReplPolicy()
+            && (!rqst.isSetTxn_type() || (rqst.isSetTxn_type() && 
rqst.getTxn_type() != TxnType.REPL_CREATED));

Review comment:
       could you pls explain this

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
##########
@@ -8400,8 +8408,10 @@ public void commit_txn(CommitTxnRequest rqst) throws 
TException {
     }
     getTxnHandler().commitTxn(rqst);
     if (listeners != null && !listeners.isEmpty()) {
-      MetaStoreListenerNotifier.notifyEvent(listeners, EventType.COMMIT_TXN,
-          new CommitTxnEvent(rqst.getTxnid(), this));
+      if (!isHiveReplTxn) {
+        MetaStoreListenerNotifier.notifyEvent(listeners, EventType.COMMIT_TXN,
+                new CommitTxnEvent(rqst.getTxnid(), this));
+      }

Review comment:
       If you are skipping this event, should you go with next line:
   Optional<CompactionInfo> compactionInfo = 
getTxnHandler().getCompactionByTxnId(rqst.getTxnid());

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/Compiler.java
##########
@@ -265,7 +266,15 @@ private void openTransaction(TxnType txnType) throws 
LockException, CommandProce
     if (DriverUtils.checkConcurrency(driverContext) && 
startImplicitTxn(driverContext.getTxnManager()) &&
         !driverContext.getTxnManager().isTxnOpen() && txnType != 
TxnType.COMPACTION) {
       String userFromUGI = DriverUtils.getUserFromUGI(driverContext);
-      driverContext.getTxnManager().openTxn(context, userFromUGI, txnType);
+      boolean isHiveReplTxn = 
(driverContext.getQueryState().getHiveOperation() != null)
+              && 
(driverContext.getQueryState().getHiveOperation().equals(HiveOperation.REPLDUMP)
+              || 
driverContext.getQueryState().getHiveOperation().equals(HiveOperation.REPLLOAD));
+      String dbUnderReplication = (isHiveReplTxn) ? 
PlanUtils.stripQuotes(tree.getChild(0).getText()) : null;
+      if (dbUnderReplication != null) {

Review comment:
       Can isHiveReplTxn be true and dbUnderReplication be null ever? if not, 
this should be based on check isHiveReplTxn

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbTxnManager.java
##########
@@ -170,6 +170,7 @@ Licensed to the Apache Software Foundation (ASF) under one
   private ScheduledFuture<?> heartbeatTask = null;
   private static final int SHUTDOWN_HOOK_PRIORITY = 0;
   private final ReentrantLock heartbeatTaskLock = new ReentrantLock();
+  private String dbUnderReplication = null;

Review comment:
       Why do you need to store it?

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
##########
@@ -8349,8 +8353,12 @@ public long get_latest_txnid_in_conflict(long txnId) 
throws MetaException {
 
   @Override
   public void commit_txn(CommitTxnRequest rqst) throws TException {
+    boolean isReplayedReplTxn = rqst.isSetReplPolicy() && rqst.isSetTxn_type() 
&&

Review comment:
       Why do you need this check - rqst.isSetTxn_type()?




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

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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 577792)
    Time Spent: 3h  (was: 2h 50m)

> Skip the repl events from getting logged in notification log
> ------------------------------------------------------------
>
>                 Key: HIVE-24909
>                 URL: https://issues.apache.org/jira/browse/HIVE-24909
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Haymant Mangla
>            Assignee: Haymant Mangla
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 3h
>  Remaining Estimate: 0h
>
> Currently REPL dump events are logged and replicated as a part of replication 
> policy. Whenever one replication cycle completed, we always have one 
> transaction left open on the target corresponding to repl dump operation. 
> This will never be caught up without manually dealing with the transaction on 
> target cluster.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to