[tarantool-patches] Re: [PATCH 2/2] swim: introduce generation

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Fri Jun 21 22:03:31 MSK 2019



On 21/06/2019 08:53, Konstantin Osipov wrote:
> * Vladislav Shpilevoy <v.shpilevoy at tarantool.org> [19/06/21 00:25]:
> 
> Generation and incarnation look and sound similar, so it is hard
> to tell which is which.
> 
> I'd like to suggest renaming 'generation' to 'epoch'.
> 
> "Age" would be a wrong name for a pair "epoch" + "incarnation".
> 
> Besides, swim's term for the counter is "incarnation", so I would
> stick to the swim terminology.
> 
> I suggest this:
> 
> struct swim_incarnation {
>     int64_t term; // Derived from RAFT word "term", persisted between restarts
>     int64_t version; // Reflects swim member state version
> };
> 
> I am open to alternatives too.
> 

Basically, you do not like that I kept generation out of incarnation.
I did it deliberately to emphasize that SWIM's incarnation is not the
same as our 'age'. Additionally, it allows not to change API and keep
incarnation as a simple number. If we say, that incarnation is a structure,
then I am not sure how to return it in public API. Split all methods
operating on incarnation in 2 parts?

Assume, that we decided to split, and can encapsulate everything inside
the incarnation.

'version' for volatile part sounds good. 'term' does not. Raft uses
'term' as a version of round, not a version of an instance. It is about
cluster state, not an instance state. 'epoch' is the same IMO. Furthermore,
both 'epoch' and 'term' are dynamic usually.

'Generation' was perfect - it means 'поколение'. And it is logically to
increment it only when an instance dies and starts again, and never
change during lifetime.

If you still think, that the complex incarnation is the best, I suggest

    incarnation = { generation, version }

It leads to the following changes in the API.

    - member:incarnation()
    + member:generation()
    + member:version()

Method event:is_new_incarnation() will return true if generation or
version are changed. To check which one a user will use

    event:is_new_version()
    event:is_new_generation()



But I think, that current 'age' solution is better. It allows to do
not touch core SWIM concept 'incarnation'.

I am waiting for your decision on what to do.




More information about the Tarantool-patches mailing list