Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 29c2c0a30 -> e63f6d672
PHOENIX-3428 Fix flapping tests in UpgradeIT Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/e63f6d67 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/e63f6d67 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/e63f6d67 Branch: refs/heads/4.x-HBase-0.98 Commit: e63f6d672e30c2c36185cb0ac226b0a6195f2dc2 Parents: 29c2c0a Author: Samarth <[email protected]> Authored: Mon Oct 31 11:31:36 2016 -0700 Committer: Samarth <[email protected]> Committed: Mon Oct 31 11:31:36 2016 -0700 ---------------------------------------------------------------------- .../it/java/org/apache/phoenix/end2end/UpgradeIT.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/e63f6d67/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java index d377bd2..0e5f9f2 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java @@ -72,8 +72,6 @@ import org.junit.Test; public class UpgradeIT extends ParallelStatsDisabledIT { private String tenantId; - private static final byte[] mutexRowKey = SchemaUtil.getTableKey(null, PhoenixDatabaseMetaData.SYSTEM_CATALOG_SCHEMA, - PhoenixDatabaseMetaData.SYSTEM_CATALOG_TABLE); @Before public void generateTenantId() { @@ -699,6 +697,8 @@ public class UpgradeIT extends ParallelStatsDisabledIT { @Test public void testAcquiringAndReleasingUpgradeMutex() throws Exception { ConnectionQueryServices services = null; + byte[] mutexRowKey = SchemaUtil.getTableKey(null, PhoenixDatabaseMetaData.SYSTEM_CATALOG_SCHEMA, + generateUniqueName()); try (Connection conn = getConnection(false, null)) { services = conn.unwrap(PhoenixConnection.class).getQueryServices(); assertTrue(((ConnectionQueryServicesImpl)services) @@ -724,8 +724,9 @@ public class UpgradeIT extends ParallelStatsDisabledIT { ConnectionQueryServices services = null; try (Connection conn = getConnection(false, null)) { services = conn.unwrap(PhoenixConnection.class).getQueryServices(); - FutureTask<Void> task1 = new FutureTask<>(new AcquireMutexRunnable(mutexStatus1, services, latch, numExceptions)); - FutureTask<Void> task2 = new FutureTask<>(new AcquireMutexRunnable(mutexStatus2, services, latch, numExceptions)); + final byte[] mutexKey = Bytes.toBytes(generateUniqueName()); + FutureTask<Void> task1 = new FutureTask<>(new AcquireMutexRunnable(mutexStatus1, services, latch, numExceptions, mutexKey)); + FutureTask<Void> task2 = new FutureTask<>(new AcquireMutexRunnable(mutexStatus2, services, latch, numExceptions, mutexKey)); Thread t1 = new Thread(task1); t1.setDaemon(true); Thread t2 = new Thread(task2); @@ -760,11 +761,13 @@ public class UpgradeIT extends ParallelStatsDisabledIT { private final ConnectionQueryServices services; private final CountDownLatch latch; private final AtomicInteger numExceptions; - public AcquireMutexRunnable(AtomicBoolean acquireStatus, ConnectionQueryServices services, CountDownLatch latch, AtomicInteger numExceptions) { + private final byte[] mutexRowKey; + public AcquireMutexRunnable(AtomicBoolean acquireStatus, ConnectionQueryServices services, CountDownLatch latch, AtomicInteger numExceptions, byte[] mutexKey) { this.acquireStatus = acquireStatus; this.services = services; this.latch = latch; this.numExceptions = numExceptions; + this.mutexRowKey = mutexKey; } @Override public Void call() throws Exception {
