[tarantool-patches] Re: [tarantool-patches] Re: [PATCH 2/2] replication: display downstream status at upstream

Konstantin Belyavskiy k.belyavskiy at tarantool.org
Tue May 22 13:44:06 MSK 2018


Kirill,
thank you for mention that. In earlier version relay could be a NULL pointer but now
it could be deleted only with replica.
So it's outdated code.
> + assert(replica->relay);


>Вторник, 22 мая 2018, 10:08 +03:00 от Kirill Yukhin <kyukhin at tarantool.org>:
>
>Hello Kostya,
>On 21 мая 20:07, Konstantin Belyavskiy wrote:
>> This fix improves 'box.info.replication' output.
>> If downstream fails and thus disconnects from upstream, improve
>> logging by printing 'status: disconnected' and error message on
>> both sides (master and replica).
>> 
>> Closes #3365
>> ---
>> diff --git a/src/box/lua/info.c b/src/box/lua/info.c
>> index 9dbc3f92c..8f358d04e 100644
>> --- a/src/box/lua/info.c
>> +++ b/src/box/lua/info.c
>> @@ -148,6 +148,23 @@ lbox_pushreplica(lua_State *L, struct replica *replica)
>>  	if (relay_get_state(replica->relay) == RELAY_FOLLOW) {
>>  		lua_pushstring(L, "downstream");
>>  		lbox_pushrelay(L, relay);
>> +		lua_settable(L, -3);
>> +	} else if (relay_get_state(replica->relay) == RELAY_STOPPED) {
>> +		lua_pushstring(L, "downstream");
>> +
>> +		lua_newtable(L);
>> +		lua_pushstring(L, "status");
>> +		lua_pushstring(L, "stopped");
>> +		lua_settable(L, -3);
>> +
>> +		assert(replica->relay);
>Few lines above you dereferenced replica (in if-stmt). Why this assert?
>If it is necessary, please note that relay is a pointer and should be compared
>against NULL according to coding style.
>
>--
>Regards, Kirill Yukhin
>


Best regards,
Konstantin Belyavskiy
k.belyavskiy at tarantool.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20180522/018494e7/attachment.html>


More information about the Tarantool-patches mailing list