Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw committed Nov 4, 2024
1 parent 318ecc5 commit 2cf2e24
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions kong/clustering/services/sync/hooks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function _M:notify_all_nodes()
return
end

ngx_log(ngx_DEBUG, "[rpc:sync] notifying all nodes of new version: ", latest_version)
ngx_log(ngx_DEBUG, "[kong.sync.v2] notifying all nodes of new version: ", latest_version)

local msg = { default = { new_version = latest_version, }, }

Expand Down Expand Up @@ -114,7 +114,7 @@ end
-- only control plane has these delta operations
function _M:register_dao_hooks()
local function is_db_export(name)
ngx_log(ngx_DEBUG, "[rpc:sync] name: ", name, " db_export: ", kong.db[name].schema.db_export)
ngx_log(ngx_DEBUG, "[kong.sync.v2] name: ", name, " db_export: ", kong.db[name].schema.db_export)

local db_export = kong.db[name].schema.db_export
return db_export == nil or db_export == true
Expand All @@ -135,7 +135,7 @@ function _M:register_dao_hooks()
return
end

ngx_log(ngx_DEBUG, "[rpc:sync] failed. Canceling ", name)
ngx_log(ngx_DEBUG, "[kong.sync.v2] failed. Canceling ", name)

local res, err = self.strategy:cancel_txn()
if not res then
Expand All @@ -148,7 +148,7 @@ function _M:register_dao_hooks()
return entity
end

ngx_log(ngx_DEBUG, "[rpc:sync] new delta due to writing ", name)
ngx_log(ngx_DEBUG, "[kong.sync.v2] new delta due to writing ", name)

return self:entity_delta_writer(entity, name, options, ws_id)
end
Expand All @@ -158,7 +158,7 @@ function _M:register_dao_hooks()
return entity
end

ngx_log(ngx_DEBUG, "[rpc:sync] new delta due to deleting ", name)
ngx_log(ngx_DEBUG, "[kong.sync.v2] new delta due to deleting ", name)

-- set lmdb value to ngx_null then return row
return self:entity_delta_writer(entity, name, options, ws_id, true)
Expand Down
6 changes: 3 additions & 3 deletions kong/db/dao/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -871,14 +871,14 @@ local function generate_foreign_key_methods(schema)
local row, err_t = self.strategy:upsert_by_field(name, unique_value,
entity_to_upsert, options)
if not row then
run_hook("dao:upsert_by:fail", err_t, entity_to_update, self.schema.name, options)
run_hook("dao:upsert_by:fail", err_t, entity_to_upsert, self.schema.name, options)
return nil, tostring(err_t), err_t
end

local ws_id = row.ws_id
row, err, err_t = self:row_to_entity(row, options)
if not row then
run_hook("dao:upsert_by:fail", err_t, entity_to_update, self.schema.name, options)
run_hook("dao:upsert_by:fail", err_t, entity_to_upsert, self.schema.name, options)
return nil, err, err_t
end

Expand Down Expand Up @@ -936,7 +936,7 @@ local function generate_foreign_key_methods(schema)
return nil, tostring(err_t), err_t

elseif not rows_affected then
run_hook("dao:delete_by:post", nil, self.schema.name, options, ws_id, nil)
run_hook("dao:delete_by:post", nil, self.schema.name, options, entity.ws_id, nil)
return nil
end

Expand Down

0 comments on commit 2cf2e24

Please sign in to comment.