You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cassandra.apache.org by Abdelkrim Fitouri <ab...@gmail.com> on 2018/06/26 22:08:46 UTC

Difference between heartbeat and generation on a Gossip packet

Hello,

I  am studying the gossip part on casssandra and wondering about the
difference between the heartbeat and generation data exchanged for the
autodiscovery.

many thanks for any help.

-- 

Best Regards.

Abdelkarim.

Re: Difference between heartbeat and generation on a Gossip packet

Posted by Abdelkrim Fitouri <ab...@gmail.com>.
Hi Joe,

Thanks for the details it is more clear for me now !

Kind regards.
Abdelkarim.

Le jeu. 28 juin 2018 08:29, Joseph Lynch <jo...@gmail.com> a écrit :

> Hi Abdelkarim,
>
> Other people on this list are much more knowledgeable than me and can
> correct me if I'm wrong, but my understanding is that the combination of
> generation and version (aka heartbeat) form a logical clock tuple
> consisting of (generation, version) and that combination is the
> HeartBeatState.
>
> The generation is the really important part and roughly corresponds to the
> last start time of that particular Cassandra process in seconds since epoch
> plus any forced increments due to e.g. the gossiper stopping or starting
> (nodetool disable/enable gossip). The generation is further stored on disk
> in the system.local table so that during a crash or restart, even if the
> system's clock moves backwards, the Cassandra node's generation should
> never move backwards. Whenever a node's generation number changes it's
> considered a major gossip state update by other nodes because they have to
> do things like ensure they are speaking the right protocol version, compare
> schema, etc ... in addition to all the versioned state changes seen below.
>
> The version is a counter used to show the passage of time within a
> generation and is used to signal versioned gossip state changes. It starts
> at zero on process start and increases by one roughly every second. There
> are various pieces of metadata like a node's status, schema, rack, dc, host
> id, tokens, etc... which are all versioned using this version counter when
> they change (whatever shows up in nodetool gossipinfo is a good example of
> these states). When the gossiper is enabled, every second, each node
> increments
> their local version by one, picks another peer to gossip with, and sends
> out their map of versioned items to that peer; other nodes know to pick up
> any new data if the version has increased. Since nodes are all gossiping
> with each other, any update to one node's versioned data get's propagated
> out quickly even if that node may not have directly gossiped with everyone.
> Naturally, the version number only increases for a given generation, but if
> the generation changes the version moves backwards (resets to zero).
>
> So yea, think of (generation, version) as forming a logical clock which
> roughly corresponds to (~last process start in seconds since the epoch,
> ~seconds since last process start) for each node. This logical clock is
> used to create ordering in gossip state changes.
>
> Hope that was helpful,
> -Joey Lynch
>
> On Tue, Jun 26, 2018 at 3:09 PM Abdelkrim Fitouri <ab...@gmail.com>
> wrote:
>
> > Hello,
> >
> > I  am studying the gossip part on casssandra and wondering about the
> > difference between the heartbeat and generation data exchanged for the
> > autodiscovery.
> >
> > many thanks for any help.
> >
> > --
> >
> > Best Regards.
> >
> > Abdelkarim.
> >
>

Re: Difference between heartbeat and generation on a Gossip packet

Posted by Joseph Lynch <jo...@gmail.com>.
Hi Abdelkarim,

Other people on this list are much more knowledgeable than me and can
correct me if I'm wrong, but my understanding is that the combination of
generation and version (aka heartbeat) form a logical clock tuple
consisting of (generation, version) and that combination is the
HeartBeatState.

The generation is the really important part and roughly corresponds to the
last start time of that particular Cassandra process in seconds since epoch
plus any forced increments due to e.g. the gossiper stopping or starting
(nodetool disable/enable gossip). The generation is further stored on disk
in the system.local table so that during a crash or restart, even if the
system's clock moves backwards, the Cassandra node's generation should
never move backwards. Whenever a node's generation number changes it's
considered a major gossip state update by other nodes because they have to
do things like ensure they are speaking the right protocol version, compare
schema, etc ... in addition to all the versioned state changes seen below.

The version is a counter used to show the passage of time within a
generation and is used to signal versioned gossip state changes. It starts
at zero on process start and increases by one roughly every second. There
are various pieces of metadata like a node's status, schema, rack, dc, host
id, tokens, etc... which are all versioned using this version counter when
they change (whatever shows up in nodetool gossipinfo is a good example of
these states). When the gossiper is enabled, every second, each node increments
their local version by one, picks another peer to gossip with, and sends
out their map of versioned items to that peer; other nodes know to pick up
any new data if the version has increased. Since nodes are all gossiping
with each other, any update to one node's versioned data get's propagated
out quickly even if that node may not have directly gossiped with everyone.
Naturally, the version number only increases for a given generation, but if
the generation changes the version moves backwards (resets to zero).

So yea, think of (generation, version) as forming a logical clock which
roughly corresponds to (~last process start in seconds since the epoch,
~seconds since last process start) for each node. This logical clock is
used to create ordering in gossip state changes.

Hope that was helpful,
-Joey Lynch

On Tue, Jun 26, 2018 at 3:09 PM Abdelkrim Fitouri <ab...@gmail.com>
wrote:

> Hello,
>
> I  am studying the gossip part on casssandra and wondering about the
> difference between the heartbeat and generation data exchanged for the
> autodiscovery.
>
> many thanks for any help.
>
> --
>
> Best Regards.
>
> Abdelkarim.
>

Re: Difference between heartbeat and generation on a Gossip packet

Posted by Jordan West <jo...@gmail.com>.
On Tue, Jun 26, 2018 at 3:08 PM, Abdelkrim Fitouri <ab...@gmail.com>
wrote:

> Hello,
>
> I  am studying the gossip part on casssandra and wondering about the
> difference between the heartbeat and generation data exchanged for the
> autodiscovery.
>
> many thanks for any help.
>

If you haven’t had a chance to check it out, Jason Brown’s Cassandra Summit
talk on gossip is a great resource:
https://www.youtube.com/watch?v=FuP1Fvrv6ZQ. Details about
heartbeat/generation start around 6 minutes in.

Jordan

>
> --
>
> Best Regards.
>
> Abdelkarim.
>