You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 20 Next »

IDIEP-77
Author Aleksandr Polovtsev
Sponsor
Created

  

StatusDRAFT


Motivation

Ignite clusters are required to have a dynamically changing topology due to the nature of distributed systems - nodes can fail and need to be restarted at any time, so new nodes can be introduced or removed from the cluster. Users expect that topology changes do not break the consistency of the cluster and it remains operational.

Description

Problem statement

This document describes the process of creating a cluster of Ignite nodes and adding new nodes to it. It describes the following concepts:

  1. Cluster setup - the process of assembling a predefined set of nodes into a cluster and preparing it for the next lifecycle steps;
  2. Cluster initialization - according to the Node Lifecycle description, a cluster can exist in a "zombie" state, until an "init" command is sent by the system administrator;
  3. Node validation - in order to maintain the cluster configuration in a consistent state, the joining nodes should be compatible with all of the existing cluster nodes. Compatibility is ensured by validating nodes' properties, which may include some local properties (Ignite product version, Cluster Tag), as well as distributed properties from the Meta Storage. NB: it is currently unclear what properties should be retrieved from the Meta Storage, however, it was decided to keep this concept for possible future features implementation.

Terminology

Init command

The "init" command moves the cluster from the "zombie" state into the "active" state. It is supposed to have the following characteristics (note that the "init" command has not been specified at the moment of writing and is out of scope of this document, so all statements are approximate and can change in the future):

  1. It should deliver the following information: addresses of the nodes that host the Meta Storage Raft group and the Cluster Tag (described below).
  2. It should deliver this information atomically, i.e. either all nodes enter the "active" state or none.

Initialized and empty nodes

This document uses a notation of "initialized" and "empty" nodes. An initialized node is a node that has received and successfully applied the "init" command sometime in its lifetime and therefore possesses the Cluster Tag and the Meta Storage Topology version. An empty node is a node that has never received nor applied the "init" command and therefore does not possess the aforementioned properties.

Meta Storage Topology Version

Meta Storage Topology Version is a property that should be used to compute the most "recent" state of a given Meta Storage configuration. At the moment of writing, Meta Storage configuration consists of a list of cluster node names that host the Meta Storage Raft group. A possible implementation can be a monotonically increasing counter, which is increased each time this list is updated.

Join Coordinator

The node join process is proposed to be made centralized: a single node is granted the role of the Join Coordinator which is responsible of orchestrating the cluster lifecycle and validating new nodes.

Cluster Tag

A cluster tag is a string that uniquely identifies a cluster. It is generated once per cluster and is distributed across the nodes during the node join process. The purpose of a cluster tag is to understand whether a joining node used to be a member of another cluster, in which case its Meta Storage Topology Version is not comparable and the joining node should be rejected. In other words, Cluster Tag, together with the Meta Storage Topology Version, creates a partial ordering that allows to compare different Meta Storage configurations.

A cluster tag should consist of two parts:

  1. Human-readable part (Cluster Name): a string property that is set by the system administrator. Its purpose is to make the debugging and error reporting easier.
  2. Unique part (Cluster ID): a generated unique string (e.g. a UUID). Its purpose is to ensure that Cluster Tags are different between different clusters.

DISCUSSION NEEDED: human-readable part can also be generated automatically, similar to Ignite 2.

Implementation details

Join Coordinator election

NOTE: this section is not described as thorough as it needs to be in order to save some time and finalize the election protocol after a discussion.

Before the nodes can start joining a cluster, a node should be elected as the Join Coordinator. For the sake of simplicity, the following algorithm is proposed, which can later be replaced with something more sophisticated:

  1. Given a list of initial cluster members, choose the "smallest" address (for example, using an alphanumeric order), which will implicitly be considered the Join Coordinator. This requires all nodes to have the IP Finder configuration (used to obtain the initial cluster member list) to be identical on all initial cluster members.
  2. If the "smallest" address is unavailable, all other nodes should fail to start after a timeout and should be manually restarted.

DISCUSSION NEEDED: What to do when constructing a cluster from some amount of stopped nodes with different Meta Storage configuration? Should it be overridden by the "init" command?

DISCUSSION NEEDED:  What if we are restarting a cluster and also introducing a new node? What if it is elected as the coordinator?

DISCUSSION NEEDED:  Can we actually use Raft and use its leader as the Join Coordinator? Can we use Raft's log to store the Meta Storage Topology Version? This way, it will be possible

