You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ka...@apache.org on 2023/02/22 17:56:20 UTC
[phoenix] branch master updated: PHOENIX-6884 Phoenix to use hbase.rpc.read.timeout and hbase.rpc.writ… (#1566)
This is an automated email from the ASF dual-hosted git repository.
kadir pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/master by this push:
new 25d98a1264 PHOENIX-6884 Phoenix to use hbase.rpc.read.timeout and hbase.rpc.writ… (#1566)
25d98a1264 is described below
commit 25d98a12649f02fb74f5565d39154d66bcc3b3d9
Author: kadirozde <37...@users.noreply.github.com>
AuthorDate: Wed Feb 22 09:56:11 2023 -0800
PHOENIX-6884 Phoenix to use hbase.rpc.read.timeout and hbase.rpc.writ… (#1566)
---
.../coprocessor/MetaDataRegionObserver.java | 4 ++
.../apache/phoenix/mapreduce/index/IndexTool.java | 4 ++
.../phoenix/mapreduce/index/IndexUpgradeTool.java | 3 ++
.../java/org/apache/phoenix/util/ScanUtil.java | 43 +++++++++++++++-------
.../java/org/apache/phoenix/query/BaseTest.java | 7 +---
5 files changed, 42 insertions(+), 19 deletions(-)
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java
index 223c69ef68..7fb2f18de5 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java
@@ -636,6 +636,10 @@ public class MetaDataRegionObserver implements RegionObserver,RegionCoprocessor
Long.toString(indexRebuildClientScannerTimeOutMs));
props.setProperty(HConstants.HBASE_RPC_TIMEOUT_KEY,
Long.toString(indexRebuildRPCTimeoutMs));
+ props.setProperty(HConstants.HBASE_RPC_READ_TIMEOUT_KEY,
+ Long.toString(indexRebuildRPCTimeoutMs));
+ props.setProperty(HConstants.HBASE_RPC_WRITE_TIMEOUT_KEY,
+ Long.toString(indexRebuildRPCTimeoutMs));
props.setProperty(HConstants.HBASE_CLIENT_RETRIES_NUMBER,
Long.toString(indexRebuildRpcRetriesCounter));
// don't run a second index populations upsert select
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java
index dc9bcbd99d..1b7dc9a3b5 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java
@@ -716,6 +716,10 @@ public class IndexTool extends Configured implements Tool {
Long.toString(indexRebuildClientScannerTimeOutMs));
configuration.set(HConstants.HBASE_RPC_TIMEOUT_KEY,
Long.toString(indexRebuildRPCTimeoutMs));
+ configuration.set(HConstants.HBASE_RPC_READ_TIMEOUT_KEY,
+ Long.toString(indexRebuildRPCTimeoutMs));
+ configuration.set(HConstants.HBASE_RPC_WRITE_TIMEOUT_KEY,
+ Long.toString(indexRebuildRPCTimeoutMs));
configuration.set(HConstants.HBASE_CLIENT_RETRIES_NUMBER,
Long.toString(indexRebuildRpcRetriesCounter));
configuration.set("mapreduce.task.timeout", Long.toString(indexRebuildQueryTimeoutMs));
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexUpgradeTool.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexUpgradeTool.java
index c528c829dd..0e97eb9e81 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexUpgradeTool.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexUpgradeTool.java
@@ -357,6 +357,7 @@ public class IndexUpgradeTool extends Configured implements Tool {
long indexRebuildRPCTimeoutMs =
conf.getLong(QueryServices.INDEX_REBUILD_RPC_TIMEOUT_ATTRIB,
QueryServicesOptions.DEFAULT_INDEX_REBUILD_RPC_TIMEOUT);
+
long indexRebuildClientScannerTimeOutMs =
conf.getLong(QueryServices.INDEX_REBUILD_CLIENT_SCANNER_TIMEOUT_ATTRIB,
QueryServicesOptions.DEFAULT_INDEX_REBUILD_CLIENT_SCANNER_TIMEOUT);
@@ -367,6 +368,8 @@ public class IndexUpgradeTool extends Configured implements Tool {
// Set phoenix and hbase level timeouts and rpc retries
conf.setLong(QueryServices.THREAD_TIMEOUT_MS_ATTRIB, indexRebuildQueryTimeoutMs);
conf.setLong(HConstants.HBASE_RPC_TIMEOUT_KEY, indexRebuildRPCTimeoutMs);
+ conf.setLong(HConstants.HBASE_RPC_READ_TIMEOUT_KEY, indexRebuildRPCTimeoutMs);
+ conf.setLong(HConstants.HBASE_RPC_WRITE_TIMEOUT_KEY, indexRebuildRPCTimeoutMs);
conf.setLong(HConstants.HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD,
indexRebuildClientScannerTimeOutMs);
conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, indexRebuildRpcRetriesCounter);
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
index 5ba1a6f1b2..445dc47922 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
@@ -1307,6 +1307,32 @@ public class ScanUtil {
}
}
+ public static Long getRPCReadTimeout(ReadOnlyProps props) {
+ if (props.get(HConstants.HBASE_RPC_READ_TIMEOUT_KEY) != null) {
+ return props.getLong(HConstants.HBASE_RPC_READ_TIMEOUT_KEY,
+ HConstants.DEFAULT_HBASE_RPC_TIMEOUT);
+ } else {
+ return props.getLong(HConstants.HBASE_RPC_TIMEOUT_KEY,
+ HConstants.DEFAULT_HBASE_RPC_TIMEOUT);
+ }
+ }
+
+ public static Long getPageSizeInMs(ReadOnlyProps props) {
+ if (props.getBoolean(QueryServices.PHOENIX_SERVER_PAGING_ENABLED_ATTRIB,
+ QueryServicesOptions.DEFAULT_PHOENIX_SERVER_PAGING_ENABLED)) {
+ long pageSizeMs = props.getInt(QueryServices.PHOENIX_SERVER_PAGE_SIZE_MS, -1);
+ if (pageSizeMs == -1) {
+ // Use the half of the HBase RPC read timeout value as the server page size to
+ // make sure that the HBase region server will be able to send a heartbeat
+ // message to the client before the client times out
+ return getRPCReadTimeout(props) / 2;
+ } else {
+ return pageSizeMs;
+ }
+ }
+ return null;
+ }
+
public static void setScanAttributesForClient(Scan scan, PTable table,
PhoenixConnection phoenixConnection) throws SQLException {
setScanAttributesForIndexReadRepair(scan, table, phoenixConnection);
@@ -1316,20 +1342,11 @@ public class ScanUtil {
if (emptyCF != null && emptyCQ != null) {
addEmptyColumnToScan(scan, emptyCF, emptyCQ);
}
- if (phoenixConnection.getQueryServices().getProps().getBoolean(
- QueryServices.PHOENIX_SERVER_PAGING_ENABLED_ATTRIB,
- QueryServicesOptions.DEFAULT_PHOENIX_SERVER_PAGING_ENABLED)) {
- long pageSizeMs = phoenixConnection.getQueryServices().getProps()
- .getInt(QueryServices.PHOENIX_SERVER_PAGE_SIZE_MS, -1);
- if (pageSizeMs == -1) {
- // Use the half of the HBase RPC timeout value as the the server page size to make sure that the HBase
- // region server will be able to send a heartbeat message to the client before the client times out
- pageSizeMs = (long) (phoenixConnection.getQueryServices().getProps()
- .getLong(HConstants.HBASE_RPC_TIMEOUT_KEY, HConstants.DEFAULT_HBASE_RPC_TIMEOUT) * 0.5);
- }
- scan.setAttribute(BaseScannerRegionObserver.SERVER_PAGE_SIZE_MS, Bytes.toBytes(Long.valueOf(pageSizeMs)));
+ Long pageSizeMs = getPageSizeInMs(phoenixConnection.getQueryServices().getProps());
+ if (pageSizeMs != null) {
+ scan.setAttribute(BaseScannerRegionObserver.SERVER_PAGE_SIZE_MS,
+ Bytes.toBytes(pageSizeMs));
}
-
}
public static void getDummyResult(byte[] rowKey, List<Cell> result) {
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
index 30f73f77c8..f35937f6d7 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
@@ -632,12 +632,7 @@ public abstract class BaseTest {
conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 2);
conf.setInt(NUM_CONCURRENT_INDEX_WRITER_THREADS_CONF_KEY, 1);
conf.setInt(GLOBAL_INDEX_ROW_AGE_THRESHOLD_TO_DELETE_MS_ATTRIB, 0);
- // This results in processing one row at a time in each next operation of the aggregate region
- // scanner, i.e., one row pages. In other words, 0ms page allows only one row to be processed
- // within one page; 0ms page is equivalent to one-row page
- if (conf.getLong(QueryServices.PHOENIX_SERVER_PAGE_SIZE_MS, 0) == 0) {
- conf.setLong(QueryServices.PHOENIX_SERVER_PAGE_SIZE_MS, 0);
- }
+ conf.setInt(HConstants.HBASE_RPC_READ_TIMEOUT_KEY, 20); // 20ms
return conf;
}