You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ja...@apache.org on 2018/11/17 23:30:18 UTC
[2/2] phoenix git commit: PHOENIX-5028 Delay acquisition of port and
increase Tephra test discovery timeouts
PHOENIX-5028 Delay acquisition of port and increase Tephra test discovery timeouts
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/e07226b3
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/e07226b3
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/e07226b3
Branch: refs/heads/4.x-HBase-1.2
Commit: e07226b3e9d6ffecdb33acd4955fd51ea4322dd7
Parents: 8a46d00
Author: James Taylor <ja...@apache.org>
Authored: Sat Nov 17 15:13:59 2018 -0800
Committer: James Taylor <ja...@apache.org>
Committed: Sat Nov 17 15:27:26 2018 -0800
----------------------------------------------------------------------
.../end2end/ConnectionQueryServicesTestImpl.java | 4 +++-
.../transaction/OmidTransactionProvider.java | 2 +-
.../transaction/PhoenixTransactionProvider.java | 2 +-
.../transaction/TephraTransactionProvider.java | 17 ++++++++++-------
.../phoenix/query/QueryServicesTestImpl.java | 3 ---
5 files changed, 15 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/e07226b3/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
index 6ebaa65..969e0f4 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionQueryServicesTestImpl.java
@@ -35,6 +35,7 @@ import org.apache.phoenix.transaction.PhoenixTransactionService;
import org.apache.phoenix.transaction.TransactionFactory;
import org.apache.phoenix.transaction.TransactionFactory.Provider;
import org.apache.phoenix.util.SQLCloseables;
+import org.apache.phoenix.util.TestUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -102,7 +103,8 @@ public class ConnectionQueryServicesTestImpl extends ConnectionQueryServicesImpl
public synchronized PhoenixTransactionClient initTransactionClient(Provider provider) throws SQLException {
PhoenixTransactionService txService = txServices[provider.ordinal()];
if (txService == null) {
- txService = txServices[provider.ordinal()] = provider.getTransactionProvider().getTransactionService(config, connectionInfo);
+ int port = TestUtil.getRandomPort();
+ txService = txServices[provider.ordinal()] = provider.getTransactionProvider().getTransactionService(config, connectionInfo, port);
}
return super.initTransactionClient(provider);
}
http://git-wip-us.apache.org/repos/asf/phoenix/blob/e07226b3/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
index c53215c..bace2bc 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java
@@ -72,7 +72,7 @@ public class OmidTransactionProvider implements PhoenixTransactionProvider {
}
@Override
- public PhoenixTransactionService getTransactionService(Configuration config, ConnectionInfo connectionInfo) throws SQLException{
+ public PhoenixTransactionService getTransactionService(Configuration config, ConnectionInfo connectionInfo, int port) throws SQLException{
return new OmidTransactionService();
}
http://git-wip-us.apache.org/repos/asf/phoenix/blob/e07226b3/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java b/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
index b7f660e..3af554b 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/transaction/PhoenixTransactionProvider.java
@@ -50,7 +50,7 @@ public interface PhoenixTransactionProvider {
public PhoenixTransactionContext getTransactionContext(PhoenixConnection connection) throws SQLException;
public PhoenixTransactionClient getTransactionClient(Configuration config, ConnectionInfo connectionInfo) throws SQLException;
- public PhoenixTransactionService getTransactionService(Configuration config, ConnectionInfo connectionInfo) throws SQLException;
+ public PhoenixTransactionService getTransactionService(Configuration config, ConnectionInfo connectionInfo, int port) throws SQLException;
public Class<? extends RegionObserver> getCoprocessor();
public Class<? extends RegionObserver> getGCCoprocessor();
http://git-wip-us.apache.org/repos/asf/phoenix/blob/e07226b3/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionProvider.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionProvider.java b/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionProvider.java
index 70937cf..7025e5b 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionProvider.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionProvider.java
@@ -89,16 +89,17 @@ public class TephraTransactionProvider implements PhoenixTransactionProvider {
}
int timeOut = config.getInt(HConstants.ZK_SESSION_TIMEOUT, HConstants.DEFAULT_ZK_SESSION_TIMEOUT);
+ int retryTimeOut = config.getInt(TxConstants.Service.CFG_DATA_TX_CLIENT_DISCOVERY_TIMEOUT_SEC,
+ TxConstants.Service.DEFAULT_DATA_TX_CLIENT_DISCOVERY_TIMEOUT_SEC);
// Create instance of the tephra zookeeper client
ZKClientService zkClientService = ZKClientServices.delegate(
ZKClients.reWatchOnExpire(
ZKClients.retryOnFailure(
new TephraZKClientService(zkQuorumServersString, timeOut, null,
ArrayListMultimap.<String, byte[]>create()),
- RetryStrategies.exponentialDelay(500, 2000, TimeUnit.MILLISECONDS))
+ RetryStrategies.exponentialDelay(500, retryTimeOut, TimeUnit.MILLISECONDS))
)
);
- //txZKClientService.startAndWait();
ZKDiscoveryService zkDiscoveryService = new ZKDiscoveryService(zkClientService);
PooledClientProvider pooledClientProvider = new PooledClientProvider(
config, zkDiscoveryService);
@@ -110,7 +111,10 @@ public class TephraTransactionProvider implements PhoenixTransactionProvider {
}
@Override
- public PhoenixTransactionService getTransactionService(Configuration config, ConnectionInfo connInfo) {
+ public PhoenixTransactionService getTransactionService(Configuration config, ConnectionInfo connInfo, int port) {
+ config.setInt(TxConstants.Service.CFG_DATA_TX_BIND_PORT, port);
+ int retryTimeOut = config.getInt(TxConstants.Service.CFG_DATA_TX_CLIENT_DISCOVERY_TIMEOUT_SEC,
+ TxConstants.Service.DEFAULT_DATA_TX_CLIENT_DISCOVERY_TIMEOUT_SEC);
ZKClientService zkClient = ZKClientServices.delegate(
ZKClients.reWatchOnExpire(
ZKClients.retryOnFailure(
@@ -118,17 +122,16 @@ public class TephraTransactionProvider implements PhoenixTransactionProvider {
.setSessionTimeout(config.getInt(HConstants.ZK_SESSION_TIMEOUT,
HConstants.DEFAULT_ZK_SESSION_TIMEOUT))
.build(),
- RetryStrategies.exponentialDelay(500, 2000, TimeUnit.MILLISECONDS)
+ RetryStrategies.exponentialDelay(500, retryTimeOut, TimeUnit.MILLISECONDS)
)
)
);
- //zkClient.startAndWait();
DiscoveryService discovery = new ZKDiscoveryService(zkClient);
- TransactionManager txManager = new TransactionManager(config, new HDFSTransactionStateStorage(config, new SnapshotCodecProvider(config), new TxMetricsCollector()), new TxMetricsCollector());
+ TransactionManager txManager = new TransactionManager(config, new HDFSTransactionStateStorage(config,
+ new SnapshotCodecProvider(config), new TxMetricsCollector()), new TxMetricsCollector());
TransactionService txService = new TransactionService(config, zkClient, discovery, Providers.of(txManager));
TephraTransactionService service = new TephraTransactionService(zkClient, txService);
- //txService.startAndWait();
service.start();
return service;
}
http://git-wip-us.apache.org/repos/asf/phoenix/blob/e07226b3/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
index eae951a..2049390 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryServicesTestImpl.java
@@ -129,13 +129,10 @@ public final class QueryServicesTestImpl extends BaseQueryServicesImpl {
.set(TxConstants.Manager.CFG_DO_PERSIST, false)
.set(TxConstants.Service.CFG_DATA_TX_CLIENT_RETRY_STRATEGY, "n-times")
.set(TxConstants.Service.CFG_DATA_TX_CLIENT_ATTEMPTS, 1)
- .set(TxConstants.Service.CFG_DATA_TX_BIND_PORT, TestUtil.getRandomPort())
.set(TxConstants.Service.CFG_DATA_TX_CLIENT_DISCOVERY_TIMEOUT_SEC, 60)
.set(TxConstants.Manager.CFG_TX_SNAPSHOT_DIR, Files.createTempDir().getAbsolutePath())
.set(TxConstants.Manager.CFG_TX_TIMEOUT, DEFAULT_TXN_TIMEOUT_SECONDS)
.set(TxConstants.Manager.CFG_TX_SNAPSHOT_INTERVAL, 5L)
- // setup default test configs for Omid
- .set(OmidTransactionProvider.OMID_TSO_PORT, TestUtil.getRandomPort())
;
}