Skip to content

Commit c72063d

Browse files
Cleanup
1 parent 2d2faba commit c72063d

File tree

3 files changed

+2
-66
lines changed

3 files changed

+2
-66
lines changed

firebase-firestore/src/main/java/com/google/firebase/firestore/local/LocalDocumentsView.java

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -281,46 +281,4 @@ private ImmutableSortedMap<DocumentKey, Document> getDocumentsMatchingCollection
281281

282282
return results;
283283
}
284-
285-
/** Queries the remote documents and mutation queue, by doing a full collection scan. */
286-
private ImmutableSortedMap<DocumentKey, Document>
287-
getDocumentsMatchingCollectionQueryFromMutationQueue(Query query, IndexOffset offset) {
288-
Map<DocumentKey, MutableDocument> remoteDocuments =
289-
remoteDocumentCache.getAll(query.getPath(), offset);
290-
291-
// TODO(indexing): We should plumb sinceReadTime through to the mutation queue
292-
List<MutationBatch> matchingBatches = mutationQueue.getAllMutationBatchesAffectingQuery(query);
293-
294-
for (MutationBatch batch : matchingBatches) {
295-
for (Mutation mutation : batch.getMutations()) {
296-
// Only process documents belonging to the collection.
297-
if (!query.getPath().isImmediateParentOf(mutation.getKey().getPath())) {
298-
continue;
299-
}
300-
301-
DocumentKey key = mutation.getKey();
302-
MutableDocument document = remoteDocuments.get(key);
303-
if (document == null) {
304-
// Create invalid document to apply mutations on top of
305-
document = MutableDocument.newInvalidDocument(key);
306-
remoteDocuments.put(key, document);
307-
}
308-
mutation.applyToLocalView(
309-
document, FieldMask.fromSet(new HashSet<>()), batch.getLocalWriteTime());
310-
if (!document.isFoundDocument()) {
311-
remoteDocuments.remove(key);
312-
}
313-
}
314-
}
315-
316-
ImmutableSortedMap<DocumentKey, Document> results = emptyDocumentMap();
317-
for (Map.Entry<DocumentKey, MutableDocument> docEntry : remoteDocuments.entrySet()) {
318-
// Finally, insert the documents that still match the query
319-
if (query.matches(docEntry.getValue())) {
320-
results = results.insert(docEntry.getKey(), docEntry.getValue());
321-
}
322-
}
323-
324-
return results;
325-
}
326284
}

firebase-firestore/src/test/java/com/google/firebase/firestore/local/CountingQueryEngine.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -154,26 +154,15 @@ public Map<DocumentKey, MutableDocument> getAll(Iterable<DocumentKey> documentKe
154154
public Map<DocumentKey, MutableDocument> getAll(
155155
String collectionGroup, IndexOffset offset, int limit) {
156156
Map<DocumentKey, MutableDocument> result = subject.getAll(collectionGroup, offset, limit);
157-
<<<<<<< HEAD
158157
documentsReadByCollection[0] += result.size();
159-
=======
160-
documentsReadByQuery[0] += result.size();
161-
>>>>>>> master
158+
162159
return result;
163160
}
164161

165162
@Override
166-
<<<<<<< HEAD
167163
public Map<DocumentKey, MutableDocument> getAll(ResourcePath collection, IndexOffset offset) {
168164
Map<DocumentKey, MutableDocument> result = subject.getAll(collection, offset);
169165
documentsReadByCollection[0] += result.size();
170-
=======
171-
public ImmutableSortedMap<DocumentKey, MutableDocument> getAllDocumentsMatchingQuery(
172-
Query query, IndexOffset offset) {
173-
ImmutableSortedMap<DocumentKey, MutableDocument> result =
174-
subject.getAllDocumentsMatchingQuery(query, offset);
175-
documentsReadByQuery[0] += result.size();
176-
>>>>>>> master
177166
return result;
178167
}
179168

firebase-firestore/src/test/java/com/google/firebase/firestore/local/LocalStoreTestCase.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -979,20 +979,9 @@ public void testReadsAllDocumentsForInitialCollectionQueries() {
979979
resetPersistenceStats();
980980

981981
localStore.executeQuery(query, /* usePreviousResults= */ true);
982-
<<<<<<< HEAD
983982
assertRemoteDocumentsRead(/* byKey= */ 0, /* byCollection= */ 2);
984-
if (Persistence.OVERLAY_SUPPORT_ENABLED) {
985-
// No mutations are read because only overlay is needed.
986-
assertMutationsRead(/* byKey= */ 0, /* byCollection= */ 0);
987-
} else {
988-
assertMutationsRead(/* byKey= */ 0, /* byCollection= */ 1);
989-
}
990-
=======
991-
992-
assertRemoteDocumentsRead(/* byKey= */ 0, /* byQuery= */ 2);
993983
// No mutations are read because only overlay is needed.
994-
assertMutationsRead(/* byKey= */ 0, /* byQuery= */ 0);
995-
>>>>>>> master
984+
assertMutationsRead(/* byKey= */ 0, /* byCollection= */ 0);
996985
}
997986

998987
@Test

0 commit comments

Comments
 (0)