This operation is only possible for TCP or HTTP proxies. To succeed, the
backend instance must have been first unpublished. Also, all of its servers
- must first be removed (via "del server" CLI).
+ must first be removed (via "del server" CLI). Finally, no stream must still
+ be attached to the backend instance.
There is additional restrictions which prevent backend removal. First, a
backend cannot be removed if it is explicitely referenced by config elements,
cannot be removed if there is a stick-table declared in it. Finally, it is
impossible for now to remove a backend if QUIC servers were present in it.
+ It can be useful to use "wait be-removable" prior to this command to check
+ for the aformentioned requisites. This also provides a methode to wait for
+ the final closure of the streams attached to the target backend.
+
This command is restricted and can only be issued on sockets configured for
level "admin". Moreover, this feature is still considered in development so it
also requires experimental mode (see "experimental-mode on").
specified condition to be satisfied, to unrecoverably fail, or to remain
unsatisfied for the whole <delay> duration. The supported conditions are:
+ - be-removable <proxy> : this will wait for the specified proxy backend to be
+ removable by the "del backend" command. Some conditions will never be
+ accepted (e.g. backend not yet unpublished or with servers in it) and will
+ cause the report of a specific error message indicating what condition is
+ not met. If everything is OK before the delay, a success is returned and
+ the operation is terminated.
+
- srv-removable <proxy>/<server> : this will wait for the specified server to
be removable by the "del server" command, i.e. be in maintenance and no
longer have any connection on it (neither active or idle). Some conditions
ctx->args[1] = ist0(sv_name);
ctx->cond = CLI_WAIT_COND_SRV_UNUSED;
}
+ else if (strcmp(args[2], "be-removable") == 0) {
+ if (!*args[3])
+ return cli_err(appctx, "Missing backend name.\n");
+ ctx->args[0] = strdup(args[3]);
+ if (!ctx->args[0])
+ return cli_err(appctx, "Out of memory trying to clone the backend name.\n");
+ ctx->cond = CLI_WAIT_COND_BE_UNUSED;
+ }
else if (*args[2]) {
/* show the command's help either upon request (-h) or error */
err = "Usage: wait {-h|<duration>} [condition [args...]]\n"
/* here we should evaluate our waiting conditions, if any */
- if (ctx->cond == CLI_WAIT_COND_SRV_UNUSED) {
- /* check if the server in args[0]/args[1] can be released now */
- ret = srv_check_for_deletion(ctx->args[0], ctx->args[1], NULL, NULL, &ctx->msg);
+ if (ctx->cond == CLI_WAIT_COND_SRV_UNUSED ||
+ ctx->cond == CLI_WAIT_COND_BE_UNUSED) {
+ if (ctx->cond == CLI_WAIT_COND_SRV_UNUSED) {
+ /* check if the server in args[0]/args[1] can be released now */
+ ret = srv_check_for_deletion(ctx->args[0], ctx->args[1], NULL, NULL, &ctx->msg);
+ }
+ else {
+ ret = be_check_for_deletion(ctx->args[0], NULL, &ctx->msg);
+ }
if (ret < 0) {
/* unrecoverable failure */