changeset 19406:63516762a64c

director: With director_consistent_hashing=yes hosts_hash wasn't always calculated right. If different servers had added hosts in different order, the hosts_hash would have become different, which caused errors and resyncs.
author Timo Sirainen <tss@iki.fi>
date Mon, 23 Nov 2015 19:35:03 +0200
parents 194e3622d5e6
children 39cfca637d60
files src/director/mail-host.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/director/mail-host.c	Wed Nov 18 16:33:26 2015 +0200
+++ b/src/director/mail-host.c	Mon Nov 23 19:35:03 2015 +0200
@@ -99,8 +99,6 @@
 	struct mail_host *const *hostp;
 	unsigned int i;
 
-	array_sort(&list->hosts, mail_host_cmp);
-
 	/* rebuild vhosts */
 	array_clear(&list->vhosts);
 	array_foreach(&list->hosts, hostp) {
@@ -119,6 +117,8 @@
 	struct mail_host *const *hostp;
 	uint32_t num;
 
+	array_sort(&list->hosts, mail_host_cmp);
+
 	if (list->consistent_hashing)
 		mail_hosts_sort_ring(list);
 	else