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

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

                Author: ASF GitHub Bot
            Created on: 24/Jun/21 12:15
            Start Date: 24/Jun/21 12:15
    Worklog Time Spent: 10m 
      Work Description: pkumarsinha commented on a change in pull request #2396:
URL: https://github.com/apache/hive/pull/2396#discussion_r657888141



##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
##########
@@ -1122,6 +1154,49 @@ public void abortTxns(AbortTxnsRequest rqst) throws 
MetaException {
     }
   }
 
+  private void markDbAsReplIncompatible(Connection dbConn, String database) 
throws SQLException, MetaException {

Review comment:
       We needn't to have almost a copy of updateReplId(). If you need similar 
code for both externalize that part. I was also wondering if we would ever need 
and update.

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ReplLoadTask.java
##########
@@ -124,6 +124,11 @@ public int execute() {
     try {
       long loadTaskStartTime = System.currentTimeMillis();
       SecurityUtils.reloginExpiringKeytabUser();
+      //Don't proceed if target db is replication incompatible.
+      Database targetDb = getHive().getDatabase(work.dbNameToLoadIn);
+      if (targetDb != null && MetaStoreUtils.isDbReplIncompatible(targetDb)) {
+        throw new 
SemanticException(ErrorMsg.REPL_INCOMPATIBLE_EXCEPTION.getMsg());

Review comment:
       Add DB name as well

##########
File path: 
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcidTables.java
##########
@@ -139,6 +142,40 @@ public void tearDown() throws Throwable {
     primary.run("drop database if exists " + primaryDbName + "_extra cascade");
   }
 
+  @Test
+  public void testTargetDbReplIncompatible() throws Throwable {
+    HiveConf primaryConf = primary.getConf();
+    TxnStore txnHandler = TxnUtils.getTxnStore(primary.getConf());
+
+    primary.run("use " + primaryDbName)
+            .run("CREATE TABLE t1(a string) STORED AS TEXTFILE")
+            .dump(primaryDbName);
+    replica.load(replicatedDbName, primaryDbName);
+
+    
assertFalse(MetaStoreUtils.isDbReplIncompatible(replica.getDatabase(replicatedDbName)));
+
+    Long sourceTxnId = openTxns(1, txnHandler, primaryConf).get(0);
+    txnHandler.abortTxn(new AbortTxnRequest(sourceTxnId));
+
+    sourceTxnId = openTxns(1, txnHandler, primaryConf).get(0);
+
+    primary.dump(primaryDbName);
+    replica.load(replicatedDbName, primaryDbName);
+    
assertFalse(MetaStoreUtils.isDbReplIncompatible(replica.getDatabase(replicatedDbName)));
+
+    Long targetTxnId = 
txnHandler.getTargetTxnId(HiveUtils.getReplPolicy(replicatedDbName), 
sourceTxnId);
+    txnHandler.abortTxn(new AbortTxnRequest(targetTxnId));
+    
assertTrue(MetaStoreUtils.isDbReplIncompatible(replica.getDatabase(replicatedDbName)));
+
+    WarehouseInstance.Tuple dumpData = primary.dump(primaryDbName);
+
+    assertFalse(ReplUtils.failedWithNonRecoverableError(new 
Path(dumpData.dumpLocation), conf));
+    replica.loadFailure(replicatedDbName, primaryDbName);
+    assertTrue(ReplUtils.failedWithNonRecoverableError(new 
Path(dumpData.dumpLocation), conf));
+
+    primary.dumpFailure(primaryDbName);

Review comment:
       Check for this :      
assertTrue(ReplUtils.failedWithNonRecoverableError(new 
Path(dumpData.dumpLocation), conf));
   event after dump failure




-- 
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: 614460)
    Time Spent: 2h 40m  (was: 2.5h)

> Fix the clean up of open repl created transactions
> --------------------------------------------------
>
>                 Key: HIVE-25246
>                 URL: https://issues.apache.org/jira/browse/HIVE-25246
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Haymant Mangla
>            Assignee: Haymant Mangla
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2h 40m
>  Remaining Estimate: 0h
>




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

Reply via email to