-
Notifications
You must be signed in to change notification settings - Fork 625
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
Release Overlay #3112
Conversation
Coverage ReportAffected SDKs
Test Logs
NotesHTML coverage reports can be produced locally with Head commit (462500e4) is created by Prow via merging commits: 9466242 dff4bbd. |
Binary Size ReportAffected SDKs
Test Logs
NotesHead commit (462500e4) is created by Prow via merging commits: 9466242 dff4bbd. |
There was a problem hiding this 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!
firebase-firestore/src/main/java/com/google/firebase/firestore/local/Persistence.java
Show resolved
Hide resolved
@schmidt-sebastian Please take another look! Without the new commit, upgrade will actually crash, because |
: Collections.emptyList()); | ||
List<MutationResult> mutationResults = | ||
transformResult == null | ||
? singletonList(new MutationResult(version, emptyList())) |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
# 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<>()); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bump :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
/test check-changed |
/retest |
firebase-firestore/src/test/java/com/google/firebase/firestore/local/LocalStoreTestCase.java
Outdated
Show resolved
Hide resolved
0823cfc
to
3aa0f7f
Compare
/retest |
# Conflicts: # firebase-firestore/CHANGELOG.md # firebase-firestore/src/main/java/com/google/firebase/firestore/local/SQLiteSchema.java
Performance test result: #3161