Open richard-ramos opened 2 weeks ago
@richard-ramos - I set it as ToDo
because I consider that any cursor
used by any client might be previously given by the store node. With that, I assume that this won't have very big impact, unless I'm missing sth :)
I think it might become an issue if you're retrieving pages, and suddenly the retention policy is applied and the cursor the user has is no longer valid. The user would proceed to use this cursor and end up receiving the list of messages again starting from record 0.
Problem
If a store request is created with an invalid cursor (that's is correctly formated), like this one:
0x0000000000000000000000000000000000000000000000000000000000000000
:Store request is not validating that the cursor that was sent does not exist. The correct behavior should be to return either no results, or an
invalid_cursor
error. I think we should do the later.This can be solved by doing a
SELECT EXISTS(SELECT 1 FROM messages WHERE message_hash=?)
to determine if the cursor exists. Since themessage_hash
is the primary key of the table, I imagine this should execute fast with no major impact on the total store query response timeThis affects both storeV2 and V3.