Detect situation where resource internal identifier differs.

This means that both nodes have separately managed resources that don't
have the same data.

MFC after:	1 week
This commit is contained in:
Pawel Jakub Dawidek 2011-03-21 14:50:12 +00:00
parent 79d514355c
commit 38ea70cadf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=219830

View File

@ -259,6 +259,19 @@ init_remote(struct hast_resource *res, struct nv *nvin)
memset(map, 0xff, mapsize);
}
nv_add_uint8(nvout, HAST_SYNCSRC_PRIMARY, "syncsrc");
} else if (res->hr_resuid != resuid) {
char errmsg[256];
(void)snprintf(errmsg, sizeof(errmsg),
"Resource unique ID mismatch (primary=%ju, secondary=%ju).",
(uintmax_t)resuid, (uintmax_t)res->hr_resuid);
pjdlog_error("%s", errmsg);
nv_add_string(nvout, errmsg, "errmsg");
if (hast_proto_send(res, res->hr_remotein, nvout, NULL, 0) < 0) {
pjdlog_exit(EX_TEMPFAIL, "Unable to send response to %s",
res->hr_remoteaddr);
}
exit(EX_CONFIG);
} else if (
/* Is primary is out-of-date? */
(res->hr_secondary_localcnt > res->hr_primary_remotecnt &&