Repository: phoenix Updated Branches: refs/heads/master c2e85f213 -> 1aabbfa0d
PHOENIX-4143 ConcurrentMutationsIT flaps Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/1aabbfa0 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/1aabbfa0 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/1aabbfa0 Branch: refs/heads/master Commit: 1aabbfa0d04261d1cebba845deaebf4c4048ae62 Parents: c2e85f2 Author: Samarth Jain <[email protected]> Authored: Thu Aug 31 17:45:35 2017 -0700 Committer: Samarth Jain <[email protected]> Committed: Thu Aug 31 17:45:35 2017 -0700 ---------------------------------------------------------------------- .../phoenix/end2end/ConcurrentMutationsIT.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/1aabbfa0/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java index 83b9913..6d327f7 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java @@ -64,16 +64,24 @@ public class ConcurrentMutationsIT extends ParallelStatsDisabledIT { private final Object lock = new Object(); private long scn = 100; - private static void addDelayingCoprocessor(Connection conn, String tableName) throws SQLException, IOException { + private static void addDelayingCoprocessor(Connection conn, String tableName) throws Exception { int priority = QueryServicesOptions.DEFAULT_COPROCESSOR_PRIORITY + 100; ConnectionQueryServices services = conn.unwrap(PhoenixConnection.class).getQueryServices(); HTableDescriptor descriptor = services.getTableDescriptor(Bytes.toBytes(tableName)); descriptor.addCoprocessor(DelayingRegionObserver.class.getName(), null, priority, null); - HBaseAdmin admin = services.getAdmin(); - try { + int numTries = 10; + try (HBaseAdmin admin = services.getAdmin()) { admin.modifyTable(Bytes.toBytes(tableName), descriptor); - } finally { - admin.close(); + while (!admin.getTableDescriptor(Bytes.toBytes(tableName)).equals(descriptor) + && numTries > 0) { + numTries--; + if (numTries == 0) { + throw new Exception( + "Check to detect if delaying co-processor was added failed after " + + numTries + " retries."); + } + Thread.sleep(1000); + } } }
