Skip to content

Commit 677b9e7

Browse files
committed
address review feedback
1 parent 74607ac commit 677b9e7

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

packages/firestore/src/remote/watch_change.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ export class WatchChangeAggregator {
451451
}
452452
TestingHooks.instance?.notifyOnExistenceFilterMismatch(
453453
createExistenceFilterMismatchInfoForTestingHooks(
454-
bloomFilterApplied,
454+
status,
455455
currentSize,
456456
watchChange.existenceFilter
457457
)
@@ -828,7 +828,7 @@ function snapshotChangesMap(): SortedMap<DocumentKey, ChangeType> {
828828
}
829829

830830
function createExistenceFilterMismatchInfoForTestingHooks(
831-
bloomFilterApplied: boolean,
831+
status: BloomFilterApplicationStatus,
832832
localCacheCount: number,
833833
existenceFilter: ExistenceFilter
834834
): TestingHooksExistenceFilterMismatchInfo {
@@ -840,7 +840,7 @@ function createExistenceFilterMismatchInfoForTestingHooks(
840840
const unchangedNames = existenceFilter.unchangedNames;
841841
if (unchangedNames) {
842842
result.bloomFilter = {
843-
applied: bloomFilterApplied,
843+
applied: status === BloomFilterApplicationStatus.Success,
844844
hashCount: unchangedNames?.hashCount ?? 0,
845845
bitmapLength: unchangedNames?.bits?.bitmap?.length ?? 0,
846846
padding: unchangedNames?.bits?.padding ?? 0

packages/firestore/test/integration/api/query.test.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2064,11 +2064,7 @@ apiDescribe('Queries', (persistence: boolean) => {
20642064
});
20652065
});
20662066

2067-
// TODO(b/270731363): Re-enable this test to run against the Firestore
2068-
// emulator once the bug where an existence filter fails to be sent when a
2069-
// query is resumed is fixed.
2070-
// eslint-disable-next-line no-restricted-properties
2071-
(USE_EMULATOR ? it.skip : it)(
2067+
it(
20722068
'resuming a query should use bloom filter to avoid full requery',
20732069
async () => {
20742070
// Create 100 documents in a new collection.
@@ -2109,7 +2105,14 @@ apiDescribe('Queries', (persistence: boolean) => {
21092105
const existenceFilterMismatches =
21102106
await captureExistenceFilterMismatches(async () => {
21112107
const snapshot2 = await getDocs(coll);
2112-
expect(snapshot2.size, 'snapshot2.size').to.equal(50);
2108+
// TODO(b/270731363): Remove the "if" condition below once the
2109+
// Firestore Emulator is fixed to send an existence filter. At the
2110+
// time of writing, the Firestore emulator fails to send an
2111+
// existence filter, resulting in the client including the deleted
2112+
// documents in the snapshot of the resumed query.
2113+
if (!(USE_EMULATOR && snapshot2.size === 100)) {
2114+
expect(snapshot2.size, 'snapshot2.size').to.equal(50);
2115+
}
21132116
});
21142117

21152118
// Skip the verification of the existence filter mismatch when

0 commit comments

Comments
 (0)