Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 54 additions & 48 deletions system-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -1198,51 +1198,51 @@ MPP は、 TiFlashエンジンによって提供される分散コンピュー
- 指定可能な値: "json,blob,mediumblob,longblob,text,mediumtext,longtext"
- この変数は、統計情報を収集するために`ANALYZE`コマンドを実行する際に、統計収集からスキップされる列の種類を制御します。この変数は`tidb_analyze_version = 2`にのみ適用されます。 `ANALYZE TABLE t COLUMNS c1, ... , cn`を使用して列を指定した場合でも、その列の型が`tidb_analyze_skip_column_types`に含まれる場合は、指定された列の統計情報は収集されません。

<!---->

mysql> SHOW CREATE TABLE t;
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| t | CREATE TABLE `t` (
`a` int DEFAULT NULL,
`b` varchar(10) DEFAULT NULL,
`c` json DEFAULT NULL,
`d` blob DEFAULT NULL,
`e` longblob DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT @@tidb_analyze_skip_column_types;
+----------------------------------+
| @@tidb_analyze_skip_column_types |
+----------------------------------+
| json,blob,mediumblob,longblob,mediumtext,longtext |
+----------------------------------+
1 row in set (0.00 sec)

mysql> ANALYZE TABLE t;
Query OK, 0 rows affected, 1 warning (0.05 sec)

mysql> SELECT job_info FROM mysql.analyze_jobs ORDER BY end_time DESC LIMIT 1;
+---------------------------------------------------------------------+
| job_info |
+---------------------------------------------------------------------+
| analyze table columns a, b with 256 buckets, 500 topn, 1 samplerate |
+---------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> ANALYZE TABLE t COLUMNS a, c;
Query OK, 0 rows affected, 1 warning (0.04 sec)

mysql> SELECT job_info FROM mysql.analyze_jobs ORDER BY end_time DESC LIMIT 1;
+------------------------------------------------------------------+
| job_info |
+------------------------------------------------------------------+
| analyze table columns a with 256 buckets, 500 topn, 1 samplerate |
+------------------------------------------------------------------+
1 row in set (0.00 sec)
```
mysql> SHOW CREATE TABLE t;
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| t | CREATE TABLE `t` (
`a` int DEFAULT NULL,
`b` varchar(10) DEFAULT NULL,
`c` json DEFAULT NULL,
`d` blob DEFAULT NULL,
`e` longblob DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT @@tidb_analyze_skip_column_types;
+----------------------------------+
| @@tidb_analyze_skip_column_types |
+----------------------------------+
| json,blob,mediumblob,longblob,mediumtext,longtext |
+----------------------------------+
1 row in set (0.00 sec)

mysql> ANALYZE TABLE t;
Query OK, 0 rows affected, 1 warning (0.05 sec)

mysql> SELECT job_info FROM mysql.analyze_jobs ORDER BY end_time DESC LIMIT 1;
+---------------------------------------------------------------------+
| job_info |
+---------------------------------------------------------------------+
| analyze table columns a, b with 256 buckets, 500 topn, 1 samplerate |
+---------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> ANALYZE TABLE t COLUMNS a, c;
Query OK, 0 rows affected, 1 warning (0.04 sec)

mysql> SELECT job_info FROM mysql.analyze_jobs ORDER BY end_time DESC LIMIT 1;
+------------------------------------------------------------------+
| job_info |
+------------------------------------------------------------------+
| analyze table columns a with 256 buckets, 500 topn, 1 samplerate |
+------------------------------------------------------------------+
1 row in set (0.00 sec)
```

### tidb_auto_analyze_concurrency <span class="version-mark">New in v8.4.0</span>

Expand Down Expand Up @@ -1594,13 +1594,17 @@ MPP は、 TiFlashエンジンによって提供される分散コンピュー
insert into t values (1);
```

Query OK, 1 row affected
```
Query OK, 1 row affected
```

```sql
tidb> commit; -- Check only when a transaction is committed.
```

ERROR 1062 : Duplicate entry '1' for key 't.PRIMARY'
```
ERROR 1062 : Duplicate entry '1' for key 't.PRIMARY'
```

- `tidb_constraint_check_in_place_pessimistic`を`ON`に設定し、悲観的トランザクションを使用する場合:

Expand All @@ -1610,7 +1614,9 @@ MPP は、 TiFlashエンジンによって提供される分散コンピュー
insert into t values (1);
```

ERROR 1062 : Duplicate entry '1' for key 't.PRIMARY'
```
ERROR 1062 : Duplicate entry '1' for key 't.PRIMARY'
```

### tidb_cost_model_version <span class="version-mark">New in v6.2.0</span>

Expand Down
20 changes: 11 additions & 9 deletions ticdc/ticdc-bidirectional-replication.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,17 @@ BDRロールが設定されていない場合、任意のDDLを実行できま
ADMIN SET BDR ROLE PRIMARY;
```

Query OK, 0 rows affected
Time: 0.003s

ADMIN SHOW BDR ROLE;
+----------+
| BDR_ROLE |
+----------+
| primary |
+----------+
```
Query OK, 0 rows affected
Time: 0.003s

ADMIN SHOW BDR ROLE;
+----------+
| BDR_ROLE |
+----------+
| primary |
+----------+
```

2. 他の TiDB クラスターで`ADMIN SET BDR ROLE SECONDARY`を実行して、それらをセカンダリ クラスターとして設定します。

Expand Down
68 changes: 35 additions & 33 deletions ticdc/ticdc-canal-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -503,38 +503,40 @@ v5.4.0 から、 `Delete`イベントのうち`old`フィールドが変更さ

以下はイベントメッセージ`Delete`です。v5.4.0より前のバージョンでは、フィールド`old`は「data」フィールドと同じ内容です。v5.4.0以降のバージョンでは、フィールド`old` nullに設定されます。「data」フィールドを使用することで、削除されたデータを取得できます。

{
"id": 0,
"database": "test",
```
{
"id": 0,
"database": "test",
...
"type": "DELETE",
...
"sqlType": {
...
"type": "DELETE",
},
"mysqlType": {
...
"sqlType": {
...
},
"mysqlType": {
...
},
"data": [
{
"c_bigint": "9223372036854775807",
"c_int": "0",
"c_mediumint": "8388607",
"c_smallint": "32767",
"c_tinyint": "0",
"id": "2"
}
],
"old": null,
// The following is an example before v5.4.0. The `old` field contains the same content as the "data" field.
"old": [
{
"c_bigint": "9223372036854775807",
"c_int": "0",
"c_mediumint": "8388607",
"c_smallint": "32767",
"c_tinyint": "0",
"id": "2"
}
]
}
},
"data": [
{
"c_bigint": "9223372036854775807",
"c_int": "0",
"c_mediumint": "8388607",
"c_smallint": "32767",
"c_tinyint": "0",
"id": "2"
}
],
"old": null,
// The following is an example before v5.4.0. The `old` field contains the same content as the "data" field.
"old": [
{
"c_bigint": "9223372036854775807",
"c_int": "0",
"c_mediumint": "8388607",
"c_smallint": "32767",
"c_tinyint": "0",
"id": "2"
}
]
}
```
4 changes: 3 additions & 1 deletion ticdc/ticdc-changefeed-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ Info: {"upstream_id":7178706266519722477,"namespace":"default","id":"simple-repl

- `--sink-uri` : レプリケーション タスクのダウンストリーム アドレス。 `--sink-uri`は、次の形式に従って設定します。現在、このスキームは`mysql` 、 `tidb` 、および`kafka`をサポートしています。

[scheme]://[userinfo@][host]:[port][/path]?[query_parameters]
```
[scheme]://[userinfo@][host]:[port][/path]?[query_parameters]
```

シンク URI パラメータに`! * ' ( ) ; : @ & = + $ , / ? % # [ ]`などの特殊文字が含まれている場合は、 [URIエンコーダー](https://www.urlencoder.org/)のように特殊文字をエスケープする必要があります。

