get_table_by_scope
's pagination scheme can lead to endless request loop when scope contains over limit
tables
#615
Labels
Milestone
get_table_by_scope
interface has a deficiency it how it handles itsmore
pagination scheme. Without a table filter, the returnedmore
will cause the next request to start at first table in that scope again. This means if a scope contains overlimit
tables (which is capped at 1000) themore
returned will always be thelower_bound
requested. Repeat forever.To illustrate this consider scopes and tables of,
Now consider requests are made with
limit=2
. The first request (with nolower_bound
) will return apple:balance and banana:balance withmore=banana
. The next response will return banana:balance1 and banana:foo withmore=banana
. And.. repeat. It's impossible to make further progress.Using a table filter as part of the request doesn't entirely resolve the problem. Even in the above example,
limit=2,lower_bound=banana,table=balance
will cause an endless pagination loop returningmore=banana
each time. This is because the limit (appropriately) applies to the number of walked tables, not the number of matched tables.This might be fixable in the current exposed API by having
more
expose a longer (possibly opaque) value representing scope+table, and then havinglower_bound
understand that value as being a scope+table instead of just a scope.lower_bound
andmore
are strings so this is allowed from that standpoint; but it's possible clients out there are treating these as names instead.Footnotes
Notice how banana:balance was returned twice: once in first request and once in second request. That's undesirable behavior of the pagination scheme as well, but a client would need to be prepared for changes between pagination requests anyways due to possible state changes between requests. ↩
The text was updated successfully, but these errors were encountered: