Back to Cadence

Overview

docs/cassandra-executions-table.md

1.4.07.0 KB
Original Source

Overview

The executions table in Cassandra is a table used for storing mutiple types of entities, because Cassandra doesn't support cross-table LWTs. The type column in executions table indicates the type of entity stored in that row. Since the table stores all the entities, the columns are the union set of columns of all entities. And the data in each column have different meaning for different type of entities. We'll explain for each type of entity the usage of the columns in executions table.

Shard

The shard entities are the rows with type=0, which stores the information of Cadence shards. The following columns are used:

  • shard_id: the id of the Cadence shard
  • type: indicates the type of entity, which is always 0 for shard
  • shard: stores the information of shard
  • range_id: used to manage changes to the shard's configuration and ownership

Other columns are set to a constant only because they're part of primary key columns:

  • domain_id: 10000000-1000-f000-f000-000000000000
  • workflow_id: 20000000-1000-f000-f000-000000000000
  • run_id: 30000000-1000-f000-f000-000000000000
  • visibility_ts: 2000-01-01 00:00:00.000000+0000
  • task_id: -11

Execution

The execution entities are the rows with type=1, which stores the information of workflow. And there are 2 types of executions: current_execution and concrete_execution.

Current Execution

The current_execution entities has a constant value in the run_id column which equals 30000000-0000-f000-f000-000000000001. The follwing columns are set:

  • shard_id: the id of the Cadence shard
  • type: indicates the type of the entity
  • domain_id: the id of the domain of the workflow
  • workflow_id: the id of the workflow
  • current_run_id: the run_id of the most recent workflow among the workflows with the same workflow_id
  • execution: stores some information about the workflow
  • workflow_last_write_version: the failover version of the workflow last updated by a Cadence cluster
  • workflow_state: the state of the workflow

The following columns are set to a constant value:

  • run_id: 30000000-0000-f000-f000-000000000001
  • visibility_ts: 2000-01-01 00:00:00.000000+0000
  • task_id: -10

Concrete Execution

The concrete_execution entities stores the information of each run of a workflow. These columns are set:

  • shard_id: the id of the Cadence shard
  • type: indicates the type of the entity
  • domain_id: the id of the domain of the workflow
  • workflow_id: the id of the workflow
  • run_id: the id of the instance of the workflow
  • execution: stores some information about the workflow
  • next_event_id: the id of the next event of the workflow
  • activity_map: the information of activities of the workflow
  • timer_map: the information of timers of the workflow
  • child_executions_map: the information of child workflows of the workflow
  • request_cancel_map: the information of cancellation requests of the workflow
  • signal_map: the information of signals applied to the workflow
  • signal_requested: the ids of the signals applied to the workflow
  • buffered_events_list: the buffered events of the workflow
  • workflow_last_write_version: the failover version of the workflow last updated by a Cadence cluster
  • workflow_state: the state of the workflow
  • version_histories: stores the information tracking the version history of the workflow
  • version_histories_encoding: the encoding type of version_histories column
  • checksum: a piece of data used for detecting data corruption in database

The following columns are set to a constant value:

  • visibility_ts: 2000-01-01 00:00:00.000000+0000
  • task_id: -10

Transfer Task

The transfer_task entities are the rows with type=2. The following columns are set:

  • shard_id: the id of the Cadence shard
  • type: indicates the type of the entity
  • task_id: the id of the task
  • transfer: the information of the task

The following columns are set to a constant value:

  • domain_id: 10000000-3000-f000-f000-000000000000
  • workflow_id: 20000000-3000-f000-f000-000000000000
  • run_id: 30000000-3000-f000-f000-000000000000
  • visibility_ts: 2000-01-01 00:00:00.000000+0000

Timer Task

The timer_task entities are the rows with type=3. The following columns are set:

  • shard_id: the id of the Cadence shard
  • type: indicates the type of the entity
  • visibility_ts: the timestamp of the timer task
  • task_id: the id of the task
  • timer: the information of the task

The following columns are set to a constant value:

  • domain_id: 10000000-4000-f000-f000-000000000000
  • workflow_id: 20000000-4000-f000-f000-000000000000
  • run_id: 30000000-4000-f000-f000-000000000000

Replication Task

The replication_task entities are the rows with type=4. The following columns are set:

  • shard_id: the id of the Cadence shard
  • type: indicates the type of the entity
  • task_id: the id of the task
  • replication: the information of the task

The following columns are set to a constant value:

  • domain_id: 10000000-5000-f000-f000-000000000000
  • workflow_id: 20000000-5000-f000-f000-000000000000
  • run_id: 30000000-5000-f000-f000-000000000000
  • visibility_ts: 2000-01-01 00:00:00.000000+0000

Replication DLQ Task

The dlq entities are the rows with type=5. The following columns are set:

  • shard_id: the id of the Cadence shard
  • type: indicates the type of the entity
  • workflow_id: the source cluster of the replication task
  • task_id: the id of the task
  • replication: the information of the task

The following columns are set to a constant value:

  • domain_id: 10000000-6000-f000-f000-000000000000
  • run_id: 30000000-6000-f000-f000-000000000000
  • visibility_ts: 2000-01-01 00:00:00.000000+0000

Cross Cluster Task

The cross_cluster_task entities are the rows with type=6. The following columns are set:

  • shard_id: the id of the Cadence shard
  • type: indicates the type of the entity
  • workflow_id: the target cluster which the task is applied to
  • task_id: the id of the task
  • cross_cluster: the information of the task

The following columns are set to a constant value:

  • domain_id: 10000000-7000-f000-f000-000000000000
  • run_id: 30000000-7000-f000-f000-000000000000
  • visibility_ts: 2000-01-01 00:00:00.000000+0000

Workflow Requests

The workflow_requests entities are rows with type in {7, 8, 9, 10}. The following columns are set:

  • shard_id: the id of the Cadence shard
  • type: indicates the type of the entity (7 = StartWorkflowRequest, 8 = SignalWorkflowRequest, 9 = CancelWorkflowRequest, 10 = ResetWorkflowRequest)
  • domain_id: the id of the domain
  • workflow_id: the id of the workflow which the request is applied to
  • run_id: the id of the request
  • task_id: the failover version of the domain when the request is applied
  • current_run_id: the run_id of the workflow which the request is applied to The following columns are set to a constant value:
  • visibility_ts: 2000-01-01 00:00:00.000000+0000