Expand Down
30 changes: 19 additions & 11 deletions ticdc/ticdc-classic-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,16 @@ TiCDCにおけるChangefeedとTaskは、2つの論理的な概念です。具体

例えば:

cdc cli changefeed create --server="http://127.0.0.1:8300" --sink-uri="kafka://127.0.0.1:9092/cdc-test?kafka-version=2.4.0&partition-num=6&max-message-bytes=67108864&replication-factor=1"
cat changefeed.toml
......
[sink]
dispatchers = [
{matcher = ['test1.tab1', 'test2.tab2'], topic = "{schema}_{table}"},
{matcher = ['test3.tab3', 'test4.tab4'], topic = "{schema}_{table}"},
]
```
cdc cli changefeed create --server="http://127.0.0.1:8300" --sink-uri="kafka://127.0.0.1:9092/cdc-test?kafka-version=2.4.0&partition-num=6&max-message-bytes=67108864&replication-factor=1"
cat changefeed.toml
......
[sink]
dispatchers = [
{matcher = ['test1.tab1', 'test2.tab2'], topic = "{schema}_{table}"},
{matcher = ['test3.tab3', 'test4.tab4'], topic = "{schema}_{table}"},
]
```

前述の`cdc cli changefeed create`コマンドのパラメータの詳細については、 [TiCDC Changefeedコンフィグレーションパラメータ](/ticdc/ticdc-changefeed-config.md)を参照してください。

Expand Down Expand Up @@ -112,7 +114,9 @@ TiCDCは、データ複製の状態を示すために、一連のタイムスタ

TiCDCの場合、TiKVから送信されるResolvedTSは`<resolvedTS: timestamp>`形式の特別なイベントです。一般に、ResolvedTSは以下の制約を満たします。

table ResolvedTS >= global ResolvedTS
```
table ResolvedTS >= global ResolvedTS
```

#### チェックポイントTS {#checkpointts}

Expand All @@ -124,11 +128,15 @@ TiCDCは、データ複製の状態を示すために、一連のタイムスタ

一般に、チェックポイントTS は次の制約を満たします。

table CheckpointTS >= global CheckpointTS
```
table CheckpointTS >= global CheckpointTS
```

