-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Use cached event number in ReadClient #17442
Merged
andy31415
merged 2 commits into
project-chip:master
from
yunhanw-google:feature/integrate_event_cache
Apr 20, 2022
Merged
Use cached event number in ReadClient #17442
andy31415
merged 2 commits into
project-chip:master
from
yunhanw-google:feature/integrate_event_cache
Apr 20, 2022
Conversation
This file contains 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
pullapprove
bot
requested review from
anush-apple,
austinh0,
Byungjoo-Lee,
bzbarsky-apple,
carol-apple,
cecille,
chrisdecenzo,
chshu,
chulspro,
Damian-Nordic,
dhrishi,
electrocucaracha,
franck-apple,
gjc13,
hawk248,
harsha-rajendran,
isiu-apple,
jelderton,
jepenven-silabs,
jmartinez-silabs,
kghost,
kpschoedel,
lazarkov,
LuDuda,
lzgrablic02,
mlepage-google and
mrjerryjohns
April 17, 2022 06:21
pullapprove
bot
requested review from
sagar-apple,
saurabhst,
selissia,
tcarmelveilleux,
tecimovic,
turon,
vijs,
vivien-apple,
wbschiller,
woody-apple,
xylophone21 and
yufengwangca
April 17, 2022 06:21
yunhanw-google
force-pushed
the
feature/integrate_event_cache
branch
from
April 17, 2022 06:36
aedddf6
to
f621005
Compare
PR #17442: Size comparison from c503a97 to f621005 Increases (23 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
Decreases (2 builds for cc13x2_26x2)
Full report (23 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
|
bzbarsky-apple
approved these changes
Apr 18, 2022
-- Update EventNumber with optional in ReadPrepareParams -- If event number is provided by user, then read client uses it to construct event filter and update it, when resubscribe happens, it would use updated event number. If event number is not provide by user, client would try to fetch the highest event number from cache, and when resubscribe happens, it would automatically retrieve the latest event number from cache. -- Add GetHighestReceivedEventNumber function in ClusterStateCache so that user can retrieve the highest recieved event number and construct the event filter manually later if user don't wanna the cache, and user could retrieve the event data using the range from x to mHighestReceivedEventNumber later.
yunhanw-google
force-pushed
the
feature/integrate_event_cache
branch
from
April 19, 2022 03:46
3ef8afc
to
c716093
Compare
PR #17442: Size comparison from 8793870 to c716093 Increases (23 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
Decreases (2 builds for cc13x2_26x2)
Full report (23 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
|
yunhanw-google
force-pushed
the
feature/integrate_event_cache
branch
from
April 19, 2022 16:40
c716093
to
b6ad775
Compare
PR #17442: Size comparison from 03ea72d to b6ad775 Increases above 0.2%:
Increases (32 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
Decreases (2 builds for cc13x2_26x2)
Full report (32 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
|
andy31415
approved these changes
Apr 20, 2022
Comment on lines
+189
to
+190
* If application don't have this one, it clear outparam and return CHIP_NO_ERROR. | ||
* if any returning error, it will fail the entire read client. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the application does not want to filter events by event number, it should call ClearValue() on aEventNumber
and return CHIP_NO_ERROR. An error return from this function will fail the entire read client interaction.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Need to use latest received EventNumber from ClusterStateCache when user read/subscribe using ClusterStateCache. If user has provided the event number, we would use that one to construct cache and bypass the one from ClusterStateCache.
This pattern is similar to what we have applied cached data version from ClusterStateCache
Change overview
-- Update EventNumber with optional in ReadPrepareParams and remove the existing mEventMin.
-- Move GenerateEventFilter logic into MessageDef
-- If event number is provided by user, then read client uses it to construct event filter and update it, when resubscribe happens, it would use updated event number. If event number is not provide by user, client would try to fetch the highest event number from cache, and when resubscribe happens, it would automatically retrieve the latest event number from cache.
-- Add virtual GetHighestReceivedEventNumber function in ClusterStateCache so that ReadClient can retrieve the event number from cache. In addition user can retrieve the highest received event number and construct the event filter manually later, and user could retrieve the event data using the range from x to mHighestReceivedEventNumber later.
Other design consideration, use the existing mEventMin in ReadClient where it has been updated when receiving the latest event data, then read client can always use the latest event number automatically during re-subscription, then we don't need virtual function GetHighestReceivedEventNumber. When using new readClient with same cache, user can call GetHighestReceivedEventNumber and update ReadPrepareParam for event number, this way, read client don't need to retrieve the highest event number from ClusterStateCache automatically. This pattern is different from the way ReadClient use cached data version from ClusterStateCache. However, prefer keeping the same pattern as data version cache has and eliminate the potential confusion regarding when to use mEventMin, particularly when mEventMin is different from the event number in cache
Testing
Add GetHighestReceivedEventNumber API test to check if the highest number is updated or not in cache correctly in existing event cache test.
Add new test to validated user-provided event can filter out the events correctly where the event number from event cache cannot be used for event filter construction.
TODO: Need to add test to validate the event things in resubscribe