Skip to content
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

More performant handling of out of order updates. #8608

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

MarkDuckworth
Copy link
Contributor

@MarkDuckworth MarkDuckworth commented Oct 25, 2024

If multiple queries receive updates to the same doc in the same global snapshot, watch does not guarantee the order of results received. Newer document versions may be received for one query before older document versions for another query. In some conditions, a newer document snapshot version could be overwritten by an older document snapshot version in the watch change aggregator. In the test scenario, stale document data is raised in a fromCache snapshot, and then the correct results were raised after a limbo resolution.

This PR provides a simple fix in the watch change aggregator where it will always accept the newest document snapshot if multiple versions are received.

Copy link

changeset-bot bot commented Oct 25, 2024

⚠️ No Changeset found

Latest commit: 2ae7e16

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@google-oss-bot
Copy link
Contributor

Size Report 1

Affected Products

  • @firebase/firestore

    TypeBase (91fa315)Merge (6194fd7)Diff
    browser381 kB382 kB+148 B (+0.0%)
    main588 kB588 kB+335 B (+0.1%)
    module381 kB382 kB+148 B (+0.0%)
    react-native382 kB382 kB+148 B (+0.0%)
  • bundle

    TypeBase (91fa315)Merge (6194fd7)Diff
    firestore (Persistence)303 kB304 kB+148 B (+0.0%)
    firestore (Query Cursors)249 kB249 kB+148 B (+0.1%)
    firestore (Query)247 kB247 kB+148 B (+0.1%)
    firestore (Read data once)234 kB234 kB+148 B (+0.1%)
    firestore (Read Write w Persistence)328 kB328 kB+148 B (+0.0%)
    firestore (Realtime updates)237 kB237 kB+148 B (+0.1%)
  • firebase

    TypeBase (91fa315)Merge (6194fd7)Diff
    firebase-compat.js794 kB795 kB+142 B (+0.0%)
    firebase-firestore-compat.js346 kB347 kB+142 B (+0.0%)
    firebase-firestore.js440 kB440 kB+148 B (+0.0%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/7U6EITLZMY.html

@google-oss-bot
Copy link
Contributor

Size Analysis Report 1

Affected Products

  • @firebase/firestore

    • enableMultiTabIndexedDbPersistence

      Size

      TypeBase (91fa315)Merge (6194fd7)Diff
      size223 kB223 kB+148 B (+0.1%)
      size-with-ext-deps295 kB295 kB+148 B (+0.1%)
    • getDoc

      Size

      TypeBase (91fa315)Merge (6194fd7)Diff
      size153 kB153 kB+148 B (+0.1%)
      size-with-ext-deps225 kB225 kB+148 B (+0.1%)
    • getDocFromServer

      Size

      TypeBase (91fa315)Merge (6194fd7)Diff
      size153 kB153 kB+148 B (+0.1%)
      size-with-ext-deps225 kB225 kB+148 B (+0.1%)
    • getDocs

      Size

      TypeBase (91fa315)Merge (6194fd7)Diff
      size155 kB155 kB+148 B (+0.1%)
      size-with-ext-deps227 kB227 kB+148 B (+0.1%)
    • getDocsFromServer

      Size

      TypeBase (91fa315)Merge (6194fd7)Diff
      size155 kB155 kB+148 B (+0.1%)
      size-with-ext-deps226 kB227 kB+148 B (+0.1%)
    • onSnapshot

      Size

      TypeBase (91fa315)Merge (6194fd7)Diff
      size155 kB155 kB+148 B (+0.1%)
      size-with-ext-deps227 kB227 kB+148 B (+0.1%)
    • onSnapshotsInSync

      Size

      TypeBase (91fa315)Merge (6194fd7)Diff
      size144 kB144 kB+148 B (+0.1%)
      size-with-ext-deps216 kB216 kB+148 B (+0.1%)
    • persistentMultipleTabManager

      Size

      TypeBase (91fa315)Merge (6194fd7)Diff
      size218 kB219 kB+148 B (+0.1%)
      size-with-ext-deps290 kB291 kB+148 B (+0.1%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/eqavd7aB32.html

@dconeybe
Copy link
Contributor

LGTM. Nice fix! Please add a changeset though. Also, please make sure these tests and fixes get ported to android and ios (whether you do the porting or someone else does).

Base automatically changed from markduckworth/8474-spec to main October 30, 2024 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants