AlinsRan opened a new pull request, #13745:
URL: https://github.com/apache/apisix/pull/13745

   ### Description
   
   Follow-up to #13714 (which fixed #13537 for the admin reload path).
   
   #13714 made the **admin** plugins reload (`PUT 
/apisix/admin/plugins/reload`) resilient to the `resty.events` broker's lack of 
a delivery guarantee: it bumps a shared `plugins_conf_version` in 
`ngx.shared["internal-status"]` and a per-worker reconciliation timer reloads 
any worker whose applied version is behind. That way a worker that misses the 
broadcast (e.g. while it is reconnecting to the broker) still converges.
   
   The **control** reload path (`PUT /v1/plugins/reload`) has the identical 
exposure but was left out of #13714 — `post_reload_plugins()` only calls 
`events:post()`. So a worker can miss the control broadcast and keep running 
the plugins/timers of a removed plugin (exactly the #13537 symptom) even though 
the API returned `200`.
   
   Note this is not a `lua-resty-events` bug to fix here — the broker has no 
replay for a reconnecting client by design; the reconciliation is the intended 
application-level compensation. This PR simply applies the existing 
compensation to the control path.
   
   ### Fix
   
   `apisix/control/v1.lua` `post_reload_plugins()` now bumps the same 
`plugins_conf_version` before broadcasting, so the reconciliation timer 
registered by the admin path converges any worker that missed the event. When 
the admin is disabled the timer is absent and the bump is a no-op, leaving the 
broadcast as the only path (unchanged).
   
   ### Tests
   
   `t/control/plugins-reload-reconcile.t` (mirrors 
`t/admin/plugins-reload-reconcile.t`):
   - **TEST 1**: `PUT /v1/plugins/reload` bumps `plugins_conf_version`.
   - **TEST 2**: reproduces a *missed* broadcast by bumping the shared version 
directly (without going through the events layer) and asserts the 
reconciliation timer reloads the worker — i.e. a worker that missed the event 
converges.
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change (no 
user-facing config/behavior change)
   - [x] I have verified that the change follows the existing code style
   


-- 
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]

Reply via email to