[
https://issues.apache.org/jira/browse/HIVE-24946?focusedWorklogId=632082&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-632082
]
ASF GitHub Bot logged work on HIVE-24946:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 01/Aug/21 14:51
Start Date: 01/Aug/21 14:51
Worklog Time Spent: 10m
Work Description: pkumarsinha commented on a change in pull request #2529:
URL: https://github.com/apache/hive/pull/2529#discussion_r680520961
##########
File path:
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcidTables.java
##########
@@ -592,7 +577,8 @@ public void testFailoverDuringDumpWithPreviousFailed()
throws Throwable {
fs.delete(dumpAckFile, false);
dumpData = primary.run("use " + primaryDbName)
- .run("insert into t2 partition(name='Carl') values(10)")
+ .run("create table t3 (id int)")
+ .run("insert into t3 values (2)")
Review comment:
insert into existing table as well. The table which has already part of
repl and assert that the change is not there
##########
File path:
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcidTables.java
##########
@@ -621,6 +607,72 @@ public void testFailoverDuringDumpWithPreviousFailed()
throws Throwable {
assertTrue(MetaStoreUtils.isTargetOfReplication(db));
assertTrue(MetaStoreUtils.isDbBeingFailedOverAtEndpoint(db,
MetaStoreUtils.FailoverEndpoint.TARGET));
assertTrue(fs.exists(new Path(dumpPath,
ReplAck.LOAD_ACKNOWLEDGEMENT.toString())));
+
+ primary.run("drop database if exists " + primaryDbName + " cascade");
+
+ WarehouseInstance.Tuple reverseDumpData = replica.run("use " +
replicatedDbName)
+ .run("create table t3 (id int)")
+ .run("insert into t3 values (2)")
+ .dump(replicatedDbName, retainPrevDumpDir);
Review comment:
Add a test where hive.repl.retain.prev.dump.dir=true with retain count
being 1
##########
File path:
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcidTables.java
##########
@@ -621,6 +607,72 @@ public void testFailoverDuringDumpWithPreviousFailed()
throws Throwable {
assertTrue(MetaStoreUtils.isTargetOfReplication(db));
assertTrue(MetaStoreUtils.isDbBeingFailedOverAtEndpoint(db,
MetaStoreUtils.FailoverEndpoint.TARGET));
assertTrue(fs.exists(new Path(dumpPath,
ReplAck.LOAD_ACKNOWLEDGEMENT.toString())));
+
+ primary.run("drop database if exists " + primaryDbName + " cascade");
+
+ WarehouseInstance.Tuple reverseDumpData = replica.run("use " +
replicatedDbName)
+ .run("create table t3 (id int)")
+ .run("insert into t3 values (2)")
Review comment:
insert different value as the last attempted one. e.g 10 or anything
other than 2
##########
File path:
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcidTables.java
##########
@@ -621,6 +607,72 @@ public void testFailoverDuringDumpWithPreviousFailed()
throws Throwable {
assertTrue(MetaStoreUtils.isTargetOfReplication(db));
assertTrue(MetaStoreUtils.isDbBeingFailedOverAtEndpoint(db,
MetaStoreUtils.FailoverEndpoint.TARGET));
assertTrue(fs.exists(new Path(dumpPath,
ReplAck.LOAD_ACKNOWLEDGEMENT.toString())));
+
+ primary.run("drop database if exists " + primaryDbName + " cascade");
+
+ WarehouseInstance.Tuple reverseDumpData = replica.run("use " +
replicatedDbName)
+ .run("create table t3 (id int)")
+ .run("insert into t3 values (2)")
+ .dump(replicatedDbName, retainPrevDumpDir);
+ assertNotEquals(reverseDumpData.dumpLocation, dumpData.dumpLocation);
+ assertTrue(fs.exists(dumpPath));
+ assertTrue(fs.exists(new Path(dumpPath,
ReplAck.FAILOVER_READY_MARKER.toString())));
+ dumpPath = new Path(reverseDumpData.dumpLocation,
ReplUtils.REPL_HIVE_BASE_DIR);
+ dumpAckFile = new Path(dumpPath, DUMP_ACKNOWLEDGEMENT.toString());
+ assertTrue(fs.exists(dumpAckFile));
+ assertFalse(fs.exists(new Path(dumpPath,
ReplAck.FAILOVER_READY_MARKER.toString())));
+ assertTrue(new DumpMetaData(dumpPath, conf).getDumpType() ==
DumpType.BOOTSTRAP);
+ db = replica.getDatabase(replicatedDbName);
+ assertTrue(MetaStoreUtils.isDbBeingFailedOverAtEndpoint(db,
MetaStoreUtils.FailoverEndpoint.TARGET));
+ assertFalse(MetaStoreUtils.isTargetOfReplication(db));
+
+ fs.delete(dumpAckFile, false);
+ assertFalse(fs.exists(dumpAckFile));
+ dumpData = replica.dump(replicatedDbName, retainPrevDumpDir);
+ assertEquals(reverseDumpData.dumpLocation, dumpData.dumpLocation);
+ assertFalse(fs.exists(new Path(dumpPath,
ReplAck.FAILOVER_READY_MARKER.toString())));
+ assertTrue(new DumpMetaData(dumpPath, conf).getDumpType() ==
DumpType.BOOTSTRAP);
+ assertTrue(fs.exists(dumpAckFile));
+ db = replica.getDatabase(replicatedDbName);
+ assertTrue(MetaStoreUtils.isDbBeingFailedOverAtEndpoint(db,
MetaStoreUtils.FailoverEndpoint.TARGET));
+ assertFalse(MetaStoreUtils.isTargetOfReplication(db));
+
+ primary.load(primaryDbName, replicatedDbName)
+ .run("use " + primaryDbName)
+ .run("show tables")
+ .verifyResults(new String[]{"t1", "t2", "t3"})
+ .run("repl status " + primaryDbName)
+ .verifyResult(dumpData.lastReplicationId)
+ .run("select id from t1")
+ .verifyResults(new String[]{"1"})
+ .run("select rank from t2 order by rank")
+ .verifyResults(new String[]{"11"})
+ .run("select id from t3")
+ .verifyResults(new String[]{"2"});
+
+ assertTrue(fs.exists(new Path(dumpPath, LOAD_ACKNOWLEDGEMENT.toString())));
+
+ reverseDumpData = replica.run("insert into t3 values (3)")
+ .dump(replicatedDbName, retainPrevDumpDir);
+ dumpPath = new Path(reverseDumpData.dumpLocation,
ReplUtils.REPL_HIVE_BASE_DIR);
+ dumpAckFile = new Path(dumpPath, DUMP_ACKNOWLEDGEMENT.toString());
+
assertFalse(MetaStoreUtils.isDbBeingFailedOverAtEndpoint(replica.getDatabase(replicatedDbName),
+ MetaStoreUtils.FailoverEndpoint.TARGET));
+ fs.delete(dumpAckFile);
+ replica.run("ALTER DATABASE " + replicatedDbName + " SET DBPROPERTIES('" +
ReplConst.REPL_FAILOVER_ENDPOINT + "'='"
+ + MetaStoreUtils.FailoverEndpoint.TARGET + "')");
+
assertTrue(MetaStoreUtils.isDbBeingFailedOverAtEndpoint(replica.getDatabase(replicatedDbName),
+ MetaStoreUtils.FailoverEndpoint.TARGET));
+ assertFalse(fs.exists(dumpAckFile));
+ assertEquals(reverseDumpData.dumpLocation, replica.dump(replicatedDbName,
retainPrevDumpDir).dumpLocation);
+ fs.exists(dumpAckFile);
+
assertFalse(MetaStoreUtils.isDbBeingFailedOverAtEndpoint(replica.getDatabase(replicatedDbName),
+ MetaStoreUtils.FailoverEndpoint.TARGET));
+
+ primary.load(primaryDbName, replicatedDbName)
+ .run("select id from t3")
+ .verifyResults(new String[]{"2", "3"});;
+ assertTrue(fs.exists(new Path(dumpPath, LOAD_ACKNOWLEDGEMENT.toString())));
Review comment:
Can you please handle different failure use case in different 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]
Issue Time Tracking
-------------------
Worklog Id: (was: 632082)
Time Spent: 2h 40m (was: 2.5h)
> Handle failover case during Repl Load
> -------------------------------------
>
> Key: HIVE-24946
> URL: https://issues.apache.org/jira/browse/HIVE-24946
> Project: Hive
> Issue Type: New Feature
> Reporter: Haymant Mangla
> Assignee: Haymant Mangla
> Priority: Major
> Labels: pull-request-available
> Time Spent: 2h 40m
> Remaining Estimate: 0h
>
> To handle:
> # Introduce two states of failover db property to denote nature of database
> at the time failover was initiated.
> # If failover start config is enabled and dump directory contains failover
> marker file, then in incremental load as a preAckTask, we should
> ## Remove repl.target.for from target db.
> ## Set repl.failover.endpoint = "TARGET"
> ## Updated the replication metrics saying that target cluster is failover
> ready
> # In the first dump operation in reverse direction, presence of failover
> ready marker and repl.failover.endpoint = "TARGET" will be used as indicator
> for bootstrap iteration.
> # In any dump operation except the first dump operation in reverse dxn, if
> repl.failover.endpoint is set for db and failover start config is set to
> false, then remove this property.
> # In incremental load, if the failover start config is disabled, then add
> repl.target.for and remove repl.failover.endpoint if present.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)