Skip to content

Commit

Permalink
Supporting human-readable format when configuring broker response size (
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhenyun20023 authored Mar 6, 2024
1 parent 0153e9e commit 227281a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
import org.apache.pinot.spi.utils.CommonConstants;
import org.apache.pinot.spi.utils.CommonConstants.Broker;
import org.apache.pinot.spi.utils.CommonConstants.Broker.Request.QueryOptionKey;
import org.apache.pinot.spi.utils.DataSizeUtils;
import org.apache.pinot.spi.utils.TimestampIndexUtils;
import org.apache.pinot.spi.utils.builder.TableNameBuilder;
import org.apache.pinot.sql.FilterKind;
Expand Down Expand Up @@ -1773,17 +1774,17 @@ private void setMaxServerResponseSizeBytes(int numServers, Map<String, String> q
}

// BrokerConfig
Long maxServerResponseSizeBrokerConfig =
_config.getProperty(Broker.CONFIG_OF_MAX_SERVER_RESPONSE_SIZE_BYTES, Long.class);
String maxServerResponseSizeBrokerConfig = _config.getProperty(Broker.CONFIG_OF_MAX_SERVER_RESPONSE_SIZE_BYTES);
if (maxServerResponseSizeBrokerConfig != null) {
queryOptions.put(QueryOptionKey.MAX_SERVER_RESPONSE_SIZE_BYTES, Long.toString(maxServerResponseSizeBrokerConfig));
queryOptions.put(QueryOptionKey.MAX_SERVER_RESPONSE_SIZE_BYTES,
Long.toString(DataSizeUtils.toBytes(maxServerResponseSizeBrokerConfig)));
return;
}
Long maxQueryResponseSizeBrokerConfig =
_config.getProperty(Broker.CONFIG_OF_MAX_QUERY_RESPONSE_SIZE_BYTES, Long.class);

String maxQueryResponseSizeBrokerConfig = _config.getProperty(Broker.CONFIG_OF_MAX_QUERY_RESPONSE_SIZE_BYTES);
if (maxQueryResponseSizeBrokerConfig != null) {
queryOptions.put(QueryOptionKey.MAX_SERVER_RESPONSE_SIZE_BYTES,
Long.toString(maxQueryResponseSizeBrokerConfig / numServers));
Long.toString(DataSizeUtils.toBytes(maxQueryResponseSizeBrokerConfig) / numServers));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,14 @@ public static class Broker {

// Broker config indicating the maximum serialized response size across all servers for a query. This value is
// equally divided across all servers processing the query.
// The value can be in human readable format (e.g. '200K', '200KB', '0.2MB') or in raw bytes (e.g. '200000').
public static final String CONFIG_OF_MAX_QUERY_RESPONSE_SIZE_BYTES = "pinot.broker.max.query.response.size.bytes";

// Broker config indicating the maximum length of the serialized response per server for a query.
// If both "server.response.size" and "query.response.size" are set, then the "server.response.size" takes
// precedence over "query.response.size" (i.e., "query.response.size" will be ignored).
public static final String CONFIG_OF_MAX_SERVER_RESPONSE_SIZE_BYTES = "pinot.broker.max.server.response.size.bytes";


public static class Request {
public static final String SQL = "sql";
public static final String TRACE = "trace";
Expand Down

0 comments on commit 227281a

Please sign in to comment.