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

Missing pagination for some bulk queries #118

Closed
3 tasks
ancazamfir opened this issue Apr 14, 2021 · 6 comments
Closed
3 tasks

Missing pagination for some bulk queries #118

ancazamfir opened this issue Apr 14, 2021 · 6 comments

Comments

@ancazamfir
Copy link

Summary

While looking at some pagination issues in hermes queries (informalsystems/hermes#811) found that there is no pagination field for the following queries:
QueryClientConnectionsRequest, QueryUnreceivedPacketsRequest , QueryUnreceivedAcksRequest.

Problem Definition

Proposal


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged/assigned
@ancazamfir
Copy link
Author

Actually probably not required for QueryUnreceivedPacketsRequest and QueryUnreceivedAcksRequest as we query for specific sequences.

@crodriguezvega
Copy link
Contributor

@ancazamfir the lack of pagination in QueryClientConnectionsRequest, is still an issue for hermes?

I ask because I was looking a bit into it and I think that it will not be so straightforward to add pagination to it. I will try to explain...

I think the regular way of adding pagination to the gRPC endpoint using SDK's machinery would be something like this:

clientConnectionPaths := []string{}
store := prefix.NewStore(ctx.KVStore(q.storeKey), []byte(host.ClientConnectionsKey(req.ClientId)))
pageRes, err := query.Paginate(store, req.Pagination, func(key, value []byte) error {
	var result types.ClientPaths
	if err := q.cdc.Unmarshal(value, &result); err != nil {
		return err
	}

	clientConnectionPaths = append(clientConnectionPaths, result.Paths...)
	return nil
})
if err != nil {
	return nil, err
}

The problem is that the connection paths for a given client ID are all stored as a []string in the key clients/<client-id>/connections, so when doing the query.Paginate there's always just one page returned that contains all the connection paths for that client, since there's nothing to paginate over on the provided prefix ([]byte(host.ClientConnectionsKey(req.ClientId))).

Alternatively we could get all the connection paths as it is done right now and do the pagination ourselves, but before building something so specific for this query, I would like to know if there's really a strong need for pagination in this query.

cc @colin-axner to double check my reasoning here when he has some time or provide alternatives ideas.

@colin-axner
Copy link
Contributor

That seems correct to me. The issue is that the request is to paginate the value returned, not the key (there's only one key). I'd assume this likely isn't a problem since there should only be a handful of connections per client

@ancazamfir
Copy link
Author

ancazamfir commented Dec 9, 2022

It's been a long time and can't recall the details. I was doing local testing with high scale numbers but can't recall if anything was breaking and how it was breaking. We can do the tests again.
Are you asking in order to close the issue?

@crodriguezvega
Copy link
Contributor

Are you asking in order to close the issue?

Yes, that's basically the reason. I can understand this could be a problem in stress-testing scenarios if you add lots of connections on top of the client, but if this is not an issue that would likely be hit in real scenarios, then I would consider closing the issue. It can be open anyway again if needed!

@crodriguezvega
Copy link
Contributor

Closing for now since there's no action to take at the moment. We will reopen if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants