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

prependChanges can result in multiple revisions for a doc in channel cache #3475

adamcfraser opened this Issue Apr 19, 2018 · 0 comments


None yet
1 participant
Copy link

adamcfraser commented Apr 19, 2018

When issuing a view query to backfill the channel cache, any results are prepended to the channel cache when the channel cache has room available.

However, the channel cache is not locked between the original query that triggered the view query, and the subsequent prepend. This leaves the possibility of the following:

  1. Document foo exists w/ rev 1-abc in channel A
  2. User issues changes request for channel A, triggering view backfill
  3. SG issues stale=false channels query
  4. Document foo is updated to rev 2-def (still in channel A)
  5. Doc foo 2-def arrives over DCP feed, is added to channel cache for channel A
  6. View query completes, includes foo rev 1-abc (stale=false isn't guaranteed to see changes made after query is issued)
  7. View results are prepended to cache, so cache contains both 1-abc and 2-def for channel A.

This won't cause any correctness issues, but can result in additional replication overhead, and sub-optimal cache utilization (other docs could be ejected from the cache in favour of the duplicates).

@adamcfraser adamcfraser changed the title prependChanges can result in multiple revision for a doc in channel cache prependChanges can result in multiple revisions for a doc in channel cache Apr 19, 2018

@adamcfraser adamcfraser added this to the 3.0.0 milestone Apr 23, 2018

@adamcfraser adamcfraser added the icebox label Apr 23, 2018

@adamcfraser adamcfraser self-assigned this May 10, 2018

@adamcfraser adamcfraser added in progress review and removed icebox labels May 10, 2018

@adamcfraser adamcfraser modified the milestones: 3.0.0, 2.1.0 May 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment