[tarantool-patches] Re: [PATCH v2 1/6] refactoring: remove exceptions from triggers except alter.cc

Georgy Kirichenko georgy at tarantool.org
Tue Aug 27 11:29:31 MSK 2019


This patch looks good for me but I would prefer if you didn't change the 
formatting here:

> -static void
> +static int
>  replica_on_applier_state_f(struct trigger *trigger, void *event)
>  {
>  	(void)event;
>  	struct replica *replica = container_of(trigger,
>  			struct replica, on_applier_state);
>  	switch (replica->applier->state) {
> -	case APPLIER_INITIAL_JOIN:
> -		replicaset.is_joining = true;
> -		break;
> -	case APPLIER_JOINED:
> -		replicaset.is_joining = false;
> -		break;
> -	case APPLIER_CONNECTED:
> -		if (tt_uuid_is_nil(&replica->uuid))
> -			replica_on_applier_connect(replica);
> -		else
> -			replica_on_applier_reconnect(replica);
> -		break;
> -	case APPLIER_LOADING:
> -	case APPLIER_DISCONNECTED:
> -		replica_on_applier_disconnect(replica);
> -		break;
> -	case APPLIER_FOLLOW:
> -		replica_on_applier_sync(replica);
> -		break;
> -	case APPLIER_OFF:
> -		/*
> -		 * Connection to self, duplicate connection
> -		 * to the same master, or the applier fiber
> -		 * has been cancelled. Assume synced.
> -		 */
> -		replica_on_applier_sync(replica);
> -		break;
> -	case APPLIER_STOPPED:
> -		/* Unrecoverable error. */
> -		replica_on_applier_disconnect(replica);
> -		break;
> -	default:
> -		break;
> +		case APPLIER_INITIAL_JOIN:
> +			replicaset.is_joining = true;
> +			break;
> +		case APPLIER_JOINED:
> +			replicaset.is_joining = false;
> +			break;
> +		case APPLIER_CONNECTED:
> +			try {
> +				if (tt_uuid_is_nil(&replica->uuid))
> +					replica_on_applier_connect(replica);
> +				else
> +					replica_on_applier_reconnect(replica);
> +			} catch (Exception *e) {
> +				return -1;
> +			}
> +			break;
> +		case APPLIER_LOADING:
> +		case APPLIER_DISCONNECTED:
> +			replica_on_applier_disconnect(replica);
> +			break;
> +		case APPLIER_FOLLOW:
> +			replica_on_applier_sync(replica);
> +			break;
> +		case APPLIER_OFF:
> +			/*
> +			 * Connection to self, duplicate connection
> +			 * to the same master, or the applier fiber
> +			 * has been cancelled. Assume synced.
> +			 */
> +			replica_on_applier_sync(replica);
> +			break;
> +		case APPLIER_STOPPED:
> +			/* Unrecoverable error. */
> +			replica_on_applier_disconnect(replica);
> +			break;
> +		default:
> +			break;
>  	}
>  	fiber_cond_signal(&replicaset.applier.cond);
> +	return 0;
>  }
> 







More information about the Tarantool-patches mailing list