-
Notifications
You must be signed in to change notification settings - Fork 116
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
[DataStore] CursorWindowAllocationException crash for large datasets #944
Comments
Hi @upachecog!
As of the last few versions of the DataStore, this is the expected behavior. Whenever you invoke a DataStore API, if the sync engine is not already running, it will be started.
@richardmcclellan is implementing a featured called "selective sync," right now, which should address this problem. With it, you would be able to define filters to select the data returned by the DataStore's initial synchronization calls. In your case, you could leverage a timestamp of some kind, to only get recent data. This work is already complete for the JavaScript library, and you can see it here: aws-amplify/amplify-js#7001. |
@jamesonwilliams We add (find) other use case, we think this issue is related. Maybe u can help me clarify if it is. https://sentry.io/share/issue/e5b30629b5654f96806593bde3b23b3b/ We are testing on the following device.
When we enter data through appsync to dynamodb, it begins to crash, until it stops entering information and opening the application several times it stops crashing, I don't know if this is related to this issue Use case Expected result: Use case Current result: Questions: 1.- Is there a way to workaround this problem? We like to test our application in a controlled environment in production, but with these types of errors we are in uncertainty |
Hi @upachecog, here's a couple things you should check:
|
@cmllamosas your report sounds like a different issue. Looks like some sort of network error occurred during the sync process, and shut down the DataStore sync process. To recover from this - calling any of the Datastore methods ( |
@richardmcclellan Thanks for your answer and help.
I have a couple of questions, though:
The question is: How can I filter my Activities based on the first query if I don't have a Date field in the Activity model but I have a @connection to the Location Model? Based on the next query I found here:
I tried to do something like the following, but of course it doesn't work:
|
This is not currently supported, and likely won't be. DataStore relies on the AppSync service, which is backed by DynamoDB. DynamoDB does not support joins across tables, by design. Instead, I'd consider how you can modify your schema so that you can filter Activities based on fields on the Activity object. Adding a Date field to the Activity model might be one way to do that.
This is not currently supported, though I like the idea! We could probably allow you to do something like:
Could you open a separate issue with this feature request if this would be useful for you? As a workaround for now, you could apply a predicate that you know will not match any records, like so:
This will would have the overhead of making a |
@richardmcclellan I implemented the workaround as you suggested and it seems to work fine. And also I opened this issue #987 for the feature request. Thank you for your help! |
Hey guys, I have some issues and usage questions:
What I am doing is just calling the first query method on the DataStore of a single model, and at that moment Amplify starts to sync/download all the data from all the models.
Issue description:
The problem I noticed is that when the amount of data in the DynamoDB started to increase, the first synchronization started to fail.
We have two main models, Location and Activities. Each location has N activities and they will be assigned to each user on a daily basis.
We made some calculations and found that each user will have approximately 1350 activities assigned per month within 150 different locations. We want to previously populate the database with locations and activities for a full month for each user. So each month will have 1500 rows in total. With this amount of data, I found the following issues just in the first sync:
First sync: When the user logs-in for the first time and I perform the first query, after that everything seems to work fine.
First query:
Issues:
Expected result:
Amplify only syncs/download the locations and activities of this single day, for this user. So the app doesn't have memory issues. OR Amplify syncs/downloads by small chunks of data.
Current result
Amplify syncs/downloads all the information previously registered information and in low-mid-range smartphones the application crashes, even though I only queried today's locations.
Usage question:
Is there a way to implement this with the current version of the API or this would be something like a new feature?
The text was updated successfully, but these errors were encountered: