-
Notifications
You must be signed in to change notification settings - Fork 26
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
"this._changes is undefined" when adding records to auto-loaded db & collection #183
Comments
My current workaround for the main bug mentioned is to put .. and kudos for the speed of LokiDB! In my tests, it outperforms lokiJS by a huge factor! |
So the problem is somewhere inside the PartitioningAdapter. But I am not sure where. Never used this one. I will take a deeper look at the weekend. |
Thank you so much! I'm looking through the partitioning adapter code, and can't find any references to _changes, so was not sure where else to go. I think I've run into another part of the glitch with the 2nd bug mentioned as well, and pinpointed the difference. Sometimes after running my own data into it and refreshing the browser (making sure to wait until there are no _dirty collections by looking at wdb._persistenceAdapter._dirtyPartitions.length ), there is a difference between these two data sets: a) wdb._collections (empty) Flow:
Oddly, right before refreshing the browser, the count of wdb._persistenceAdapter._dbref.collections where _dirty is true is always 1. And it's always the LAST collection that has that flag set. :-/ Even if I wait for 5-10 minutes, that last collection remains marked as DIRTY, but is not mentioned in wdb._persistenceAdapter._dirtyPartitions. It could just be the way they do loops and unmark the collections, but I find the _dirty flag to be an oddity there. The real problem is the (a)(b) issue above, where the adapter seems to silently stop loading data from IndexedDB. No errors thrown. I'm going to try using several different splitting characters to see if that's hitting something in my data, as well as pinpoint exactly the record that's making it drop the ball and will report back here. |
Wow, great analysis! I found the first bug. I don't know what chased me to rename the serialization output (removing the underscore)...with the correct naming it works. Please have a look here: #184 Could you provide a small code example for the second bug? Maybe it is gone with the fix. |
#184 fixed the first bug, thank you! The 2nd bug remains. I'll see if I can work up some code with timeouts or intervals to repeat it. :-) |
2nd Issue Repeatable CodeAfter running the below code, take a look at the IndexedDB storage, and you should notice some keys missing. On mine it likes to skip mm.db.4, 9, 14, and 19 consistently. It helps if you stick
I took a stab at letting the |
As a workaround in my code, I added a callback into the Partitioning Adapter code that is called whenever a partition is saved. Then I tied into that in my application code and reset the _dirty flag for that partion, and it is all working. (and also commented out the |
It looks like
I've split the bug of |
I'm submitting a...
Current behavior
This error shows up after saving 500,000 rows, then refreshing the browser and trying to save the next set of rows. Code is simple to replicate.
Error Code
Expected behavior
No error, rows inserted into collection.
Minimal reproduction of the problem with instructions
https://jsbin.com/nejijiberu (Copy to local dev server if needed. it's hard to make LokiDB work on jsBin) Same code as below
What is the motivation / use case for changing the behavior?
I need to save large numbers of records (about 2 mil) across 80 or so collections. The above bug was encountered while I was attempting to make an easy way to replicate a secondary bug.
The secondary bug: With 80 or so collections and ~2M records saved (and showing up in both IndexedDB and in memory), reloading the browser would cause the collections to vanish, even though I can still see the data sitting in IndexedDB. I figured it'd be best to focus on the primary bug first, then try to figure out why something between LokiDB, IndexedStorage, and PartitioningAdapter was failing to autoload the 80+ collections.
Environment
The text was updated successfully, but these errors were encountered: