-
Notifications
You must be signed in to change notification settings - Fork 939
Firestore: Optimize local cache sync when resuming a query that had docs deleted #7229
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
Merged
Changes from all commits
Commits
Show all changes
59 commits
Select commit
Hold shift + click to select a range
0ccea52
Update proto to include BloomFilter (#6780)
milaGGL dd8b061
Merge branch 'master' into mila/BloomFilter
milaGGL d6c5756
Merge branch 'master' into mila/BloomFilter
milaGGL a2c1c24
Merge branch 'master' into mila/BloomFilter
milaGGL c17af51
add BloomFilter class (#6795)
milaGGL a3fb711
Add bloom filter to existence filter and watchFilters spec builder (#…
milaGGL 4bd34f1
Merge branch 'master' into mila/BloomFilter
milaGGL eaef9da
Merge branch 'master' into mila/BloomFilter
milaGGL 036849f
Merge branch 'master' into mila/BloomFilter
milaGGL 9e49b4c
Add expectedCount to Target in listen request (#6854)
milaGGL dd66835
Merge branch 'master' into mila/BloomFilter
milaGGL 5335e7a
Merge branch 'master' into mila/BloomFilter
milaGGL 333aac9
apply bloomFilter while handling existence filter mismatch (#6897)
milaGGL 7e2f069
Merge branch 'master' into mila/BloomFilter
milaGGL c128eaa
Merge branch 'master' into mila/BloomFilter
milaGGL dee7744
add "no-ios", "no-android" to invalid base64 bitmap spec test case
milaGGL 277f8e1
Optimize bloom filter application (#6992)
milaGGL d66f4ca
Merge branch 'master' into mila/BloomFilter
milaGGL dbed11f
Merge remote-tracking branch 'origin/master' into HEAD
dconeybe a3cd73d
base64.ts: tweak the comment about why we're doing custom base64 leng…
dconeybe 839ccf7
Merge remote-tracking branch 'origin/master' into HEAD
dconeybe b7072d1
Merge branch 'master' into mila/BloomFilter
milaGGL 97ca3ee
Mila/bloom filter add integration test (#7045)
milaGGL 5bd6142
Merge remote-tracking branch 'origin/master' into HEAD
dconeybe 7b410e6
skip the integration test when using emulator
milaGGL 8a5faad
Merge remote-tracking branch 'origin/master' into mila/BloomFilter
dconeybe 65e5452
Fix `expectedCount` encoding in grpc (#7087)
dconeybe a4ee560
Merge remote-tracking branch 'origin/master' into HEAD
dconeybe 465e8df
Merge remote-tracking branch 'origin/master' into mila/BloomFilter
dconeybe 5c2ec00
Add 'existence-filter-mismatch-bloom' to listen request labels and te…
milaGGL 7c20d7d
Update the integration test to verify that bloom filter averted full …
dconeybe 272a6a6
Merge branch 'master' into mila/BloomFilter
milaGGL 519c1ef
fix bloom filter specs
milaGGL a0e0432
Cleanup and improvements to the "complex" bloom filter integration te…
dconeybe e2afbf8
Merge remote-tracking branch 'origin/master' into mila/BloomFilter
dconeybe a936b02
Merge remote-tracking branch 'origin/master' into mila/BloomFilter
dconeybe ea44722
Merge remote-tracking branch 'origin/master' into mila/BloomFilter
dconeybe e043119
Merge remote-tracking branch 'origin/master' into mila/BloomFilter
dconeybe 4778c99
Merge remote-tracking branch 'origin/master' into mila/BloomFilter
dconeybe e73c52b
md5_integer_size_delta.txt added [delete this file before merging int…
dconeybe fc0fa73
query.test.ts: Remove check for `TARGET_BACKEND !== 'nightly'` since …
dconeybe 9a5877f
Merge remote-tracking branch 'origin/master' into mila/BloomFilter
dconeybe a3c7bb3
Merge remote-tracking branch 'origin/master' into mila/BloomFilter
dconeybe 5d907b8
Remove temp file md5_integer_size_delta.txt
dconeybe 67c34c3
Merge branch 'master' into mila/BloomFilter
milaGGL 85d3604
add changeset
milaGGL 256cb3e
Merge remote-tracking branch 'origin/master' into mila/BloomFilter
dconeybe bbc1944
Merge remote-tracking branch 'origin/master' into mila/BloomFilter
dconeybe f6ef44c
[no ci]
dconeybe a3ccdeb
Format bloom filter golden test JSON files with prettier
dconeybe f30c45f
.changeset/swift-eels-change.md: update
dconeybe 0c74eb0
Remove no-longer-needed exports of TargetBackend and TARGET_BACKEND
dconeybe c238fd2
bloom_filter_golden_test_data/README.md added
dconeybe b8066f1
Disable bloom filter spec tests on android and ios; enable them once …
dconeybe 7681f05
Merge remote-tracking branch 'origin/master' into mila/BloomFilter
dconeybe 93dedd1
Further tweak the change log entry
dconeybe 80fc46d
Merge remote-tracking branch 'origin/master' into mila/BloomFilter
dconeybe f795005
listen_spec.test.ts: withGCEnabled(false) -> ensureManualLruGC()
dconeybe 787d523
Further tweak change log
dconeybe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@firebase/webchannel-wrapper': minor | ||
'@firebase/firestore': minor | ||
'firebase': minor | ||
--- | ||
|
||
Implemented an optimization in the local cache synchronization logic that reduces the number of billed document reads when documents were deleted on the server while the client was not actively listening to the query (e.g. while the client was offline). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
packages/firestore/src/protos/google/firestore/v1/bloom_filter.proto
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Copyright 2022 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
syntax = "proto3"; | ||
|
||
package google.firestore.v1; | ||
|
||
option csharp_namespace = "Google.Cloud.Firestore.V1"; | ||
option go_package = "google.golang.org/genproto/googleapis/firestore/v1;firestore"; | ||
option java_multiple_files = true; | ||
option java_outer_classname = "BloomFilterProto"; | ||
option java_package = "com.google.firestore.v1"; | ||
option objc_class_prefix = "GCFS"; | ||
option php_namespace = "Google\\Cloud\\Firestore\\V1"; | ||
option ruby_package = "Google::Cloud::Firestore::V1"; | ||
|
||
// A sequence of bits, encoded in a byte array. | ||
// | ||
// Each byte in the `bitmap` byte array stores 8 bits of the sequence. The only | ||
// exception is the last byte, which may store 8 _or fewer_ bits. The `padding` | ||
// defines the number of bits of the last byte to be ignored as "padding". The | ||
// values of these "padding" bits are unspecified and must be ignored. | ||
// | ||
// To retrieve the first bit, bit 0, calculate: (bitmap[0] & 0x01) != 0. | ||
// To retrieve the second bit, bit 1, calculate: (bitmap[0] & 0x02) != 0. | ||
// To retrieve the third bit, bit 2, calculate: (bitmap[0] & 0x04) != 0. | ||
// To retrieve the fourth bit, bit 3, calculate: (bitmap[0] & 0x08) != 0. | ||
// To retrieve bit n, calculate: (bitmap[n / 8] & (0x01 << (n % 8))) != 0. | ||
// | ||
// The "size" of a `BitSequence` (the number of bits it contains) is calculated | ||
// by this formula: (bitmap.length * 8) - padding. | ||
message BitSequence { | ||
// The bytes that encode the bit sequence. | ||
// May have a length of zero. | ||
bytes bitmap = 1; | ||
|
||
// The number of bits of the last byte in `bitmap` to ignore as "padding". | ||
// If the length of `bitmap` is zero, then this value must be 0. | ||
// Otherwise, this value must be between 0 and 7, inclusive. | ||
int32 padding = 2; | ||
} | ||
|
||
// A bloom filter (https://en.wikipedia.org/wiki/Bloom_filter). | ||
// | ||
// The bloom filter hashes the entries with MD5 and treats the resulting 128-bit | ||
// hash as 2 distinct 64-bit hash values, interpreted as unsigned integers | ||
// using 2's complement encoding. | ||
// | ||
// These two hash values, named h1 and h2, are then used to compute the | ||
// `hash_count` hash values using the formula, starting at i=0: | ||
// | ||
// h(i) = h1 + (i * h2) | ||
// | ||
// These resulting values are then taken modulo the number of bits in the bloom | ||
// filter to get the bits of the bloom filter to test for the given entry. | ||
message BloomFilter { | ||
// The bloom filter data. | ||
BitSequence bits = 1; | ||
|
||
// The number of hashes used by the algorithm. | ||
int32 hash_count = 2; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.