Skip to content

Update AGW to support the flat digest pattern, including storing and communicating digests#7340

Merged
hcgatewood merged 2 commits intomagma:masterfrom
wangyyt1013:agw-digest
Jun 25, 2021
Merged

Update AGW to support the flat digest pattern, including storing and communicating digests#7340
hcgatewood merged 2 commits intomagma:masterfrom
wangyyt1013:agw-digest

Conversation

@wangyyt1013
Copy link
Copy Markdown
Member

@wangyyt1013 wangyyt1013 commented Jun 4, 2021

Signed-off-by: Yuanyuting Wang [email protected]

Summary

  1. Add function in subscriberdb/store/sqlite.py to store and retrieve the current digest for the gateway
  2. Add flat digest logic in subscriberdb/client.py to fetch, receive, and update digests, as well as skip subscriber data resyncing when no_updates=true
  3. Add unit tests to cover added functionalities

Test Plan

  1. Run all existing agw python tests. All should pass
  2. Add new unit tests in subscriberdb/tests/store/store_tests.py and subscriberdb/tests/client_tests.py
  3. Locally verified flow with subscriberdb cloud in docker

Additional Information

@wangyyt1013 wangyyt1013 added the component: agw Access gateway-related issue label Jun 4, 2021
@wangyyt1013 wangyyt1013 requested a review from hcgatewood June 4, 2021 20:10
@wangyyt1013 wangyyt1013 self-assigned this Jun 4, 2021
@pull-request-size pull-request-size bot added the size/XL Denotes a Pull Request that changes 500-999 lines. label Jun 4, 2021
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jun 4, 2021

Thanks for opening a PR! 💯 Please note that all commits must be signed off. This is enforced by the DCO check.

Howto

  • Reviews. The "Reviewers" listed for this PR are the Magma maintainers who will shepherd it.
  • Checks. All required CI checks must pass before merge.
  • Merge. Once approved and passing CI checks, use the ready2merge label to indicate the maintainers can merge your PR.

More info

Please take a moment to read through the Magma project's

If this is your first Magma PR, also consider reading

@wangyyt1013 wangyyt1013 force-pushed the agw-digest branch 2 times, most recently from 553901b to 1d7c7f2 Compare June 10, 2021 13:40
@pull-request-size pull-request-size bot added size/L Denotes a Pull Request that changes 100-499 lines. and removed size/XL Denotes a Pull Request that changes 500-999 lines. labels Jun 11, 2021
@wangyyt1013 wangyyt1013 force-pushed the agw-digest branch 2 times, most recently from 57630ca to e72ade3 Compare June 14, 2021 07:29
@wangyyt1013 wangyyt1013 marked this pull request as ready for review June 14, 2021 07:29
@wangyyt1013 wangyyt1013 requested review from a team, pshelar and themarwhal June 14, 2021 07:29
Copy link
Copy Markdown
Contributor

@hcgatewood hcgatewood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, couple fixes and couple questions

Copy link
Copy Markdown
Contributor

@hcgatewood hcgatewood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, couple cleanup items

Comment on lines +143 to +141
self._store.update_digest(cur_digest.md5_base64_digest)
return subscribers, no_updates
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure we test what happens when cloud sends down empty digest

Copy link
Copy Markdown
Member Author

@wangyyt1013 wangyyt1013 Jun 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently the logic works as such: when cloud sends down an empty digest, the gateway will store the empty gateway and send it in its next request; however, if ListSubscribersRequest.Digest = "", then cloud will not enable the no_updates logic, but will send down the full subscriber list (as well as a new digest if it has one) as usual. Wondering if you think this is a reasonable logic? @hcgatewood

P.S. the "cloud not enabling no_updates logic when digest = """ is included in #7472

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this is how it should work, makes sense. My note was just to verify that this is being tested

@wangyyt1013 wangyyt1013 requested review from a team and hcgatewood June 19, 2021 04:10
@wangyyt1013 wangyyt1013 force-pushed the agw-digest branch 2 times, most recently from fd69f22 to 77db6a3 Compare June 22, 2021 17:42
Copy link
Copy Markdown
Contributor

@hcgatewood hcgatewood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

  1. Fix one small nit
  2. Wait to merge until we get both PRs ready and manually verified

@wangyyt1013 wangyyt1013 force-pushed the agw-digest branch 3 times, most recently from a2a3755 to 2b08f77 Compare June 25, 2021 03:17
@wangyyt1013 wangyyt1013 requested a review from hcgatewood June 25, 2021 03:18
Copy link
Copy Markdown
Contributor

@hcgatewood hcgatewood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple small changes then let's merge. Also need an agw review, msg @themarwhal

Copy link
Copy Markdown
Contributor

@ardzoht ardzoht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, left one comment but it can be added in a separate PR

SUBSCRIBER_SYNC_FAILURE_TOTAL.inc()
return None
return None, None
logging.info(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For tuple structs like this I would recommend using a NamedTuple and explicitly name the parameters instead of returning a tuple here, it doesn't have to be in this PR you can add it as a TODO and add this later.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good, will do!

@hcgatewood hcgatewood merged commit a71492e into magma:master Jun 25, 2021
themarwhal pushed a commit that referenced this pull request Jun 25, 2021
rmeleromira pushed a commit to rmeleromira/magma that referenced this pull request Jul 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apply-v1.6 backported-v1.6 component: agw Access gateway-related issue size/L Denotes a Pull Request that changes 100-499 lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants