[Tarantool-patches] [PATCH 02/17] recovery: convert WalSubscription class to structure

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sun May 3 21:42:53 MSK 2020


Thanks for the patch!

See 3 comments below.

> diff --git a/src/box/recovery.cc b/src/box/recovery.cc
> index 1d0e80057..76b771a91 100644
> --- a/src/box/recovery.cc
> +++ b/src/box/recovery.cc
> @@ -375,83 +375,92 @@ recovery_finalize(struct recovery *r)
>   * file triggers a wakeup. The WAL dir path is set in the
>   * constructor. XLOG file path is set with set_log_path().

1. Maybe it is worth changing set_log_path() to
wal_subscr_set_log_path().

>   */
> -class WalSubscription {
> -public:
> -	struct fiber *f;
> -	unsigned events;
> -	struct ev_stat dir_stat;
> -	struct ev_stat file_stat;
> -	char dir_path[PATH_MAX];
> -	char file_path[PATH_MAX];
> -
> -	static void dir_stat_cb(struct ev_loop *, struct ev_stat *stat, int)
> -	{
> -		((WalSubscription *)stat->data)->wakeup(WAL_EVENT_ROTATE);
> -	}
> -
> -	static void file_stat_cb(struct ev_loop *, struct ev_stat *stat, int)
> -	{
> -		((WalSubscription *)stat->data)->wakeup(WAL_EVENT_WRITE);
> -	}
> +struct wal_subscr {

2. Lets better not truncate the name. 'subscr' looks ugly.
'wal_subscription' is a fine name, not too long. If you are strictly
against 'subscription', 'wal_sub' would be better too, IMO. At least
it is pronounceable.

> +	struct fiber	*f;
> +	unsigned int	events;
> +	struct ev_stat	dir_stat;
> +	struct ev_stat	file_stat;
> +	char		dir_path[PATH_MAX];
> +	char		file_path[PATH_MAX];

3. Please, don't align struct members. That is not our code style
and creates problems, when a new member is added with a too long
type name.


More information about the Tarantool-patches mailing list