[tarantool-patches] Re: [PATCH v2 1/2] swim: disseminate event for log(cluster_size) steps

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Thu Jul 4 02:30:51 MSK 2019


Hi! Thanks for the review!

>> diff --git a/src/lib/swim/swim.c b/src/lib/swim/swim.c
>> index bb9e9f519..9647094f5 100644
>> --- a/src/lib/swim/swim.c
>> +++ b/src/lib/swim/swim.c
>> @@ -616,7 +616,24 @@ swim_register_event(struct swim *swim, struct swim_member *member)
>>  		rlist_add_tail_entry(&swim->dissemination_queue, member,
>>  				     in_dissemination_queue);
>>  	}
>> -	member->status_ttd = mh_size(swim->members);
>> +	/*
>> +	 * Logarithm is a perfect number of disseminations of an
>> +	 * event.
>> +	 *
>> +	 * Firstly, it matches the dissemination speed.
>> +	 *
>> +	 * Secondly, bigger number of disseminations (for example,
>> +	 * linear) causes events and anti-entropy starvation in
>> +	 * big clusters, when lots of events occupy the whole UDP
>> +	 * packet, and factually the same packet content is being
>> +	 * sent for quite a long time. No randomness. Anti-entropy
>> +	 * does not get a chance to disseminate something new and
>> +	 * random. Bigger orders are redundant and harmful.
>> +	 *
>> +	 * Thirdly, logarithm is proved by the original
>> +	 * SWIM paper as the best option.
>> +	 */
>> +	member->status_ttd = ceil(log2(mh_size(swim->members)));

I've changed this place to

    member->status_ttd = ceil(log2(mh_size(swim->members))) + 1;

It allows to do not break the tests in this commit, and fixes a bug,
when status_ttd became negative for 'self'. Because ceil(log2(1)) = 0,
and on a next round step it became -1, -2, etc.

I didn't push the patch yet, if you have anything against that.




More information about the Tarantool-patches mailing list