pkumarsinha commented on a change in pull request #2092:
URL: https://github.com/apache/hive/pull/2092#discussion_r606895664
##########
File path:
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java
##########
@@ -480,7 +481,7 @@ public boolean validate(Task task) {
private Task getReplLoadRootTask(String sourceDb, String replicadb, boolean
isIncrementalDump,
Tuple tuple) throws Throwable {
- HiveConf confTemp = new HiveConf();
+ HiveConf confTemp = driverMirror.getConf();
Review comment:
Why was this needed?
##########
File path:
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java
##########
@@ -4287,6 +4288,42 @@ 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);
+ run("ALTER DATABASE " + dbName + " Set DBPROPERTIES('custom_property' =
'custom_value')", driver);
+ String replDbName = dbName + "_dupe";
+
+ run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE",
driver);
+ Tuple bootstrapDump = bootstrapLoadAndVerify(dbName, replDbName);
+ run("DESCRIBE DATABASE EXTENDED " + replDbName, driverMirror);
+ List<String> result = getOutput(driverMirror);
+ assertTrue(result.get(0), result.get(0).contains("repl.target.for=true"));
+ assertTrue(result.get(0),
result.get(0).contains("custom_property=custom_value"));
+
+ // Remove TARGET_OF_REPLICATION property.
+ run("ALTER DATABASE " + replDbName + " Set DBPROPERTIES('" +
TARGET_OF_REPLICATION + "' = '')", driverMirror);
+
+ run("DESCRIBE DATABASE EXTENDED " + replDbName, driverMirror);
+ result = getOutput(driverMirror);
+ assertTrue(result.get(0), result.get(0).contains("repl.target.for="));
+
+ String[] unptn_data = new String[]{ "eleven" , "twelve" };
+ String unptn_locn = new Path(TEST_PATH, name + "_unptn").toUri().getPath();
+ createTestDataFile(unptn_locn, unptn_data);
+ run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " +
dbName + ".unptned", true, driver);
+ verifySetup("SELECT * from " + dbName + ".unptned", unptn_data, driver);
+
+ // Perform REPL-DUMP/LOAD
+ Tuple incrementalDump = incrementalLoadAndVerify(dbName, replDbName);
+
+ run("DESCRIBE DATABASE EXTENDED " + replDbName, driverMirror);
+ result = getOutput(driverMirror);
+ assertTrue(result.get(0), result.get(0).contains("repl.target.for=true"));
Review comment:
I think we decided to move this to
TestReplicationScenariosAcrossInstances in order to do match both exact entry
as well as count of the db properties entries, no?
##########
File path:
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/WarehouseInstance.java
##########
@@ -458,10 +458,10 @@ private void verifyReplTargetProperty(Map<String, String>
props) {
assertTrue(props.containsKey(ReplConst.REPL_TARGET_TABLE_PROPERTY));
}
- public void verifyTargetOfReplProperty(String dbName) throws Exception {
+ public boolean isSetTargetOfReplProperty(String dbName) throws Exception {
Database db = getDatabase(dbName);
-
assertTrue(db.getParameters().containsKey(ReplUtils.TARGET_OF_REPLICATION));
-
assertTrue(Boolean.getBoolean(db.getParameters().get(ReplUtils.TARGET_OF_REPLICATION)));
+ return db.getParameters().containsKey(ReplUtils.TARGET_OF_REPLICATION)
+ &&
!db.getParameters().get(ReplUtils.TARGET_OF_REPLICATION).isEmpty();
Review comment:
Isn't the value always boolean if set? Why are we breaking that
assumption?
--
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]