-
Notifications
You must be signed in to change notification settings - Fork 69
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
Malformed cursor causing issues with paginated queries #362
Comments
Thank you I will look into this! |
This branch fixes issue #362. The root cause of the issue was that one of the composite attributes was hidden. Because the cursor was created using the "formatted" return item, it was the hidden composite was not available to the cursor formatting function. We now check for this unique case and perform some additional calculations. Ideally this reduces the surface area of performance implications to only entities that have a hidden composite attribute defined.
@ngomezdelcampo I started a PR request for this, I still need to add unit tests but I have identified the root cause: The composite attribute |
@ngomezdelcampo Small update on this: I started working on this PR and found that the underlying implementation was very disagreeable with this scenario. It proved a bit difficult to not add more overhead to react differently in this case, and I think it will require a bit more time determine a better refactor. Can you confirm whether or not you are still in need of this fix, or if you have moved on? I am working to triage some recent issues, thank you for your patience so far |
Describe the bug
When I use a query the count option, my cursor is sometimes malformed. Note that the merchantid is incomplete.
eyJwayI6IiRwYWxvbW1hI21lcmNoYW50aWRfIiwic2siOiIkY3VzdG9tZXJfMSNpZF8wMWhwancwOGU0Y2c4anIyOGNkZnEzdzhqOCJ9
{"pk":"$palomma#merchantid_","sk":"$customer_1#id_01hpjw08e4cg8jr28cdfq3w8j8"}
When I make the same query with the limit option, the cursor is properly formed.
eyJwayI6IiRwYWxvbW1hI21lcmNoYW50aWRfZmVsaXBlIiwic2siOiIkY3VzdG9tZXJfMSNpZF8wMWhwaHB2bnNod2RlYTd4MzJxZWc3MzljayJ9
{"pk":"$palomma#merchantid_felipe","sk":"$customer_1#id_01hphpvnshwdea7x32qeg739ck"}
The impact is that pagination breaks with count with the following error:
The query can return at most one row and cannot be restarted
ElectroDB Version
2.13.1
ElectroDB Playground Link
https://electrodb.fun/?#code/PQKgBAsg9gJgpgGzARwK5wE4Es4GcA0YuccYGeqCALgUQBYCG5YA7llXWAGbZwB2MXGBDAAUKKwBbAA5QMVMAG8wA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Vh0gavN0RhRuCGP+lQS7VhgawAEwAMyjQArAAbAA7AAHAAnD8PZ9gOtivPD-QAAKfL2-a-VYPxzguJMrjYlOrLLctyzYoimLykqfFAfKeN9yS-VSTEA-NQUg-GxhQBDlp2rDvOI8jcBowTvqYwG154+jDtE5LZO2KsVO04zrPs0LXPxXDCMC4HIuSGL85FB73Qy-L8uK8rqvqx9X35Drx567UBvA3FYOm+CkMWyH-RI9qdu1ITWPO-jVdu+WlakxT1P08zbPghz-bdDzoeC5zEdRxLTdS-HCey0nKtqxr6c-X92cXEDi3dAXZtQzYlsI+XqOu6WTs4zGddsg36ix17Ptt-7neBz3pdQGHA9JUPMcj570vjwrStT6nn3AMAplLC+CKKAqB1CEA4KQYg2QYAoHQGKFqVJwq4FntrNAmBNCSj8gFLKhsYDlEULnZeoMTY2GTtPAGbRvCgIvOTE0ch4Bv3gLgI+dRlaawzmgsUmD-JL1yvgwhuUV4kLIerChdQqHqBaLQp4vRkhyG6NGP+qY8LsBBHQUgg1kgKE4RkWUMDpBHDUaQWRuA5BgEdGAdR5Anj0KlkwlhTU06xH-nkR0nwwAICkOwcB6iiAOB8DAnR5ihCDSKCg3AkodHcOwQtPhBDeFG1XiI-BTxPGSHYFIuhGAGHdHsVuNh4TIlwIwVghJeD4k4LzkI8GySxHVDSRksA0iIQmPkbYRR-8GAqP8L4zRfhYHoNTAIMABienGNQHIjA5i+CWO1DY7Jdi8AONNB9IAA
Entity/Service Definitions
Include your entity model (or a model that sufficiently recreates your issue) to help troubleshoot.
Expected behavior
The cursor of the query operation with the count option should give a properly formed cursor that enables me to query the next page.
Errors
The text was updated successfully, but these errors were encountered: