Execute hook when split-brain is detected.
MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
This commit is contained in:
parent
6d0c801ea9
commit
2be8fd75ff
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=211983
@ -232,6 +232,11 @@ between the nodes.
|
|||||||
.Pp
|
.Pp
|
||||||
Executed on both primary and secondary nodes when resource role is changed.
|
Executed on both primary and secondary nodes when resource role is changed.
|
||||||
.Pp
|
.Pp
|
||||||
|
.It Ic "<path> split-brain <resource>"
|
||||||
|
.Pp
|
||||||
|
Executed on both primary and secondary nodes when split-brain condition is
|
||||||
|
detected.
|
||||||
|
.Pp
|
||||||
.El
|
.El
|
||||||
The
|
The
|
||||||
.Aq path
|
.Aq path
|
||||||
|
@ -498,6 +498,7 @@ init_remote(struct hast_resource *res, struct proto_conn **inp,
|
|||||||
assert(real_remote(res));
|
assert(real_remote(res));
|
||||||
|
|
||||||
in = out = NULL;
|
in = out = NULL;
|
||||||
|
errmsg = NULL;
|
||||||
|
|
||||||
/* Prepare outgoing connection with remote node. */
|
/* Prepare outgoing connection with remote node. */
|
||||||
if (proto_client(res->hr_remoteaddr, &out) < 0) {
|
if (proto_client(res->hr_remoteaddr, &out) < 0) {
|
||||||
@ -673,6 +674,8 @@ init_remote(struct hast_resource *res, struct proto_conn **inp,
|
|||||||
}
|
}
|
||||||
return (true);
|
return (true);
|
||||||
close:
|
close:
|
||||||
|
if (errmsg != NULL && strcmp(errmsg, "Split-brain condition!") == 0)
|
||||||
|
hook_exec(res->hr_exec, "split-brain", res->hr_name, NULL);
|
||||||
proto_close(out);
|
proto_close(out);
|
||||||
if (in != NULL)
|
if (in != NULL)
|
||||||
proto_close(in);
|
proto_close(in);
|
||||||
|
@ -323,6 +323,7 @@ init_remote(struct hast_resource *res, struct nv *nvin)
|
|||||||
if (res->hr_secondary_localcnt > res->hr_primary_remotecnt &&
|
if (res->hr_secondary_localcnt > res->hr_primary_remotecnt &&
|
||||||
res->hr_primary_localcnt > res->hr_secondary_remotecnt) {
|
res->hr_primary_localcnt > res->hr_secondary_remotecnt) {
|
||||||
/* Exit on split-brain. */
|
/* Exit on split-brain. */
|
||||||
|
hook_exec(res->hr_exec, "split-brain", res->hr_name, NULL);
|
||||||
exit(EX_CONFIG);
|
exit(EX_CONFIG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -373,6 +374,7 @@ hastd_secondary(struct hast_resource *res, struct nv *nvin)
|
|||||||
if (proto_timeout(res->hr_remoteout, res->hr_timeout) < 0)
|
if (proto_timeout(res->hr_remoteout, res->hr_timeout) < 0)
|
||||||
pjdlog_errno(LOG_WARNING, "Unable to set connection timeout");
|
pjdlog_errno(LOG_WARNING, "Unable to set connection timeout");
|
||||||
|
|
||||||
|
hook_init();
|
||||||
init_local(res);
|
init_local(res);
|
||||||
init_remote(res, nvin);
|
init_remote(res, nvin);
|
||||||
init_environment();
|
init_environment();
|
||||||
|
Loading…
Reference in New Issue
Block a user