2.2.1 • Published 3 years ago

qtopology-mysql v2.2.1

Weekly downloads
2
License
ISC
Repository
github
Last release
3 years ago

qtopology-mysql

npm Build status

This package contains coordination-storage plugin for QTopology that uses MySQL database to store and manipulate coordination data.

NPM package: https://www.npmjs.com/package/qtopology-mysql

Installation

npm install qtopology-mysql

Initialization

The database doesn't need to be prepared in advance. All the objects will be created automatically, using the scripts in the db directory:

  • init.sql - create initial database state that will be used to upgrade schema to latest version.
  • reset.sql - resets database schema to the initial state. Removes all data, tables and stored procedures.
  • clear.sql - just erases all data, but leaves schema in tact. Should be used on the latest schema.
  • vX.sql - version upgrades.

Each time the coordinator is instantiated, it first peforms database initialization by executing these steps:

run init.js
fetch version from database
detect version-upgrade files that need to be run
for each upgrade file
    run file
    update version

If database schema is already at the latest version, then nothing happens.

Database schema

Tables

TableDescription
qtopology_settingsSimple settings, also contains version information
qtopology_workerList of workers, their statuses and latest pings
qtopology_topologyList of topologies, their statuses and latest pings
qtopology_messageMessage queue for workers
qtopology_worker_historyList of important changes inside qtopology_worker table
qtopology_topology_hostoryList of important changes inside qtopology_topology table

Stored procedures

TableDescription
qtopology_sp_add_topology_historyEnters new historical record for topology
qtopology_sp_add_worker_historyEnters new historical record for worker
qtopology_sp_announce_leader_candidacySets status for given worker that it is a candidate for leadership
qtopology_sp_check_leader_candidacyChecks if leadership candidacy succeeded for given worker
qtopology_sp_disable_defunct_leadersDisables leaders that have been inactive too long or are marked as dead
qtopology_sp_disable_defunct_workersDisables workers that have been inactive too long or are marked as dead
qtopology_sp_leader_pingUpdates last ping for given leader
qtopology_sp_worker_pingUpdates last ping for given worker, doesn't change status
qtopology_sp_messages_for_workerRetrieves messages for single worker
qtopology_sp_refresh_statusesRefreshes all statuses by calling other stored procedures that update inactive workers etc.
qtopology_sp_register_topologyRegisters new topology. If topology exists, it is overwritten.
qtopology_sp_register_workerRegisters new worker. If worker exists, it is overwritten.
qtopology_sp_unassign_waiting_topologiesSets topologies that have been assigned a while ago but are not running as unassigned.
qtopology_sp_worker_statusesCounts how many workers are in certain leadership status.
2.2.1

3 years ago

2.2.0

4 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.6

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.4.0

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.5

7 years ago

1.2.4

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.4.2

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.2.0

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago