You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2018/07/04 01:35:13 UTC
[2/5] hive git commit: HIVE-20062 : TestReplicationScenarios doesn't
clean injection properly,
causing bizarre interdependent failures (Sergey Shelukhin,
reviewed by Sankar Hariappan)
HIVE-20062 : TestReplicationScenarios doesn't clean injection properly, causing bizarre interdependent failures (Sergey Shelukhin, reviewed by Sankar Hariappan)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/19676a33
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/19676a33
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/19676a33
Branch: refs/heads/master-txnstats
Commit: 19676a33c250a1c1b7f1c3d016098d4b30bb9f02
Parents: cc8ac97
Author: sergey <se...@apache.org>
Authored: Tue Jul 3 16:11:45 2018 -0700
Committer: sergey <se...@apache.org>
Committed: Tue Jul 3 16:11:45 2018 -0700
----------------------------------------------------------------------
.../hive/ql/parse/TestReplicationScenarios.java | 87 +++++++++++---------
1 file changed, 49 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/19676a33/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java
----------------------------------------------------------------------
diff --git a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java
index c82a933..73ac6d8 100644
--- a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java
+++ b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java
@@ -455,11 +455,13 @@ public class TestReplicationScenarios {
}
};
InjectableBehaviourObjectStore.setGetTableBehaviour(ptnedTableNuller);
-
- // The ptned table will not be dumped as getTable will return null
- run("REPL DUMP " + dbName, driver);
- ptnedTableNuller.assertInjectionsPerformed(true,true);
- InjectableBehaviourObjectStore.resetGetTableBehaviour(); // reset the behaviour
+ try {
+ // The ptned table will not be dumped as getTable will return null
+ run("REPL DUMP " + dbName, driver);
+ ptnedTableNuller.assertInjectionsPerformed(true,true);
+ } finally {
+ InjectableBehaviourObjectStore.resetGetTableBehaviour(); // reset the behaviour
+ }
String replDumpLocn = getResult(0, 0, driver);
String replDumpId = getResult(0, 1, true, driver);
@@ -520,11 +522,13 @@ public class TestReplicationScenarios {
}
};
InjectableBehaviourObjectStore.setListPartitionNamesBehaviour(listPartitionNamesNuller);
-
- // None of the partitions will be dumped as the partitions list was empty
- run("REPL DUMP " + dbName, driver);
- listPartitionNamesNuller.assertInjectionsPerformed(true, false);
- InjectableBehaviourObjectStore.resetListPartitionNamesBehaviour(); // reset the behaviour
+ try {
+ // None of the partitions will be dumped as the partitions list was empty
+ run("REPL DUMP " + dbName, driver);
+ listPartitionNamesNuller.assertInjectionsPerformed(true, false);
+ } finally {
+ InjectableBehaviourObjectStore.resetListPartitionNamesBehaviour(); // reset the behaviour
+ }
String replDumpLocn = getResult(0, 0, driver);
String replDumpId = getResult(0, 1, true, driver);
@@ -607,12 +611,13 @@ public class TestReplicationScenarios {
}
};
InjectableBehaviourObjectStore.setGetTableBehaviour(ptnedTableRenamer);
-
- // The intermediate rename would've failed as bootstrap dump in progress
- bootstrapLoadAndVerify(dbName, replDbName);
-
- ptnedTableRenamer.assertInjectionsPerformed(true,true);
- InjectableBehaviourObjectStore.resetGetTableBehaviour(); // reset the behaviour
+ try {
+ // The intermediate rename would've failed as bootstrap dump in progress
+ bootstrapLoadAndVerify(dbName, replDbName);
+ ptnedTableRenamer.assertInjectionsPerformed(true,true);
+ } finally {
+ InjectableBehaviourObjectStore.resetGetTableBehaviour(); // reset the behaviour
+ }
// The ptned table should be there in both source and target as rename was not successful
verifyRun("SELECT a from " + dbName + ".ptned WHERE (b=1) ORDER BY a", ptn_data, driver);
@@ -660,7 +665,7 @@ public class TestReplicationScenarios {
CommandProcessorResponse ret = driver2.run("DROP TABLE " + dbName + ".ptned");
success = (ret.getException() == null);
assertTrue(success);
- LOG.info("Exit new thread success - {}", success);
+ LOG.info("Exit new thread success - {}", success, ret.getException());
}
});
t.start();
@@ -675,11 +680,13 @@ public class TestReplicationScenarios {
}
};
InjectableBehaviourObjectStore.setGetTableBehaviour(ptnedTableRenamer);
-
- Tuple bootstrap = bootstrapLoadAndVerify(dbName, replDbName);
-
- ptnedTableRenamer.assertInjectionsPerformed(true,true);
- InjectableBehaviourObjectStore.resetGetTableBehaviour(); // reset the behaviour
+ Tuple bootstrap = null;
+ try {
+ bootstrap = bootstrapLoadAndVerify(dbName, replDbName);
+ ptnedTableRenamer.assertInjectionsPerformed(true,true);
+ } finally {
+ InjectableBehaviourObjectStore.resetGetTableBehaviour(); // reset the behaviour
+ }
incrementalLoadAndVerify(dbName, bootstrap.lastReplId, replDbName);
verifyIfTableNotExist(replDbName, "ptned", metaStoreClientMirror);
@@ -853,12 +860,14 @@ public class TestReplicationScenarios {
}
};
InjectableBehaviourObjectStore.setGetNextNotificationBehaviour(eventIdSkipper);
-
- advanceDumpDir();
- CommandProcessorResponse ret = driver.run("REPL DUMP " + dbName + " FROM " + replDumpId);
- assertTrue(ret.getResponseCode() == ErrorMsg.REPL_EVENTS_MISSING_IN_METASTORE.getErrorCode());
- eventIdSkipper.assertInjectionsPerformed(true,false);
- InjectableBehaviourObjectStore.resetGetNextNotificationBehaviour(); // reset the behaviour
+ try {
+ advanceDumpDir();
+ CommandProcessorResponse ret = driver.run("REPL DUMP " + dbName + " FROM " + replDumpId);
+ assertTrue(ret.getResponseCode() == ErrorMsg.REPL_EVENTS_MISSING_IN_METASTORE.getErrorCode());
+ eventIdSkipper.assertInjectionsPerformed(true,false);
+ } finally {
+ InjectableBehaviourObjectStore.resetGetNextNotificationBehaviour(); // reset the behaviour
+ }
}
@Test
@@ -1372,11 +1381,12 @@ public class TestReplicationScenarios {
}
};
InjectableBehaviourObjectStore.setGetNextNotificationBehaviour(eventTypeValidator);
-
- incrementalLoadAndVerify(dbName, bootstrap.lastReplId, replDbName);
-
- eventTypeValidator.assertInjectionsPerformed(true,false);
- InjectableBehaviourObjectStore.resetGetNextNotificationBehaviour(); // reset the behaviour
+ try {
+ incrementalLoadAndVerify(dbName, bootstrap.lastReplId, replDbName);
+ eventTypeValidator.assertInjectionsPerformed(true,false);
+ } finally {
+ InjectableBehaviourObjectStore.resetGetNextNotificationBehaviour(); // reset the behaviour
+ }
verifyRun("SELECT a from " + replDbName + ".ptned where (b=1)", ptn_data, driverMirror);
}
@@ -1431,11 +1441,12 @@ public class TestReplicationScenarios {
}
};
InjectableBehaviourObjectStore.setGetNextNotificationBehaviour(insertEventRepeater);
-
- incrementalLoadAndVerify(dbName, bootstrap.lastReplId, replDbName);
-
- insertEventRepeater.assertInjectionsPerformed(true,false);
- InjectableBehaviourObjectStore.resetGetNextNotificationBehaviour(); // reset the behaviour
+ try {
+ incrementalLoadAndVerify(dbName, bootstrap.lastReplId, replDbName);
+ insertEventRepeater.assertInjectionsPerformed(true,false);
+ } finally {
+ InjectableBehaviourObjectStore.resetGetNextNotificationBehaviour(); // reset the behaviour
+ }
verifyRun("SELECT a from " + replDbName + ".unptned", unptn_data, driverMirror);
}