Key | Data Type | Description | Sample Value |
---|---|---|---|
type | string | Identifies the type of state stored. For streaming replication, it is typically set to "STREAM" . | "STREAM" |
streams | array | An array that contains one or more stream state objects. Each object represents the replication state for a specific table or partition. | [ { ... } ] |
stream | string | Within each stream object, this specifies the unique identifier (often the table name) whose state is being tracked. | "sample_table" |
namespace | string | Indicates the database name or logical grouping the stream belongs to. | "main" |
sync_mode | string | Represents the active synchronization mode for the stream. It may be left empty or specify a mode such as "cdc" . | "" (empty string) |
state | object | Contains the details required to resume replication. This nested object holds the exact point up to which data has been processed. | { "binlog_file": "mysql-bin.000003", "binlog_position": 1027, "chunks": [], "server_id": 1000 } |
binlog_file | string | (Nested in state ) The name of the binary log file from which replication will resume. | "mysql-bin.000003" |
binlog_position | integer | (Nested in state ) The specific position in the binary log file indicating where to resume. | 1027 |
chunks | array | (Nested in state ) An array for storing chunk information, useful for managing segmented or large datasets. | [] |
server_id | integer | (Nested in state ) The identifier of the source MySQL server that generated the binary logs, used for ensuring correct replication tracking. | 1000 |
How It Works
-
State Tracking:
Thetype
field declares the kind of state (here, a streaming state), while thestreams
array holds one or more stream objects. Each stream object tracks the replication state for a particular table or partition. -
Resuming Synchronization:
Thestate
object inside each stream contains fields likebinlog_file
andbinlog_position
which tell the system exactly where to resume data replication. This prevents reprocessing already synced records. -
Handling Data Chunks:
Thechunks
field, although empty in this sample, can be used to manage segmented data, which is useful when handling large datasets. -
Source Identification:
Theserver_id
field helps identify which MySQL server’s binary logs are being tracked, ensuring consistency in multi-server replication setups.
Refer here for more about sync modes.