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

feat(clustering/sync): validate deltas #14127

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chobits
Copy link
Contributor

@chobits chobits commented Jan 10, 2025

Summary

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

Fix KAG-5897

@chronolaw chronolaw changed the title feat(sync): validate deltas feat(clustering/sync): validate deltas Jan 10, 2025
if delta_entity ~= nil and delta_entity ~= ngx.null then
dc_table[delta_type] = dc_table[delta_type] or {}

table.insert(dc_table[delta_type], delta_entity)
Copy link
Contributor

Choose a reason for hiding this comment

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

localize table.insert?


-- table: primary key string -> entity
if not is_full_sync then
local schema = kong.db[delta_type].schema
Copy link
Contributor

Choose a reason for hiding this comment

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

localize kong.db in function?


local foreign_refs = foreign_references[item_type]

if not item or item == ngx.null or not foreign_refs then
Copy link
Contributor

Choose a reason for hiding this comment

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

localize ngx.null?

local pks = DeclarativeConfig.pk_string(db.schema, v)
local fvalue = deltas_map[pks]
if fvalue then
goto found
Copy link
Contributor

Choose a reason for hiding this comment

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

should be break?

@@ -506,6 +507,71 @@ local function validate_references(self, input)
end


function DeclarativeConfig.validate_references_full(self, input)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the parameter is call self? I think that DeclarativeConfig has no method new() to create instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants