From 7034b37abe0aa61c75a2ce1df9cbfce6032fcfab Mon Sep 17 00:00:00 2001 From: chronolaw Date: Tue, 14 Nov 2023 20:59:18 +0800 Subject: [PATCH 01/30] conf.lmdb_validation_tag --- kong/conf_loader/init.lua | 8 ++++++++ kong/templates/nginx_inject.lua | 1 + 2 files changed, 9 insertions(+) diff --git a/kong/conf_loader/init.lua b/kong/conf_loader/init.lua index 92a9f05e9464..0ab2f49785fc 100644 --- a/kong/conf_loader/init.lua +++ b/kong/conf_loader/init.lua @@ -137,6 +137,11 @@ local cipher_suites = { } +-- using kong version, "major.minor" +local LMDB_VALIDATION_TAG = string.match(require("kong.meta").version, + "^%d+%.%d+") + + local DEFAULT_PATHS = { "/etc/kong/kong.conf", "/etc/kong.conf", @@ -2002,6 +2007,9 @@ local function load(path, custom_conf, opts) end end + -- lmdb validation tag + conf.lmdb_validation_tag = LMDB_VALIDATION_TAG + -- Wasm module support if conf.wasm then local wasm_filters = get_wasm_filters(conf.wasm_filters_path) diff --git a/kong/templates/nginx_inject.lua b/kong/templates/nginx_inject.lua index 37164044ad5b..372c56397544 100644 --- a/kong/templates/nginx_inject.lua +++ b/kong/templates/nginx_inject.lua @@ -2,5 +2,6 @@ return [[ > if database == "off" then lmdb_environment_path ${{LMDB_ENVIRONMENT_PATH}}; lmdb_map_size ${{LMDB_MAP_SIZE}}; +lmdb_validation_tag $(lmdb_validation_tag); > end ]] From 1e777185270c466901ee3c5f687b37018d8f272c Mon Sep 17 00:00:00 2001 From: chronolaw Date: Wed, 15 Nov 2023 18:53:32 +0800 Subject: [PATCH 02/30] style fix --- kong/conf_loader/init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/kong/conf_loader/init.lua b/kong/conf_loader/init.lua index 0ab2f49785fc..e9121e714a98 100644 --- a/kong/conf_loader/init.lua +++ b/kong/conf_loader/init.lua @@ -139,7 +139,6 @@ local cipher_suites = { -- using kong version, "major.minor" local LMDB_VALIDATION_TAG = string.match(require("kong.meta").version, - "^%d+%.%d+") local DEFAULT_PATHS = { From 9b65cf9dd89f7993c2d31385f5749c118c7559db Mon Sep 17 00:00:00 2001 From: chronolaw Date: Wed, 15 Nov 2023 18:56:13 +0800 Subject: [PATCH 03/30] fix mistake --- kong/conf_loader/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kong/conf_loader/init.lua b/kong/conf_loader/init.lua index e9121e714a98..400adafede2c 100644 --- a/kong/conf_loader/init.lua +++ b/kong/conf_loader/init.lua @@ -138,7 +138,7 @@ local cipher_suites = { -- using kong version, "major.minor" -local LMDB_VALIDATION_TAG = string.match(require("kong.meta").version, +local LMDB_VALIDATION_TAG = string.match(require("kong.meta").version local DEFAULT_PATHS = { From 201fcfd256501009a846b68fffd4c7135b35a4e5 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Wed, 15 Nov 2023 19:09:25 +0800 Subject: [PATCH 04/30] add match pattern --- kong/conf_loader/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kong/conf_loader/init.lua b/kong/conf_loader/init.lua index 400adafede2c..c3451b431438 100644 --- a/kong/conf_loader/init.lua +++ b/kong/conf_loader/init.lua @@ -138,7 +138,8 @@ local cipher_suites = { -- using kong version, "major.minor" -local LMDB_VALIDATION_TAG = string.match(require("kong.meta").version +local LMDB_VALIDATION_TAG = string.match(require("kong.meta").version, + "^%d+%.%d") local DEFAULT_PATHS = { From 2ef20f490cb7f66706081b1f632680c737f6c798 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Wed, 15 Nov 2023 19:19:11 +0800 Subject: [PATCH 05/30] update template --- kong/templates/nginx_inject.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kong/templates/nginx_inject.lua b/kong/templates/nginx_inject.lua index 372c56397544..06a0912e009a 100644 --- a/kong/templates/nginx_inject.lua +++ b/kong/templates/nginx_inject.lua @@ -2,6 +2,10 @@ return [[ > if database == "off" then lmdb_environment_path ${{LMDB_ENVIRONMENT_PATH}}; lmdb_map_size ${{LMDB_MAP_SIZE}}; + +> if lmdb_validation_tag then lmdb_validation_tag $(lmdb_validation_tag); +> end + > end ]] From fea42e06c4f2af54f346dfad7141338cecc0a1b2 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Wed, 15 Nov 2023 19:49:14 +0800 Subject: [PATCH 06/30] disable tag --- kong/conf_loader/init.lua | 2 +- kong/templates/nginx_inject.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kong/conf_loader/init.lua b/kong/conf_loader/init.lua index c3451b431438..0ab2f49785fc 100644 --- a/kong/conf_loader/init.lua +++ b/kong/conf_loader/init.lua @@ -139,7 +139,7 @@ local cipher_suites = { -- using kong version, "major.minor" local LMDB_VALIDATION_TAG = string.match(require("kong.meta").version, - "^%d+%.%d") + "^%d+%.%d+") local DEFAULT_PATHS = { diff --git a/kong/templates/nginx_inject.lua b/kong/templates/nginx_inject.lua index 06a0912e009a..c89a9cda17df 100644 --- a/kong/templates/nginx_inject.lua +++ b/kong/templates/nginx_inject.lua @@ -4,7 +4,7 @@ lmdb_environment_path ${{LMDB_ENVIRONMENT_PATH}}; lmdb_map_size ${{LMDB_MAP_SIZE}}; > if lmdb_validation_tag then -lmdb_validation_tag $(lmdb_validation_tag); +#lmdb_validation_tag $(lmdb_validation_tag); > end > end From a8e7ac223c865795521d4711e03e7051d2932f88 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Wed, 15 Nov 2023 21:11:33 +0800 Subject: [PATCH 07/30] use notice level branch --- .requirements | 2 +- kong/templates/nginx_inject.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.requirements b/.requirements index 0c18973a4b66..e5616df01cad 100644 --- a/.requirements +++ b/.requirements @@ -7,7 +7,7 @@ PCRE=8.45 LIBEXPAT=2.5.0 LUA_KONG_NGINX_MODULE=4fbc3ddc7dcbc706ed286b95344f3cb6da17e637 # 0.8.0 -LUA_RESTY_LMDB=d236fc5ba339897e8f2c6ada1c1b4ab9311feee8 # 1.4.0 +LUA_RESTY_LMDB=472a22b2a56176a9dec8c2386c83a062ee8b4fe5 # 1.4.x LUA_RESTY_EVENTS=8448a92cec36ac04ea522e78f6496ba03c9b1fd8 # 0.2.0 LUA_RESTY_WEBSOCKET=60eafc3d7153bceb16e6327074e0afc3d94b1316 # 0.4.0 ATC_ROUTER=7a2ad42d4246598ba1f753b6ae79cb1456040afa # 1.3.1 diff --git a/kong/templates/nginx_inject.lua b/kong/templates/nginx_inject.lua index c89a9cda17df..06a0912e009a 100644 --- a/kong/templates/nginx_inject.lua +++ b/kong/templates/nginx_inject.lua @@ -4,7 +4,7 @@ lmdb_environment_path ${{LMDB_ENVIRONMENT_PATH}}; lmdb_map_size ${{LMDB_MAP_SIZE}}; > if lmdb_validation_tag then -#lmdb_validation_tag $(lmdb_validation_tag); +lmdb_validation_tag $(lmdb_validation_tag); > end > end From 9a3111f207f88483f73bec7eaf2f58b71b2046a8 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Thu, 16 Nov 2023 11:19:31 +0800 Subject: [PATCH 08/30] update resty-lmdb --- .requirements | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.requirements b/.requirements index e5616df01cad..b09662b84bec 100644 --- a/.requirements +++ b/.requirements @@ -7,7 +7,7 @@ PCRE=8.45 LIBEXPAT=2.5.0 LUA_KONG_NGINX_MODULE=4fbc3ddc7dcbc706ed286b95344f3cb6da17e637 # 0.8.0 -LUA_RESTY_LMDB=472a22b2a56176a9dec8c2386c83a062ee8b4fe5 # 1.4.x +LUA_RESTY_LMDB=233a3ef51065e1fe2764a68a4e39bc1411e26741 # 1.4.x LUA_RESTY_EVENTS=8448a92cec36ac04ea522e78f6496ba03c9b1fd8 # 0.2.0 LUA_RESTY_WEBSOCKET=60eafc3d7153bceb16e6327074e0afc3d94b1316 # 0.4.0 ATC_ROUTER=7a2ad42d4246598ba1f753b6ae79cb1456040afa # 1.3.1 From 0cbd29d7c3ef7a0882778fafd66d9543c8ad027d Mon Sep 17 00:00:00 2001 From: chronolaw Date: Thu, 16 Nov 2023 11:48:27 +0800 Subject: [PATCH 09/30] add tag to custom template --- .requirements | 2 +- spec/fixtures/custom_nginx.template | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.requirements b/.requirements index b09662b84bec..d52c2a596571 100644 --- a/.requirements +++ b/.requirements @@ -7,7 +7,7 @@ PCRE=8.45 LIBEXPAT=2.5.0 LUA_KONG_NGINX_MODULE=4fbc3ddc7dcbc706ed286b95344f3cb6da17e637 # 0.8.0 -LUA_RESTY_LMDB=233a3ef51065e1fe2764a68a4e39bc1411e26741 # 1.4.x +LUA_RESTY_LMDB=7d49fc89fb55132b5bf653dfc036359e5035f04f # 1.4.x LUA_RESTY_EVENTS=8448a92cec36ac04ea522e78f6496ba03c9b1fd8 # 0.2.0 LUA_RESTY_WEBSOCKET=60eafc3d7153bceb16e6327074e0afc3d94b1316 # 0.4.0 ATC_ROUTER=7a2ad42d4246598ba1f753b6ae79cb1456040afa # 1.3.1 diff --git a/spec/fixtures/custom_nginx.template b/spec/fixtures/custom_nginx.template index abee4616d9bb..ed4d030cb18d 100644 --- a/spec/fixtures/custom_nginx.template +++ b/spec/fixtures/custom_nginx.template @@ -16,6 +16,7 @@ $(el.name) $(el.value); > if database == "off" then lmdb_environment_path ${{LMDB_ENVIRONMENT_PATH}}; lmdb_map_size ${{LMDB_MAP_SIZE}}; +lmdb_validation_tag test; > end events { From ec5fdd2cf948f9b42201d96c0c7a0e592e4314b3 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Thu, 16 Nov 2023 11:57:30 +0800 Subject: [PATCH 10/30] change log --- changelog/unreleased/kong/bump-lua-resty-lmdb-1.4.0.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/unreleased/kong/bump-lua-resty-lmdb-1.4.0.yml b/changelog/unreleased/kong/bump-lua-resty-lmdb-1.4.0.yml index ea9b62f3d999..0f4739d31c8b 100644 --- a/changelog/unreleased/kong/bump-lua-resty-lmdb-1.4.0.yml +++ b/changelog/unreleased/kong/bump-lua-resty-lmdb-1.4.0.yml @@ -1,3 +1,3 @@ -message: Bumped lua-resty-lmdb from 1.3.0 to 1.4.0 +message: Bumped lua-resty-lmdb from 1.3.0 to 1.4.x type: dependency scope: Core From ca53e20f4c3fe45b335f4b508f2721dedd36377e Mon Sep 17 00:00:00 2001 From: chronolaw Date: Thu, 16 Nov 2023 15:09:45 +0800 Subject: [PATCH 11/30] disable tag again --- kong/templates/nginx_inject.lua | 2 +- spec/fixtures/custom_nginx.template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kong/templates/nginx_inject.lua b/kong/templates/nginx_inject.lua index 06a0912e009a..c89a9cda17df 100644 --- a/kong/templates/nginx_inject.lua +++ b/kong/templates/nginx_inject.lua @@ -4,7 +4,7 @@ lmdb_environment_path ${{LMDB_ENVIRONMENT_PATH}}; lmdb_map_size ${{LMDB_MAP_SIZE}}; > if lmdb_validation_tag then -lmdb_validation_tag $(lmdb_validation_tag); +#lmdb_validation_tag $(lmdb_validation_tag); > end > end diff --git a/spec/fixtures/custom_nginx.template b/spec/fixtures/custom_nginx.template index ed4d030cb18d..df1e0de74461 100644 --- a/spec/fixtures/custom_nginx.template +++ b/spec/fixtures/custom_nginx.template @@ -16,7 +16,7 @@ $(el.name) $(el.value); > if database == "off" then lmdb_environment_path ${{LMDB_ENVIRONMENT_PATH}}; lmdb_map_size ${{LMDB_MAP_SIZE}}; -lmdb_validation_tag test; +#lmdb_validation_tag test; > end events { From 7c7ff6b61f18c42681f707c85a86e39a9550a631 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Wed, 22 Nov 2023 10:59:29 +0800 Subject: [PATCH 12/30] enable tag --- kong/templates/nginx_inject.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kong/templates/nginx_inject.lua b/kong/templates/nginx_inject.lua index c89a9cda17df..06a0912e009a 100644 --- a/kong/templates/nginx_inject.lua +++ b/kong/templates/nginx_inject.lua @@ -4,7 +4,7 @@ lmdb_environment_path ${{LMDB_ENVIRONMENT_PATH}}; lmdb_map_size ${{LMDB_MAP_SIZE}}; > if lmdb_validation_tag then -#lmdb_validation_tag $(lmdb_validation_tag); +lmdb_validation_tag $(lmdb_validation_tag); > end > end From 0c08f46570a3545abc6a32a3959dc21000e761b5 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Wed, 22 Nov 2023 14:41:16 +0800 Subject: [PATCH 13/30] pending some tests --- spec/02-integration/02-cmd/03-reload_spec.lua | 2 +- spec/02-integration/02-cmd/14-vault_spec.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/02-integration/02-cmd/03-reload_spec.lua b/spec/02-integration/02-cmd/03-reload_spec.lua index e70c84c97d47..aa9825ba3238 100644 --- a/spec/02-integration/02-cmd/03-reload_spec.lua +++ b/spec/02-integration/02-cmd/03-reload_spec.lua @@ -271,7 +271,7 @@ describe("kong reload #" .. strategy, function() end) end) - it("preserves declarative config from memory when not using declarative_config from kong.conf", function() + pending("preserves declarative config from memory when not using declarative_config from kong.conf", function() local pok, admin_client finally(function() diff --git a/spec/02-integration/02-cmd/14-vault_spec.lua b/spec/02-integration/02-cmd/14-vault_spec.lua index 91d66ff40839..fca6b0b65a93 100644 --- a/spec/02-integration/02-cmd/14-vault_spec.lua +++ b/spec/02-integration/02-cmd/14-vault_spec.lua @@ -134,7 +134,7 @@ describe("kong vault #" .. strategy, function() helpers.stop_kong() end) - it("vault get env", function() + pending("vault get env", function() finally(function() helpers.unsetenv("SECRETS_TEST") end) @@ -149,7 +149,7 @@ describe("kong vault #" .. strategy, function() assert.is_true(ok) end) - it("vault get non-existing env", function() + pending("vault get non-existing env", function() local ok, stderr, stdout = helpers.kong_exec("vault get test-env/nonexist", { prefix = helpers.test_conf.prefix, }) From 7b35bde4b432b7e32a1f93c1d6cf5acea4f21d01 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Wed, 22 Nov 2023 16:21:19 +0800 Subject: [PATCH 14/30] custom_nginx.template --- spec/fixtures/custom_nginx.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/fixtures/custom_nginx.template b/spec/fixtures/custom_nginx.template index df1e0de74461..3b7359dbb1a6 100644 --- a/spec/fixtures/custom_nginx.template +++ b/spec/fixtures/custom_nginx.template @@ -16,7 +16,7 @@ $(el.name) $(el.value); > if database == "off" then lmdb_environment_path ${{LMDB_ENVIRONMENT_PATH}}; lmdb_map_size ${{LMDB_MAP_SIZE}}; -#lmdb_validation_tag test; +lmdb_validation_tag 3.6; > end events { From e560684ac311a8a5b74b76117f855c2ffe485c6a Mon Sep 17 00:00:00 2001 From: chronolaw Date: Wed, 22 Nov 2023 17:05:40 +0800 Subject: [PATCH 15/30] enable reload test --- spec/02-integration/02-cmd/03-reload_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/02-integration/02-cmd/03-reload_spec.lua b/spec/02-integration/02-cmd/03-reload_spec.lua index aa9825ba3238..e70c84c97d47 100644 --- a/spec/02-integration/02-cmd/03-reload_spec.lua +++ b/spec/02-integration/02-cmd/03-reload_spec.lua @@ -271,7 +271,7 @@ describe("kong reload #" .. strategy, function() end) end) - pending("preserves declarative config from memory when not using declarative_config from kong.conf", function() + it("preserves declarative config from memory when not using declarative_config from kong.conf", function() local pok, admin_client finally(function() From 8f245cfe7bed5e1c41713fbe27d1061e10641474 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Wed, 22 Nov 2023 17:39:22 +0800 Subject: [PATCH 16/30] enable vault tests --- spec/02-integration/02-cmd/14-vault_spec.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/02-integration/02-cmd/14-vault_spec.lua b/spec/02-integration/02-cmd/14-vault_spec.lua index fca6b0b65a93..91d66ff40839 100644 --- a/spec/02-integration/02-cmd/14-vault_spec.lua +++ b/spec/02-integration/02-cmd/14-vault_spec.lua @@ -134,7 +134,7 @@ describe("kong vault #" .. strategy, function() helpers.stop_kong() end) - pending("vault get env", function() + it("vault get env", function() finally(function() helpers.unsetenv("SECRETS_TEST") end) @@ -149,7 +149,7 @@ describe("kong vault #" .. strategy, function() assert.is_true(ok) end) - pending("vault get non-existing env", function() + it("vault get non-existing env", function() local ok, stderr, stdout = helpers.kong_exec("vault get test-env/nonexist", { prefix = helpers.test_conf.prefix, }) From 5b776577cea600d23d3cff26dd8426a87b2e4383 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Wed, 22 Nov 2023 19:42:37 +0800 Subject: [PATCH 17/30] update lmdb --- .requirements | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.requirements b/.requirements index d52c2a596571..330ec8d3cc66 100644 --- a/.requirements +++ b/.requirements @@ -7,7 +7,7 @@ PCRE=8.45 LIBEXPAT=2.5.0 LUA_KONG_NGINX_MODULE=4fbc3ddc7dcbc706ed286b95344f3cb6da17e637 # 0.8.0 -LUA_RESTY_LMDB=7d49fc89fb55132b5bf653dfc036359e5035f04f # 1.4.x +LUA_RESTY_LMDB=5fe7b611e7727da8127ad8652e81489421b906bc # 1.4.x LUA_RESTY_EVENTS=8448a92cec36ac04ea522e78f6496ba03c9b1fd8 # 0.2.0 LUA_RESTY_WEBSOCKET=60eafc3d7153bceb16e6327074e0afc3d94b1316 # 0.4.0 ATC_ROUTER=7a2ad42d4246598ba1f753b6ae79cb1456040afa # 1.3.1 From a3d623d8b2bf92ab43a3a2adcdefd621015fcf07 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Wed, 22 Nov 2023 21:44:43 +0800 Subject: [PATCH 18/30] change custom_nginx.template --- spec/fixtures/custom_nginx.template | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spec/fixtures/custom_nginx.template b/spec/fixtures/custom_nginx.template index 3b7359dbb1a6..b5b7381c3f9c 100644 --- a/spec/fixtures/custom_nginx.template +++ b/spec/fixtures/custom_nginx.template @@ -16,7 +16,12 @@ $(el.name) $(el.value); > if database == "off" then lmdb_environment_path ${{LMDB_ENVIRONMENT_PATH}}; lmdb_map_size ${{LMDB_MAP_SIZE}}; -lmdb_validation_tag 3.6; + +#lmdb_validation_tag 3.6; +> if lmdb_validation_tag then +lmdb_validation_tag $(lmdb_validation_tag); +> end + > end events { From 3f58a5998c23d6b8d8c0881285676d778e2f00f1 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Thu, 23 Nov 2023 08:22:47 +0800 Subject: [PATCH 19/30] update lmdb --- .requirements | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.requirements b/.requirements index 330ec8d3cc66..a8e321fdbbea 100644 --- a/.requirements +++ b/.requirements @@ -7,7 +7,7 @@ PCRE=8.45 LIBEXPAT=2.5.0 LUA_KONG_NGINX_MODULE=4fbc3ddc7dcbc706ed286b95344f3cb6da17e637 # 0.8.0 -LUA_RESTY_LMDB=5fe7b611e7727da8127ad8652e81489421b906bc # 1.4.x +LUA_RESTY_LMDB=0c5f46e6ad5843788764fd4b5993e58996518053 # 1.4.x LUA_RESTY_EVENTS=8448a92cec36ac04ea522e78f6496ba03c9b1fd8 # 0.2.0 LUA_RESTY_WEBSOCKET=60eafc3d7153bceb16e6327074e0afc3d94b1316 # 0.4.0 ATC_ROUTER=7a2ad42d4246598ba1f753b6ae79cb1456040afa # 1.3.1 From 8f647b5b341690f6458e5f20520b0a194ba4fa65 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Thu, 23 Nov 2023 11:06:15 +0800 Subject: [PATCH 20/30] clean code --- spec/fixtures/custom_nginx.template | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/fixtures/custom_nginx.template b/spec/fixtures/custom_nginx.template index b5b7381c3f9c..e6498c1ef196 100644 --- a/spec/fixtures/custom_nginx.template +++ b/spec/fixtures/custom_nginx.template @@ -17,7 +17,6 @@ $(el.name) $(el.value); lmdb_environment_path ${{LMDB_ENVIRONMENT_PATH}}; lmdb_map_size ${{LMDB_MAP_SIZE}}; -#lmdb_validation_tag 3.6; > if lmdb_validation_tag then lmdb_validation_tag $(lmdb_validation_tag); > end From cdd05541e0725cd4a066b724f9f45ccb149573a7 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Fri, 24 Nov 2023 17:07:32 +0800 Subject: [PATCH 21/30] bump to 1.4.1 --- .requirements | 2 +- changelog/unreleased/kong/bump-lua-resty-lmdb-1.4.0.yml | 3 --- changelog/unreleased/kong/bump-lua-resty-lmdb-1.4.1.yml | 3 +++ 3 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 changelog/unreleased/kong/bump-lua-resty-lmdb-1.4.0.yml create mode 100644 changelog/unreleased/kong/bump-lua-resty-lmdb-1.4.1.yml diff --git a/.requirements b/.requirements index a8e321fdbbea..d3543e59b819 100644 --- a/.requirements +++ b/.requirements @@ -7,7 +7,7 @@ PCRE=8.45 LIBEXPAT=2.5.0 LUA_KONG_NGINX_MODULE=4fbc3ddc7dcbc706ed286b95344f3cb6da17e637 # 0.8.0 -LUA_RESTY_LMDB=0c5f46e6ad5843788764fd4b5993e58996518053 # 1.4.x +LUA_RESTY_LMDB=19a6da0616db43baf8197dace59e64244430b3c4 # 1.4.1 LUA_RESTY_EVENTS=8448a92cec36ac04ea522e78f6496ba03c9b1fd8 # 0.2.0 LUA_RESTY_WEBSOCKET=60eafc3d7153bceb16e6327074e0afc3d94b1316 # 0.4.0 ATC_ROUTER=7a2ad42d4246598ba1f753b6ae79cb1456040afa # 1.3.1 diff --git a/changelog/unreleased/kong/bump-lua-resty-lmdb-1.4.0.yml b/changelog/unreleased/kong/bump-lua-resty-lmdb-1.4.0.yml deleted file mode 100644 index 0f4739d31c8b..000000000000 --- a/changelog/unreleased/kong/bump-lua-resty-lmdb-1.4.0.yml +++ /dev/null @@ -1,3 +0,0 @@ -message: Bumped lua-resty-lmdb from 1.3.0 to 1.4.x -type: dependency -scope: Core diff --git a/changelog/unreleased/kong/bump-lua-resty-lmdb-1.4.1.yml b/changelog/unreleased/kong/bump-lua-resty-lmdb-1.4.1.yml new file mode 100644 index 000000000000..c355f59c9722 --- /dev/null +++ b/changelog/unreleased/kong/bump-lua-resty-lmdb-1.4.1.yml @@ -0,0 +1,3 @@ +message: Bumped lua-resty-lmdb from 1.3.0 to 1.4.1 +type: dependency +scope: Core From 8c98db0de600dbaa439bb2b532639cda2fe8fb71 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Sat, 25 Nov 2023 09:30:27 +0800 Subject: [PATCH 22/30] change LMDB_VALIDATION_TAG --- kong/conf_loader/init.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/kong/conf_loader/init.lua b/kong/conf_loader/init.lua index 0ab2f49785fc..86bb306f491b 100644 --- a/kong/conf_loader/init.lua +++ b/kong/conf_loader/init.lua @@ -137,11 +137,6 @@ local cipher_suites = { } --- using kong version, "major.minor" -local LMDB_VALIDATION_TAG = string.match(require("kong.meta").version, - "^%d+%.%d+") - - local DEFAULT_PATHS = { "/etc/kong/kong.conf", "/etc/kong.conf", @@ -688,6 +683,12 @@ local _nop_tostring_mt = { } +-- using kong version, "major.minor" +local LMDB_VALIDATION_TAG = string.format("%d.%d", + meta._VERSION_TABLE.major, + meta._VERSION_TABLE.minor) + + local function parse_value(value, typ) if type(value) == "string" then value = strip(value) From 4d75f1712ca8a0e571b8affe423fc86dcf594a96 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Sat, 25 Nov 2023 09:33:59 +0800 Subject: [PATCH 23/30] lint fix --- kong/conf_loader/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/kong/conf_loader/init.lua b/kong/conf_loader/init.lua index 86bb306f491b..86fcd94e35c6 100644 --- a/kong/conf_loader/init.lua +++ b/kong/conf_loader/init.lua @@ -1,6 +1,7 @@ local require = require +local kong_meta = require "kong.meta" local kong_default_conf = require "kong.templates.kong_defaults" local process_secrets = require "kong.cmd.utils.process_secrets" local nginx_signals = require "kong.cmd.utils.nginx_signals" From 116b63f986f4c9ca9edea55f670824cd8572ea9c Mon Sep 17 00:00:00 2001 From: chronolaw Date: Sat, 25 Nov 2023 09:36:18 +0800 Subject: [PATCH 24/30] lint fix --- kong/conf_loader/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kong/conf_loader/init.lua b/kong/conf_loader/init.lua index 86fcd94e35c6..078db46eba14 100644 --- a/kong/conf_loader/init.lua +++ b/kong/conf_loader/init.lua @@ -686,8 +686,8 @@ local _nop_tostring_mt = { -- using kong version, "major.minor" local LMDB_VALIDATION_TAG = string.format("%d.%d", - meta._VERSION_TABLE.major, - meta._VERSION_TABLE.minor) + kong_meta._VERSION_TABLE.major, + kong_meta._VERSION_TABLE.minor) local function parse_value(value, typ) From 2ce458af9c5a81ea3fbe5e436c6dbe9c3b6b6614 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Sat, 25 Nov 2023 12:17:12 +0800 Subject: [PATCH 25/30] introduce_lmdb_validation_tag.yml --- changelog/unreleased/kong/introduce_lmdb_validation_tag.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/unreleased/kong/introduce_lmdb_validation_tag.yml diff --git a/changelog/unreleased/kong/introduce_lmdb_validation_tag.yml b/changelog/unreleased/kong/introduce_lmdb_validation_tag.yml new file mode 100644 index 000000000000..f62d61e42521 --- /dev/null +++ b/changelog/unreleased/kong/introduce_lmdb_validation_tag.yml @@ -0,0 +1,5 @@ +message: | + Validate LMDB cache by Kong's version (major + minor), + wiping the content if tag mismatch. +type: feature +scope: Configuration From 036967aa8cb70c230e645105ab6fb10ec0f5aeca Mon Sep 17 00:00:00 2001 From: chronolaw Date: Mon, 27 Nov 2023 11:48:19 +0800 Subject: [PATCH 26/30] change log desc --- changelog/unreleased/kong/introduce_lmdb_validation_tag.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog/unreleased/kong/introduce_lmdb_validation_tag.yml b/changelog/unreleased/kong/introduce_lmdb_validation_tag.yml index f62d61e42521..6fd2ea4357a2 100644 --- a/changelog/unreleased/kong/introduce_lmdb_validation_tag.yml +++ b/changelog/unreleased/kong/introduce_lmdb_validation_tag.yml @@ -1,5 +1,6 @@ message: | Validate LMDB cache by Kong's version (major + minor), - wiping the content if tag mismatch. + wiping the content if tag mismatch to avoid compatibility issues + during minor version upgrade. type: feature scope: Configuration From 790da80b9ec818165bdca57a8825aa2a5aa2dd05 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Mon, 27 Nov 2023 14:55:58 +0800 Subject: [PATCH 27/30] 04-prefix_handler_spec.lua --- spec/01-unit/04-prefix_handler_spec.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/01-unit/04-prefix_handler_spec.lua b/spec/01-unit/04-prefix_handler_spec.lua index 7cc4d9c56769..fe8264c31d46 100644 --- a/spec/01-unit/04-prefix_handler_spec.lua +++ b/spec/01-unit/04-prefix_handler_spec.lua @@ -1415,6 +1415,7 @@ describe("NGINX conf compiler", function() local main_inject_conf = prefix_handler.compile_nginx_main_inject_conf(helpers.test_conf) assert.not_matches("lmdb_environment_path", main_inject_conf, nil, true) assert.not_matches("lmdb_map_size", main_inject_conf, nil, true) + assert.not_matches("lmdb_validation_tag", main_inject_conf, nil, true) end) it("compiles a main NGINX inject conf #database=off", function() @@ -1424,6 +1425,7 @@ describe("NGINX conf compiler", function() local main_inject_conf = prefix_handler.compile_nginx_main_inject_conf(conf) assert.matches("lmdb_environment_path%s+dbless.lmdb;", main_inject_conf) assert.matches("lmdb_map_size%s+2048m;", main_inject_conf) + assert.matches("lmdb_validation_tag%s+%d+%.%d+;", main_inject_conf) end) end) From 7bda7a4e28524e1e217f66528df1d2a19c3c6b0d Mon Sep 17 00:00:00 2001 From: chronolaw Date: Mon, 27 Nov 2023 15:09:49 +0800 Subject: [PATCH 28/30] 03-conf_loader_spec.lua --- spec/01-unit/03-conf_loader_spec.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/01-unit/03-conf_loader_spec.lua b/spec/01-unit/03-conf_loader_spec.lua index ad41d52ea8bd..52d1e68ad906 100644 --- a/spec/01-unit/03-conf_loader_spec.lua +++ b/spec/01-unit/03-conf_loader_spec.lua @@ -67,6 +67,7 @@ describe("Configuration loader", function() assert.same(nil, conf.privileged_agent) assert.same(true, conf.dedicated_config_processing) assert.same(false, conf.allow_debug_header) + assert.matches("%d+%.%d+", conf.lmdb_validation_tag) assert.is_nil(getmetatable(conf)) end) it("loads a given file, with higher precedence", function() @@ -84,6 +85,7 @@ describe("Configuration loader", function() assert.same({"127.0.0.1:9001"}, conf.admin_listen) assert.same({"0.0.0.0:9000", "0.0.0.0:9443 http2 ssl", "0.0.0.0:9002 http2"}, conf.proxy_listen) + assert.matches("%d+%.%d+", conf.lmdb_validation_tag) assert.is_nil(getmetatable(conf)) end) it("preserves default properties if not in given file", function() From 400da70e584bdb55e676ec07349da8b140dbe6db Mon Sep 17 00:00:00 2001 From: chronolaw Date: Mon, 27 Nov 2023 18:19:35 +0800 Subject: [PATCH 29/30] test proper version --- spec/01-unit/04-prefix_handler_spec.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/01-unit/04-prefix_handler_spec.lua b/spec/01-unit/04-prefix_handler_spec.lua index fe8264c31d46..e246a411f27d 100644 --- a/spec/01-unit/04-prefix_handler_spec.lua +++ b/spec/01-unit/04-prefix_handler_spec.lua @@ -1425,7 +1425,11 @@ describe("NGINX conf compiler", function() local main_inject_conf = prefix_handler.compile_nginx_main_inject_conf(conf) assert.matches("lmdb_environment_path%s+dbless.lmdb;", main_inject_conf) assert.matches("lmdb_map_size%s+2048m;", main_inject_conf) - assert.matches("lmdb_validation_tag%s+%d+%.%d+;", main_inject_conf) + + local kong_meta = require "kong.meta" + local major = kong_meta._VERSION_TABLE.major + local minor = kong_meta._VERSION_TABLE.minor + assert.matches("lmdb_validation_tag%s+" .. major .. "%." .. minor .. ";", main_inject_conf) end) end) From 853df3feb973490353e8138ad3adbc1619b08fb4 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Mon, 27 Nov 2023 18:23:40 +0800 Subject: [PATCH 30/30] spec/01-unit/03-conf_loader_spec.lua --- spec/01-unit/03-conf_loader_spec.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/spec/01-unit/03-conf_loader_spec.lua b/spec/01-unit/03-conf_loader_spec.lua index 52d1e68ad906..562a6b86219c 100644 --- a/spec/01-unit/03-conf_loader_spec.lua +++ b/spec/01-unit/03-conf_loader_spec.lua @@ -1,3 +1,4 @@ +local kong_meta = require "kong.meta" local conf_loader = require "kong.conf_loader" local utils = require "kong.tools.utils" local helpers = require "spec.helpers" @@ -15,6 +16,11 @@ ffi.cdef([[ ]]) +local KONG_VERSION = string.format("%d.%d", + kong_meta._VERSION_TABLE.major, + kong_meta._VERSION_TABLE.minor) + + local function kong_user_group_exists() if C.getpwnam("kong") == nil or C.getgrnam("kong") == nil then return false @@ -67,7 +73,7 @@ describe("Configuration loader", function() assert.same(nil, conf.privileged_agent) assert.same(true, conf.dedicated_config_processing) assert.same(false, conf.allow_debug_header) - assert.matches("%d+%.%d+", conf.lmdb_validation_tag) + assert.same(KONG_VERSION, conf.lmdb_validation_tag) assert.is_nil(getmetatable(conf)) end) it("loads a given file, with higher precedence", function() @@ -85,7 +91,7 @@ describe("Configuration loader", function() assert.same({"127.0.0.1:9001"}, conf.admin_listen) assert.same({"0.0.0.0:9000", "0.0.0.0:9443 http2 ssl", "0.0.0.0:9002 http2"}, conf.proxy_listen) - assert.matches("%d+%.%d+", conf.lmdb_validation_tag) + assert.same(KONG_VERSION, conf.lmdb_validation_tag) assert.is_nil(getmetatable(conf)) end) it("preserves default properties if not in given file", function()