You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2021/04/01 01:54:13 UTC
[GitHub] [hive] hmangla98 commented on a change in pull request #2092: HIVE-24912: Support to add repl.target.for property during incrementa…
hmangla98 commented on a change in pull request #2092:
URL: https://github.com/apache/hive/pull/2092#discussion_r605326404
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/incremental/IncrementalLoadTasksBuilder.java
##########
@@ -163,6 +163,17 @@ public IncrementalLoadTasksBuilder(String dbName, String loadPath,
taskChainTail.addDependentTask(updateIncPendTask);
taskChainTail = updateIncPendTask;
+ Database dbToLoadIn = hive.getDatabase(dbName);
+ if (dbToLoadIn != null && !ReplUtils.isTargetOfReplication(dbToLoadIn)) {
Review comment:
We have one test in TestReplicationScenarios.testTaskCreationOptimization in which we may get dbToLoadIn to be null. Rest in all cases, it would be not null.
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/incremental/IncrementalLoadTasksBuilder.java
##########
@@ -163,6 +163,17 @@ public IncrementalLoadTasksBuilder(String dbName, String loadPath,
taskChainTail.addDependentTask(updateIncPendTask);
taskChainTail = updateIncPendTask;
+ Database dbToLoadIn = hive.getDatabase(dbName);
+ if (dbToLoadIn != null && !ReplUtils.isTargetOfReplication(dbToLoadIn)) {
+ Map<String, String> props = new HashMap<>();
+ props.put(ReplUtils.TARGET_OF_REPLICATION, "true");
Review comment:
It just appends this prop to existing db properties.
##########
File path: itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java
##########
@@ -1114,13 +1115,18 @@ public void testIfCkptAndSourceOfReplPropsIgnoredByReplDump() throws Throwable {
.dump(primaryDbName, Collections.emptyList());
// Incremental Repl A -> B with alters on db/table/partition
- WarehouseInstance.Tuple tupleReplicaInc = replica.load(replicatedDbName, primaryDbName)
- .run("repl status " + replicatedDbName)
+ replica.load(replicatedDbName, primaryDbName);
Review comment:
Done
##########
File path: itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java
##########
@@ -4287,6 +4288,37 @@ public void testMoveOptimizationIncremental() throws IOException {
verifyRun("SELECT count(*) from " + replDbName + ".unptned_late ", "3", driverMirror);
}
+ @Test
+ public void testReplTargetSetInIncremental() throws Exception {
+ String name = testName.getMethodName();
+ String dbName = createDB(name, driver);
Review comment:
Done
##########
File path: itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java
##########
@@ -4287,6 +4288,37 @@ public void testMoveOptimizationIncremental() throws IOException {
verifyRun("SELECT count(*) from " + replDbName + ".unptned_late ", "3", driverMirror);
}
+ @Test
+ public void testReplTargetSetInIncremental() throws Exception {
+ String name = testName.getMethodName();
+ String dbName = createDB(name, driver);
+ String replDbName = dbName + "_dupe";
+
+ run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE", driver);
+ Tuple bootstrapDump = bootstrapLoadAndVerify(dbName, replDbName);
+
Review comment:
Done
##########
File path: itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java
##########
@@ -4287,6 +4288,37 @@ public void testMoveOptimizationIncremental() throws IOException {
verifyRun("SELECT count(*) from " + replDbName + ".unptned_late ", "3", driverMirror);
}
+ @Test
+ public void testReplTargetSetInIncremental() throws Exception {
+ String name = testName.getMethodName();
+ String dbName = createDB(name, driver);
+ String replDbName = dbName + "_dupe";
+
+ run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE", driver);
+ Tuple bootstrapDump = bootstrapLoadAndVerify(dbName, replDbName);
+
+ // Remove TARGET_OF_REPLICATION property.
+ run("ALTER DATABASE " + replDbName + " Set DBPROPERTIES ( '" + TARGET_OF_REPLICATION + "' = '')", driverMirror);
+
Review comment:
Done
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org