diff options
author | pjd <pjd@FreeBSD.org> | 2011-03-21 14:50:12 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2011-03-21 14:50:12 +0000 |
commit | 421e84b77e740bfade4f141a097f2a557147b1a2 (patch) | |
tree | db0fe0b9bb85e35b269f2c2de4145e48c3d1efa3 /sbin/hastd | |
parent | 1231af61c3fe3cf68ce8dac91f917971217eda12 (diff) | |
download | FreeBSD-src-421e84b77e740bfade4f141a097f2a557147b1a2.zip FreeBSD-src-421e84b77e740bfade4f141a097f2a557147b1a2.tar.gz |
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
Diffstat (limited to 'sbin/hastd')
-rw-r--r-- | sbin/hastd/secondary.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sbin/hastd/secondary.c b/sbin/hastd/secondary.c index e718b2c..cf27789 100644 --- a/sbin/hastd/secondary.c +++ b/sbin/hastd/secondary.c @@ -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 && |