Skip to content

Commit

Permalink
Fix data race on stream resultsets
Browse files Browse the repository at this point in the history
  • Loading branch information
alex268 committed Oct 16, 2024
1 parent 1ac976e commit 263c846
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,14 @@ public StreamQueryResult(String msg, YdbStatement statement, YdbQuery query, Run

public void onStreamResultSet(int index, ResultSetReader rsr) {
CompletableFuture<Result<LazyResultSet>> future = resultFutures.get(index);

if (!future.isDone()) {
ColumnInfo[] columns = ColumnInfo.fromResultSetReader(rsr);
future.complete(Result.success(new LazyResultSet(statement, columns)));
LazyResultSet rs = new LazyResultSet(statement, columns);
rs.addResultSet(rsr);
if (future.complete(Result.success(rs))) {
return;
}
}

Result<LazyResultSet> res = future.join();
Expand Down

0 comments on commit 263c846

Please sign in to comment.