Skip to content

Add more Recovery spec tests #3084

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
merged 4 commits into from
May 21, 2020
Merged

Conversation

schmidt-sebastian
Copy link
Contributor

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

Addresses #2755

@google-oss-bot
Copy link
Contributor

google-oss-bot commented May 18, 2020

Binary Size Report

Affected SDKs

  • @firebase/firestore

    Type Base (4b037f4) Head (f4875b7) Diff
    browser 251 kB 251 kB +736 B (+0.3%)
    esm2017 194 kB 195 kB +636 B (+0.3%)
    main 492 kB 493 kB +1.10 kB (+0.2%)
    module 248 kB 249 kB +736 B (+0.3%)
  • @firebase/firestore/memory

    Type Base (4b037f4) Head (f4875b7) Diff
    browser 191 kB 192 kB +712 B (+0.4%)
    esm2017 149 kB 149 kB +609 B (+0.4%)
    main 368 kB 369 kB +1.16 kB (+0.3%)
    module 189 kB 190 kB +712 B (+0.4%)
  • @firebase/performance

    Type Base (4b037f4) Head (f4875b7) Diff
    browser 28.1 kB 26.7 kB -1.43 kB (-5.1%)
    esm2017 26.1 kB 24.7 kB -1.40 kB (-5.4%)
    main 28.1 kB 26.7 kB -1.43 kB (-5.1%)
    module 27.9 kB 26.4 kB -1.43 kB (-5.1%)
  • firebase

    Type Base (4b037f4) Head (f4875b7) Diff
    firebase-firestore.js 289 kB 290 kB +746 B (+0.3%)
    firebase-firestore.memory.js 231 kB 232 kB +711 B (+0.3%)
    firebase-performance-standalone.es2017.js 72.7 kB 71.9 kB -733 B (-1.0%)
    firebase-performance-standalone.js 48.1 kB 47.4 kB -765 B (-1.6%)
    firebase-performance.js 38.5 kB 37.7 kB -765 B (-2.0%)
    firebase.js 823 kB 823 kB -19 B (-0.0%)

Test Logs

@schmidt-sebastian schmidt-sebastian changed the base branch from master to mrschmidt/simplifyspecs May 19, 2020 01:11
@schmidt-sebastian schmidt-sebastian force-pushed the mrschmidt/synchronizereadtime branch from 60bf67c to 7f14814 Compare May 19, 2020 01:12
'Clients fail to lookup mutations (with recovery)',
['multi-client'],
() => {
return client(0)
Copy link
Contributor

Choose a reason for hiding this comment

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

A comment giving some context for what this test is trying to do would be helpful. It took me some time to realize that this was simulating a non-master tab writing, failing, and then recovering.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added top-level comment and comments inline to better explain this test.

.failDatabaseTransactions('updateClientMetadataAndTryBecomePrimary')
.runTimer(TimerId.ClientMetadataRefresh)
.client(1)
.failDatabaseTransactions('updateClientMetadataAndTryBecomePrimary')
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm sort of surprised we need to specify this on a per-client basis. My expectation would be that if the database is failing it would fail for all clients, no?

Do you find that you're writing tests where different clients see different failures? I wonder if we could make that the exception, rather than the rule?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are already a couple multi-tab tests in this file that use different failure modes per client, which also matches my expected behavior. A foreground tab is able to access IndexedDB, while a background tab lost filesystem access.

FWIW, I am not planning on adding further multi-tab tests for now.

.expectPrimaryState(true)
.client(1)
.recoverDatabase()
.runTimer(TimerId.ClientMetadataRefresh)
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if client 1 happens to run their metadata refresh timer first?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added comment and a second section that verifies the reverse. The primary state doesn't transition during an IndexedDB failure and the order here should not affect which tab is primary.

Note that this is because of: https://github.com/firebase/firebase-js-sdk/blob/master/packages/firestore/src/local/indexeddb_persistence.ts#L433

@wilhuff wilhuff assigned schmidt-sebastian and unassigned wilhuff May 19, 2020
@schmidt-sebastian schmidt-sebastian changed the base branch from mrschmidt/simplifyspecs to master May 21, 2020 22:42
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. Thanks for these comments--they help immensely.

@wilhuff wilhuff removed their assignment May 21, 2020
@schmidt-sebastian schmidt-sebastian merged commit 4e86d01 into master May 21, 2020
@firebase firebase locked and limited conversation to collaborators Jun 21, 2020
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/synchronizereadtime branch July 9, 2020 17:44
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