Ericsson / ecchronos

Ericsson distributed repair scheduler for Apache Cassandra
Apache License 2.0
28 stars 35 forks source link

Create EccNodesSync Object to Represent Table nodes_sync #672

Open VictorCavichioli opened 4 weeks ago

VictorCavichioli commented 4 weeks ago

Story Description: To keep ecchronos instances on sync is proposed to create a sync table, this table is not fully designed yet and might change on the future, but for the initial PoC is proposed to follow the below CQL definition:

CREATE TABLE ecchronos.nodes_sync
(
    ecchronos_id TEXT,
    datacenter_name TEXT,
    node_id UUID,
    node_endpoint TEXT,
    node_status TEXT,
    last_connection TIMESTAMP,
    next_connection TIMESTAMP,
    PRIMARY KEY
    (
        ecchronos_id,
        datacenter_name,
        node_endpoint,
        node_status
    )
) WITH CLUSTERING ORDER BY(
    datacenter_name DESC,
    node_endpoint DESC,
    node_status DESC
);

Is proposed to create a new package called sync in the core module with the designed class, at the beginning the insertStatement function is mandatory.

Acceptance Criteria:

Definition of Done:

Code designed as described and approved by the maintainers

Notes:

Use EccRepairHistory as an inspiration.

Related to #652

paulchandler commented 3 weeks ago

I would recommend the following primary key PRIMARY KEY ( ecchronos_id, datacenter_name, node_id )

node_status should not be in there, or else you would have to delete and re insert the record when the status changes. node_id should be used rather rather than node_endpoint as this will not change when the echronos is restarted by k8s.

VictorCavichioli commented 3 weeks ago

Hi @paulchandler , thank you for your comment, the design for that table would be now this:

CREATE TABLE ecchronos.nodes_sync
(
    ecchronos_id TEXT,
    datacenter_name TEXT,
    node_id UUID,
    node_endpoint TEXT,
    node_status TEXT,
    last_connection TIMESTAMP,
    next_connection TIMESTAMP,
    PRIMARY KEY
    (
        ecchronos_id,
        datacenter_name,
        node_id
    )
) WITH CLUSTERING ORDER BY(
    datacenter_name DESC,
    node_id DESC
);