implement Young-Seok's review comments
diff --git a/asterix-common/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java b/asterix-common/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
index 3fec2c8..e47dfdb 100644
--- a/asterix-common/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
+++ b/asterix-common/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
@@ -422,26 +422,7 @@
break;
case "txnqar": //qar represents query after recovery
try {
- ////////////// <begin of temporary fix> ////////////////////////////
- //TODO
- //Temporary fix in order not to block the build test(mvn verify)
- //A proper fix should not have the while loop here.
- int maxRetryCount = 12;
- int tryCount = 0;
- InputStream resultStream = null;
- long sleepTime = 5;
-
- do {
- //wait until NC starts
- sleepTime *= 2;
- Thread.sleep(sleepTime);
- if (++tryCount > maxRetryCount) {
- LOGGER.info("Metadata node is not running - this test will fail.");
- break;
- }
- resultStream = executeQuery(statement);
- } while (resultStream.toString().contains("Connection refused to host"));
- ////////////// <end of temporary fix> //////////////////////////////
+ InputStream resultStream = executeQuery(statement);
qarFile = new File(actualPath + File.separator
+ testCaseCtx.getTestCase().getFilePath().replace(File.separator, "_") + "_"
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataManager.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataManager.java
index b863e16..1119b0a 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataManager.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataManager.java
@@ -71,6 +71,9 @@
* with transaction ids of regular jobs or other metadata transactions.
*/
public class MetadataManager implements IMetadataManager {
+ private static final int RETRY_MULTIPLIER = 4;
+ private static final int MAX_RETRY_COUNT = 10;
+ private static final int INITIAL_SLEEP_TIME = 64;
// Set in init().
public static MetadataManager INSTANCE;
private final MetadataCache cache = new MetadataCache();
@@ -108,14 +111,14 @@
}
try {
int retry = 0;
- int sleep = 64;
- while (retry++ < 10) {
+ int sleep = INITIAL_SLEEP_TIME;
+ while (retry++ < MAX_RETRY_COUNT) {
metadataNode = proxy.getMetadataNode();
if (metadataNode != null) {
break;
}
Thread.sleep(sleep);
- sleep *= 4;
+ sleep *= RETRY_MULTIPLIER;
}
} catch (InterruptedException e) {
throw new MetadataException(e);