Skip to content

Commit

Permalink
Ensure cached query results are discarded
Browse files Browse the repository at this point in the history
  • Loading branch information
linzebing committed Mar 15, 2022
1 parent 48e0bfa commit d2c7f63
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,10 @@ private synchronized QueryResults getNextResult(long token, UriInfo uriInfo, Dat
// only return a next if
// (1) the query is not done AND the query state is not FAILED
// OR
// (2)there is more data to send (due to buffering)
if (queryInfo.getState() != FAILED && (!queryInfo.isFinalQueryInfo() || !exchangeClient.isFinished() || (lastResult != null && lastResult.getData() != null))) {
// (2) there is more data to send (due to buffering)
// OR
// (3) cached query result needs client acknowledgement to discard
if (queryInfo.getState() != FAILED && (!queryInfo.isFinalQueryInfo() || !exchangeClient.isFinished() || (queryInfo.getOutputStage().isPresent() && !resultRows.isEmpty()))) {
nextToken = OptionalLong.of(token + 1);
}
else {
Expand Down

0 comments on commit d2c7f63

Please sign in to comment.