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

[backport -> release/3.9.x] fix(sync): do not introduce router rebuild timer for full sync #14006

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions kong/runloop/handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,17 @@ local function new_router(version)
end
end

local detect_changes = kong.core_cache and true

-- for dbless we will not check changes when initing
if db.strategy == "off" and get_phase() == "init_worker" then
detect_changes = false
end
-- We need to detect router changes if there is some one modifying the routers,
-- like rebuild_router_timer. And it relies on core_cache to detect changes.
--
-- 1. stratey off (dbless)
-- incremental_sync on:
-- non init worker: true(kong.core_cache)
-- init worker: false
-- incremental_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"))

local counter = 0
local page_size = db.routes.pagination.max_page_size
Expand Down Expand Up @@ -979,7 +984,10 @@ return {
end
end

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

local router_async_opts = {
Expand Down
Loading