Skip to content

Address potential IndexedDB failure in synchronizeQueryViewsAndRaiseSnapshots #3113

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

Merged

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented May 27, 2020

This removes a releaseQuery call from Multi-Tab synchronization. The idea of this code path in synchronizeQueryViewsAndRaiseSnapshots is that it releases and re-allocates a query if a new primary already has a local query view but needs to make sure that it matches the data in IndexedDB before starting a Listen.

We should not need to call releaseTarget here, since it overwrites the target data with potentially stale state. Instead, we just load the latest state via allocateTarget which has the ability to load a target from disk or from memory. I added a check to also update the in-memory data when it is stale, but I wasn't able to find any difference for this using a spec tests I hacked together (not committed).

Addresses #2755

@google-oss-bot
Copy link
Contributor

google-oss-bot commented May 27, 2020

Binary Size Report

Affected SDKs

  • @firebase/firestore

    Type Base (230cd48) Head (a76b1b5) Diff
    browser 251 kB 251 kB -20 B (-0.0%)
    esm2017 195 kB 195 kB +11 B (+0.0%)
    main 493 kB 493 kB +38 B (+0.0%)
    module 249 kB 249 kB -20 B (-0.0%)
  • @firebase/firestore/memory

    Type Base (230cd48) Head (a76b1b5) Diff
    browser 192 kB 192 kB +25 B (+0.0%)
    esm2017 149 kB 149 kB +34 B (+0.0%)
    main 369 kB 370 kB +112 B (+0.0%)
    module 190 kB 190 kB +25 B (+0.0%)
  • firebase

    Type Base (230cd48) Head (a76b1b5) Diff
    firebase-firestore.js 290 kB 290 kB -20 B (-0.0%)
    firebase-firestore.memory.js 232 kB 232 kB +25 B (+0.0%)
    firebase.js 823 kB 823 kB -20 B (-0.0%)

Test Logs

@schmidt-sebastian schmidt-sebastian force-pushed the mrschmidt/synchronizeQueryViewsAndRaiseSnapshots branch from 28d7bf3 to e07baa6 Compare May 27, 2020 06:10
@schmidt-sebastian schmidt-sebastian changed the title WIP Address potential IndexedDB failure in synchronizeQueryViewsAndRaiseSnapshots Address potential IndexedDB failure in synchronizeQueryViewsAndRaiseSnapshots May 27, 2020
@schmidt-sebastian schmidt-sebastian requested a review from wilhuff May 27, 2020 06:49
Copy link
Contributor

@wilhuff wilhuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wilhuff wilhuff assigned schmidt-sebastian and unassigned wilhuff May 27, 2020
@schmidt-sebastian schmidt-sebastian merged commit ef5fb1b into master May 27, 2020
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/synchronizeQueryViewsAndRaiseSnapshots branch May 27, 2020 19:22
@firebase firebase locked and limited conversation to collaborators Jun 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants