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