Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fewer results than are expected are returned when using limit #516

Closed
epequeno opened this issue May 31, 2021 · 2 comments
Closed

Fewer results than are expected are returned when using limit #516

epequeno opened this issue May 31, 2021 · 2 comments
Assignees
Labels

Comments

@epequeno
Copy link

When attempting to limit the number of results using limit the number of results are fewer than expected.

$ curl -s "localhost:8980/v2/accounts" | jq '.accounts|length'
4

$ curl -s "localhost:8980/v2/accounts?limit=1" | jq '.accounts|length'
0

$ curl -s "localhost:8980/v2/accounts?limit=2" | jq '.accounts|length'
1

In this example there are 4 total accounts. I would expect that a request to limit results to 1 should return an array of length 1.

I've tried to reset and update the environment as suggested on discord. This issue is present in the version noted here:

$ ./sandbox down

Stopping sandbox containers...
Stopping algorand-sandbox-indexer  ... done
Stopping algorand-sandbox-algod    ... done
Stopping algorand-sandbox-postgres ... done

$ ./sandbox clean

Cleaning up sandbox environment...

$ docker system prune -a
...
Total reclaimed space: 1.954GB

$ docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

 $ git rev-parse HEAD
2e172b792a8b3fbb0952e5a7d34073bd44279f31

$ ./sandbox up

Starting default sandbox: release
see sandbox.log for detailed progress, or use -v.
* started!

algod version
8590327808
2.6.0.stable [rel/stable] (commit #8fe22d4e)
go-algorand is licensed with AGPLv3.0
source code available at https://github.com/algorand/go-algorand

Indexer version
2.4.0 compiled at 2021-05-31T22:24:40+0000 from git hash baa014ff63c6638074a04fcea32d4ce647b0dbb8 (modified)

Postgres version
postgres (PostgreSQL) 13.3
@yaovi-a
Copy link
Contributor

yaovi-a commented Jul 1, 2021

Need to reproduce.

@winder winder self-assigned this Mar 2, 2022
@winder
Copy link
Contributor

winder commented Mar 14, 2022

Thank you for reporting this issue.

It looks like this was fixed at some point in the last 10 months. Tested just now with a fresh sandbox private network and the number of results is equal to the limit.

That said, there are some scenarios where the limit will act as an upper bound and not an exact result set size. For example, the recent "inner transaction" feature causes duplicate results to be returned in some cases. The duplicates are filtered out in most cases but were still counted towards the limit.

@winder winder closed this as completed Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants