Skip to content

Commit

Permalink
comments change
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw committed Dec 17, 2024
1 parent d515208 commit 913562d
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion kong/conf_loader/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ local function load(path, custom_conf, opts)
end

if conf.cluster_rpc_sync and not conf.cluster_rpc then
log.warn("Cluster incremental sync has been forcibly disabled, " ..
log.warn("Cluster rpc sync has been forcibly disabled, " ..
"please enable cluster RPC.")
conf.cluster_rpc_sync = false
end
Expand Down
2 changes: 1 addition & 1 deletion kong/global.lua
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ function _GLOBAL.init_worker_events(kong_config)
local enable_privileged_agent = false
if kong_config.dedicated_config_processing and
kong_config.role == "data_plane" and
not kong.sync -- for incremental sync there is no privileged_agent
not kong.sync -- for rpc sync there is no privileged_agent
then
enable_privileged_agent = true
end
Expand Down
8 changes: 4 additions & 4 deletions kong/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -885,8 +885,8 @@ function Kong.init_worker()
local is_dp_sync_v1 = is_data_plane(kong.configuration) and not kong.sync
local using_dedicated = kong.configuration.dedicated_config_processing

-- CP needs to support both full and incremental sync
-- full sync is only enabled for DP if incremental sync is disabled
-- CP needs to support both v1 and v2 sync
-- v1 sync is only enabled for DP if v2 sync is disabled
if is_cp or is_dp_sync_v1 then
kong.clustering:init_worker()
end
Expand Down Expand Up @@ -992,15 +992,15 @@ function Kong.init_worker()
plugin_servers.start()
end

-- rpc and incremental sync
-- rpc and sync
if is_http_module then

-- init rpc connection
if kong.rpc then
kong.rpc:init_worker()
end

-- init incremental sync
-- init sync
-- should run after rpc init successfully
if kong.sync then
kong.sync:init_worker()
Expand Down
6 changes: 3 additions & 3 deletions kong/runloop/handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,10 @@ local function new_router(version)
-- like rebuild_router_timer. And it relies on core_cache to detect changes.
--
-- 1. stratey off (dbless)
-- incremental_sync on:
-- rpc_sync on:
-- non init worker: true(kong.core_cache)
-- init worker: false
-- incremental_sync off: false
-- rpc_sync off: false
-- 2. strategy on (non dbless): true(kong.core_cache)
local detect_changes = kong.core_cache and
(db.strategy ~= "off" or (kong.sync and get_phase() ~= "init_worker"))
Expand Down Expand Up @@ -986,7 +986,7 @@ return {

-- start some rebuild timers for
-- 1. traditional mode
-- 2. DP with incremental sync on (dbless mode)
-- 2. DP with rpc sync on (dbless mode)
if strategy ~= "off" or kong.sync then
local worker_state_update_frequency = kong.configuration.worker_state_update_frequency or 1

Expand Down
2 changes: 1 addition & 1 deletion spec/01-unit/01-db/10-declarative_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ keyauth_credentials:
assert.equals("services|123|fieldname|" .. sha256_hex("test"), key)
end)

-- since incremental sync the param `unique_across_ws` is useless
-- since rpc sync the param `unique_across_ws` is useless
-- this test case is just for compatibility
it("does not omits the workspace id when 'unique_across_ws' is 'true'", function()
local key = unique_field_key("services", "123", "fieldname", "test", true)
Expand Down
4 changes: 2 additions & 2 deletions spec/01-unit/01-db/11-declarative_lmdb_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ describe("#off preserve nulls", function()

local id, item = next(entities.basicauth_credentials)

-- format changed after incremental sync
-- format changed after rpc sync
local cache_key = concat({
"basicauth_credentials|",
item.ws_id,
Expand All @@ -225,7 +225,7 @@ describe("#off preserve nulls", function()
for _, plugin in pairs(entities.plugins) do
if plugin.name == PLUGIN_NAME then

-- format changed after incremental sync
-- format changed after rpc sync
cache_key = concat({
"plugins|",
plugin.ws_id,
Expand Down
6 changes: 3 additions & 3 deletions spec/02-integration/09-hybrid_mode/01-sync_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ describe("CP/DP labels #" .. strategy, function()
assert.equal(CLUSTERING_SYNC_STATUS.NORMAL, v.sync_status)
assert.equal(CLUSTERING_SYNC_STATUS.NORMAL, v.sync_status)
-- TODO: The API output does include labels and certs when the
-- incremental sync is enabled.
-- rpc sync is enabled.
if rpc_sync == "off" then
assert.equal("mycloud", v.labels.deployment)
assert.equal("us-east-1", v.labels.region)
Expand Down Expand Up @@ -860,7 +860,7 @@ describe("CP/DP cert details(cluster_mtls = shared) #" .. strategy, function()
for _, v in pairs(json.data) do
if v.ip == "127.0.0.1" then
-- TODO: The API output does include labels and certs when the
-- incremental sync is enabled.
-- rpc sync is enabled.
if rpc_sync == "off" then
assert.equal(1888983905, v.cert_details.expiry_timestamp)
end
Expand Down Expand Up @@ -929,7 +929,7 @@ describe("CP/DP cert details(cluster_mtls = pki) #" .. strategy, function()
for _, v in pairs(json.data) do
if v.ip == "127.0.0.1" then
-- TODO: The API output does include labels and certs when the
-- incremental sync is enabled.
-- rpc sync is enabled.
if rpc_sync == "off" then
assert.equal(1897136778, v.cert_details.expiry_timestamp)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ local function get_sync_status(id)
end


-- XXX TODO: helpers.clustering_client supports incremental sync
-- XXX TODO: helpers.clustering_client supports rpc sync
for _, rpc_sync in ipairs { "off" } do
for _, strategy in helpers.each_strategy() do

Expand Down
2 changes: 1 addition & 1 deletion spec/02-integration/09-hybrid_mode/12-errors_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ local function get_error_report(client, msg)
end


-- XXX TODO: mock_cp does not support incremental sync rpc
-- XXX TODO: mock_cp does not support rpc sync rpc
for _, rpc_sync in ipairs { "off" } do
for _, strategy in helpers.each_strategy() do
describe("CP/DP sync error-reporting with #" .. strategy .. " rpc_sync=" .. rpc_sync .. " backend", function()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe("DP diabled Incremental Sync RPC #" .. strategy, function()
cluster_listen = "127.0.0.1:9005",
nginx_conf = "spec/fixtures/custom_nginx.template",

cluster_rpc_sync = "on", -- ENABLE incremental sync
cluster_rpc_sync = "on", -- ENABLE rpc sync
}))

assert(helpers.start_kong({
Expand All @@ -35,7 +35,7 @@ describe("DP diabled Incremental Sync RPC #" .. strategy, function()
nginx_worker_processes = 2, -- multiple workers

cluster_rpc = "off", -- DISABLE rpc
cluster_rpc_sync = "off", -- DISABLE incremental sync
cluster_rpc_sync = "off", -- DISABLE rpc sync

dedicated_config_processing = dedicated, -- privileged agent
}))
Expand Down
4 changes: 2 additions & 2 deletions spec/02-integration/19-incrmental_sync/01-sync_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe("Incremental Sync RPC #" .. strategy, function()
cluster_listen = "127.0.0.1:9005",
nginx_conf = "spec/fixtures/custom_nginx.template",
cluster_rpc = "on",
cluster_rpc_sync = "on", -- incremental sync
cluster_rpc_sync = "on", -- rpc sync
}))

assert(helpers.start_kong({
Expand All @@ -50,7 +50,7 @@ describe("Incremental Sync RPC #" .. strategy, function()
nginx_conf = "spec/fixtures/custom_nginx.template",
nginx_worker_processes = 4, -- multiple workers
cluster_rpc = "on",
cluster_rpc_sync = "on", -- incremental sync
cluster_rpc_sync = "on", -- rpc sync
worker_state_update_frequency = 1,
}))
end)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ local function start_cp(strategy, port)
cluster_listen = "127.0.0.1:" .. port,
nginx_conf = "spec/fixtures/custom_nginx.template",
cluster_rpc = "on",
cluster_rpc_sync = "on", -- incremental sync
cluster_rpc_sync = "on", -- rpc sync
}))
end

Expand All @@ -26,7 +26,7 @@ local function start_dp(prefix, port)
nginx_conf = "spec/fixtures/custom_nginx.template",
nginx_worker_processes = 4, -- multiple workers
cluster_rpc = "on",
cluster_rpc_sync = "on", -- incremental sync
cluster_rpc_sync = "on", -- rpc sync
worker_state_update_frequency = 1,
}))
end
Expand Down

0 comments on commit 913562d

Please sign in to comment.