Skip to content

Commit

Permalink
fix(clustering): do not generate event for full sync (#13854)
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw authored Nov 13, 2024
1 parent 945d333 commit a6dceee
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions kong/clustering/services/sync/rpc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,6 @@ local function do_sync()
return nil, err
end

local crud_event_type = old_entity and "update" or "create"

-- If we will wipe lmdb, we don't need to delete it from lmdb.
if old_entity and not wipe then
local res, err = delete_entity_for_txn(t, delta_type, old_entity, opts)
Expand All @@ -275,7 +273,10 @@ local function do_sync()
", version: ", delta_version,
", type: ", delta_type)

ev = { delta_type, crud_event_type, delta_entity, old_entity, }
-- wipe the whole lmdb, should not have events
if not wipe then
ev = { delta_type, old_entity and "update" or "create", delta_entity, old_entity, }
end

else
-- delete the entity, opts for getting correct lmdb key
Expand All @@ -297,11 +298,17 @@ local function do_sync()
", version: ", delta_version,
", type: ", delta_type)

ev = { delta_type, "delete", old_entity, }
end
-- wipe the whole lmdb, should not have events
if not wipe then
ev = { delta_type, "delete", old_entity, }
end
end -- if delta_entity ~= nil and delta_entity ~= ngx_null

crud_events_n = crud_events_n + 1
crud_events[crud_events_n] = ev
-- wipe the whole lmdb, should not have events
if not wipe then
crud_events_n = crud_events_n + 1
crud_events[crud_events_n] = ev
end

-- delta.version should not be nil or ngx.null
assert(type(delta_version) == "number")
Expand Down

1 comment on commit a6dceee

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

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

Bazel Build

Docker image available kong/kong:a6dceee6a7f030a8e581371f7fc60eeef7c74a77
Artifacts available https://github.com/Kong/kong/actions/runs/11809708128

Please sign in to comment.