You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.9 KiB

  1. commit ef9b56022c656df34044103a317b7b890ced6628
  2. Author: Willy Tarreau <w@1wt.eu>
  3. Date: Tue Aug 7 10:14:53 2018 +0200
  4. BUG/MEDIUM: servers: check the queues once enabling a server
  5. Commit 64cc49c ("MAJOR: servers: propagate server status changes
  6. asynchronously.") heavily changed the way the server states are
  7. updated since they became asynchronous. During this change, some
  8. code was lost, which is used to shut down some sessions from a
  9. backup server and to pick pending connections from a proxy once
  10. a server is turned back from maintenance to ready state. The
  11. effect is that when temporarily disabling a server, connections
  12. stay in the backend's queue, and when re-enabling it, they are
  13. not picked and they expire in the backend's queue. Now they're
  14. properly picked again.
  15. This fix must be backported to 1.8.
  16. (cherry picked from commit 6a78e61694d69beb49c0e8486be9550f5e8b7d08)
  17. Signed-off-by: Willy Tarreau <w@1wt.eu>
  18. diff --git a/src/server.c b/src/server.c
  19. index 3d6a4093..fbed6cd4 100644
  20. --- a/src/server.c
  21. +++ b/src/server.c
  22. @@ -4774,6 +4774,19 @@ void srv_update_status(struct server *s)
  23. if (prev_srv_count && s->proxy->srv_bck == 0 && s->proxy->srv_act == 0)
  24. set_backend_down(s->proxy);
  25. + /* If the server is set with "on-marked-up shutdown-backup-sessions",
  26. + * and it's not a backup server and its effective weight is > 0,
  27. + * then it can accept new connections, so we shut down all streams
  28. + * on all backup servers.
  29. + */
  30. + if ((s->onmarkedup & HANA_ONMARKEDUP_SHUTDOWNBACKUPSESSIONS) &&
  31. + !(s->flags & SRV_F_BACKUP) && s->next_eweight)
  32. + srv_shutdown_backup_streams(s->proxy, SF_ERR_UP);
  33. +
  34. + /* check if we can handle some connections queued at the proxy. We
  35. + * will take as many as we can handle.
  36. + */
  37. + xferred = pendconn_grab_from_px(s);
  38. }
  39. else if (s->next_admin & SRV_ADMF_MAINT) {
  40. /* remaining in maintenance mode, let's inform precisely about the