Skip to content

Commit c2d2ce2

Browse files
sre-bottoutdesuite
andauthored
cherry pick pingcap#2691 to release-4.0 (pingcap#2721)
Signed-off-by: sre-bot <sre-bot@pingcap.com> Co-authored-by: toutdesuite <guizhiluo2014@163.com>
1 parent 019d827 commit c2d2ce2

File tree

1 file changed

+80
-2
lines changed

1 file changed

+80
-2
lines changed

ticdc/ticdc-open-protocol.md

Lines changed: 80 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ This section introduces the formats of Row Changed Event, DDL Event, and Resolve
8888
| :---------- | :----- | :--------------------- |
8989
| UpdateOrDelete | String | Identifies whether the row is updated or deleted in the Event. The optional values are `u` or `d`. |
9090
| Column Name | String | The column name. |
91-
| Column Type | Number | The column type. See [Column and DDL Type Codes](/ticdc/column-ddl-type-codes.md) for details. |
91+
| Column Type | Number | The column type. For details, see [Column Type Code](#column-type-code). |
9292
| Where Handle | Bool | Determines whether this column can be the filter condition of the `Where` clause. When this column is unique on the table, `Where Handle` is `true`. |
9393
| Column Value | Any | The Column value. |
9494
@@ -123,7 +123,7 @@ This section introduces the formats of Row Changed Event, DDL Event, and Resolve
123123
| Parameter | Type | Description |
124124
| :-------- | :----- | :------------ |
125125
| DDL Query | String | DDL Query SQL |
126-
| DDL Type | String | The DDL type. See [Column and DDL Type Codes](/ticdc/column-ddl-type-codes.md) for details. |
126+
| DDL Type | String | The DDL type. For details, see [DDL Type Code](#ddl-type-code). |
127127
128128
### Resolved Event
129129
@@ -210,3 +210,81 @@ COMMIT;
210210
13. [partition=0] [key="{\"ts\":415508881038376963,\"t\":3}"] [value=]
211211
14. [partition=1] [key="{\"ts\":415508881038376963,\"t\":3}"] [value=]
212212
```
213+
214+
## Column and DDL type codes
215+
216+
The column and DDL type codes are encodings defined by TiCDC Open Protocol. `Column Type Code` represents the column data type of the Row Changed Event, and `DDL Type Code` represents the DDL statement type of the DDL Event.
217+
218+
### Column Type Code
219+
220+
| Type | Code | Output Example | Note |
221+
| :---------- | :--- | :------ | :-- |
222+
| Decimal | 0 | {"t":0,"v":"129012.1230000"} | |
223+
| Tiny/Bool | 1 | {"t":1,"v":1} | |
224+
| Short | 2 | {"t":2,"v":1} | |
225+
| Long | 3 | {"t":3,"v":123} | |
226+
| Float | 4 | {"t":4,"v":153.123} | |
227+
| Double | 5 | {"t":5,"v":153.123} | |
228+
| Null | 6 | {"t":6,"v":null} | |
229+
| Timestamp | 7 | {"t":7,"v":"1973-12-30 15:30:00"} | |
230+
| Longlong | 8 | {"t":8,"v":123} | |
231+
| Int24 | 9 | {"t":9,"v":123} | |
232+
| Date | 10 | {"t":10,"v":"2000-01-01"} | |
233+
| Duration | 11 | {"t":11,"v":"23:59:59"} | |
234+
| Datetime | 12 | {"t":12,"v":"2015-12-20 23:58:58"} | |
235+
| Year | 13 | {"t":13,"v":1970} | |
236+
| New Date | 14 | {"t":14,"v":"2000-01-01"} | |
237+
| Varchar | 15 | {"t":15,"v":"test"} | The value is encoded in UTF-8. |
238+
| Bit | 16 | {"t":16,"v":81} | |
239+
| JSON | 245 | {"t":245,"v":"{\\"key1\\": \\"value1\\"}"} | |
240+
| New Decimal | 246 | {"t":246,"v":"129012.1230000"} | |
241+
| Enum | 247 | {"t":247,"v":1} | |
242+
| Set | 248 | {"t":248,"v":3} | |
243+
| Tiny Blob | 249 | {"t":249,"v":"5rWL6K+VdGV4dA=="} | The value is encoded in Base64. |
244+
| Medium Blob | 250 | {"t":250,"v":"5rWL6K+VdGV4dA=="} | The value is encoded in Base64. |
245+
| Long Blob | 251 | {"t":251,"v":"5rWL6K+VdGV4dA=="} | The value is encoded in Base64. |
246+
| Blob | 252 | {"t":252,"v":"5rWL6K+VdGV4dA=="} | The value is encoded in Base64. |
247+
| Var String | 253 | {"t":253,"v":"test"} | The value is encoded in UTF-8. |
248+
| String | 254 | {"t":254,"v":"test"} | The value is encoded in UTF-8. |
249+
| Geometry | 255 | | Unsupported type. |
250+
251+
### DDL Type Code
252+
253+
| Type | Code |
254+
| :-------------------------------- | :- |
255+
| Create Schema | 1 |
256+
| Drop Schema | 2 |
257+
| Create Table | 3 |
258+
| Drop Table | 4 |
259+
| Add Column | 5 |
260+
| Drop Column | 6 |
261+
| Add Index | 7 |
262+
| Drop Index | 8 |
263+
| Add Foreign Key | 9 |
264+
| Drop Foreign Key | 10 |
265+
| Truncate Table | 11 |
266+
| Modify Column | 12 |
267+
| Rebase Auto ID | 13 |
268+
| Rename Table | 14 |
269+
| Set Default Value | 15 |
270+
| Shard RowID | 16 |
271+
| Modify Table Comment | 17 |
272+
| Rename Index | 18 |
273+
| Add Table Partition | 19 |
274+
| Drop Table Partition | 20 |
275+
| Create View | 21 |
276+
| Modify Table Charset And Collate | 22 |
277+
| Truncate Table Partition | 23 |
278+
| Drop View | 24 |
279+
| Recover Table | 25 |
280+
| Modify Schema Charset And Collate | 26 |
281+
| Lock Table | 27 |
282+
| Unlock Table | 28 |
283+
| Repair Table | 29 |
284+
| Set TiFlash Replica | 30 |
285+
| Update TiFlash Replica Status | 31 |
286+
| Add Primary Key | 32 |
287+
| Drop Primary Key | 33 |
288+
| Create Sequence | 34 |
289+
| Alter Sequence | 35 |
290+
| Drop Sequence | 36 |

0 commit comments

Comments
 (0)