TiCDC はグローバル ResolvedTS よりも小さいデータのみをダウンストリームに複製するため、完全な制約は次のようになります。

table ResolvedTS >= global ResolvedTS >= table CheckpointTS >= global CheckpointTS
```
table ResolvedTS >= global ResolvedTS >= table CheckpointTS >= global CheckpointTS
```

データの変更とトランザクションがコミットされた後、TiKVノードのResolvedTSは引き続き進み、TiCDCノードのPullerモジュールはTiKVからプッシュされたデータを受信し続けます。Pullerモジュールは受信したデータの変更に基づいて増分データをスキャンするかどうかも決定し、すべてのデータ変更がTiCDCノードに送信されるようにします。

Expand Down
16 changes: 9 additions & 7 deletions ticdc/ticdc-csv.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,15 @@ CREATE TABLE `employee` (

`include-commit-ts = true`と`output-old-value = true`の場合、このテーブルの DML イベントは、次のように CSV 形式で保存されます。

"I","employee","hr",433305438660591626,false,101,"Smith","Bob","2014-06-04","New York"
"D","employee","hr",433305438660591627,true,101,"Smith","Bob","2015-10-08","Shanghai"
"I","employee","hr",433305438660591627,true,101,"Smith","Bob","2015-10-08","Los Angeles"
"D","employee","hr",433305438660591629,false,101,"Smith","Bob","2017-03-13","Dallas"
"I","employee","hr",433305438660591630,false,102,"Alex","Alice","2017-03-14","Shanghai"
"D","employee","hr",433305438660591630,true,102,"Alex","Alice","2017-03-14","Beijing"
"I","employee","hr",433305438660591630,true,102,"Alex","Alice","2018-06-15","Beijing"
```
"I","employee","hr",433305438660591626,false,101,"Smith","Bob","2014-06-04","New York"
"D","employee","hr",433305438660591627,true,101,"Smith","Bob","2015-10-08","Shanghai"
"I","employee","hr",433305438660591627,true,101,"Smith","Bob","2015-10-08","Los Angeles"
"D","employee","hr",433305438660591629,false,101,"Smith","Bob","2017-03-13","Dallas"
"I","employee","hr",433305438660591630,false,102,"Alex","Alice","2017-03-14","Shanghai"
"D","employee","hr",433305438660591630,true,102,"Alex","Alice","2017-03-14","Beijing"
"I","employee","hr",433305438660591630,true,102,"Alex","Alice","2018-06-15","Beijing"
```

`include-commit-ts = true` 、 `output-old-value = true` 、および`output-field-header = true`の場合、このテーブルのDMLイベントは、次のようにCSV形式で保存されます。

Expand Down
4 changes: 3 additions & 1 deletion ticdc/ticdc-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,9 @@ UPDATE data_table SET value = 'v1' WHERE id = 2;

`CDC:ErrMySQLDuplicateEntryCDC`エラーが頻繁に発生する場合は、 [`sink-uri`](/ticdc/ticdc-sink-to-mysql.md#configure-sink-uri-for-mysql-or-tidb)構成で`safe-mode=true`パラメータを設定することで TiCDC セーフ モードを有効にすることができます。

mysql://user:password@host:port/?safe-mode=true
```
mysql://user:password@host:port/?safe-mode=true
```

セーフ モードでは、TiCDC は`UPDATE`操作を`DELETE + REPLACE INTO`に分割して実行し、一意のキーの競合エラーを回避します。

Expand Down
14 changes: 8 additions & 6 deletions ticdc/ticdc-integrity-check.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,15 @@ For clusters created in v8.4.0 or later, or clusters upgraded to v8.4.0 or later

チェックサム計算アルゴリズムの疑似コードは次のとおりです。

fn checksum(columns) {
let result = 0
for column in sort_by_schema_order(columns) {
result = crc32.update(result, encode(column))
}
return result
```
fn checksum(columns) {
let result = 0
for column in sort_by_schema_order(columns) {
result = crc32.update(result, encode(column))
}
return result
}
```
- `columns`列IDでソートする必要があります。Avroスキーマでは、フィールドは既に列IDでソートされているため、 `columns`の順序をそのまま使用できます。
Expand Down
4 changes: 3 additions & 1 deletion ticdc/ticdc-sink-to-cloud-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ GCSへのアクセスに使用するアカウントは、アクセスキーを

インデックスファイルには、現在のディレクトリで使用されている最大のファイル名が記録されます。例:

CDC000005.csv
```
CDC000005.csv
```

この例では、このディレクトリ内のファイル`CDC000001.csv`から`CDC000004.csv`使用中です。TiCDC クラスターでテーブルスケジューリングまたはノードの再起動が発生すると、新しいノードはインデックスファイルを読み取り、 `CDC000005.csv`使用中かどうかを判断します。使用中でない場合、新しいノードは`CDC000005.csv`からファイルに書き込みます。使用中の場合は`CDC000006.csv`から書き込みを開始し、他のノードによって書き込まれたデータの上書きを防ぎます。

Expand Down
Loading
Loading