Skip to content

Release Overlay #3112

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 13 commits into from
Dec 6, 2021
Merged

Release Overlay #3112

merged 13 commits into from
Dec 6, 2021

Conversation

wu-hui
Copy link
Contributor

@wu-hui wu-hui commented Nov 8, 2021

Performance test result: #3161

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Nov 8, 2021

Coverage Report

Affected SDKs

  • firebase-firestore

    SDK overall coverage changed from 45.32% (9466242) to 45.17% (462500e4) by -0.16%.

    Filename Base (9466242) Head (462500e4) Diff
    BasePath.java 98.08% 86.54% -11.54%
    DeleteMutation.java 90.00% 95.00% +5.00%
    FieldMask.java 55.56% 57.89% +2.34%
    LocalDocumentsView.java 97.70% 69.14% -28.56%
    PatchMutation.java 98.39% 100.00% +1.61%
    SQLiteOverlayMigrationManager.java 61.90% 90.48% +28.57%
    SQLitePersistence.java 84.57% 86.70% +2.13%
    SQLiteSchema.java 96.65% 96.63% -0.03%
    SetMutation.java 94.29% 97.14% +2.86%

Test Logs

Notes

HTML coverage reports can be produced locally with ./gradlew <product>:checkCoverage.
Report files are located at <product-build-dir>/reports/jacoco/.

Head commit (462500e4) is created by Prow via merging commits: 9466242 dff4bbd.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Nov 8, 2021

Binary Size Report

Affected SDKs

  • firebase-firestore

    Type Base (9466242) Head (462500e4) Diff
    aar 1.23 MB 1.23 MB +97 B (+0.0%)
    apk (release) 3.33 MB 3.33 MB +32 B (+0.0%)

Test Logs

Notes

Head commit (462500e4) is created by Prow via merging commits: 9466242 dff4bbd.

Copy link
Contributor

@schmidt-sebastian schmidt-sebastian left a comment

Choose a reason for hiding this comment

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

Woohoo!

Please verify that the schema upgrades works as intended using an actual app. Thanks!

@wu-hui wu-hui assigned schmidt-sebastian and unassigned wu-hui Nov 9, 2021
@wu-hui
Copy link
Contributor Author

wu-hui commented Nov 9, 2021

@schmidt-sebastian Please take another look!

Without the new commit, upgrade will actually crash, because data_migrations table is not created. Thanks for reminding me to check with an actual App.

: Collections.emptyList());
List<MutationResult> mutationResults =
transformResult == null
? singletonList(new MutationResult(version, emptyList()))
Copy link
Contributor

Choose a reason for hiding this comment

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

We usually refer to these method using the class name: Arrays.singletonList.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

? singletonList(new MutationResult(version, emptyList()))
: Arrays.stream(transformResult)
.map(o -> new MutationResult(version, Collections.singletonList(TestUtil.wrap(o))))
.collect(Collectors.toList());
Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO this entire statement is not very readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@@ -963,9 +964,8 @@ public void testReadsAllDocumentsForInitialCollectionQueries() {
localStore.executeQuery(query, /* usePreviousResults= */ true);

assertRemoteDocumentsRead(/* byKey= */ 0, /* byQuery= */ 2);
if (!Persistence.OVERLAY_SUPPORT_ENABLED) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a blocker, but we should ideally remove all statements like this (including the flag) or leave them all here. If we leave the flag, we should be able to turn it off during development and have the tests pass.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

}

void runSchemaUpgrades(int fromVersion) {
int toVersion = VERSION;
if (Persistence.OVERLAY_SUPPORT_ENABLED) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should remove the flag in its entirety to just set it to true but leave all conditional checks. This makes sure that we can turn it to false again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one here has to be deleted, because if the version is increased again, doing this will override it.

@wu-hui wu-hui assigned schmidt-sebastian and unassigned wu-hui Nov 23, 2021
# Conflicts:
#	firebase-firestore/src/test/java/com/google/firebase/firestore/local/LocalStoreTestCase.java
@@ -203,7 +203,9 @@ private void recalculateAndSaveOverlays(Map<DocumentKey, MutableDocument> docs)
// along the way.
for (MutationBatch batch : batches) {
for (DocumentKey key : batch.getKeys()) {
FieldMask mask = batch.applyToLocalView(docs.get(key), masks.get(key));
FieldMask mask =
masks.containsKey(key) ? masks.get(key) : FieldMask.fromSet(new HashSet<>());
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we create an EMPTY_MASK sentinel? The missing mask is the default case and we create two objects each time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -152,23 +151,25 @@ private void udpateViews(int targetId, boolean fromCache) {
notifyLocalViewChanges(viewChanges(targetId, fromCache, asList(), asList()));
}

private void acknowledgeMutation(long documentVersion, @Nullable Object transformResult) {
private void acknowledgeMutationWithTransform(long documentVersion, Object... transformResult) {
Copy link
Contributor

Choose a reason for hiding this comment

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

acknowledgeMutationWithTransformResults ? (or leave as before)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

: Collections.emptyList());
List<MutationResult> mutationResults =
Collections.singletonList(new MutationResult(version, emptyList()));
if (transformResult != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This array should never be null. You can also use Java8 streams to simplify this logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is null when acknowledgeMutation is called.

Copy link
Contributor

Choose a reason for hiding this comment

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

You should call it with no arguments instead of null.

Copy link
Contributor

Choose a reason for hiding this comment

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

Bump :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@wu-hui wu-hui assigned schmidt-sebastian and unassigned wu-hui Nov 24, 2021
@wu-hui
Copy link
Contributor Author

wu-hui commented Nov 24, 2021

/test check-changed

@wu-hui
Copy link
Contributor Author

wu-hui commented Nov 25, 2021

/retest

@wu-hui wu-hui force-pushed the wuandy/OverlayRelease branch from 0823cfc to 3aa0f7f Compare November 30, 2021 19:56
@wu-hui
Copy link
Contributor Author

wu-hui commented Nov 30, 2021

/retest

# Conflicts:
#	firebase-firestore/CHANGELOG.md
#	firebase-firestore/src/main/java/com/google/firebase/firestore/local/SQLiteSchema.java
@wu-hui wu-hui merged commit 7c9c133 into master Dec 6, 2021
@wu-hui wu-hui deleted the wuandy/OverlayRelease branch December 6, 2021 21:04
@firebase firebase locked and limited conversation to collaborators Jan 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes Override cla size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants