[tarantool-patches] Re: [PATCH 6/6] [RAW] swim: introduce failure detection component
Konstantin Osipov
kostja at tarantool.org
Fri Mar 29 21:59:20 MSK 2019
* Vladislav Shpilevoy <v.shpilevoy at tarantool.org> [19/03/20 14:11]:
>
>
> +/**
> + * Decode a failure detection message. Schedule acks, process
> + * acks.
> + */
> +static int
> +swim_process_failure_detection(struct swim *swim, const char **pos,
> + const char *end, const struct sockaddr_in *src,
> + const struct tt_uuid *uuid)
> +{
> + const char *prefix = "invalid failure detection message:";
> + struct swim_failure_detection_def def;
> + struct swim_member_def mdef;
> + if (swim_failure_detection_def_decode(&def, pos, end, prefix) != 0)
> + return -1;
> + say_verbose("SWIM %d: process failure detection's %s", swim_fd(swim),
> + swim_fd_msg_type_strs[def.type]);
> + swim_member_def_create(&mdef);
> + mdef.addr = *src;
> + mdef.incarnation = def.incarnation;
> + mdef.uuid = *uuid;
> + struct swim_member *member = swim_upsert_member(swim, &mdef);
> + if (member == NULL)
> + return -1;
> + if (def.incarnation < member->incarnation)
> + return 0;
I think this branch a comment. Why do you not respond to pings
from older incarnations?
> + if (no_acks_to_gc >= 0)
> + swim->no_acks_to_gc = no_acks_to_gc;
Why do you actually need a custom no_acks_to_gc? Could you please
add a comment for this variable declaration?
> +enum {
> + /**
> + * Value being used to say that unacknowledged pings
> + * should not affect a certain decision about member. For
> + * example, regardless of number of unacked pings, never
> + * drop a member.
> + */
> + SWIM_NO_ACKS_IGNORE = INT_MAX,
> +};
OK, now I get it. You use it to pin members. I would actually use
bool is_pinned for that. It seems you make no_acks_to_gc a
variable only to use it for pinning. Let's add a separate varaible
for pins.
> +/**
> + * Send a ping to this address. If an ACK is received, the member
> + * will be added.
Could you also please explain in the comment why this is useful?
E.g. why would I want to add a member only after a successful
ping/ack?
> + */
> +int
> +swim_probe_member(struct swim *swim, const char *uri);
> +
> + SWIM_FD_MSG_TYPE,
The patch is generally OK to push after fixing the minor comments
above. I also changed a few comments on the branch.
--
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov
More information about the Tarantool-patches
mailing list