yanglimingcn commented on PR #3750: URL: https://github.com/apache/brpc/pull/3750#issuecomment-7029642111
The design of commit `4f4df926a30bdbf0b32126227beaadcb2ab302f0` is based on the following assumptions: - **Per-tag lifecycle independence:** Each tag owns and synchronizes its own poller group. Initialization, failure, rollback, and release of one tag must not depend on or modify another tag. - **One-time initialization:** A successfully initialized tag remains initialized. Repeated initialization calls are no-ops and must not create additional pollers or replace callbacks. - **Permanent creation failure:** If any poller cannot be created, the entire initialization attempt fails permanently. Subsequent calls return the original error without retrying, even if the underlying failure was transient. - **All-or-nothing batch startup:** A batch succeeds only after every poller has been created. Pollers wait on a startup gate and do not execute user callbacks until the complete batch is ready. - **No callbacks for an aborted batch:** If creation fails partway through, already-created pollers are awakened with `ABORTED` and exit without running `init_fn`, `callback`, or `release_fn`. - **Synchronous rollback:** Initialization holds the per-tag lifecycle lock while waking and joining already-created pollers. Competing initialization or release calls cannot observe an intermediate rollback state or return prematurely. - **Separation of startup and stopping:** `startup_result` controls startup synchronization, while `running` only controls the polling loop. A successful batch must still execute all initialization callbacks even if shutdown begins before some pollers are scheduled. - **Asynchronous initialization callbacks:** Successful initialization means all poller threads were created, not that every `init_fn` has completed. Once the batch is released through the startup gate, callbacks may coordinate with one another. - **Release is final shutdown:** Release is intended to be called from outside poller callbacks during final shutdown. It joins active pollers and prevents future initialization with `ESHUTDOWN`; it is not a pause/restart operation. - **Stable group storage:** Poller groups and their sizes are expected to be configured before use and not resized or destroyed while pollers are still running. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
