Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.2 aa2cce6c4 -> d877abe74
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/d877abe7 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/d877abe7 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/d877abe7 Branch: refs/heads/4.x-HBase-1.2 Commit: d877abe745c1fbc1a5e2bcb80430792041e9d2d4 Parents: aa2cce6 Author: Samarth Jain <[email protected]> Authored: Thu Aug 31 17:45:59 2017 -0700 Committer: Samarth Jain <[email protected]> Committed: Thu Aug 31 17:45:59 2017 -0700 ---------------------------------------------------------------------- .../phoenix/end2end/ConcurrentMutationsIT.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/d877abe7/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); + } } }
