Skip to content

Don't update query target metadata for updates #1063

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
Jul 30, 2018

Conversation

schmidt-sebastian
Copy link
Contributor

This PR ports some of what I think I learned by reviewing Greg's latest Android PR to the Web. This save an additional read on every query update in Multi-Tab.

Greg - is this correct?

}
});
});
return this.saveQueryData(transaction, queryData);
Copy link

Choose a reason for hiding this comment

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

You will still potentially need to update the metadata. Once QueryCache starts tracking the highest sequence number, it is likely that an update will trigger a metadata write.

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 updated the PR to allow future Greg to set the sequence number as part of the setLastRemoteSnapshotVersion call. Let me know if that will work as is for GC.

I am also still accepting nominations for the API name voting challenge.

Copy link

@gsoltis gsoltis left a comment

Choose a reason for hiding this comment

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

I don't think you can remove this [potential] write.

transaction: PersistenceTransaction,
snapshotVersion: SnapshotVersion
highestListenSequenceNumber: number,
lastRemoteSnapshotVersion?: SnapshotVersion
Copy link

Choose a reason for hiding this comment

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

Why is this optional? Do we ever not supply it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Local Store doesn't always call setLastRemoteSnapshotVersion. Do you still want to update the listen sequence number?

See https://github.com/firebase/firebase-js-sdk/blob/master/packages/firestore/src/local/local_store.ts#L524

Copy link

Choose a reason for hiding this comment

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

I see. I do still want to update the sequence number. I guess optional is ok, although it looks like in that case we could also pass in the highest snapshot version and have it be a no-op. I don't feel too strongly either way though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can refine the API when we start porting to Web, but I believe the highest snapshot version that you know of could be SnapshotVersion.MIN (unless you pass the version that you just got from getLastRemoteSnapshotVersion).

Copy link

Choose a reason for hiding this comment

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

Yeah, I meant the one you just read. But yeah, we can update later if need be.

@schmidt-sebastian schmidt-sebastian merged commit 40dea6a into firestore-multi-tab Jul 30, 2018
@schmidt-sebastian schmidt-sebastian deleted the multitab-addupdate branch August 3, 2018 17:15
@firebase firebase locked and limited conversation to collaborators Oct 17, 2019
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