bzp2010 commented on code in PR #13904:
URL: https://github.com/apache/apisix/pull/13904#discussion_r3911856446
##########
apisix/admin/standalone.lua:
##########
@@ -40,22 +58,60 @@ local METADATA_DIGEST = "X-Digest"
local _M = {}
+
+-- the "config" key in the standalone-config shared dict stores
+-- "<digest length>\n<digest><json body>" instead of plain JSON, so a worker
+-- can compare digests without decoding the (potentially large) JSON on
+-- every poll
+-- the reason for combining them into a single string and writing them to
+-- only one key is to ensure concurrent safety for updates by multiple
+-- workers
+local CONFIG_DIGEST_LENGTH_SEPARATOR = "\n"
+
+local function encode_config(digest, raw)
+ digest = digest or ""
+ return #digest .. CONFIG_DIGEST_LENGTH_SEPARATOR .. digest .. raw
+end
+
+
+local function decode_config(stored)
+ local idx = str_find(stored, CONFIG_DIGEST_LENGTH_SEPARATOR, 1, true)
+ if not idx then
+ return nil, nil, "missing digest length prefix"
Review Comment:
That's complete bullshit.
There is no proper workflow that allows you to perform a hot update for Lua.
This update will only be available in the next minor version; if you want to
upgrade, you must perform a full restart, because there is no viable
incremental path.
Therefore, there is absolutely no possibility of retaining shdict. Nor is
there any possibility of running both old and new versions of Lua scripts
simultaneously.
What you're assuming will never happen; you have absolutely no understanding
of how this project works or its programming model. Stop that nonsense.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]