Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;

import org.apache.http.util.EntityUtils;

/**
* Test throughput for Pinot.
Expand Down Expand Up @@ -90,8 +90,9 @@ public void run() {
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
while (System.currentTimeMillis() < endTime) {
long startTime = System.currentTimeMillis();
CloseableHttpResponse httpResponse = httpClient.execute(httpPosts[RANDOM.nextInt(numQueries)]);
httpResponse.close();
try (CloseableHttpResponse httpResponse = httpClient.execute(httpPosts[RANDOM.nextInt(numQueries)])) {
EntityUtils.consume(httpResponse.getEntity());
}
long responseTime = System.currentTimeMillis() - startTime;
counter.getAndIncrement();
totalResponseTime.getAndAdd(responseTime);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public ZkHelixPropertyStore<ZNRecord> getPropertyStore() {
private void addInstanceGroupTagIfNeeded() {
InstanceConfig instanceConfig = getHelixInstanceConfig(_instanceId);
assert instanceConfig != null;
if (!instanceConfig.containsTag(Helix.CONTROLLER_INSTANCE)) {
if (instanceConfig != null && !instanceConfig.containsTag(Helix.CONTROLLER_INSTANCE)) {
LOGGER.info("Controller: {} doesn't contain group tag: {}. Adding one.", _instanceId, Helix.CONTROLLER_INSTANCE);
instanceConfig.addTag(Helix.CONTROLLER_INSTANCE);
HelixDataAccessor accessor = _helixZkManager.getHelixDataAccessor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ public String deserialize(byte[] bytes) {

@Override
public String deserialize(ByteBuffer byteBuffer) {
if (byteBuffer.hasArray()) {
return StringUtil.decodeUtf8(byteBuffer.array(), byteBuffer.position() + byteBuffer.arrayOffset(), byteBuffer.remaining());
}
byte[] bytes = new byte[byteBuffer.remaining()];
byteBuffer.get(bytes);
return StringUtil.decodeUtf8(bytes);
Expand Down