bhouse-nexthop commented on PR #14640:
URL: https://github.com/apache/cloudstack/pull/14640#issuecomment-7317132770

   @DaanHoogland thanks for the close read, and @jmsperu thanks for measuring 
it.
   
   **Only one command after an aggregated set?** No. The first Finish applies 
the queue and removes it. Every later command for that router, from any job, 
finds no queue and is applied directly on its own, as before this PR (jmsperu's 
first table: 3 later commands, 3 applies). The "only one" in the code is the 
stored failure, not the commands.
   
   **One failure per router: will that do?** No, not in all cases. jmsperu's 
runs show two where it gives the wrong answer:
   - A joined job's shared apply failed. Then an unrelated aggregation on the 
same router succeeded before the joined job's Finish, and that Finish reported 
success.
   - The agent restarted after a Start with a command queued. The Finish found 
no queue and reported success, though nothing reached the router. Before this 
PR, that Finish failed with the NPE.
   
   The root cause is that Start, the queued commands and Finish carry no job 
identity. The agent can't tell which aggregation a Finish belongs to, so any 
per-router bookkeeping guesses. I tried counting joins instead, but a joined 
job whose Finish never comes (its reprogram step failed) still hands its result 
to someone else's Finish.
   
   What I'd propose instead:
   - The management server puts an aggregation id (a UUID) in the access 
details of the Start, of the commands it queues, and of the Finish.
   - The agent keys the queue and its result by that id. A Finish gets exactly 
the result of the apply its own commands were in.
   - A Finish with an unknown id fails, rather than reporting success for 
commands that may never have reached the router.
   
   This changes both sides and needs a fresh test. Would you like it in this 
PR, or this PR as it is (which removes the NPE and the dropped commands) with 
the id in a follow-up? Either way I'll take your two suggestions: the fields 
without the leading underscore, and a comment on each map saying what it holds.
   


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