Skip to content

Commit

Permalink
Client: fix PagingIterator that could recompute the bounds without re…
Browse files Browse the repository at this point in the history
…pescting the snapshot flag in some rare circumstances

- OnFirstAsync could perform a non-snapshot read event if the original query is a snapshot read.
  • Loading branch information
KrzysFR committed Jun 30, 2024
1 parent 70bf619 commit 540b633
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion FoundationDB.Client/FdbRangeQuery.PagingIterator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ protected override async ValueTask<bool> OnFirstAsync()
if (this.Begin != bounds.Begin || this.End != bounds.End)
{
//TODO: find a better way to do this!
var keys = await this.Transaction.GetKeysAsync([ bounds.Begin, this.Begin, bounds.End, this.End ]).ConfigureAwait(false);
var tr = this.Query.Snapshot ? this.Transaction.Snapshot : this.Transaction;
var keys = await tr.GetKeysAsync([ bounds.Begin, this.Begin, bounds.End, this.End ]).ConfigureAwait(false);

var min = keys[0] >= keys[1] ? keys[0] : keys[1];
var max = keys[2] <= keys[3] ? keys[2] : keys[3];
Expand Down

0 comments on commit 540b633

Please sign in to comment.