You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ja...@apache.org on 2022/01/14 17:20:02 UTC
[pinot] branch master updated: Fixes for various JDBC issues (#7784)
This is an automated email from the ASF dual-hosted git repository.
jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new c1e9072 Fixes for various JDBC issues (#7784)
c1e9072 is described below
commit c1e9072fbad8e9d6fee81d1bdc6290b310a13d2b
Author: Kenny Bastani <kb...@socialmoon.com>
AuthorDate: Fri Jan 14 12:19:40 2022 -0500
Fixes for various JDBC issues (#7784)
- The default maximum limit on records is added to SQL queries without a defined limit, which causes errors to be returned for some queries.
- Various timeout issues were detected in the async HTTP client requests to the Pinot broker.
---
.../src/main/java/org/apache/pinot/client/Connection.java | 15 ++++++++++++++-
.../pinot/client/JsonAsyncHttpPinotClientTransport.java | 11 ++++++++---
.../main/java/org/apache/pinot/client/PinotStatement.java | 2 +-
3 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/Connection.java b/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/Connection.java
index 8033c9a..0e5e66a 100644
--- a/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/Connection.java
+++ b/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/Connection.java
@@ -136,6 +136,18 @@ public class Connection {
throw new PinotClientException(
"Could not find broker to query for table: " + (tableName == null ? "null" : tableName));
}
+ return execute(request, brokerHostPort);
+ }
+
+ /**
+ * Executes a Pinot request with a specified broker URL.
+ * @param request is the request to execute
+ * @param brokerHostPort is the URL of the broker to query
+ * @return The result of the query
+ * @throws PinotClientException If an exception occurs while processing the query
+ */
+ public ResultSetGroup execute(Request request, String brokerHostPort)
+ throws PinotClientException {
BrokerResponse response = _transport.executeQuery(brokerHostPort, request);
if (response.hasExceptions() && _failOnExceptions) {
throw new PinotClientException("Query had processing exceptions: \n" + response.getExceptions());
@@ -143,6 +155,7 @@ public class Connection {
return new ResultSetGroup(response);
}
+
/**
* Executes a PQL query asynchronously.
*
@@ -223,7 +236,7 @@ public class Connection {
public ResultSetGroup get()
throws InterruptedException, ExecutionException {
try {
- return get(1000L, TimeUnit.DAYS);
+ return get(60000L, TimeUnit.MILLISECONDS);
} catch (TimeoutException e) {
throw new ExecutionException(e);
}
diff --git a/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java b/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java
index 603d6aa..010474c 100644
--- a/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java
+++ b/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java
@@ -54,6 +54,9 @@ public class JsonAsyncHttpPinotClientTransport implements PinotClientTransport {
private final Map<String, String> _headers;
private final String _scheme;
+ private static final long BROKER_READ_TIMEOUT_MS = 60000L;
+ private static final int BROKER_CONNECT_TIMEOUT_MS = 2000;
+
private final AsyncHttpClient _httpClient;
public JsonAsyncHttpPinotClientTransport() {
@@ -72,6 +75,8 @@ public class JsonAsyncHttpPinotClientTransport implements PinotClientTransport {
builder.setSslContext(new JdkSslContext(sslContext, true, ClientAuth.OPTIONAL));
}
+ builder.setReadTimeout((int) BROKER_READ_TIMEOUT_MS)
+ .setConnectTimeout(BROKER_CONNECT_TIMEOUT_MS);
_httpClient = Dsl.asyncHttpClient(builder.build());
}
@@ -92,7 +97,7 @@ public class JsonAsyncHttpPinotClientTransport implements PinotClientTransport {
public BrokerResponse executeQuery(String brokerAddress, String query)
throws PinotClientException {
try {
- return executeQueryAsync(brokerAddress, query).get();
+ return executeQueryAsync(brokerAddress, query).get(BROKER_READ_TIMEOUT_MS, TimeUnit.MILLISECONDS);
} catch (Exception e) {
throw new PinotClientException(e);
}
@@ -137,7 +142,7 @@ public class JsonAsyncHttpPinotClientTransport implements PinotClientTransport {
public BrokerResponse executeQuery(String brokerAddress, Request request)
throws PinotClientException {
try {
- return executeQueryAsync(brokerAddress, request).get();
+ return executeQueryAsync(brokerAddress, request).get(BROKER_READ_TIMEOUT_MS, TimeUnit.MILLISECONDS);
} catch (Exception e) {
throw new PinotClientException(e);
}
@@ -191,7 +196,7 @@ public class JsonAsyncHttpPinotClientTransport implements PinotClientTransport {
@Override
public BrokerResponse get()
throws ExecutionException {
- return get(1000L, TimeUnit.DAYS);
+ return get(BROKER_READ_TIMEOUT_MS, TimeUnit.MILLISECONDS);
}
@Override
diff --git a/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotStatement.java b/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotStatement.java
index 23c790d..43910ad 100644
--- a/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotStatement.java
+++ b/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotStatement.java
@@ -34,7 +34,7 @@ public class PinotStatement extends AbstractBaseStatement {
private ResultSetGroup _resultSetGroup;
private boolean _closed;
private ResultSet _resultSet;
- private int _maxRows = Integer.MAX_VALUE;
+ private int _maxRows = 1000000;
public PinotStatement(PinotConnection connection) {
_connection = connection;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org