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

Add bloom filter to existence filter and watchFilters spec builder #6839

Merged

Conversation

milaGGL
Copy link
Contributor

@milaGGL milaGGL commented Nov 30, 2022

  • Add nullable bloom filter to ExistenceFilter class
  • Update watchFilters to optionally accept a bloom filter without exploding existing tests

Note: The logic for using bloom filter and skipping full re-query is not implemented yet.

@changeset-bot
Copy link

changeset-bot bot commented Nov 30, 2022

⚠️ No Changeset found

Latest commit: 0b76b5e

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

@@ -769,18 +770,19 @@ export class SpecBuilder {
return this;
}

watchFilters(queries: Query[], ...docs: DocumentKey[]): this {
Copy link
Contributor Author

@milaGGL milaGGL Nov 30, 2022

Choose a reason for hiding this comment

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

Original watchFilters accept an array of targetIds (limited to only 1 targetId), and spread operator to pass in unlimited number of docs(only to get count later on). These will be flattened into an array(SpecWatchFilter), and saved into currentStep. When processing, the number on 0 index is targetId, all others will contribute to count.
updated the watchFilters to accept array of targetIds, array of docs(default to empty array), and an optional bloom filter.
updated the SpecWatchFilter to be an object instead of an array.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Nov 30, 2022

Size Report 1

Affected Products

  • @firebase/firestore

    TypeBase (c17af51)Merge (828b811)Diff
    browser272 kB272 kB+43 B (+0.0%)
    esm5339 kB339 kB+59 B (+0.0%)
    main545 kB545 kB+95 B (+0.0%)
    module272 kB272 kB+43 B (+0.0%)
    react-native272 kB272 kB+43 B (+0.0%)
  • bundle

    TypeBase (c17af51)Merge (828b811)Diff
    firestore (Persistence)291 kB291 kB+43 B (+0.0%)
    firestore (Query Cursors)230 kB230 kB+43 B (+0.0%)
    firestore (Query)228 kB228 kB+43 B (+0.0%)
    firestore (Read data once)215 kB215 kB+43 B (+0.0%)
    firestore (Realtime updates)217 kB217 kB+43 B (+0.0%)
  • firebase

    TypeBase (c17af51)Merge (828b811)Diff
    firebase-compat.js756 kB756 kB+47 B (+0.0%)
    firebase-firestore-compat.js330 kB330 kB+47 B (+0.0%)
    firebase-firestore.js331 kB331 kB+43 B (+0.0%)

Test Logs

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

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Nov 30, 2022

Size Analysis Report 1

Affected Products

  • @firebase/firestore

    • enableMultiTabIndexedDbPersistence

      Size

      TypeBase (c17af51)Merge (828b811)Diff
      size211 kB211 kB+43 B (+0.0%)
      size-with-ext-deps282 kB282 kB+43 B (+0.0%)
    • getDoc

      Size

      TypeBase (c17af51)Merge (828b811)Diff
      size135 kB135 kB+43 B (+0.0%)
      size-with-ext-deps205 kB205 kB+43 B (+0.0%)
    • getDocFromServer

      Size

      TypeBase (c17af51)Merge (828b811)Diff
      size135 kB135 kB+43 B (+0.0%)
      size-with-ext-deps205 kB205 kB+43 B (+0.0%)
    • getDocs

      Size

      TypeBase (c17af51)Merge (828b811)Diff
      size136 kB136 kB+43 B (+0.0%)
      size-with-ext-deps206 kB206 kB+43 B (+0.0%)
    • getDocsFromServer

      Size

      TypeBase (c17af51)Merge (828b811)Diff
      size136 kB136 kB+43 B (+0.0%)
      size-with-ext-deps206 kB206 kB+43 B (+0.0%)
    • onSnapshot

      Size

      TypeBase (c17af51)Merge (828b811)Diff
      size137 kB137 kB+43 B (+0.0%)
      size-with-ext-deps207 kB207 kB+43 B (+0.0%)
    • onSnapshotsInSync

      Size

      TypeBase (c17af51)Merge (828b811)Diff
      size126 kB126 kB+43 B (+0.0%)
      size-with-ext-deps196 kB196 kB+43 B (+0.0%)

Test Logs

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

Copy link
Contributor

@dconeybe dconeybe left a comment

Choose a reason for hiding this comment

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

Looks great! Just two extremely minor comments.

packages/firestore/src/protos/firestore_proto_api.ts Outdated Show resolved Hide resolved
@milaGGL milaGGL marked this pull request as ready for review November 30, 2022 20:29
@milaGGL milaGGL requested a review from dconeybe November 30, 2022 20:29
@milaGGL milaGGL merged commit a3fb711 into mila/BloomFilter Nov 30, 2022
@milaGGL milaGGL deleted the mila/BloomFilter-add-bloom-filter-to-existence-filter branch November 30, 2022 21:29
@firebase firebase locked and limited conversation to collaborators Dec 31, 2022
@milaGGL milaGGL self-assigned this Jan 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants