use of com.hazelcast.map.QueryResultSizeExceededException in project hazelcast by hazelcast.
the class QueryEngineImpl method addResultsOfPredicate.
@SuppressWarnings("unchecked")
private // modifies partitionIds list! Optimization not to allocate an extra collection with collected partitionIds
void addResultsOfPredicate(List<Future<Result>> futures, Result result, PartitionIdSet unfinishedPartitionIds, boolean rethrowAll) {
for (Future<Result> future : futures) {
Result queryResult = null;
try {
queryResult = future.get();
} catch (Throwable t) {
if (t.getCause() instanceof QueryResultSizeExceededException || rethrowAll) {
throw rethrow(t);
}
logger.fine("Could not get query results", t);
}
if (queryResult == null) {
continue;
}
PartitionIdSet queriedPartitionIds = queryResult.getPartitionIds();
if (queriedPartitionIds != null) {
if (!unfinishedPartitionIds.containsAll(queriedPartitionIds)) {
// see also https://github.com/hazelcast/hazelcast/issues/6471
continue;
}
unfinishedPartitionIds.removeAll(queriedPartitionIds);
result.combine(queryResult);
}
}
}
use of com.hazelcast.map.QueryResultSizeExceededException in project hazelcast by hazelcast.
the class QueryResultSizeLimiter method precheckMaxResultLimitOnLocalPartitions.
void precheckMaxResultLimitOnLocalPartitions(String mapName) {
// check if feature is enabled
if (!isPreCheckEnabled) {
return;
}
// limit number of local partitions to check to keep runtime constant
PartitionIdSet localPartitions = mapServiceContext.getOrInitCachedMemberPartitions();
int partitionsToCheck = min(localPartitions.size(), maxLocalPartitionsLimitForPreCheck);
if (partitionsToCheck == 0) {
return;
}
// calculate size of local partitions
int localPartitionSize = getLocalPartitionSize(mapName, localPartitions, partitionsToCheck);
if (localPartitionSize == 0) {
return;
}
// check local result size
long localResultLimit = getNodeResultLimit(partitionsToCheck);
if (localPartitionSize > localResultLimit * MAX_RESULT_LIMIT_FACTOR_FOR_PRECHECK) {
throw new QueryResultSizeExceededException(maxResultLimit, " Result size exceeded in local pre-check.");
}
}
Aggregations