TODO: describe coordinator re-election.

Initial cluster setup

This section describes the process of assembling a new Ignite cluster from a set of nodes.

  1. Initial set of nodes is configured, including the following properties:
    1. A subset of nodes (minimum 1, more can be specified to increase startup reliability) in the initial cluster setup (provided by the IP Finder).
  2. A Join Coordinator is elected (see Join Coordinator election);
  3. The Join Coordinator generates a Cluster Tag (if it hasn't already been generated);
  4. All other nodes connect to the Coordinator and provide the following information:
    1. Ignite product version;
    2. Cluster Tag, if any (if a node has obtained it at any time during its life);
    3. Meta Storage Topology version, if any (if a node has obtained it at any time during its life).
  5. All of the aforementioned parameters get compared with the information stored on the Coordinator, and if all of the parameters are the same, the joining node is allowed into the cluster. Otherwise, the joining node is rejected.
  6. Join Coordinator adds the new node to the list of validated nodes. This can be implemented using different approaches, for example it is possible to piggyback on the current Cluster Membership implementation (ScaleCube) and to modify its transport protocol so that only valid nodes will be visible to others (similar to the implementation of the Handshake Protocol). Another way is to explicitly store and maintain a list of valid nodes in the Meta Storage.
  7. If the joining node is allowed to enter the topology, it receives the following parameters from the Coordinator:
    1. Cluster Tag.

DISCUSSION NEEDED: What to do if the Coordinator dies during any step of the setup process.

Cluster initialization

This section describes the next step of the Ignite cluster lifecycle: moving the nodes from the "zombie" state into the "active" state.

  1. After the cluster has been established, it remains in the "zombie" state, until the "init" command arrives;
  2. "Init" command is sent by the administrator either directly to the Join Coordinator, or to any other node, in which case it should be redirected to the Join Coordinator;
  3. The "init" command should specify the following information:
    1. List of addresses of the nodes that should host the Meta Storage Raft group (a.k.a. Meta Storage Configuration).
  4. The Join Coordinator generates the initial Meta Storage Topology Version property (if it hasn't already been generated);
  5. The Join Coordinator atomically broadcasts the Meta Storage Configuration to all valid nodes in the topology. If this step is successful, then Meta Storage is considered to be initialized and available;
  6. The Join Coordinator persists the following information into the Meta Storage (therefore propagating it to all nodes):
    1. Meta Storage Topology Version.

DISCUSSION NEEDED: What to do if the Coordinator dies during any step of the initialization process.

Adding a new node to a running cluster

This section describes a scenario when a new node wants to join an initialized cluster. Depending on the node configuration, there exist multiple possible scenarios:

Empty node joins a cluster

If an empty node tries to join a cluster the following process is proposed:

  1. The new node connects to a random node. If this node is not the Join Coordinator, the random node redirects the new node to it.
  2. The new node provides its Ignite product version and is validated on the Coordinator (see Initial cluster setup).
  3. If the validation is successful, the new node is added to the list of validated nodes and receives the list of Meta Storage hosts as the response.

In case of errors or a timeout, the whole process should be repeated by the joining node.

Initialized node joins a cluster

If an initialized node tries to join a cluster the following process is proposed:

  1. The new node connects to a random node. If this node is not the Join Coordinator, the random node redirects the new node to it.
  2. The joining node connect to the Coordinator and provide the following information:
    1. Ignite product version;
    2. Cluster Tag;
    3. Meta Storage Topology Version.
  3. If the Cluster Tag and the Ignite product version do not match with the ones stored on the Coordinator, the node is rejected. If they match, the Meta Storage Topology Version is compared. If the node's Meta Storage Topology Version is smaller or equal to the Version on the Coordinator, it is allowed to enter the topology and the updates its Meta Storage Configuration.

DISCUSSION NEEDED: What to do if the joining node's Meta Storage Topology Version is greater than the Version stored on the Coordinator?

Changes in API

TODO

Risks and Assumptions

  1. "Init" command is not fully specified and can influence the design.
  2. Proposed implementation does not discuss message encryption and security credentials.

Discussion Links

TODO

Reference Links

  1. IEP-73: Node startup
  2. https://github.com/apache/ignite-3/blob/main/modules/runner/README.md
  3. IEP-67: Networking module
  4. IEP-61: Common Replication Infrastructure

Tickets

Unable to render Jira issues macro, execution error.

  • No labels