Skip to content

Schema Distribution

Pekka Enberg edited this page Jul 22, 2015 · 2 revisions

Schema definitions such as keyspaces and tables are stored in system tables. When the schema is changed, nodes in a cluster are notified of the changes via schema push mechanism. If a node was down during a schema change, it will use the schema pull mechanism to synchronize with the rest of the cluster at startup.

Push

Push happens whenever a schema is changed (e.g. CREATE KEYSPACE) via migration manager. This makes schema changes visible across all available nodes in the cluster. The local node sends schema change mutations in a DEFINITIONS_UPDATE message to all live members. Each node that receives the message, applies the mutations via schema merging.

Pull

Schema pull is triggered when a the onAlive(), onChange(), onJoin() event handlers in StorageService are invoked.

Here's the sequence of events in Origin:

  1. At node boostrap, MigrationManager.scheduleSchemaPull() is invoked.
  2. The scheduleSchemaPull() function submits a MigrationTask is which sends a MIGRATION_REQUEST.
  3. An endpoint responds with INTERNAL_RESPONSE that includes a list of mutations returned from LegacySchemaTables.convertSchemaToMutations().
  4. The bootrapping node applies the mutations via LegacySchemaTables.mergeSchema().
Clone this wiki locally