-
Notifications
You must be signed in to change notification settings - Fork 2.7k
bugfix: clear all cached data when get delete action, and removing stale boolean data in table self.values with a safer way
#2158
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
Conversation
…il` object, and
we may get wrong length if it contain any `nil`.
https://stackoverflow.com/questions/25903170/operator-nil-values-at-end-of-array
|
we'll get the wrong route list in APISIX by this case: ETCDCTL_API=2 etcdctl rm -r /apisix && make init
make run
curl -i http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/route",
"plugins": {
"serverless-pre-function": {
"phase": "rewrite",
"functions" : ["return function() local router = require(\"apisix.http.router.radixtree_host_uri\")\nlocal routes, routes_ver = router.routes()\n\nlocal core = require(\"apisix.core\")\nngx.say(\"worker_pid: \", ngx.worker.pid())\nngx.say(\"route_ver: \", routes_ver)\nngx.say(\"routes_type: \", type(routes))\n\nlocal keys = {}\nfor key in pairs(routes) do\n table.insert(keys, key)\nend\n\ntable.sort(keys)\n\nfor _, key in ipairs(keys) do\n ngx.say(\"--> key: \", key)\n ngx.say(\"--> val: \", core.json.encode(routes[key], true))\nend\n end"]
}
}
}'
curl http://127.0.0.1:9080/route -i
# 200 routes
bash -x create && bash -x delete && bash -x create
curl http://127.0.0.1:9080/route -i
make stop |
delete action, and removing stale boolean data in table self.values with a safer way
|
@apache/apisix-committers please take a look at this PR, I updated the title and reason right now |
|
Please close this PR and lock the conversation. You have just pinged hundreds of Apache people... |
|
Hi @membphis, No need to mention apache committers since it notifies all the committers of all ASF projects. |
|
to be precise, 3301 people. |
sorry for this, I chose wong group. will take care later |
|
Not really @membphis fault. I think this is a configuration issue. Notifying all committers should only be allowed by the admins of the Apache GitHub organization. |
|
@mxm that is not an available configuration option, unfortunately 😥 (believe me: we'd do that in a heartbeat) |
What this PR does / why we need it:
If the administrator user creates and deletes the same route multiple times, the new route will not be correctly synchronized to the APISIX gateway node, resulting in some request route matching failures and a 404 response.
bugfix: clear all cached data when get
deleteaction, and removing stale boolean data in tableself.valueswith a safer wayit is not easy to add test case. will add later
Pre-submission checklist: