From c7561e2afacadf75cbd755da26e7f2b2acd132b3 Mon Sep 17 00:00:00 2001 From: milaGGL <107142260+milaGGL@users.noreply.github.com> Date: Mon, 13 Mar 2023 10:42:19 -0700 Subject: [PATCH 1/7] initial code --- .../firebase/firestore/core/SyncEngine.java | 2 +- .../firebase/firestore/local/LocalStore.java | 2 +- .../firestore/local/QueryPurpose.java | 5 ++ .../firestore/remote/RemoteEvent.java | 11 +-- .../firestore/remote/RemoteSerializer.java | 87 +++++++++++-------- .../firestore/remote/RemoteStore.java | 7 +- .../remote/WatchChangeAggregator.java | 10 +-- 7 files changed, 73 insertions(+), 51 deletions(-) diff --git a/firebase-firestore/src/main/java/com/google/firebase/firestore/core/SyncEngine.java b/firebase-firestore/src/main/java/com/google/firebase/firestore/core/SyncEngine.java index b8655d91656..1cda1f721c5 100644 --- a/firebase-firestore/src/main/java/com/google/firebase/firestore/core/SyncEngine.java +++ b/firebase-firestore/src/main/java/com/google/firebase/firestore/core/SyncEngine.java @@ -428,7 +428,7 @@ public void handleRejectedListen(int targetId, Status error) { new RemoteEvent( SnapshotVersion.NONE, /* targetChanges= */ Collections.emptyMap(), - /* targetMismatches= */ Collections.emptySet(), + /* targetMismatches= */ Collections.emptyMap(), documentUpdates, limboDocuments); handleRemoteEvent(event); diff --git a/firebase-firestore/src/main/java/com/google/firebase/firestore/local/LocalStore.java b/firebase-firestore/src/main/java/com/google/firebase/firestore/local/LocalStore.java index 440d6a30a5a..5721ecc9271 100644 --- a/firebase-firestore/src/main/java/com/google/firebase/firestore/local/LocalStore.java +++ b/firebase-firestore/src/main/java/com/google/firebase/firestore/local/LocalStore.java @@ -425,7 +425,7 @@ public ImmutableSortedMap applyRemoteEvent(RemoteEvent re targetCache.addMatchingKeys(change.getAddedDocuments(), targetId); TargetData newTargetData = oldTargetData.withSequenceNumber(sequenceNumber); - if (remoteEvent.getTargetMismatches().contains(targetId)) { + if (remoteEvent.getTargetMismatches().containsKey(targetId)) { newTargetData = newTargetData .withResumeToken(ByteString.EMPTY, SnapshotVersion.NONE) diff --git a/firebase-firestore/src/main/java/com/google/firebase/firestore/local/QueryPurpose.java b/firebase-firestore/src/main/java/com/google/firebase/firestore/local/QueryPurpose.java index e56f0cf4e66..7595592ba8e 100644 --- a/firebase-firestore/src/main/java/com/google/firebase/firestore/local/QueryPurpose.java +++ b/firebase-firestore/src/main/java/com/google/firebase/firestore/local/QueryPurpose.java @@ -22,6 +22,11 @@ public enum QueryPurpose { /** The query was used to refill a query after an existence filter mismatch. */ EXISTENCE_FILTER_MISMATCH, + /** + * The query target was used if the query is the result of a false positive in the bloom filter. + */ + EXISTENCE_FILTER_MISMATCH_BLOOM, + /** The query was used to resolve a limbo document. */ LIMBO_RESOLUTION, } diff --git a/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteEvent.java b/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteEvent.java index e890574ba8a..337d0ef53a1 100644 --- a/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteEvent.java +++ b/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteEvent.java @@ -14,6 +14,7 @@ package com.google.firebase.firestore.remote; +import com.google.firebase.firestore.local.QueryPurpose; import com.google.firebase.firestore.model.DocumentKey; import com.google.firebase.firestore.model.MutableDocument; import com.google.firebase.firestore.model.SnapshotVersion; @@ -27,14 +28,14 @@ public final class RemoteEvent { private final SnapshotVersion snapshotVersion; private final Map targetChanges; - private final Set targetMismatches; + private final Map targetMismatches; private final Map documentUpdates; private final Set resolvedLimboDocuments; public RemoteEvent( SnapshotVersion snapshotVersion, Map targetChanges, - Set targetMismatches, + Map targetMismatches, Map documentUpdates, Set resolvedLimboDocuments) { this.snapshotVersion = snapshotVersion; @@ -55,10 +56,10 @@ public Map getTargetChanges() { } /** - * Returns a set of targets that is known to be inconsistent. Listens for these targets should be - * re-established without resume tokens. + * A map of targets that is known to be inconsistent, and the purpose for re-listening. Listens + * for these targets should be re-established without resume tokens. */ - public Set getTargetMismatches() { + public Map getTargetMismatches() { return targetMismatches; } diff --git a/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteSerializer.java b/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteSerializer.java index 655842a73af..1a87bb2c467 100644 --- a/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteSerializer.java +++ b/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteSerializer.java @@ -124,7 +124,8 @@ public SnapshotVersion decodeVersion(com.google.protobuf.Timestamp proto) { // Names and Keys /** - * Encodes the given document key as a fully qualified name. This includes the databaseId from the + * Encodes the given document key as a fully qualified name. This includes the + * databaseId from the * constructor and the key path. */ public String encodeKey(DocumentKey key) { @@ -149,8 +150,10 @@ private String encodeQueryPath(ResourcePath path) { private ResourcePath decodeQueryPath(String name) { ResourcePath resource = decodeResourceName(name); if (resource.length() == 4) { - // In v1beta1 queries for collections at the root did not have a trailing "/documents". In v1 - // all resource paths contain "/documents". Preserve the ability to read the v1 form for + // In v1beta1 queries for collections at the root did not have a trailing + // "/documents". In v1 + // all resource paths contain "/documents". Preserve the ability to read the v1 + // form for // compatibility with queries persisted in the local query cache. return ResourcePath.EMPTY; } else { @@ -167,8 +170,10 @@ private String encodeResourceName(DatabaseId databaseId, ResourcePath path) { } /** - * Decodes a fully qualified resource name into a resource path and validates that there is a - * project and database encoded in the path. There are no guarantees that a local path is also + * Decodes a fully qualified resource name into a resource path and validates + * that there is a + * project and database encoded in the path. There are no guarantees that a + * local path is also * encoded in this resource name. */ private ResourcePath decodeResourceName(String encoded) { @@ -178,7 +183,10 @@ private ResourcePath decodeResourceName(String encoded) { return resource; } - /** Creates the prefix for a fully qualified resource path, without a local path on the end. */ + /** + * Creates the prefix for a fully qualified resource path, without a local path + * on the end. + */ private static ResourcePath encodedDatabaseId(DatabaseId databaseId) { return ResourcePath.fromSegments( Arrays.asList( @@ -186,7 +194,8 @@ private static ResourcePath encodedDatabaseId(DatabaseId databaseId) { } /** - * Decodes a fully qualified resource name into a resource path and validates that there is a + * Decodes a fully qualified resource name into a resource path and validates + * that there is a * project and database encoded in the path along with a local path. */ private static ResourcePath extractLocalPathFromResourceName(ResourcePath resourceName) { @@ -197,7 +206,10 @@ private static ResourcePath extractLocalPathFromResourceName(ResourcePath resour return resourceName.popFirst(5); } - /** Validates that a path has a prefix that looks like a valid encoded databaseId. */ + /** + * Validates that a path has a prefix that looks like a valid encoded + * databaseId. + */ private static boolean isValidResourceName(ResourcePath path) { // Resource names have at least 4 components (project ID, database ID) // and commonly the (root) resource type, e.g. documents @@ -219,8 +231,7 @@ public String databaseName() { // Documents public com.google.firestore.v1.Document encodeDocument(DocumentKey key, ObjectValue value) { - com.google.firestore.v1.Document.Builder builder = - com.google.firestore.v1.Document.newBuilder(); + com.google.firestore.v1.Document.Builder builder = com.google.firestore.v1.Document.newBuilder(); builder.setName(encodeKey(key)); builder.putAllFields(value.getFieldsMap()); return builder.build(); @@ -289,10 +300,9 @@ public com.google.firestore.v1.Write encodeMutation(Mutation mutation) { } public Mutation decodeMutation(com.google.firestore.v1.Write mutation) { - Precondition precondition = - mutation.hasCurrentDocument() - ? decodePrecondition(mutation.getCurrentDocument()) - : Precondition.NONE; + Precondition precondition = mutation.hasCurrentDocument() + ? decodePrecondition(mutation.getCurrentDocument()) + : Precondition.NONE; List fieldTransforms = new ArrayList<>(); for (DocumentTransform.FieldTransform fieldTransform : mutation.getUpdateTransformsList()) { @@ -329,8 +339,7 @@ public Mutation decodeMutation(com.google.firestore.v1.Write mutation) { private com.google.firestore.v1.Precondition encodePrecondition(Precondition precondition) { hardAssert(!precondition.isNone(), "Can't serialize an empty precondition"); - com.google.firestore.v1.Precondition.Builder builder = - com.google.firestore.v1.Precondition.newBuilder(); + com.google.firestore.v1.Precondition.Builder builder = com.google.firestore.v1.Precondition.newBuilder(); if (precondition.getUpdateTime() != null) { return builder.setUpdateTime(encodeVersion(precondition.getUpdateTime())).build(); } else if (precondition.getExists() != null) { @@ -390,8 +399,7 @@ private DocumentTransform.FieldTransform encodeFieldTransform(FieldTransform fie .setRemoveAllFromArray(ArrayValue.newBuilder().addAllValues(remove.getElements())) .build(); } else if (transform instanceof NumericIncrementTransformOperation) { - NumericIncrementTransformOperation incrementOperation = - (NumericIncrementTransformOperation) transform; + NumericIncrementTransformOperation incrementOperation = (NumericIncrementTransformOperation) transform; return DocumentTransform.FieldTransform.newBuilder() .setFieldPath(fieldTransform.getFieldPath().canonicalString()) .setIncrement(incrementOperation.getOperand()) @@ -405,8 +413,7 @@ private FieldTransform decodeFieldTransform(DocumentTransform.FieldTransform fie switch (fieldTransform.getTransformTypeCase()) { case SET_TO_SERVER_VALUE: hardAssert( - fieldTransform.getSetToServerValue() - == DocumentTransform.FieldTransform.ServerValue.REQUEST_TIME, + fieldTransform.getSetToServerValue() == DocumentTransform.FieldTransform.ServerValue.REQUEST_TIME, "Unknown transform setToServerValue: %s", fieldTransform.getSetToServerValue()); return new FieldTransform( @@ -433,9 +440,12 @@ private FieldTransform decodeFieldTransform(DocumentTransform.FieldTransform fie public MutationResult decodeMutationResult( com.google.firestore.v1.WriteResult proto, SnapshotVersion commitVersion) { - // NOTE: Deletes don't have an updateTime but the commit timestamp from the containing - // CommitResponse or WriteResponse indicates essentially that the delete happened no later than - // that. For our purposes we don't care exactly when the delete happened so long as we can tell + // NOTE: Deletes don't have an updateTime but the commit timestamp from the + // containing + // CommitResponse or WriteResponse indicates essentially that the delete + // happened no later than + // that. For our purposes we don't care exactly when the delete happened so long + // as we can tell // when an update on the watch stream is at or later than that change. SnapshotVersion version = decodeVersion(proto.getUpdateTime()); if (SnapshotVersion.NONE.equals(version)) { @@ -454,7 +464,8 @@ public MutationResult decodeMutationResult( @Nullable public Map encodeListenRequestLabels(TargetData targetData) { - @Nullable String value = encodeLabel(targetData.getPurpose()); + @Nullable + String value = encodeLabel(targetData.getPurpose()); if (value == null) { return null; } @@ -471,6 +482,8 @@ private String encodeLabel(QueryPurpose purpose) { return null; case EXISTENCE_FILTER_MISMATCH: return "existence-filter-mismatch"; + case EXISTENCE_FILTER_MISMATCH_BLOOM: + return "existence-filter-mismatch-bloom"; case LIMBO_RESOLUTION: return "limbo-document"; default: @@ -492,7 +505,8 @@ public Target encodeTarget(TargetData targetData) { if (targetData.getResumeToken().isEmpty() && targetData.getSnapshotVersion().compareTo(SnapshotVersion.NONE) > 0) { - // TODO(wuandy): Consider removing above check because it is most likely true. Right now, many + // TODO(wuandy): Consider removing above check because it is most likely true. + // Right now, many // tests depend on this behaviour though (leaving min() out of serialization). builder.setReadTime(encodeTimestamp(targetData.getSnapshotVersion().getTimestamp())); } else { @@ -649,11 +663,11 @@ private StructuredQuery.Filter encodeFilters(List filters) { private List decodeFilters(StructuredQuery.Filter proto) { Filter result = decodeFilter(proto); - // Instead of a singletonList containing AND(F1, F2, ...), we can return a list containing F1, + // Instead of a singletonList containing AND(F1, F2, ...), we can return a list + // containing F1, // F2, ... to stay consistent with the older SDK versions. if (result instanceof com.google.firebase.firestore.core.CompositeFilter) { - com.google.firebase.firestore.core.CompositeFilter compositeFilter = - (com.google.firebase.firestore.core.CompositeFilter) result; + com.google.firebase.firestore.core.CompositeFilter compositeFilter = (com.google.firebase.firestore.core.CompositeFilter) result; if (compositeFilter.isFlatConjunction()) { return compositeFilter.getFilters(); } @@ -911,9 +925,8 @@ public WatchChange decodeWatchChange(ListenResponse protoChange) { default: throw new IllegalArgumentException("Unknown target change type"); } - watchChange = - new WatchTargetChange( - changeType, targetChange.getTargetIdsList(), targetChange.getResumeToken(), cause); + watchChange = new WatchTargetChange( + changeType, targetChange.getTargetIdsList(), targetChange.getResumeToken(), cause); break; case DOCUMENT_CHANGE: DocumentChange docChange = protoChange.getDocumentChange(); @@ -934,8 +947,7 @@ public WatchChange decodeWatchChange(ListenResponse protoChange) { // Note that version might be unset in which case we use SnapshotVersion.NONE version = decodeVersion(docDelete.getReadTime()); MutableDocument doc = MutableDocument.newNoDocument(key, version); - watchChange = - new WatchChange.DocumentChange(Collections.emptyList(), removed, doc.getKey(), doc); + watchChange = new WatchChange.DocumentChange(Collections.emptyList(), removed, doc.getKey(), doc); break; case DOCUMENT_REMOVE: DocumentRemove docRemove = protoChange.getDocumentRemove(); @@ -945,8 +957,7 @@ public WatchChange decodeWatchChange(ListenResponse protoChange) { break; case FILTER: com.google.firestore.v1.ExistenceFilter protoFilter = protoChange.getFilter(); - ExistenceFilter filter = - new ExistenceFilter(protoFilter.getCount(), protoFilter.getUnchangedNames()); + ExistenceFilter filter = new ExistenceFilter(protoFilter.getCount(), protoFilter.getUnchangedNames()); int targetId = protoFilter.getTargetId(); watchChange = new ExistenceFilterWatchChange(targetId, filter); break; @@ -959,8 +970,10 @@ public WatchChange decodeWatchChange(ListenResponse protoChange) { } public SnapshotVersion decodeVersionFromListenResponse(ListenResponse watchChange) { - // We have only reached a consistent snapshot for the entire stream if there is a read_time set - // and it applies to all targets (i.e. the list of targets is empty). The backend is guaranteed + // We have only reached a consistent snapshot for the entire stream if there is + // a read_time set + // and it applies to all targets (i.e. the list of targets is empty). The + // backend is guaranteed // to send such responses. if (watchChange.getResponseTypeCase() != ResponseTypeCase.TARGET_CHANGE) { return SnapshotVersion.NONE; diff --git a/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteStore.java b/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteStore.java index 1f5ad514b46..b44ca5a471b 100644 --- a/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteStore.java +++ b/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteStore.java @@ -547,7 +547,10 @@ private void raiseWatchSnapshot(SnapshotVersion snapshotVersion) { // Re-establish listens for the targets that have been invalidated by existence filter // mismatches. - for (int targetId : remoteEvent.getTargetMismatches()) { + for (Map.Entry entry : remoteEvent.getTargetMismatches().entrySet()) { + + int targetId = entry.getKey(); + TargetData targetData = this.listenTargets.get(targetId); // A watched target might have been removed already. if (targetData != null) { @@ -569,7 +572,7 @@ private void raiseWatchSnapshot(SnapshotVersion snapshotVersion) { targetData.getTarget(), targetId, targetData.getSequenceNumber(), - QueryPurpose.EXISTENCE_FILTER_MISMATCH); + /*QueryPurpose=*/ entry.getValue()); this.sendWatchRequest(requestTargetData); } } diff --git a/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/WatchChangeAggregator.java b/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/WatchChangeAggregator.java index 435cbca9e24..4d4ab71ccb5 100644 --- a/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/WatchChangeAggregator.java +++ b/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/WatchChangeAggregator.java @@ -75,10 +75,10 @@ public interface TargetMetadataProvider { private Map> pendingDocumentTargetMapping = new HashMap<>(); /** - * A list of targets with existence filter mismatches. These targets are known to be inconsistent + * A map of targets with existence filter mismatches. These targets are known to be inconsistent * and their listens needs to be re-established by RemoteStore. */ - private Set pendingTargetResets = new HashSet<>(); + private Map pendingTargetResets = new HashMap<>(); /** The log tag to use for this class. */ private static final String LOG_TAG = "WatchChangeAggregator"; @@ -214,7 +214,7 @@ public void handleExistenceFilter(ExistenceFilterWatchChange watchChange) { // If bloom filter application fails, we reset the mapping and // trigger re-run of the query. resetTarget(targetId); - pendingTargetResets.add(targetId); + pendingTargetResets.put(targetId, QueryPurpose.EXISTENCE_FILTER_MISMATCH); } } } @@ -341,14 +341,14 @@ public RemoteEvent createRemoteEvent(SnapshotVersion snapshotVersion) { new RemoteEvent( snapshotVersion, Collections.unmodifiableMap(targetChanges), - Collections.unmodifiableSet(pendingTargetResets), + Collections.unmodifiableMap(pendingTargetResets), Collections.unmodifiableMap(pendingDocumentUpdates), Collections.unmodifiableSet(resolvedLimboDocuments)); // Re-initialize the current state to ensure that we do not modify the generated RemoteEvent. pendingDocumentUpdates = new HashMap<>(); pendingDocumentTargetMapping = new HashMap<>(); - pendingTargetResets = new HashSet<>(); + pendingTargetResets = new HashMap<>(); return remoteEvent; } From 1b16c7aa37a8d3c122db0edd231bb79bbf1d68ed Mon Sep 17 00:00:00 2001 From: milaGGL <107142260+milaGGL@users.noreply.github.com> Date: Mon, 13 Mar 2023 11:36:16 -0700 Subject: [PATCH 2/7] set bloom filter application status --- .../firestore/remote/RemoteSerializer.java | 58 +- .../remote/WatchChangeAggregator.java | 38 +- .../test/resources/json/bundle_spec_test.json | 2 +- .../json/existence_filter_spec_test.json | 645 ++++++++++++------ .../test/resources/json/limbo_spec_test.json | 122 ++-- .../test/resources/json/limit_spec_test.json | 20 +- .../resources/json/offline_spec_test.json | 6 +- .../resources/json/recovery_spec_test.json | 8 +- 8 files changed, 563 insertions(+), 336 deletions(-) diff --git a/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteSerializer.java b/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteSerializer.java index 1a87bb2c467..5580b431ca8 100644 --- a/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteSerializer.java +++ b/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteSerializer.java @@ -124,8 +124,7 @@ public SnapshotVersion decodeVersion(com.google.protobuf.Timestamp proto) { // Names and Keys /** - * Encodes the given document key as a fully qualified name. This includes the - * databaseId from the + * Encodes the given document key as a fully qualified name. This includes the databaseId from the * constructor and the key path. */ public String encodeKey(DocumentKey key) { @@ -170,10 +169,8 @@ private String encodeResourceName(DatabaseId databaseId, ResourcePath path) { } /** - * Decodes a fully qualified resource name into a resource path and validates - * that there is a - * project and database encoded in the path. There are no guarantees that a - * local path is also + * Decodes a fully qualified resource name into a resource path and validates that there is a + * project and database encoded in the path. There are no guarantees that a local path is also * encoded in this resource name. */ private ResourcePath decodeResourceName(String encoded) { @@ -183,10 +180,7 @@ private ResourcePath decodeResourceName(String encoded) { return resource; } - /** - * Creates the prefix for a fully qualified resource path, without a local path - * on the end. - */ + /** Creates the prefix for a fully qualified resource path, without a local path on the end. */ private static ResourcePath encodedDatabaseId(DatabaseId databaseId) { return ResourcePath.fromSegments( Arrays.asList( @@ -194,8 +188,7 @@ private static ResourcePath encodedDatabaseId(DatabaseId databaseId) { } /** - * Decodes a fully qualified resource name into a resource path and validates - * that there is a + * Decodes a fully qualified resource name into a resource path and validates that there is a * project and database encoded in the path along with a local path. */ private static ResourcePath extractLocalPathFromResourceName(ResourcePath resourceName) { @@ -206,10 +199,7 @@ private static ResourcePath extractLocalPathFromResourceName(ResourcePath resour return resourceName.popFirst(5); } - /** - * Validates that a path has a prefix that looks like a valid encoded - * databaseId. - */ + /** Validates that a path has a prefix that looks like a valid encoded databaseId. */ private static boolean isValidResourceName(ResourcePath path) { // Resource names have at least 4 components (project ID, database ID) // and commonly the (root) resource type, e.g. documents @@ -231,7 +221,8 @@ public String databaseName() { // Documents public com.google.firestore.v1.Document encodeDocument(DocumentKey key, ObjectValue value) { - com.google.firestore.v1.Document.Builder builder = com.google.firestore.v1.Document.newBuilder(); + com.google.firestore.v1.Document.Builder builder = + com.google.firestore.v1.Document.newBuilder(); builder.setName(encodeKey(key)); builder.putAllFields(value.getFieldsMap()); return builder.build(); @@ -300,9 +291,10 @@ public com.google.firestore.v1.Write encodeMutation(Mutation mutation) { } public Mutation decodeMutation(com.google.firestore.v1.Write mutation) { - Precondition precondition = mutation.hasCurrentDocument() - ? decodePrecondition(mutation.getCurrentDocument()) - : Precondition.NONE; + Precondition precondition = + mutation.hasCurrentDocument() + ? decodePrecondition(mutation.getCurrentDocument()) + : Precondition.NONE; List fieldTransforms = new ArrayList<>(); for (DocumentTransform.FieldTransform fieldTransform : mutation.getUpdateTransformsList()) { @@ -339,7 +331,8 @@ public Mutation decodeMutation(com.google.firestore.v1.Write mutation) { private com.google.firestore.v1.Precondition encodePrecondition(Precondition precondition) { hardAssert(!precondition.isNone(), "Can't serialize an empty precondition"); - com.google.firestore.v1.Precondition.Builder builder = com.google.firestore.v1.Precondition.newBuilder(); + com.google.firestore.v1.Precondition.Builder builder = + com.google.firestore.v1.Precondition.newBuilder(); if (precondition.getUpdateTime() != null) { return builder.setUpdateTime(encodeVersion(precondition.getUpdateTime())).build(); } else if (precondition.getExists() != null) { @@ -399,7 +392,8 @@ private DocumentTransform.FieldTransform encodeFieldTransform(FieldTransform fie .setRemoveAllFromArray(ArrayValue.newBuilder().addAllValues(remove.getElements())) .build(); } else if (transform instanceof NumericIncrementTransformOperation) { - NumericIncrementTransformOperation incrementOperation = (NumericIncrementTransformOperation) transform; + NumericIncrementTransformOperation incrementOperation = + (NumericIncrementTransformOperation) transform; return DocumentTransform.FieldTransform.newBuilder() .setFieldPath(fieldTransform.getFieldPath().canonicalString()) .setIncrement(incrementOperation.getOperand()) @@ -413,7 +407,8 @@ private FieldTransform decodeFieldTransform(DocumentTransform.FieldTransform fie switch (fieldTransform.getTransformTypeCase()) { case SET_TO_SERVER_VALUE: hardAssert( - fieldTransform.getSetToServerValue() == DocumentTransform.FieldTransform.ServerValue.REQUEST_TIME, + fieldTransform.getSetToServerValue() + == DocumentTransform.FieldTransform.ServerValue.REQUEST_TIME, "Unknown transform setToServerValue: %s", fieldTransform.getSetToServerValue()); return new FieldTransform( @@ -464,8 +459,7 @@ public MutationResult decodeMutationResult( @Nullable public Map encodeListenRequestLabels(TargetData targetData) { - @Nullable - String value = encodeLabel(targetData.getPurpose()); + @Nullable String value = encodeLabel(targetData.getPurpose()); if (value == null) { return null; } @@ -667,7 +661,8 @@ private List decodeFilters(StructuredQuery.Filter proto) { // containing F1, // F2, ... to stay consistent with the older SDK versions. if (result instanceof com.google.firebase.firestore.core.CompositeFilter) { - com.google.firebase.firestore.core.CompositeFilter compositeFilter = (com.google.firebase.firestore.core.CompositeFilter) result; + com.google.firebase.firestore.core.CompositeFilter compositeFilter = + (com.google.firebase.firestore.core.CompositeFilter) result; if (compositeFilter.isFlatConjunction()) { return compositeFilter.getFilters(); } @@ -925,8 +920,9 @@ public WatchChange decodeWatchChange(ListenResponse protoChange) { default: throw new IllegalArgumentException("Unknown target change type"); } - watchChange = new WatchTargetChange( - changeType, targetChange.getTargetIdsList(), targetChange.getResumeToken(), cause); + watchChange = + new WatchTargetChange( + changeType, targetChange.getTargetIdsList(), targetChange.getResumeToken(), cause); break; case DOCUMENT_CHANGE: DocumentChange docChange = protoChange.getDocumentChange(); @@ -947,7 +943,8 @@ public WatchChange decodeWatchChange(ListenResponse protoChange) { // Note that version might be unset in which case we use SnapshotVersion.NONE version = decodeVersion(docDelete.getReadTime()); MutableDocument doc = MutableDocument.newNoDocument(key, version); - watchChange = new WatchChange.DocumentChange(Collections.emptyList(), removed, doc.getKey(), doc); + watchChange = + new WatchChange.DocumentChange(Collections.emptyList(), removed, doc.getKey(), doc); break; case DOCUMENT_REMOVE: DocumentRemove docRemove = protoChange.getDocumentRemove(); @@ -957,7 +954,8 @@ public WatchChange decodeWatchChange(ListenResponse protoChange) { break; case FILTER: com.google.firestore.v1.ExistenceFilter protoFilter = protoChange.getFilter(); - ExistenceFilter filter = new ExistenceFilter(protoFilter.getCount(), protoFilter.getUnchangedNames()); + ExistenceFilter filter = + new ExistenceFilter(protoFilter.getCount(), protoFilter.getUnchangedNames()); int targetId = protoFilter.getTargetId(); watchChange = new ExistenceFilterWatchChange(targetId, filter); break; diff --git a/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/WatchChangeAggregator.java b/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/WatchChangeAggregator.java index 4d4ab71ccb5..5e2cbf73ac6 100644 --- a/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/WatchChangeAggregator.java +++ b/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/WatchChangeAggregator.java @@ -83,6 +83,13 @@ public interface TargetMetadataProvider { /** The log tag to use for this class. */ private static final String LOG_TAG = "WatchChangeAggregator"; + /** The bloom filter application status while handling existence filter mismatch. */ + private enum BloomFilterApplicationStatus { + SUCCESS, + SKIPPED, + FALSE_POSITIVE + } + public WatchChangeAggregator(TargetMetadataProvider targetMetadataProvider) { this.targetMetadataProvider = targetMetadataProvider; } @@ -208,27 +215,34 @@ public void handleExistenceFilter(ExistenceFilterWatchChange watchChange) { if (currentSize != expectedCount) { // Apply bloom filter to identify and mark removed documents. - boolean bloomFilterApplied = this.applyBloomFilter(watchChange, currentSize); + BloomFilterApplicationStatus status = this.applyBloomFilter(watchChange, currentSize); - if (!bloomFilterApplied) { + if (status != BloomFilterApplicationStatus.SUCCESS) { // If bloom filter application fails, we reset the mapping and // trigger re-run of the query. resetTarget(targetId); - pendingTargetResets.put(targetId, QueryPurpose.EXISTENCE_FILTER_MISMATCH); + + QueryPurpose purpose = + status == BloomFilterApplicationStatus.FALSE_POSITIVE + ? QueryPurpose.EXISTENCE_FILTER_MISMATCH_BLOOM + : QueryPurpose.EXISTENCE_FILTER_MISMATCH; + + pendingTargetResets.put(targetId, purpose); } } } } } - /** Returns whether a bloom filter removed the deleted documents successfully. */ - private boolean applyBloomFilter(ExistenceFilterWatchChange watchChange, int currentCount) { + /** Apply bloom filter to remove the deleted documents, and return the application status. */ + private BloomFilterApplicationStatus applyBloomFilter( + ExistenceFilterWatchChange watchChange, int currentCount) { int expectedCount = watchChange.getExistenceFilter().getCount(); com.google.firestore.v1.BloomFilter unchangedNames = watchChange.getExistenceFilter().getUnchangedNames(); if (unchangedNames == null || !unchangedNames.hasBits()) { - return false; + return BloomFilterApplicationStatus.SKIPPED; } byte[] bitmap = unchangedNames.getBits().getBitmap().toByteArray(); @@ -244,12 +258,20 @@ private boolean applyBloomFilter(ExistenceFilterWatchChange watchChange, int cur "Decoding the base64 bloom filter in existence filter failed (" + e.getMessage() + "); ignoring the bloom filter and falling back to full re-query."); - return false; + return BloomFilterApplicationStatus.SKIPPED; + } + + if (bloomFilter.getBitCount() == 0) { + return BloomFilterApplicationStatus.SKIPPED; } int removedDocumentCount = this.filterRemovedDocuments(bloomFilter, watchChange.getTargetId()); - return expectedCount == (currentCount - removedDocumentCount); + if (expectedCount != (currentCount - removedDocumentCount)) { + return BloomFilterApplicationStatus.FALSE_POSITIVE; + } + + return BloomFilterApplicationStatus.SUCCESS; } /** diff --git a/firebase-firestore/src/test/resources/json/bundle_spec_test.json b/firebase-firestore/src/test/resources/json/bundle_spec_test.json index 94bc9cc0da1..617f5946d5f 100644 --- a/firebase-firestore/src/test/resources/json/bundle_spec_test.json +++ b/firebase-firestore/src/test/resources/json/bundle_spec_test.json @@ -1166,7 +1166,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ diff --git a/firebase-firestore/src/test/resources/json/existence_filter_spec_test.json b/firebase-firestore/src/test/resources/json/existence_filter_spec_test.json index 16442ba1702..9c7169a9785 100644 --- a/firebase-firestore/src/test/resources/json/existence_filter_spec_test.json +++ b/firebase-firestore/src/test/resources/json/existence_filter_spec_test.json @@ -91,7 +91,8 @@ { "added": [ { - "key": "collection/ÀÒ∑", + + "key": "collection/ÀÒ∑", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -102,7 +103,8 @@ "version": 1000 }, { - "key": "collection/À∑Ò", + + "key": "collection/À∑Ò", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -178,7 +180,8 @@ "path": "collection/À∑Ò" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "2": { "queries": [ @@ -289,7 +292,8 @@ { "added": [ { - "key": "collection/a", + + "key": "collection/a", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -300,7 +304,8 @@ "version": 1000 }, { - "key": "collection/b", + + "key": "collection/b", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -371,7 +376,8 @@ "path": "collection" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 1 } } } @@ -470,7 +476,8 @@ { "added": [ { - "key": "collection/a", + + "key": "collection/a", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -481,7 +488,8 @@ "version": 1000 }, { - "key": "collection/b", + + "key": "collection/b", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -552,7 +560,8 @@ { "added": [ { - "key": "collection/c", + + "key": "collection/c", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -590,7 +599,8 @@ "path": "collection/b" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "2": { "queries": [ @@ -701,7 +711,8 @@ { "added": [ { - "key": "collection/a", + + "key": "collection/a", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -712,7 +723,8 @@ "version": 1000 }, { - "key": "collection/b", + + "key": "collection/b", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -788,7 +800,8 @@ "path": "collection/b" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "2": { "queries": [ @@ -828,7 +841,8 @@ }, "removed": [ { - "key": "collection/b", + + "key": "collection/b", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2032,7 +2046,8 @@ { "added": [ { - "key": "collection/doc0", + + "key": "collection/doc0", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2043,7 +2058,8 @@ "version": 1000 }, { - "key": "collection/doc1", + + "key": "collection/doc1", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2054,7 +2070,8 @@ "version": 1000 }, { - "key": "collection/doc2", + + "key": "collection/doc2", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2065,7 +2082,8 @@ "version": 1000 }, { - "key": "collection/doc3", + + "key": "collection/doc3", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2076,7 +2094,8 @@ "version": 1000 }, { - "key": "collection/doc4", + + "key": "collection/doc4", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2087,7 +2106,8 @@ "version": 1000 }, { - "key": "collection/doc5", + + "key": "collection/doc5", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2098,7 +2118,8 @@ "version": 1000 }, { - "key": "collection/doc6", + + "key": "collection/doc6", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2109,7 +2130,8 @@ "version": 1000 }, { - "key": "collection/doc7", + + "key": "collection/doc7", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2120,7 +2142,8 @@ "version": 1000 }, { - "key": "collection/doc8", + + "key": "collection/doc8", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2131,7 +2154,8 @@ "version": 1000 }, { - "key": "collection/doc9", + + "key": "collection/doc9", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2142,7 +2166,8 @@ "version": 1000 }, { - "key": "collection/doc10", + + "key": "collection/doc10", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2153,7 +2178,8 @@ "version": 1000 }, { - "key": "collection/doc11", + + "key": "collection/doc11", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2164,7 +2190,8 @@ "version": 1000 }, { - "key": "collection/doc12", + + "key": "collection/doc12", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2175,7 +2202,8 @@ "version": 1000 }, { - "key": "collection/doc13", + + "key": "collection/doc13", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2186,7 +2214,8 @@ "version": 1000 }, { - "key": "collection/doc14", + + "key": "collection/doc14", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2197,7 +2226,8 @@ "version": 1000 }, { - "key": "collection/doc15", + + "key": "collection/doc15", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2208,7 +2238,8 @@ "version": 1000 }, { - "key": "collection/doc16", + + "key": "collection/doc16", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2219,7 +2250,8 @@ "version": 1000 }, { - "key": "collection/doc17", + + "key": "collection/doc17", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2230,7 +2262,8 @@ "version": 1000 }, { - "key": "collection/doc18", + + "key": "collection/doc18", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2241,7 +2274,8 @@ "version": 1000 }, { - "key": "collection/doc19", + + "key": "collection/doc19", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2252,7 +2286,8 @@ "version": 1000 }, { - "key": "collection/doc20", + + "key": "collection/doc20", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2263,7 +2298,8 @@ "version": 1000 }, { - "key": "collection/doc21", + + "key": "collection/doc21", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2274,7 +2310,8 @@ "version": 1000 }, { - "key": "collection/doc22", + + "key": "collection/doc22", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2285,7 +2322,8 @@ "version": 1000 }, { - "key": "collection/doc23", + + "key": "collection/doc23", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2296,7 +2334,8 @@ "version": 1000 }, { - "key": "collection/doc24", + + "key": "collection/doc24", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2307,7 +2346,8 @@ "version": 1000 }, { - "key": "collection/doc25", + + "key": "collection/doc25", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2318,7 +2358,8 @@ "version": 1000 }, { - "key": "collection/doc26", + + "key": "collection/doc26", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2329,7 +2370,8 @@ "version": 1000 }, { - "key": "collection/doc27", + + "key": "collection/doc27", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2340,7 +2382,8 @@ "version": 1000 }, { - "key": "collection/doc28", + + "key": "collection/doc28", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2351,7 +2394,8 @@ "version": 1000 }, { - "key": "collection/doc29", + + "key": "collection/doc29", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2362,7 +2406,8 @@ "version": 1000 }, { - "key": "collection/doc30", + + "key": "collection/doc30", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2373,7 +2418,8 @@ "version": 1000 }, { - "key": "collection/doc31", + + "key": "collection/doc31", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2384,7 +2430,8 @@ "version": 1000 }, { - "key": "collection/doc32", + + "key": "collection/doc32", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2395,7 +2442,8 @@ "version": 1000 }, { - "key": "collection/doc33", + + "key": "collection/doc33", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2406,7 +2454,8 @@ "version": 1000 }, { - "key": "collection/doc34", + + "key": "collection/doc34", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2417,7 +2466,8 @@ "version": 1000 }, { - "key": "collection/doc35", + + "key": "collection/doc35", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2428,7 +2478,8 @@ "version": 1000 }, { - "key": "collection/doc36", + + "key": "collection/doc36", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2439,7 +2490,8 @@ "version": 1000 }, { - "key": "collection/doc37", + + "key": "collection/doc37", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2450,7 +2502,8 @@ "version": 1000 }, { - "key": "collection/doc38", + + "key": "collection/doc38", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2461,7 +2514,8 @@ "version": 1000 }, { - "key": "collection/doc39", + + "key": "collection/doc39", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2472,7 +2526,8 @@ "version": 1000 }, { - "key": "collection/doc40", + + "key": "collection/doc40", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2483,7 +2538,8 @@ "version": 1000 }, { - "key": "collection/doc41", + + "key": "collection/doc41", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2494,7 +2550,8 @@ "version": 1000 }, { - "key": "collection/doc42", + + "key": "collection/doc42", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2505,7 +2562,8 @@ "version": 1000 }, { - "key": "collection/doc43", + + "key": "collection/doc43", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2516,7 +2574,8 @@ "version": 1000 }, { - "key": "collection/doc44", + + "key": "collection/doc44", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2527,7 +2586,8 @@ "version": 1000 }, { - "key": "collection/doc45", + + "key": "collection/doc45", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2538,7 +2598,8 @@ "version": 1000 }, { - "key": "collection/doc46", + + "key": "collection/doc46", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2549,7 +2610,8 @@ "version": 1000 }, { - "key": "collection/doc47", + + "key": "collection/doc47", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2560,7 +2622,8 @@ "version": 1000 }, { - "key": "collection/doc48", + + "key": "collection/doc48", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2571,7 +2634,8 @@ "version": 1000 }, { - "key": "collection/doc49", + + "key": "collection/doc49", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2582,7 +2646,8 @@ "version": 1000 }, { - "key": "collection/doc50", + + "key": "collection/doc50", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2593,7 +2658,8 @@ "version": 1000 }, { - "key": "collection/doc51", + + "key": "collection/doc51", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2604,7 +2670,8 @@ "version": 1000 }, { - "key": "collection/doc52", + + "key": "collection/doc52", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2615,7 +2682,8 @@ "version": 1000 }, { - "key": "collection/doc53", + + "key": "collection/doc53", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2626,7 +2694,8 @@ "version": 1000 }, { - "key": "collection/doc54", + + "key": "collection/doc54", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2637,7 +2706,8 @@ "version": 1000 }, { - "key": "collection/doc55", + + "key": "collection/doc55", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2648,7 +2718,8 @@ "version": 1000 }, { - "key": "collection/doc56", + + "key": "collection/doc56", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2659,7 +2730,8 @@ "version": 1000 }, { - "key": "collection/doc57", + + "key": "collection/doc57", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2670,7 +2742,8 @@ "version": 1000 }, { - "key": "collection/doc58", + + "key": "collection/doc58", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2681,7 +2754,8 @@ "version": 1000 }, { - "key": "collection/doc59", + + "key": "collection/doc59", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2692,7 +2766,8 @@ "version": 1000 }, { - "key": "collection/doc60", + + "key": "collection/doc60", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2703,7 +2778,8 @@ "version": 1000 }, { - "key": "collection/doc61", + + "key": "collection/doc61", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2714,7 +2790,8 @@ "version": 1000 }, { - "key": "collection/doc62", + + "key": "collection/doc62", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2725,7 +2802,8 @@ "version": 1000 }, { - "key": "collection/doc63", + + "key": "collection/doc63", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2736,7 +2814,8 @@ "version": 1000 }, { - "key": "collection/doc64", + + "key": "collection/doc64", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2747,7 +2826,8 @@ "version": 1000 }, { - "key": "collection/doc65", + + "key": "collection/doc65", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2758,7 +2838,8 @@ "version": 1000 }, { - "key": "collection/doc66", + + "key": "collection/doc66", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2769,7 +2850,8 @@ "version": 1000 }, { - "key": "collection/doc67", + + "key": "collection/doc67", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2780,7 +2862,8 @@ "version": 1000 }, { - "key": "collection/doc68", + + "key": "collection/doc68", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2791,7 +2874,8 @@ "version": 1000 }, { - "key": "collection/doc69", + + "key": "collection/doc69", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2802,7 +2886,8 @@ "version": 1000 }, { - "key": "collection/doc70", + + "key": "collection/doc70", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2813,7 +2898,8 @@ "version": 1000 }, { - "key": "collection/doc71", + + "key": "collection/doc71", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2824,7 +2910,8 @@ "version": 1000 }, { - "key": "collection/doc72", + + "key": "collection/doc72", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2835,7 +2922,8 @@ "version": 1000 }, { - "key": "collection/doc73", + + "key": "collection/doc73", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2846,7 +2934,8 @@ "version": 1000 }, { - "key": "collection/doc74", + + "key": "collection/doc74", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2857,7 +2946,8 @@ "version": 1000 }, { - "key": "collection/doc75", + + "key": "collection/doc75", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2868,7 +2958,8 @@ "version": 1000 }, { - "key": "collection/doc76", + + "key": "collection/doc76", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2879,7 +2970,8 @@ "version": 1000 }, { - "key": "collection/doc77", + + "key": "collection/doc77", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2890,7 +2982,8 @@ "version": 1000 }, { - "key": "collection/doc78", + + "key": "collection/doc78", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2901,7 +2994,8 @@ "version": 1000 }, { - "key": "collection/doc79", + + "key": "collection/doc79", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2912,7 +3006,8 @@ "version": 1000 }, { - "key": "collection/doc80", + + "key": "collection/doc80", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2923,7 +3018,8 @@ "version": 1000 }, { - "key": "collection/doc81", + + "key": "collection/doc81", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2934,7 +3030,8 @@ "version": 1000 }, { - "key": "collection/doc82", + + "key": "collection/doc82", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2945,7 +3042,8 @@ "version": 1000 }, { - "key": "collection/doc83", + + "key": "collection/doc83", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2956,7 +3054,8 @@ "version": 1000 }, { - "key": "collection/doc84", + + "key": "collection/doc84", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2967,7 +3066,8 @@ "version": 1000 }, { - "key": "collection/doc85", + + "key": "collection/doc85", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2978,7 +3078,8 @@ "version": 1000 }, { - "key": "collection/doc86", + + "key": "collection/doc86", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -2989,7 +3090,8 @@ "version": 1000 }, { - "key": "collection/doc87", + + "key": "collection/doc87", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -3000,7 +3102,8 @@ "version": 1000 }, { - "key": "collection/doc88", + + "key": "collection/doc88", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -3011,7 +3114,8 @@ "version": 1000 }, { - "key": "collection/doc89", + + "key": "collection/doc89", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -3022,7 +3126,8 @@ "version": 1000 }, { - "key": "collection/doc90", + + "key": "collection/doc90", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -3033,7 +3138,8 @@ "version": 1000 }, { - "key": "collection/doc91", + + "key": "collection/doc91", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -3044,7 +3150,8 @@ "version": 1000 }, { - "key": "collection/doc92", + + "key": "collection/doc92", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -3055,7 +3162,8 @@ "version": 1000 }, { - "key": "collection/doc93", + + "key": "collection/doc93", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -3066,7 +3174,8 @@ "version": 1000 }, { - "key": "collection/doc94", + + "key": "collection/doc94", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -3077,7 +3186,8 @@ "version": 1000 }, { - "key": "collection/doc95", + + "key": "collection/doc95", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -3088,7 +3198,8 @@ "version": 1000 }, { - "key": "collection/doc96", + + "key": "collection/doc96", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -3099,7 +3210,8 @@ "version": 1000 }, { - "key": "collection/doc97", + + "key": "collection/doc97", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -3110,7 +3222,8 @@ "version": 1000 }, { - "key": "collection/doc98", + + "key": "collection/doc98", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -3121,7 +3234,8 @@ "version": 1000 }, { - "key": "collection/doc99", + + "key": "collection/doc99", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -3295,7 +3409,8 @@ "path": "collection/doc50" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "11": { "queries": [ @@ -3307,7 +3422,8 @@ "path": "collection/doc55" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "13": { "queries": [ @@ -3319,7 +3435,8 @@ "path": "collection/doc56" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "15": { "queries": [ @@ -3331,7 +3448,8 @@ "path": "collection/doc57" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "17": { "queries": [ @@ -3343,7 +3461,8 @@ "path": "collection/doc58" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "19": { "queries": [ @@ -3355,7 +3474,8 @@ "path": "collection/doc59" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "2": { "queries": [ @@ -3379,7 +3499,8 @@ "path": "collection/doc60" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "23": { "queries": [ @@ -3391,7 +3512,8 @@ "path": "collection/doc61" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "25": { "queries": [ @@ -3403,7 +3525,8 @@ "path": "collection/doc62" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "27": { "queries": [ @@ -3415,7 +3538,8 @@ "path": "collection/doc63" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "29": { "queries": [ @@ -3427,7 +3551,8 @@ "path": "collection/doc64" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "3": { "queries": [ @@ -3439,7 +3564,8 @@ "path": "collection/doc51" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "31": { "queries": [ @@ -3451,7 +3577,8 @@ "path": "collection/doc65" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "33": { "queries": [ @@ -3463,7 +3590,8 @@ "path": "collection/doc66" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "35": { "queries": [ @@ -3475,7 +3603,8 @@ "path": "collection/doc67" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "37": { "queries": [ @@ -3487,7 +3616,8 @@ "path": "collection/doc68" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "39": { "queries": [ @@ -3499,7 +3629,8 @@ "path": "collection/doc69" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "41": { "queries": [ @@ -3511,7 +3642,8 @@ "path": "collection/doc70" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "43": { "queries": [ @@ -3523,7 +3655,8 @@ "path": "collection/doc71" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "45": { "queries": [ @@ -3535,7 +3668,8 @@ "path": "collection/doc72" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "47": { "queries": [ @@ -3547,7 +3681,8 @@ "path": "collection/doc73" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "49": { "queries": [ @@ -3559,7 +3694,8 @@ "path": "collection/doc74" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "5": { "queries": [ @@ -3571,7 +3707,8 @@ "path": "collection/doc52" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "51": { "queries": [ @@ -3583,7 +3720,8 @@ "path": "collection/doc75" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "53": { "queries": [ @@ -3595,7 +3733,8 @@ "path": "collection/doc76" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "55": { "queries": [ @@ -3607,7 +3746,8 @@ "path": "collection/doc77" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "57": { "queries": [ @@ -3619,7 +3759,8 @@ "path": "collection/doc78" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "59": { "queries": [ @@ -3631,7 +3772,8 @@ "path": "collection/doc79" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "61": { "queries": [ @@ -3643,7 +3785,8 @@ "path": "collection/doc80" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "63": { "queries": [ @@ -3655,7 +3798,8 @@ "path": "collection/doc81" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "65": { "queries": [ @@ -3667,7 +3811,8 @@ "path": "collection/doc82" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "67": { "queries": [ @@ -3679,7 +3824,8 @@ "path": "collection/doc83" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "69": { "queries": [ @@ -3691,7 +3837,8 @@ "path": "collection/doc84" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "7": { "queries": [ @@ -3703,7 +3850,8 @@ "path": "collection/doc53" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "71": { "queries": [ @@ -3715,7 +3863,8 @@ "path": "collection/doc85" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "73": { "queries": [ @@ -3727,7 +3876,8 @@ "path": "collection/doc86" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "75": { "queries": [ @@ -3739,7 +3889,8 @@ "path": "collection/doc87" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "77": { "queries": [ @@ -3751,7 +3902,8 @@ "path": "collection/doc88" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "79": { "queries": [ @@ -3763,7 +3915,8 @@ "path": "collection/doc89" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "81": { "queries": [ @@ -3775,7 +3928,8 @@ "path": "collection/doc90" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "83": { "queries": [ @@ -3787,7 +3941,8 @@ "path": "collection/doc91" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "85": { "queries": [ @@ -3799,7 +3954,8 @@ "path": "collection/doc92" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "87": { "queries": [ @@ -3811,7 +3967,8 @@ "path": "collection/doc93" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "89": { "queries": [ @@ -3823,7 +3980,8 @@ "path": "collection/doc94" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "9": { "queries": [ @@ -3835,7 +3993,8 @@ "path": "collection/doc54" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "91": { "queries": [ @@ -3847,7 +4006,8 @@ "path": "collection/doc95" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "93": { "queries": [ @@ -3859,7 +4019,8 @@ "path": "collection/doc96" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "95": { "queries": [ @@ -3871,7 +4032,8 @@ "path": "collection/doc97" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "97": { "queries": [ @@ -3883,7 +4045,8 @@ "path": "collection/doc98" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "99": { "queries": [ @@ -3895,7 +4058,8 @@ "path": "collection/doc99" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 } } } @@ -3995,7 +4159,8 @@ { "added": [ { - "key": "collection/1", + + "key": "collection/1", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -4006,7 +4171,8 @@ "version": 1000 }, { - "key": "collection/2", + + "key": "collection/2", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -4104,7 +4270,8 @@ { "added": [ { - "key": "collection/1", + + "key": "collection/1", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -4115,7 +4282,8 @@ "version": 1000 }, { - "key": "collection/2", + + "key": "collection/2", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -4238,7 +4406,8 @@ { "added": [ { - "key": "collection/1", + + "key": "collection/1", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -4303,7 +4472,8 @@ { "added": [ { - "key": "collection/3", + + "key": "collection/3", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -4416,7 +4586,8 @@ { "added": [ { - "key": "collection/2", + + "key": "collection/2", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -4523,7 +4694,8 @@ { "added": [ { - "key": "collection/1", + + "key": "collection/1", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -4578,7 +4750,8 @@ { "added": [ { - "key": "collection/1", + + "key": "collection/1", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -4762,7 +4935,8 @@ { "added": [ { - "key": "collection/1", + + "key": "collection/1", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -4773,7 +4947,8 @@ "version": 1000 }, { - "key": "collection/2", + + "key": "collection/2", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -4907,7 +5082,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ @@ -4948,7 +5123,8 @@ }, "removed": [ { - "key": "collection/2", + + "key": "collection/2", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -5064,7 +5240,8 @@ { "added": [ { - "key": "collection/1", + + "key": "collection/1", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -5219,7 +5396,8 @@ { "added": [ { - "key": "collection/1", + + "key": "collection/1", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -5337,7 +5515,8 @@ { "added": [ { - "key": "collection/1", + + "key": "collection/1", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -5348,7 +5527,8 @@ "version": 1000 }, { - "key": "collection/2", + + "key": "collection/2", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -5482,7 +5662,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ @@ -5533,7 +5713,8 @@ }, "removed": [ { - "key": "collection/2", + + "key": "collection/2", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -5660,7 +5841,8 @@ { "added": [ { - "key": "collection/1", + + "key": "collection/1", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -5671,7 +5853,8 @@ "version": 1000 }, { - "key": "collection/2", + + "key": "collection/2", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -5835,7 +6018,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ @@ -5886,7 +6069,8 @@ }, "removed": [ { - "key": "collection/2", + + "key": "collection/2", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -6002,7 +6186,8 @@ { "added": [ { - "key": "collection/a", + + "key": "collection/a", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -6055,7 +6240,8 @@ }, "removed": [ { - "key": "collection/a", + + "key": "collection/a", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -6285,7 +6471,8 @@ { "added": [ { - "key": "collection/a", + + "key": "collection/a", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -6296,7 +6483,8 @@ "version": 1000 }, { - "key": "collection/b", + + "key": "collection/b", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -6372,7 +6560,8 @@ "path": "collection/b" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "2": { "queries": [ @@ -6422,7 +6611,8 @@ }, "removed": [ { - "key": "collection/b", + + "key": "collection/b", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -6550,7 +6740,8 @@ { "added": [ { - "key": "collection/a", + + "key": "collection/a", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -6561,7 +6752,8 @@ "version": 1000 }, { - "key": "collection/b", + + "key": "collection/b", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -6634,7 +6826,8 @@ "path": "collection" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 1 } } } @@ -6744,7 +6937,8 @@ { "added": [ { - "key": "collection/a", + + "key": "collection/a", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -6755,7 +6949,8 @@ "version": 1000 }, { - "key": "collection/b", + + "key": "collection/b", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -6766,7 +6961,8 @@ "version": 1000 }, { - "key": "collection/c", + + "key": "collection/c", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -6826,14 +7022,7 @@ "path": "collection" } } - ] - }, - { - "watchRemove": { - "targetIds": [ - 2 - ] - }, + ], "expectedState": { "activeTargets": { "2": { @@ -6846,7 +7035,8 @@ "path": "collection" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 2 } } } @@ -6945,7 +7135,8 @@ { "added": [ { - "key": "collection/a", + + "key": "collection/a", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -6956,7 +7147,8 @@ "version": 1000 }, { - "key": "collection/b", + + "key": "collection/b", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -7029,7 +7221,8 @@ "path": "collection" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 1 } } } @@ -7128,7 +7321,8 @@ { "added": [ { - "key": "collection/a", + + "key": "collection/a", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -7139,7 +7333,8 @@ "version": 1000 }, { - "key": "collection/b", + + "key": "collection/b", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -7212,7 +7407,8 @@ "path": "collection" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 1 } } } @@ -7321,7 +7517,8 @@ { "added": [ { - "key": "collection/a", + + "key": "collection/a", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -7332,7 +7529,8 @@ "version": 1000 }, { - "key": "collection/b", + + "key": "collection/b", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -7381,7 +7579,8 @@ { "added": [ { - "key": "collection/b", + + "key": "collection/b", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -7502,7 +7701,8 @@ { "added": [ { - "key": "collection/c", + + "key": "collection/c", "options": { "hasCommittedMutations": false, "hasLocalMutations": false @@ -7588,7 +7788,8 @@ "path": "collection/a" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "2": { "queries": [ @@ -7685,7 +7886,8 @@ "path": "collection/a" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "2": { "queries": [ @@ -7714,7 +7916,8 @@ "path": "collection/c" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "4": { "queries": [ diff --git a/firebase-firestore/src/test/resources/json/limbo_spec_test.json b/firebase-firestore/src/test/resources/json/limbo_spec_test.json index d966cb1f238..de82951040a 100644 --- a/firebase-firestore/src/test/resources/json/limbo_spec_test.json +++ b/firebase-firestore/src/test/resources/json/limbo_spec_test.json @@ -235,7 +235,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -281,7 +281,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -406,7 +406,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -489,7 +489,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -572,7 +572,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -675,7 +675,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "10": { "queries": [ @@ -775,7 +775,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "10": { "queries": [ @@ -866,7 +866,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -940,7 +940,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -1202,7 +1202,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -1248,7 +1248,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -1373,7 +1373,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -1456,7 +1456,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -1539,7 +1539,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -1642,7 +1642,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "10": { "queries": [ @@ -1742,7 +1742,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "10": { "queries": [ @@ -2038,7 +2038,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -2123,7 +2123,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -2206,7 +2206,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -2420,7 +2420,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ @@ -2834,7 +2834,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -3119,7 +3119,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ @@ -3386,7 +3386,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ @@ -3633,7 +3633,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ @@ -3921,7 +3921,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ @@ -4037,7 +4037,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ @@ -4298,7 +4298,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ @@ -4646,7 +4646,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ @@ -5025,7 +5025,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ @@ -5114,7 +5114,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ @@ -5486,7 +5486,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ @@ -5511,7 +5511,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 } } } @@ -5623,7 +5623,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ @@ -5648,7 +5648,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 } } } @@ -5703,7 +5703,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 } } } @@ -5822,7 +5822,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 } } } @@ -6255,7 +6255,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -6782,7 +6782,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -7109,7 +7109,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ @@ -7193,7 +7193,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 } }, "enqueuedLimboDocs": [ @@ -7512,7 +7512,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ @@ -7537,7 +7537,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 } }, "enqueuedLimboDocs": [ @@ -7646,7 +7646,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "7": { "queries": [ @@ -7659,7 +7659,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 } }, "enqueuedLimboDocs": [ @@ -7765,7 +7765,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 } }, "enqueuedLimboDocs": [ @@ -8187,7 +8187,8 @@ "path": "collection/a1" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "2": { "queries": [ @@ -8211,7 +8212,8 @@ "path": "collection/a2" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 } }, "enqueuedLimboDocs": [ @@ -8632,7 +8634,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ @@ -8658,7 +8660,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 } }, "enqueuedLimboDocs": [ @@ -8765,7 +8767,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 } }, "enqueuedLimboDocs": [ @@ -9095,7 +9097,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ @@ -9120,7 +9122,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 } }, "enqueuedLimboDocs": [ @@ -9210,7 +9212,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "5": { "queries": [ @@ -9223,7 +9225,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 } }, "enqueuedLimboDocs": [ @@ -9307,7 +9309,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "7": { "queries": [ @@ -9320,7 +9322,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 } }, "enqueuedLimboDocs": [ @@ -9403,7 +9405,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "9": { "queries": [ @@ -9416,7 +9418,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 } }, "enqueuedLimboDocs": [ @@ -9497,7 +9499,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 } }, "enqueuedLimboDocs": [ @@ -9869,7 +9871,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ diff --git a/firebase-firestore/src/test/resources/json/limit_spec_test.json b/firebase-firestore/src/test/resources/json/limit_spec_test.json index 3b226ee1061..ed2b461ce74 100644 --- a/firebase-firestore/src/test/resources/json/limit_spec_test.json +++ b/firebase-firestore/src/test/resources/json/limit_spec_test.json @@ -214,7 +214,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ @@ -4334,7 +4334,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ @@ -4361,7 +4361,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -4495,7 +4495,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -4520,7 +4520,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 } } } @@ -4661,7 +4661,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "7": { "queries": [ @@ -4674,7 +4674,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 } } } @@ -4814,7 +4814,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 } } } @@ -5304,7 +5304,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -5565,7 +5565,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "2": { "queries": [ diff --git a/firebase-firestore/src/test/resources/json/offline_spec_test.json b/firebase-firestore/src/test/resources/json/offline_spec_test.json index eb8a35f3074..91e4205e441 100644 --- a/firebase-firestore/src/test/resources/json/offline_spec_test.json +++ b/firebase-firestore/src/test/resources/json/offline_spec_test.json @@ -1149,7 +1149,8 @@ "path": "collection/a" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "2": { "queries": [ @@ -1186,7 +1187,8 @@ "path": "collection/a" } ], - "resumeToken": "" + "resumeToken": "", + "targetPurpose": 3 }, "2": { "queries": [ diff --git a/firebase-firestore/src/test/resources/json/recovery_spec_test.json b/firebase-firestore/src/test/resources/json/recovery_spec_test.json index bb7306476a3..2e66d63b8d5 100644 --- a/firebase-firestore/src/test/resources/json/recovery_spec_test.json +++ b/firebase-firestore/src/test/resources/json/recovery_spec_test.json @@ -3095,7 +3095,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -3184,7 +3184,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -3569,7 +3569,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ @@ -3629,7 +3629,7 @@ } ], "resumeToken": "", - "targetPurpose": 2 + "targetPurpose": 3 }, "4": { "queries": [ From 437144d5a321180a066f4db507f9f7f703d7b03b Mon Sep 17 00:00:00 2001 From: milaGGL <107142260+milaGGL@users.noreply.github.com> Date: Mon, 13 Mar 2023 13:41:27 -0700 Subject: [PATCH 3/7] format --- .../firestore/remote/RemoteSerializer.java | 27 ++-- .../json/existence_filter_spec_test.json | 148 ------------------ 2 files changed, 9 insertions(+), 166 deletions(-) diff --git a/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteSerializer.java b/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteSerializer.java index 5580b431ca8..9a352000f6b 100644 --- a/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteSerializer.java +++ b/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteSerializer.java @@ -149,10 +149,8 @@ private String encodeQueryPath(ResourcePath path) { private ResourcePath decodeQueryPath(String name) { ResourcePath resource = decodeResourceName(name); if (resource.length() == 4) { - // In v1beta1 queries for collections at the root did not have a trailing - // "/documents". In v1 - // all resource paths contain "/documents". Preserve the ability to read the v1 - // form for + // In v1beta1 queries for collections at the root did not have a trailing "/documents". In v1 + // all resource paths contain "/documents". Preserve the ability to read the v1 form for // compatibility with queries persisted in the local query cache. return ResourcePath.EMPTY; } else { @@ -435,12 +433,9 @@ private FieldTransform decodeFieldTransform(DocumentTransform.FieldTransform fie public MutationResult decodeMutationResult( com.google.firestore.v1.WriteResult proto, SnapshotVersion commitVersion) { - // NOTE: Deletes don't have an updateTime but the commit timestamp from the - // containing - // CommitResponse or WriteResponse indicates essentially that the delete - // happened no later than - // that. For our purposes we don't care exactly when the delete happened so long - // as we can tell + // NOTE: Deletes don't have an updateTime but the commit timestamp from the containing + // CommitResponse or WriteResponse indicates essentially that the delete happened no later than + // that. For our purposes we don't care exactly when the delete happened so long as we can tell // when an update on the watch stream is at or later than that change. SnapshotVersion version = decodeVersion(proto.getUpdateTime()); if (SnapshotVersion.NONE.equals(version)) { @@ -499,8 +494,7 @@ public Target encodeTarget(TargetData targetData) { if (targetData.getResumeToken().isEmpty() && targetData.getSnapshotVersion().compareTo(SnapshotVersion.NONE) > 0) { - // TODO(wuandy): Consider removing above check because it is most likely true. - // Right now, many + // TODO(wuandy): Consider removing above check because it is most likely true. Right now, many // tests depend on this behaviour though (leaving min() out of serialization). builder.setReadTime(encodeTimestamp(targetData.getSnapshotVersion().getTimestamp())); } else { @@ -657,8 +651,7 @@ private StructuredQuery.Filter encodeFilters(List filters) { private List decodeFilters(StructuredQuery.Filter proto) { Filter result = decodeFilter(proto); - // Instead of a singletonList containing AND(F1, F2, ...), we can return a list - // containing F1, + // Instead of a singletonList containing AND(F1, F2, ...), we can return a list containing F1, // F2, ... to stay consistent with the older SDK versions. if (result instanceof com.google.firebase.firestore.core.CompositeFilter) { com.google.firebase.firestore.core.CompositeFilter compositeFilter = @@ -968,10 +961,8 @@ public WatchChange decodeWatchChange(ListenResponse protoChange) { } public SnapshotVersion decodeVersionFromListenResponse(ListenResponse watchChange) { - // We have only reached a consistent snapshot for the entire stream if there is - // a read_time set - // and it applies to all targets (i.e. the list of targets is empty). The - // backend is guaranteed + // We have only reached a consistent snapshot for the entire stream if there is a read_time set + // and it applies to all targets (i.e. the list of targets is empty). The backend is guaranteed // to send such responses. if (watchChange.getResponseTypeCase() != ResponseTypeCase.TARGET_CHANGE) { return SnapshotVersion.NONE; diff --git a/firebase-firestore/src/test/resources/json/existence_filter_spec_test.json b/firebase-firestore/src/test/resources/json/existence_filter_spec_test.json index 9c7169a9785..131d47cd4a1 100644 --- a/firebase-firestore/src/test/resources/json/existence_filter_spec_test.json +++ b/firebase-firestore/src/test/resources/json/existence_filter_spec_test.json @@ -91,7 +91,6 @@ { "added": [ { - "key": "collection/ÀÒ∑", "options": { "hasCommittedMutations": false, @@ -103,7 +102,6 @@ "version": 1000 }, { - "key": "collection/À∑Ò", "options": { "hasCommittedMutations": false, @@ -292,7 +290,6 @@ { "added": [ { - "key": "collection/a", "options": { "hasCommittedMutations": false, @@ -304,7 +301,6 @@ "version": 1000 }, { - "key": "collection/b", "options": { "hasCommittedMutations": false, @@ -476,7 +472,6 @@ { "added": [ { - "key": "collection/a", "options": { "hasCommittedMutations": false, @@ -488,7 +483,6 @@ "version": 1000 }, { - "key": "collection/b", "options": { "hasCommittedMutations": false, @@ -560,7 +554,6 @@ { "added": [ { - "key": "collection/c", "options": { "hasCommittedMutations": false, @@ -711,7 +704,6 @@ { "added": [ { - "key": "collection/a", "options": { "hasCommittedMutations": false, @@ -723,7 +715,6 @@ "version": 1000 }, { - "key": "collection/b", "options": { "hasCommittedMutations": false, @@ -841,7 +832,6 @@ }, "removed": [ { - "key": "collection/b", "options": { "hasCommittedMutations": false, @@ -2046,7 +2036,6 @@ { "added": [ { - "key": "collection/doc0", "options": { "hasCommittedMutations": false, @@ -2058,7 +2047,6 @@ "version": 1000 }, { - "key": "collection/doc1", "options": { "hasCommittedMutations": false, @@ -2070,7 +2058,6 @@ "version": 1000 }, { - "key": "collection/doc2", "options": { "hasCommittedMutations": false, @@ -2082,7 +2069,6 @@ "version": 1000 }, { - "key": "collection/doc3", "options": { "hasCommittedMutations": false, @@ -2094,7 +2080,6 @@ "version": 1000 }, { - "key": "collection/doc4", "options": { "hasCommittedMutations": false, @@ -2106,7 +2091,6 @@ "version": 1000 }, { - "key": "collection/doc5", "options": { "hasCommittedMutations": false, @@ -2118,7 +2102,6 @@ "version": 1000 }, { - "key": "collection/doc6", "options": { "hasCommittedMutations": false, @@ -2130,7 +2113,6 @@ "version": 1000 }, { - "key": "collection/doc7", "options": { "hasCommittedMutations": false, @@ -2142,7 +2124,6 @@ "version": 1000 }, { - "key": "collection/doc8", "options": { "hasCommittedMutations": false, @@ -2154,7 +2135,6 @@ "version": 1000 }, { - "key": "collection/doc9", "options": { "hasCommittedMutations": false, @@ -2166,7 +2146,6 @@ "version": 1000 }, { - "key": "collection/doc10", "options": { "hasCommittedMutations": false, @@ -2178,7 +2157,6 @@ "version": 1000 }, { - "key": "collection/doc11", "options": { "hasCommittedMutations": false, @@ -2190,7 +2168,6 @@ "version": 1000 }, { - "key": "collection/doc12", "options": { "hasCommittedMutations": false, @@ -2202,7 +2179,6 @@ "version": 1000 }, { - "key": "collection/doc13", "options": { "hasCommittedMutations": false, @@ -2214,7 +2190,6 @@ "version": 1000 }, { - "key": "collection/doc14", "options": { "hasCommittedMutations": false, @@ -2226,7 +2201,6 @@ "version": 1000 }, { - "key": "collection/doc15", "options": { "hasCommittedMutations": false, @@ -2238,7 +2212,6 @@ "version": 1000 }, { - "key": "collection/doc16", "options": { "hasCommittedMutations": false, @@ -2250,7 +2223,6 @@ "version": 1000 }, { - "key": "collection/doc17", "options": { "hasCommittedMutations": false, @@ -2262,7 +2234,6 @@ "version": 1000 }, { - "key": "collection/doc18", "options": { "hasCommittedMutations": false, @@ -2274,7 +2245,6 @@ "version": 1000 }, { - "key": "collection/doc19", "options": { "hasCommittedMutations": false, @@ -2286,7 +2256,6 @@ "version": 1000 }, { - "key": "collection/doc20", "options": { "hasCommittedMutations": false, @@ -2298,7 +2267,6 @@ "version": 1000 }, { - "key": "collection/doc21", "options": { "hasCommittedMutations": false, @@ -2310,7 +2278,6 @@ "version": 1000 }, { - "key": "collection/doc22", "options": { "hasCommittedMutations": false, @@ -2322,7 +2289,6 @@ "version": 1000 }, { - "key": "collection/doc23", "options": { "hasCommittedMutations": false, @@ -2334,7 +2300,6 @@ "version": 1000 }, { - "key": "collection/doc24", "options": { "hasCommittedMutations": false, @@ -2346,7 +2311,6 @@ "version": 1000 }, { - "key": "collection/doc25", "options": { "hasCommittedMutations": false, @@ -2358,7 +2322,6 @@ "version": 1000 }, { - "key": "collection/doc26", "options": { "hasCommittedMutations": false, @@ -2370,7 +2333,6 @@ "version": 1000 }, { - "key": "collection/doc27", "options": { "hasCommittedMutations": false, @@ -2382,7 +2344,6 @@ "version": 1000 }, { - "key": "collection/doc28", "options": { "hasCommittedMutations": false, @@ -2394,7 +2355,6 @@ "version": 1000 }, { - "key": "collection/doc29", "options": { "hasCommittedMutations": false, @@ -2406,7 +2366,6 @@ "version": 1000 }, { - "key": "collection/doc30", "options": { "hasCommittedMutations": false, @@ -2418,7 +2377,6 @@ "version": 1000 }, { - "key": "collection/doc31", "options": { "hasCommittedMutations": false, @@ -2430,7 +2388,6 @@ "version": 1000 }, { - "key": "collection/doc32", "options": { "hasCommittedMutations": false, @@ -2442,7 +2399,6 @@ "version": 1000 }, { - "key": "collection/doc33", "options": { "hasCommittedMutations": false, @@ -2454,7 +2410,6 @@ "version": 1000 }, { - "key": "collection/doc34", "options": { "hasCommittedMutations": false, @@ -2466,7 +2421,6 @@ "version": 1000 }, { - "key": "collection/doc35", "options": { "hasCommittedMutations": false, @@ -2478,7 +2432,6 @@ "version": 1000 }, { - "key": "collection/doc36", "options": { "hasCommittedMutations": false, @@ -2490,7 +2443,6 @@ "version": 1000 }, { - "key": "collection/doc37", "options": { "hasCommittedMutations": false, @@ -2502,7 +2454,6 @@ "version": 1000 }, { - "key": "collection/doc38", "options": { "hasCommittedMutations": false, @@ -2514,7 +2465,6 @@ "version": 1000 }, { - "key": "collection/doc39", "options": { "hasCommittedMutations": false, @@ -2526,7 +2476,6 @@ "version": 1000 }, { - "key": "collection/doc40", "options": { "hasCommittedMutations": false, @@ -2538,7 +2487,6 @@ "version": 1000 }, { - "key": "collection/doc41", "options": { "hasCommittedMutations": false, @@ -2550,7 +2498,6 @@ "version": 1000 }, { - "key": "collection/doc42", "options": { "hasCommittedMutations": false, @@ -2562,7 +2509,6 @@ "version": 1000 }, { - "key": "collection/doc43", "options": { "hasCommittedMutations": false, @@ -2574,7 +2520,6 @@ "version": 1000 }, { - "key": "collection/doc44", "options": { "hasCommittedMutations": false, @@ -2586,7 +2531,6 @@ "version": 1000 }, { - "key": "collection/doc45", "options": { "hasCommittedMutations": false, @@ -2598,7 +2542,6 @@ "version": 1000 }, { - "key": "collection/doc46", "options": { "hasCommittedMutations": false, @@ -2610,7 +2553,6 @@ "version": 1000 }, { - "key": "collection/doc47", "options": { "hasCommittedMutations": false, @@ -2622,7 +2564,6 @@ "version": 1000 }, { - "key": "collection/doc48", "options": { "hasCommittedMutations": false, @@ -2634,7 +2575,6 @@ "version": 1000 }, { - "key": "collection/doc49", "options": { "hasCommittedMutations": false, @@ -2646,7 +2586,6 @@ "version": 1000 }, { - "key": "collection/doc50", "options": { "hasCommittedMutations": false, @@ -2658,7 +2597,6 @@ "version": 1000 }, { - "key": "collection/doc51", "options": { "hasCommittedMutations": false, @@ -2670,7 +2608,6 @@ "version": 1000 }, { - "key": "collection/doc52", "options": { "hasCommittedMutations": false, @@ -2682,7 +2619,6 @@ "version": 1000 }, { - "key": "collection/doc53", "options": { "hasCommittedMutations": false, @@ -2694,7 +2630,6 @@ "version": 1000 }, { - "key": "collection/doc54", "options": { "hasCommittedMutations": false, @@ -2706,7 +2641,6 @@ "version": 1000 }, { - "key": "collection/doc55", "options": { "hasCommittedMutations": false, @@ -2718,7 +2652,6 @@ "version": 1000 }, { - "key": "collection/doc56", "options": { "hasCommittedMutations": false, @@ -2730,7 +2663,6 @@ "version": 1000 }, { - "key": "collection/doc57", "options": { "hasCommittedMutations": false, @@ -2742,7 +2674,6 @@ "version": 1000 }, { - "key": "collection/doc58", "options": { "hasCommittedMutations": false, @@ -2754,7 +2685,6 @@ "version": 1000 }, { - "key": "collection/doc59", "options": { "hasCommittedMutations": false, @@ -2766,7 +2696,6 @@ "version": 1000 }, { - "key": "collection/doc60", "options": { "hasCommittedMutations": false, @@ -2778,7 +2707,6 @@ "version": 1000 }, { - "key": "collection/doc61", "options": { "hasCommittedMutations": false, @@ -2790,7 +2718,6 @@ "version": 1000 }, { - "key": "collection/doc62", "options": { "hasCommittedMutations": false, @@ -2802,7 +2729,6 @@ "version": 1000 }, { - "key": "collection/doc63", "options": { "hasCommittedMutations": false, @@ -2814,7 +2740,6 @@ "version": 1000 }, { - "key": "collection/doc64", "options": { "hasCommittedMutations": false, @@ -2826,7 +2751,6 @@ "version": 1000 }, { - "key": "collection/doc65", "options": { "hasCommittedMutations": false, @@ -2838,7 +2762,6 @@ "version": 1000 }, { - "key": "collection/doc66", "options": { "hasCommittedMutations": false, @@ -2850,7 +2773,6 @@ "version": 1000 }, { - "key": "collection/doc67", "options": { "hasCommittedMutations": false, @@ -2862,7 +2784,6 @@ "version": 1000 }, { - "key": "collection/doc68", "options": { "hasCommittedMutations": false, @@ -2874,7 +2795,6 @@ "version": 1000 }, { - "key": "collection/doc69", "options": { "hasCommittedMutations": false, @@ -2886,7 +2806,6 @@ "version": 1000 }, { - "key": "collection/doc70", "options": { "hasCommittedMutations": false, @@ -2898,7 +2817,6 @@ "version": 1000 }, { - "key": "collection/doc71", "options": { "hasCommittedMutations": false, @@ -2910,7 +2828,6 @@ "version": 1000 }, { - "key": "collection/doc72", "options": { "hasCommittedMutations": false, @@ -2922,7 +2839,6 @@ "version": 1000 }, { - "key": "collection/doc73", "options": { "hasCommittedMutations": false, @@ -2934,7 +2850,6 @@ "version": 1000 }, { - "key": "collection/doc74", "options": { "hasCommittedMutations": false, @@ -2946,7 +2861,6 @@ "version": 1000 }, { - "key": "collection/doc75", "options": { "hasCommittedMutations": false, @@ -2958,7 +2872,6 @@ "version": 1000 }, { - "key": "collection/doc76", "options": { "hasCommittedMutations": false, @@ -2970,7 +2883,6 @@ "version": 1000 }, { - "key": "collection/doc77", "options": { "hasCommittedMutations": false, @@ -2982,7 +2894,6 @@ "version": 1000 }, { - "key": "collection/doc78", "options": { "hasCommittedMutations": false, @@ -2994,7 +2905,6 @@ "version": 1000 }, { - "key": "collection/doc79", "options": { "hasCommittedMutations": false, @@ -3006,7 +2916,6 @@ "version": 1000 }, { - "key": "collection/doc80", "options": { "hasCommittedMutations": false, @@ -3018,7 +2927,6 @@ "version": 1000 }, { - "key": "collection/doc81", "options": { "hasCommittedMutations": false, @@ -3030,7 +2938,6 @@ "version": 1000 }, { - "key": "collection/doc82", "options": { "hasCommittedMutations": false, @@ -3042,7 +2949,6 @@ "version": 1000 }, { - "key": "collection/doc83", "options": { "hasCommittedMutations": false, @@ -3054,7 +2960,6 @@ "version": 1000 }, { - "key": "collection/doc84", "options": { "hasCommittedMutations": false, @@ -3066,7 +2971,6 @@ "version": 1000 }, { - "key": "collection/doc85", "options": { "hasCommittedMutations": false, @@ -3078,7 +2982,6 @@ "version": 1000 }, { - "key": "collection/doc86", "options": { "hasCommittedMutations": false, @@ -3090,7 +2993,6 @@ "version": 1000 }, { - "key": "collection/doc87", "options": { "hasCommittedMutations": false, @@ -3102,7 +3004,6 @@ "version": 1000 }, { - "key": "collection/doc88", "options": { "hasCommittedMutations": false, @@ -3114,7 +3015,6 @@ "version": 1000 }, { - "key": "collection/doc89", "options": { "hasCommittedMutations": false, @@ -3126,7 +3026,6 @@ "version": 1000 }, { - "key": "collection/doc90", "options": { "hasCommittedMutations": false, @@ -3138,7 +3037,6 @@ "version": 1000 }, { - "key": "collection/doc91", "options": { "hasCommittedMutations": false, @@ -3150,7 +3048,6 @@ "version": 1000 }, { - "key": "collection/doc92", "options": { "hasCommittedMutations": false, @@ -3162,7 +3059,6 @@ "version": 1000 }, { - "key": "collection/doc93", "options": { "hasCommittedMutations": false, @@ -3174,7 +3070,6 @@ "version": 1000 }, { - "key": "collection/doc94", "options": { "hasCommittedMutations": false, @@ -3186,7 +3081,6 @@ "version": 1000 }, { - "key": "collection/doc95", "options": { "hasCommittedMutations": false, @@ -3198,7 +3092,6 @@ "version": 1000 }, { - "key": "collection/doc96", "options": { "hasCommittedMutations": false, @@ -3210,7 +3103,6 @@ "version": 1000 }, { - "key": "collection/doc97", "options": { "hasCommittedMutations": false, @@ -3222,7 +3114,6 @@ "version": 1000 }, { - "key": "collection/doc98", "options": { "hasCommittedMutations": false, @@ -3234,7 +3125,6 @@ "version": 1000 }, { - "key": "collection/doc99", "options": { "hasCommittedMutations": false, @@ -4159,7 +4049,6 @@ { "added": [ { - "key": "collection/1", "options": { "hasCommittedMutations": false, @@ -4171,7 +4060,6 @@ "version": 1000 }, { - "key": "collection/2", "options": { "hasCommittedMutations": false, @@ -4270,7 +4158,6 @@ { "added": [ { - "key": "collection/1", "options": { "hasCommittedMutations": false, @@ -4282,7 +4169,6 @@ "version": 1000 }, { - "key": "collection/2", "options": { "hasCommittedMutations": false, @@ -4406,7 +4292,6 @@ { "added": [ { - "key": "collection/1", "options": { "hasCommittedMutations": false, @@ -4472,7 +4357,6 @@ { "added": [ { - "key": "collection/3", "options": { "hasCommittedMutations": false, @@ -4586,7 +4470,6 @@ { "added": [ { - "key": "collection/2", "options": { "hasCommittedMutations": false, @@ -4694,7 +4577,6 @@ { "added": [ { - "key": "collection/1", "options": { "hasCommittedMutations": false, @@ -4750,7 +4632,6 @@ { "added": [ { - "key": "collection/1", "options": { "hasCommittedMutations": false, @@ -4935,7 +4816,6 @@ { "added": [ { - "key": "collection/1", "options": { "hasCommittedMutations": false, @@ -4947,7 +4827,6 @@ "version": 1000 }, { - "key": "collection/2", "options": { "hasCommittedMutations": false, @@ -5123,7 +5002,6 @@ }, "removed": [ { - "key": "collection/2", "options": { "hasCommittedMutations": false, @@ -5240,7 +5118,6 @@ { "added": [ { - "key": "collection/1", "options": { "hasCommittedMutations": false, @@ -5396,7 +5273,6 @@ { "added": [ { - "key": "collection/1", "options": { "hasCommittedMutations": false, @@ -5515,7 +5391,6 @@ { "added": [ { - "key": "collection/1", "options": { "hasCommittedMutations": false, @@ -5527,7 +5402,6 @@ "version": 1000 }, { - "key": "collection/2", "options": { "hasCommittedMutations": false, @@ -5713,7 +5587,6 @@ }, "removed": [ { - "key": "collection/2", "options": { "hasCommittedMutations": false, @@ -5841,7 +5714,6 @@ { "added": [ { - "key": "collection/1", "options": { "hasCommittedMutations": false, @@ -5853,7 +5725,6 @@ "version": 1000 }, { - "key": "collection/2", "options": { "hasCommittedMutations": false, @@ -6069,7 +5940,6 @@ }, "removed": [ { - "key": "collection/2", "options": { "hasCommittedMutations": false, @@ -6186,7 +6056,6 @@ { "added": [ { - "key": "collection/a", "options": { "hasCommittedMutations": false, @@ -6240,7 +6109,6 @@ }, "removed": [ { - "key": "collection/a", "options": { "hasCommittedMutations": false, @@ -6471,7 +6339,6 @@ { "added": [ { - "key": "collection/a", "options": { "hasCommittedMutations": false, @@ -6483,7 +6350,6 @@ "version": 1000 }, { - "key": "collection/b", "options": { "hasCommittedMutations": false, @@ -6611,7 +6477,6 @@ }, "removed": [ { - "key": "collection/b", "options": { "hasCommittedMutations": false, @@ -6740,7 +6605,6 @@ { "added": [ { - "key": "collection/a", "options": { "hasCommittedMutations": false, @@ -6752,7 +6616,6 @@ "version": 1000 }, { - "key": "collection/b", "options": { "hasCommittedMutations": false, @@ -6937,7 +6800,6 @@ { "added": [ { - "key": "collection/a", "options": { "hasCommittedMutations": false, @@ -6949,7 +6811,6 @@ "version": 1000 }, { - "key": "collection/b", "options": { "hasCommittedMutations": false, @@ -6961,7 +6822,6 @@ "version": 1000 }, { - "key": "collection/c", "options": { "hasCommittedMutations": false, @@ -7135,7 +6995,6 @@ { "added": [ { - "key": "collection/a", "options": { "hasCommittedMutations": false, @@ -7147,7 +7006,6 @@ "version": 1000 }, { - "key": "collection/b", "options": { "hasCommittedMutations": false, @@ -7321,7 +7179,6 @@ { "added": [ { - "key": "collection/a", "options": { "hasCommittedMutations": false, @@ -7333,7 +7190,6 @@ "version": 1000 }, { - "key": "collection/b", "options": { "hasCommittedMutations": false, @@ -7517,7 +7373,6 @@ { "added": [ { - "key": "collection/a", "options": { "hasCommittedMutations": false, @@ -7529,7 +7384,6 @@ "version": 1000 }, { - "key": "collection/b", "options": { "hasCommittedMutations": false, @@ -7579,7 +7433,6 @@ { "added": [ { - "key": "collection/b", "options": { "hasCommittedMutations": false, @@ -7701,7 +7554,6 @@ { "added": [ { - "key": "collection/c", "options": { "hasCommittedMutations": false, From 62db05f983f520e07f42fa14c838cb475aa0de97 Mon Sep 17 00:00:00 2001 From: milaGGL <107142260+milaGGL@users.noreply.github.com> Date: Tue, 14 Mar 2023 12:36:31 -0700 Subject: [PATCH 4/7] Update WatchChangeAggregator.java --- .../google/firebase/firestore/remote/WatchChangeAggregator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/WatchChangeAggregator.java b/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/WatchChangeAggregator.java index 5e2cbf73ac6..dc29f2633f1 100644 --- a/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/WatchChangeAggregator.java +++ b/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/WatchChangeAggregator.java @@ -255,7 +255,7 @@ private BloomFilterApplicationStatus applyBloomFilter( } catch (BloomFilterException e) { Logger.warn( LOG_TAG, - "Decoding the base64 bloom filter in existence filter failed (" + "Applying bloom filter failed: (" + e.getMessage() + "); ignoring the bloom filter and falling back to full re-query."); return BloomFilterApplicationStatus.SKIPPED; From 5dbda4c1ea02f930396c971b2caeee9c582b7fa4 Mon Sep 17 00:00:00 2001 From: milaGGL <107142260+milaGGL@users.noreply.github.com> Date: Tue, 14 Mar 2023 16:29:30 -0700 Subject: [PATCH 5/7] add missing imports to pass compileDebugAndroidTestJavaWithJavac --- .../java/com/google/firebase/firestore/QueryTest.java | 3 +-- .../com/google/firebase/firestore/remote/RemoteEvent.java | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/firebase-firestore/src/androidTest/java/com/google/firebase/firestore/QueryTest.java b/firebase-firestore/src/androidTest/java/com/google/firebase/firestore/QueryTest.java index f77e4630578..67713bb696d 100644 --- a/firebase-firestore/src/androidTest/java/com/google/firebase/firestore/QueryTest.java +++ b/firebase-firestore/src/androidTest/java/com/google/firebase/firestore/QueryTest.java @@ -31,6 +31,7 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assume.assumeFalse; +import static org.junit.Assume.assumeTrue; import androidx.test.ext.junit.runners.AndroidJUnit4; import com.google.android.gms.tasks.Task; @@ -1071,8 +1072,6 @@ public void resumingQueryShouldRemoveDeletedDocumentsIndicatedByExistenceFilter( assertEquals(snapshot2.size(), 50); } - // TODO(orquery): Enable this test when prod supports OR queries. - @Ignore @Test public void testOrQueries() { Map> testDocs = diff --git a/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteEvent.java b/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteEvent.java index 337d0ef53a1..443ee13ecea 100644 --- a/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteEvent.java +++ b/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteEvent.java @@ -56,8 +56,8 @@ public Map getTargetChanges() { } /** - * A map of targets that is known to be inconsistent, and the purpose for re-listening. Listens - * for these targets should be re-established without resume tokens. + * Returns a map of targets that is known to be inconsistent, and the purpose for re-listening. + * Listens for these targets should be re-established without resume tokens. */ public Map getTargetMismatches() { return targetMismatches; From 3c78c3a787f47d286861e2aaee0a39c167c71e10 Mon Sep 17 00:00:00 2001 From: milaGGL <107142260+milaGGL@users.noreply.github.com> Date: Thu, 16 Mar 2023 09:30:53 -0700 Subject: [PATCH 6/7] resolve comments --- .../java/com/google/firebase/firestore/remote/RemoteStore.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteStore.java b/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteStore.java index b44ca5a471b..99a7058fc2a 100644 --- a/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteStore.java +++ b/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteStore.java @@ -548,7 +548,6 @@ private void raiseWatchSnapshot(SnapshotVersion snapshotVersion) { // Re-establish listens for the targets that have been invalidated by existence filter // mismatches. for (Map.Entry entry : remoteEvent.getTargetMismatches().entrySet()) { - int targetId = entry.getKey(); TargetData targetData = this.listenTargets.get(targetId); @@ -572,7 +571,7 @@ private void raiseWatchSnapshot(SnapshotVersion snapshotVersion) { targetData.getTarget(), targetId, targetData.getSequenceNumber(), - /*QueryPurpose=*/ entry.getValue()); + /*purpose=*/ entry.getValue()); this.sendWatchRequest(requestTargetData); } } From 06cbcbaed6416d5cccdff2d99516b11e04bb0177 Mon Sep 17 00:00:00 2001 From: milaGGL <107142260+milaGGL@users.noreply.github.com> Date: Thu, 16 Mar 2023 09:32:35 -0700 Subject: [PATCH 7/7] Update RemoteStore.java --- .../java/com/google/firebase/firestore/remote/RemoteStore.java | 1 - 1 file changed, 1 deletion(-) diff --git a/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteStore.java b/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteStore.java index 99a7058fc2a..15f132d6d1b 100644 --- a/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteStore.java +++ b/firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteStore.java @@ -549,7 +549,6 @@ private void raiseWatchSnapshot(SnapshotVersion snapshotVersion) { // mismatches. for (Map.Entry entry : remoteEvent.getTargetMismatches().entrySet()) { int targetId = entry.getKey(); - TargetData targetData = this.listenTargets.get(targetId); // A watched target might have been removed already. if (targetData != null) {