diff --git a/kong/clustering/services/sync/rpc.lua b/kong/clustering/services/sync/rpc.lua index 1ec1aa475f5a..4100afbb9675 100644 --- a/kong/clustering/services/sync/rpc.lua +++ b/kong/clustering/services/sync/rpc.lua @@ -31,7 +31,7 @@ local ngx_DEBUG = ngx.DEBUG -- number of versions behind before a full sync is forced -local FULL_SYNC_THRESHOLD = 512 +local DEFAULT_FULL_SYNC_THRESHOLD = 512 function _M.new(strategy) @@ -62,6 +62,10 @@ end function _M:init_cp(manager) local purge_delay = manager.conf.cluster_data_plane_purge_delay + -- number of versions behind before a full sync is forced + local FULL_SYNC_THRESHOLD = manager.conf.cluster_full_sync_threshold or + DEFAULT_FULL_SYNC_THRESHOLD + -- CP -- Method: kong.sync.v2.get_delta -- Params: versions: list of current versions of the database diff --git a/kong/conf_loader/constants.lua b/kong/conf_loader/constants.lua index 8f1e734160c2..95fff6f6867a 100644 --- a/kong/conf_loader/constants.lua +++ b/kong/conf_loader/constants.lua @@ -514,6 +514,7 @@ local CONF_PARSERS = { cluster_dp_labels = { typ = "array" }, cluster_rpc = { typ = "boolean" }, cluster_incremental_sync = { typ = "boolean" }, + cluster_full_sync_threshold = { typ = "number" }, cluster_cjson = { typ = "boolean" }, kic = { typ = "boolean" }, diff --git a/kong/templates/kong_defaults.lua b/kong/templates/kong_defaults.lua index 73f9cda4cf1a..939626417403 100644 --- a/kong/templates/kong_defaults.lua +++ b/kong/templates/kong_defaults.lua @@ -43,6 +43,7 @@ cluster_use_proxy = off cluster_dp_labels = NONE cluster_rpc = off cluster_incremental_sync = off +cluster_full_sync_threshold = 512 cluster_cjson = off lmdb_environment_path = dbless.lmdb