Skip to content

Firestore: QueryTest.java: use a different Firestore instance instead of a WriteBatch #5184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1077,17 +1077,18 @@ public void resumingAQueryShouldUseBloomFilterToAvoidFullRequery() throws Except
}
assertWithMessage("createdDocuments").that(createdDocuments).hasSize(100);

// Delete 50 of the 100 documents. Use a WriteBatch, rather than DocumentReference.delete(),
// to avoid affecting the local cache.
// Delete 50 of the 100 documents. Use a different Firestore instance to avoid affecting the
// local cache.
HashSet<String> deletedDocumentIds = new HashSet<>();
{
WriteBatch writeBatchForDocumentDeletes = collection.getFirestore().batch();
FirebaseFirestore db2 = testFirestore();
WriteBatch batch = db2.batch();
for (int i = 0; i < createdDocuments.size(); i += 2) {
DocumentReference documentToDelete = createdDocuments.get(i);
writeBatchForDocumentDeletes.delete(documentToDelete);
DocumentReference documentToDelete = db2.document(createdDocuments.get(i).getPath());
batch.delete(documentToDelete);
deletedDocumentIds.add(documentToDelete.getId());
}
waitFor(writeBatchForDocumentDeletes.commit());
waitFor(batch.commit());
}
assertWithMessage("deletedDocumentIds").that(deletedDocumentIds).hasSize(50);

Expand Down Expand Up @@ -1236,14 +1237,10 @@ public void bloomFilterShouldCorrectlyEncodeComplexUnicodeCharacters() throws Ex
}

// Delete one of the documents so that the next call to collection.get() will experience an
// existence filter mismatch. Use a WriteBatch, rather than DocumentReference.delete(), to avoid
// affecting the local cache.
// existence filter mismatch. Use a different Firestore instance to avoid affecting the local
// cache.
DocumentReference documentToDelete = collection.document("DocumentToDelete");
{
WriteBatch writeBatchForDocumentDeletes = collection.getFirestore().batch();
writeBatchForDocumentDeletes.delete(documentToDelete);
waitFor(writeBatchForDocumentDeletes.commit());
}
waitFor(testFirestore().document(documentToDelete.getPath()).delete());

// Wait for 10 seconds, during which Watch will stop tracking the query and will send an
// existence filter rather than "delete" events when the query is resumed.
Expand Down