Skip to content

IndexeddbIndexManager.updateEntries() #5999

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 8 commits into from
Feb 15, 2022

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Feb 11, 2022

This ports the updateEntries code from Android.

@changeset-bot
Copy link

changeset-bot bot commented Feb 11, 2022

⚠️ No Changeset found

Latest commit: 774c5e0

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

@schmidt-sebastian schmidt-sebastian force-pushed the mrschmidt/updateindexentries branch from 4eca730 to ea903a6 Compare February 11, 2022 17:02
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Feb 11, 2022

Size Report 1

Affected Products

  • @firebase/firestore

    TypeBase (c1b9cf1)Merge (84b971b)Diff
    browser233 kB244 kB+11.2 kB (+4.8%)
    esm5291 kB304 kB+13.1 kB (+4.5%)
    main463 kB486 kB+23.6 kB (+5.1%)
    module233 kB244 kB+11.2 kB (+4.8%)
    react-native233 kB244 kB+11.2 kB (+4.8%)
  • @firebase/firestore-lite

    TypeBase (c1b9cf1)Merge (84b971b)Diff
    browser72.8 kB73.0 kB+172 B (+0.2%)
    esm586.1 kB86.4 kB+295 B (+0.3%)
    main125 kB125 kB+172 B (+0.1%)
    module72.8 kB73.0 kB+172 B (+0.2%)
    react-native73.0 kB73.2 kB+172 B (+0.2%)
  • bundle

    12 size changes

    TypeBase (c1b9cf1)Merge (84b971b)Diff
    firestore (Persistence)234 kB245 kB+11.2 kB (+4.8%)
    firestore (Query Cursors)190 kB192 kB+2.11 kB (+1.1%)
    firestore (Query)191 kB193 kB+2.11 kB (+1.1%)
    firestore (Read data once)179 kB181 kB+2.11 kB (+1.2%)
    firestore (Realtime updates)181 kB183 kB+2.11 kB (+1.2%)
    firestore (Transaction)164 kB166 kB+2.11 kB (+1.3%)
    firestore (Write data)163 kB165 kB+2.11 kB (+1.3%)
    firestore-lite (Query Cursors)56.7 kB56.8 kB+172 B (+0.3%)
    firestore-lite (Query)59.7 kB59.9 kB+172 B (+0.3%)
    firestore-lite (Read data once)44.2 kB44.4 kB+172 B (+0.4%)
    firestore-lite (Transaction)61.5 kB61.7 kB+172 B (+0.3%)
    firestore-lite (Write data)47.0 kB47.2 kB+172 B (+0.4%)

  • firebase

    TypeBase (c1b9cf1)Merge (84b971b)Diff
    firebase-compat.js758 kB769 kB+10.9 kB (+1.4%)
    firebase-firestore-compat.js285 kB296 kB+10.9 kB (+3.8%)
    firebase-firestore-lite.js249 kB250 kB+400 B (+0.2%)
    firebase-firestore.js784 kB812 kB+28.3 kB (+3.6%)

Test Logs

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

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Feb 11, 2022

Size Analysis Report 1

This report is too large (641,979 characters) to be displayed here in a GitHub comment. Please use the below link to see the full report on Google Cloud Storage.

Test Logs

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

@@ -269,8 +320,176 @@ export class IndexedDbIndexManager implements IndexManager {
transaction: PersistenceTransaction,
documents: DocumentMap
): PersistencePromise<void> {
// TODO(indexing): Implement
return PersistencePromise.resolve();
const memoizedIndexes = new Map<string, FieldIndex[]>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like Android calls getFieldIndexes and have the memoization optimization done there? Is there a reason for the deviation?

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 comment:

    // Porting Note: `getFieldIndexes()` on Web does not cache index lookups as
    // it could be used across different IndexedDB transactions. As any cached
    // data might invalidated by other multi-tab clients, we can only trust data
    // within a single IndexedDB transaction. We therefore add a cache here.

Copy link
Contributor

Choose a reason for hiding this comment

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

might -> might be

@wu-hui wu-hui assigned schmidt-sebastian and unassigned wu-hui Feb 14, 2022
Copy link
Contributor

@wu-hui wu-hui left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -269,8 +320,176 @@ export class IndexedDbIndexManager implements IndexManager {
transaction: PersistenceTransaction,
documents: DocumentMap
): PersistencePromise<void> {
// TODO(indexing): Implement
return PersistencePromise.resolve();
const memoizedIndexes = new Map<string, FieldIndex[]>();
Copy link
Contributor

Choose a reason for hiding this comment

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

might -> might be

@wu-hui wu-hui assigned schmidt-sebastian and unassigned wu-hui Feb 15, 2022
@schmidt-sebastian schmidt-sebastian merged commit 05a6aff into master Feb 15, 2022
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/updateindexentries branch February 15, 2022 17:02
@firebase firebase locked and limited conversation to collaborators Mar 18, 2022
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