@@ -274,7 +274,7 @@ describeSpec('Existence Filters:', [], () => {
274
274
// BloomFilter identify docB is deleted, skip full query and put docB
275
275
// into limbo directly.
276
276
. expectEvents ( query1 , { fromCache : true } )
277
- . expectLimboDocs ( docB . key ) // docB is now in limbo
277
+ . expectLimboDocs ( docB . key ) // docB is now in limbo.
278
278
. ackLimbo ( 2000 , deletedDoc ( 'collection/b' , 2000 ) )
279
279
. expectLimboDocs ( ) // docB is no longer in limbo
280
280
. expectEvents ( query1 , {
@@ -310,9 +310,9 @@ describeSpec('Existence Filters:', [], () => {
310
310
// positive results for docB. Re-run query is triggered.
311
311
. expectEvents ( query1 , { fromCache : true } )
312
312
. expectActiveTargets ( { query : query1 , resumeToken : '' } )
313
- . watchRemoves ( query1 ) // Acks removal of query
313
+ . watchRemoves ( query1 ) // Acks removal of query.
314
314
. watchAcksFull ( query1 , 2000 , docA )
315
- . expectLimboDocs ( docB . key , docC . key ) // docB and docC are now in limbo
315
+ . expectLimboDocs ( docB . key , docC . key ) // docB and docC are now in limbo.
316
316
. ackLimbo ( 2001 , deletedDoc ( 'collection/b' , 2001 ) )
317
317
. expectEvents ( query1 , {
318
318
removed : [ docB ] ,
@@ -352,7 +352,7 @@ describeSpec('Existence Filters:', [], () => {
352
352
// BloomFilter identify docB is deleted, skip full query and put docB
353
353
// into limbo directly.
354
354
. expectEvents ( query1 , { fromCache : true } )
355
- . expectLimboDocs ( docB . key ) // docB is now in limbo
355
+ . expectLimboDocs ( docB . key ) // docB is now in limbo.
356
356
) ;
357
357
}
358
358
) ;
@@ -372,7 +372,7 @@ describeSpec('Existence Filters:', [], () => {
372
372
. expectEvents ( query1 , { added : [ docA , docB ] } )
373
373
// DocB is deleted in the next sync.
374
374
. watchFilters ( [ query1 ] , [ docA . key ] , {
375
- // Invalid 64base string in bitmap
375
+ // Invalid 64base string in bitmap.
376
376
bits : { bitmap : '*#!' , padding : 1 } ,
377
377
hashCount : 1
378
378
} )
@@ -398,7 +398,7 @@ describeSpec('Existence Filters:', [], () => {
398
398
. expectEvents ( query1 , { added : [ docA , docB ] } )
399
399
// DocB is deleted in the next sync.
400
400
. watchFilters ( [ query1 ] , [ docA . key ] , {
401
- // Invalid hashCount in bloom filter
401
+ // Invalid hashCount in bloom filter.
402
402
bits : { bitmap : 'AQ==' , padding : 1 } ,
403
403
hashCount : - 1
404
404
} )
@@ -431,7 +431,7 @@ describeSpec('Existence Filters:', [], () => {
431
431
) ;
432
432
} ) ;
433
433
434
- specTest ( 'Same docs can have different bloom filter ' , [ ] , ( ) => {
434
+ specTest ( 'Same docs can have different bloom filters ' , [ ] , ( ) => {
435
435
const query1 = query ( 'collection' , filter ( 'v' , '<=' , 2 ) ) ;
436
436
const query2 = query ( 'collection' , filter ( 'v' , '>=' , 2 ) ) ;
437
437
@@ -461,18 +461,19 @@ describeSpec('Existence Filters:', [], () => {
461
461
. watchAcksFull ( query2 , 1001 , docB , docC )
462
462
. expectEvents ( query2 , { added : [ docC ] } )
463
463
464
- // DocA is deleted in the next sync.
464
+ // DocA is deleted in the next sync for query1 .
465
465
. watchFilters ( [ query1 ] , [ docB . key ] , bloomFilterProto1 )
466
466
. watchSnapshots ( 2000 )
467
467
// BloomFilter identify docA is deleted, skip full query.
468
468
. expectEvents ( query1 , { fromCache : true } )
469
- . expectLimboDocs ( docA . key ) // docA is now in limbo
469
+ . expectLimboDocs ( docA . key ) // docA is now in limbo.
470
470
471
+ // DocC is deleted in the next sync for query2.
471
472
. watchFilters ( [ query2 ] , [ docB . key ] , bloomFilterProto2 )
472
473
. watchSnapshots ( 3000 )
473
- // BloomFilter identify docA is deleted, skip full query.
474
+ // BloomFilter identify docC is deleted, skip full query.
474
475
. expectEvents ( query2 , { fromCache : true } )
475
- . expectLimboDocs ( docA . key , docC . key ) // docA is now in limbo
476
+ . expectLimboDocs ( docA . key , docC . key ) // docC is now in limbo.
476
477
) ;
477
478
} ) ;
478
479
@@ -498,7 +499,6 @@ describeSpec('Existence Filters:', [], () => {
498
499
// send a new global snapshot. We should not see an event until we
499
500
// receive the snapshot.
500
501
. watchFilters ( [ query1 ] , [ docA . key ] , bloomFilterProto )
501
- // BloomFilter identifies docB is removed, moves it to limbo.
502
502
. watchSends ( { affects : [ query1 ] } , docC )
503
503
. watchSnapshots ( 2000 )
504
504
. expectEvents ( query1 , { added : [ docC ] , fromCache : true } )
@@ -524,12 +524,12 @@ describeSpec('Existence Filters:', [], () => {
524
524
. watchFilters ( [ query1 ] , [ docA . key ] , bloomFilterProto )
525
525
. watchSnapshots ( 2000 )
526
526
. expectEvents ( query1 , { fromCache : true } )
527
- . expectLimboDocs ( docB . key ) // docB is now in limbo
527
+ . expectLimboDocs ( docB . key ) // docB is now in limbo.
528
528
. watchRemoves (
529
529
newQueryForPath ( docB . key . path ) ,
530
530
new RpcError ( Code . PERMISSION_DENIED , 'no' )
531
531
)
532
- . expectLimboDocs ( ) // docB is no longer in limbo
532
+ . expectLimboDocs ( ) // docB is no longer in limbo.
533
533
. expectEvents ( query1 , {
534
534
removed : [ docB ]
535
535
} ) ;
@@ -538,14 +538,14 @@ describeSpec('Existence Filters:', [], () => {
538
538
specTest ( 'Bloom filter with large size works as expected' , [ ] , ( ) => {
539
539
const query1 = query ( 'collection' ) ;
540
540
const docs = [ ] ;
541
- for ( let i = 0 ; i < 10 ; i ++ ) {
541
+ for ( let i = 0 ; i < 100 ; i ++ ) {
542
542
docs . push ( doc ( `collection/doc${ i } ` , 1000 , { v : 1 } ) ) ;
543
543
}
544
544
const docKeys = docs . map ( item => item . key ) ;
545
545
546
546
const bloomFilterProto = generateBloomFilterProto ( {
547
- contains : docKeys . slice ( 0 , 5 ) . map ( item => item . toString ( ) ) ,
548
- notContains : docKeys . slice ( 5 ) . map ( item => item . toString ( ) ) ,
547
+ contains : docKeys . slice ( 0 , 50 ) . map ( item => item . toString ( ) ) ,
548
+ notContains : docKeys . slice ( 50 ) . map ( item => item . toString ( ) ) ,
549
549
numOfBits : 1000 ,
550
550
hashCount : 16
551
551
} ) ;
@@ -554,12 +554,12 @@ describeSpec('Existence Filters:', [], () => {
554
554
. userListens ( query1 )
555
555
. watchAcksFull ( query1 , 1000 , ...docs )
556
556
. expectEvents ( query1 , { added : docs } )
557
- // Doc0 to doc5 are deleted in the next sync.
558
- . watchFilters ( [ query1 ] , docKeys . slice ( 0 , 5 ) , bloomFilterProto )
557
+ // Doc0 to doc50 are deleted in the next sync.
558
+ . watchFilters ( [ query1 ] , docKeys . slice ( 0 , 50 ) , bloomFilterProto )
559
559
. watchSnapshots ( 2000 )
560
560
// BloomFilter correctly identifies docs that deleted, skip full query.
561
561
. expectEvents ( query1 , { fromCache : true } )
562
- . expectLimboDocs ( ...docKeys . slice ( 5 ) )
562
+ . expectLimboDocs ( ...docKeys . slice ( 50 ) )
563
563
) ;
564
564
} ) ;
565
565
} ) ;
0 commit comments