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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]