total_rows is not consistent between worker threads and main thread #6055

Closed
nolanlawson opened this Issue Dec 22, 2016 · 2 comments

Projects

None yet

1 participant

@nolanlawson
Member

There's an in-memory cache for total_rows (aka doc_count) in the IDB adapter. This is cute and has some perf benefits, but it also introduces inconsistencies between the worker thread and main thread because we're caching stuff in-memory, outside of the IDB transaction.

Given the increasing usage of web workers and service workers, I don't think this is a safe tradeoff to make anymore. We should just remove this optimization and look for other, safer optimizations.

@nolanlawson nolanlawson added the bug label Dec 22, 2016
@nolanlawson
Member

Technically you can also reproduce this by just using the same PouchDB in multiple tabs, so it's not safe for that case either.

@nolanlawson nolanlawson added a commit that referenced this issue Dec 23, 2016
@nolanlawson nolanlawson (#6055) - remove docCount optimization from IDB
Removes this unsafe optimization.
0ea6baa
@nolanlawson nolanlawson added a commit that referenced this issue Dec 23, 2016
@nolanlawson nolanlawson (#6055) - remove docCount optimization from WebSQL
Removes this unsafe optimization.
3352d0f
@nolanlawson nolanlawson self-assigned this Dec 23, 2016
@nolanlawson nolanlawson added a commit that referenced this issue Dec 23, 2016
@nolanlawson nolanlawson (#6055) - remove docCount optimization from IDB
Removes this unsafe optimization.
1c0ddfc
@nolanlawson nolanlawson added a commit that referenced this issue Dec 24, 2016
@nolanlawson nolanlawson (#6055) - remove docCount optimization from IDB
Removes this unsafe optimization.
b2f8811
@daleharvey daleharvey added a commit that referenced this issue Dec 26, 2016
@nolanlawson @daleharvey nolanlawson + daleharvey (#6055) - remove docCount optimization from IDB
Removes this unsafe optimization.
fa2b3a6
@daleharvey daleharvey added a commit that referenced this issue Dec 26, 2016
@nolanlawson @daleharvey nolanlawson + daleharvey (#6055) - remove docCount optimization from WebSQL
Removes this unsafe optimization.
70750f9
@nolanlawson
Member

Fixed now

@nolanlawson nolanlawson closed this Jan 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment