Skip to content
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

fix(incremental sync): fix cache_key handling for select_by_cache_key #13815

Merged
merged 3 commits into from
Oct 31, 2024

Conversation

chobits
Copy link
Contributor

@chobits chobits commented Oct 31, 2024

Summary

This is part 2 of cache_key bugfix.

  1. fix(dao): don't generate ws_id for cache_key if schema is not workspaceable
  2. only insert one cache_key into lmdb, and its unique key's ws_id could be a placeholder, here it uses default ws id. Because the ws_id should be handled by :cache_key(). And returned value of :cache_key() is already unique globally. An example is that kong.cache:get() will directly use this value as global unique key.
    • the final key-value in lmdb for cache_key will be:
    • key: <entity_name>:<default_ws_id>:cache_key:<returned value from :cache_key()>
    • value: <index: item's key in lmdb>

Checklist

  • The Pull Request has tests
  • A changelog file has been added to CHANGELOG/unreleased/kong or adding skip-changelog label on PR if unnecessary. README.md
  • The Pull Request has backports to all the versions it needs to cover
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

Fix KAG-5661

@github-actions github-actions bot added core/db cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee labels Oct 31, 2024
@pull-request-size pull-request-size bot added size/M and removed size/S labels Oct 31, 2024
@team-gateway-bot team-gateway-bot added the author/community PRs from the open-source community (not Kong Inc) label Oct 31, 2024
kong/db/declarative/import.lua Show resolved Hide resolved
kong/db/declarative/import.lua Outdated Show resolved Hide resolved
kong/db/strategies/off/init.lua Outdated Show resolved Hide resolved
@chronolaw chronolaw merged commit 8505300 into refactor/tuning_inc_sync Oct 31, 2024
28 checks passed
@chronolaw chronolaw deleted the fix/incr_sync_cache_key branch October 31, 2024 06:46
chronolaw pushed a commit that referenced this pull request Oct 31, 2024
…#13815)

* fix(incremental sync): fix cache_key handling for select_by_cache_key

* fix some comments

* fix: remove unnecessary comment
bungle pushed a commit that referenced this pull request Nov 1, 2024
* fix(db): pagesize must not be less than 2
* fix(db): set global key in lmdb
* fix(db): use request_aware_table correctly
* fix(dbless): get default workspace correctly
* fix(clustering): check latest_version and d.ws_id
* fix(clustering): fix dp do_sync()
* fix(clustering):fix declarative export sync
* fix(clustering):check latest_version == ngx_null in CP
* fix(clustering): inc sync add ws (#13790)
* fix(clustering/sync): set ws_id in do_sync()
* fix(clustering): delta version is null (#13789)
* fix(clustering/sync): delta.version may be null
* refactor(clustering): change sync data structure (#13794)
* fix(incremental sync): added comment for 2 times do_sync (#13801)
* fix(incremental sync): fix cache_key handling for select_by_cache_key (#13815)
* fix(incremental sync): fix cache_key handling for select_by_cache_key
* refactor(dbless): clean logic of select_by_field (#13817)
* refactor(dbless): clean logic of selec_by_field
* fix(incremental sync): fixed ws_id processing in _set_entity_for_txn (#13816)

---------

Co-authored-by: Xiaochen Wang <wangxiaochen0@gmail.com>
Co-authored-by: Datong Sun <datong.sun@konghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author/community PRs from the open-source community (not Kong Inc) cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee core/db schema-change-noteworthy size/M skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants