diff --git a/tiflash/tiflash-mintso-scheduler.md b/tiflash/tiflash-mintso-scheduler.md index e000ab36065af..a27e973868f3e 100644 --- a/tiflash/tiflash-mintso-scheduler.md +++ b/tiflash/tiflash-mintso-scheduler.md @@ -27,22 +27,24 @@ MPPクエリを処理する際、TiDBはクエリを1つ以上のMPPタスクに EXPLAIN SELECT count(*) FROM t0 a JOIN t0 b ON a.id = b.id; ``` - +--------------------------------------------+----------+--------------+---------------+----------------------------------------------------------+ - | id | estRows | task | access object | operator info | - +--------------------------------------------+----------+--------------+---------------+----------------------------------------------------------+ - | HashAgg_44 | 1.00 | root | | funcs:count(Column#8)->Column#7 | - | └─TableReader_46 | 1.00 | root | | MppVersion: 2, data:ExchangeSender_45 | - | └─ExchangeSender_45 | 1.00 | mpp[tiflash] | | ExchangeType: PassThrough | - | └─HashAgg_13 | 1.00 | mpp[tiflash] | | funcs:count(1)->Column#8 | - | └─Projection_43 | 12487.50 | mpp[tiflash] | | test.t0.id | - | └─HashJoin_42 | 12487.50 | mpp[tiflash] | | inner join, equal:[eq(test.t0.id, test.t0.id)] | - | ├─ExchangeReceiver_22(Build) | 9990.00 | mpp[tiflash] | | | - | │ └─ExchangeSender_21 | 9990.00 | mpp[tiflash] | | ExchangeType: Broadcast, Compression: FAST | - | │ └─Selection_20 | 9990.00 | mpp[tiflash] | | not(isnull(test.t0.id)) | - | │ └─TableFullScan_19 | 10000.00 | mpp[tiflash] | table:a | pushed down filter:empty, keep order:false, stats:pseudo | - | └─Selection_24(Probe) | 9990.00 | mpp[tiflash] | | not(isnull(test.t0.id)) | - | └─TableFullScan_23 | 10000.00 | mpp[tiflash] | table:b | pushed down filter:empty, keep order:false, stats:pseudo | - +--------------------------------------------+----------+--------------+---------------+----------------------------------------------------------+ +``` ++--------------------------------------------+----------+--------------+---------------+----------------------------------------------------------+ +| id | estRows | task | access object | operator info | ++--------------------------------------------+----------+--------------+---------------+----------------------------------------------------------+ +| HashAgg_44 | 1.00 | root | | funcs:count(Column#8)->Column#7 | +| └─TableReader_46 | 1.00 | root | | MppVersion: 2, data:ExchangeSender_45 | +| └─ExchangeSender_45 | 1.00 | mpp[tiflash] | | ExchangeType: PassThrough | +| └─HashAgg_13 | 1.00 | mpp[tiflash] | | funcs:count(1)->Column#8 | +| └─Projection_43 | 12487.50 | mpp[tiflash] | | test.t0.id | +| └─HashJoin_42 | 12487.50 | mpp[tiflash] | | inner join, equal:[eq(test.t0.id, test.t0.id)] | +| ├─ExchangeReceiver_22(Build) | 9990.00 | mpp[tiflash] | | | +| │ └─ExchangeSender_21 | 9990.00 | mpp[tiflash] | | ExchangeType: Broadcast, Compression: FAST | +| │ └─Selection_20 | 9990.00 | mpp[tiflash] | | not(isnull(test.t0.id)) | +| │ └─TableFullScan_19 | 10000.00 | mpp[tiflash] | table:a | pushed down filter:empty, keep order:false, stats:pseudo | +| └─Selection_24(Probe) | 9990.00 | mpp[tiflash] | | not(isnull(test.t0.id)) | +| └─TableFullScan_23 | 10000.00 | mpp[tiflash] | table:b | pushed down filter:empty, keep order:false, stats:pseudo | ++--------------------------------------------+----------+--------------+---------------+----------------------------------------------------------+ +``` 例えば、上記のクエリは各TiFlashノードに2つのMPPタスクを生成しますが、 `ExchangeSender_45`のエグゼキューターを含むMPPタスクは`ExchangeSender_21`エグゼキューターを含むMPPタスクに依存しています。同時実行性の高いシナリオでは、スケジューラーが各クエリに対して`ExchangeSender_45`のエグゼキューターを含むMPPタスクをスケジュールすると、システムはデッドロック状態になります。 diff --git a/tiflash/tiflash-spill-disk.md b/tiflash/tiflash-spill-disk.md index dfa7c7ea74998..fdb84c57e470e 100644 --- a/tiflash/tiflash-spill-disk.md +++ b/tiflash/tiflash-spill-disk.md @@ -52,7 +52,9 @@ TiFlash は、データをディスクに書き出すための 2 つのトリガ 3. TiFlashのログから、クエリは単一のTiFlashノードで 29.55 GiB のメモリを消費する必要があることがわかります。 - [DEBUG] [MemoryTracker.cpp:69] ["Peak memory usage (total): 29.55 GiB."] [source=MemoryTracker] [thread_id=468] + ``` + [DEBUG] [MemoryTracker.cpp:69] ["Peak memory usage (total): 29.55 GiB."] [source=MemoryTracker] [thread_id=468] + ``` 4. 次のステートメントを実行します。このステートメントは、キーが`GROUP BY`ハッシュ集計子のメモリ使用量を10737418240(10 GiB)に制限します。 @@ -72,7 +74,9 @@ TiFlash は、データをディスクに書き出すための 2 つのトリガ 5. TiFlashのログを見ると、 `tidb_max_bytes_before_tiflash_external_group_by`設定するとTiFlash が中間結果のスピルをトリガーし、クエリで使用されるメモリが大幅に削減されることがわかります。 - [DEBUG] [MemoryTracker.cpp:69] ["Peak memory usage (total): 12.80 GiB."] [source=MemoryTracker] [thread_id=110] + ``` + [DEBUG] [MemoryTracker.cpp:69] ["Peak memory usage (total): 12.80 GiB."] [source=MemoryTracker] [thread_id=110] + ``` ### クエリレベルのスピル {#query-level-spilling} @@ -109,7 +113,9 @@ TiFlash v7.4.0以降、クエリレベルでの自動スピルをサポートし 3. TiFlashのログから、クエリが単一のTiFlashノードで 29.55 GiB のメモリを消費していることがわかります。 - [DEBUG] [MemoryTracker.cpp:69] ["Peak memory usage (total): 29.55 GiB."] [source=MemoryTracker] [thread_id=468] + ``` + [DEBUG] [MemoryTracker.cpp:69] ["Peak memory usage (total): 29.55 GiB."] [source=MemoryTracker] [thread_id=468] + ``` 4. 以下のステートメントを実行します。これらのステートメントは、 TiFlashノード上のクエリの最大メモリ使用量を5GiBに制限します。 @@ -130,7 +136,9 @@ TiFlash v7.4.0以降、クエリレベルでの自動スピルをサポートし 5. TiFlashのログから、クエリ レベルのスピルを構成すると、 TiFlash中間結果のスピルがトリガーされ、クエリで使用されるメモリが大幅に削減されることがわかります。 - [DEBUG] [MemoryTracker.cpp:101] ["Peak memory usage (for query): 3.94 GiB."] [source=MemoryTracker] [thread_id=1547] + ``` + [DEBUG] [MemoryTracker.cpp:101] ["Peak memory usage (for query): 3.94 GiB."] [source=MemoryTracker] [thread_id=1547] + ``` ## 注記 {#notes} diff --git a/tiflash/troubleshoot-tiflash.md b/tiflash/troubleshoot-tiflash.md index 8c487e29f1edc..9e54636e768ad 100644 --- a/tiflash/troubleshoot-tiflash.md +++ b/tiflash/troubleshoot-tiflash.md @@ -79,26 +79,28 @@ TiFlashのワークロードが大きすぎてTiFlashデータのレプリケー curl http://:/pd/api/v1/config/rules/group/tiflash ``` - [ + ``` + [ + { + "group_id": "tiflash", + "id": "table-45-r", + "override": true, + "start_key": "7480000000000000FF2D5F720000000000FA", + "end_key": "7480000000000000FF2E00000000000000F8", + "role": "learner", + "count": 1, + "label_constraints": [ { - "group_id": "tiflash", - "id": "table-45-r", - "override": true, - "start_key": "7480000000000000FF2D5F720000000000FA", - "end_key": "7480000000000000FF2E00000000000000F8", - "role": "learner", - "count": 1, - "label_constraints": [ - { - "key": "engine", - "op": "in", - "values": [ - "tiflash" - ] - } + "key": "engine", + "op": "in", + "values": [ + "tiflash" ] } ] + } + ] + ``` 2. TiFlashに関連するすべてのデータ複製ルールを削除します。例えば、 `id`が`table-45-r`であるルールを例に挙げます。以下のコマンドで削除します。 @@ -121,11 +123,13 @@ show warnings; この例では、警告メッセージは、TiDB 5.4 以前のバージョンでは`subtime`関数がサポートされていないため、TiDB が MPP モードを選択しないことを示しています。 - +---------+------+-----------------------------------------------------------------------------+ - | Level | Code | Message | - +---------+------+-----------------------------------------------------------------------------+ - | Warning | 1105 | Scalar function 'subtime'(signature: SubDatetimeAndString, return type: datetime) is not supported to push down to tiflash now. | - +---------+------+-----------------------------------------------------------------------------+ +``` ++---------+------+-----------------------------------------------------------------------------+ +| Level | Code | Message | ++---------+------+-----------------------------------------------------------------------------+ +| Warning | 1105 | Scalar function 'subtime'(signature: SubDatetimeAndString, return type: datetime) is not supported to push down to tiflash now. | ++---------+------+-----------------------------------------------------------------------------+ +``` ## TiFlashレプリカは常に利用できません {#tiflash-replica-is-always-unavailable} @@ -186,7 +190,9 @@ TiDB クラスターを展開した後、 TiFlashレプリカの作成が継続 - 値を`low-space-ratio`に変更すると、PD は新しいしきい値に達するまでTiFlashノードへのリージョンのスケジュールを再開できるようになります。 - tiup ctl:nightly pd -u http://${pd-ip}:${pd-port} config set low-space-ratio 0.9 + ``` + tiup ctl:nightly pd -u http://${pd-ip}:${pd-port} config set low-space-ratio 0.9 + ``` - 新しいTiFlashノードをスケールアウトします。PD はTiFlashノード間でリージョンのバランスを自動的に取り、十分なディスク容量を持つTiFlashノードへのリージョンのスケジュールを再開します。 diff --git a/tiflash/use-tidb-to-read-tiflash.md b/tiflash/use-tidb-to-read-tiflash.md index 2d24ef0b012d9..64899a8b9b3f9 100644 --- a/tiflash/use-tidb-to-read-tiflash.md +++ b/tiflash/use-tidb-to-read-tiflash.md @@ -17,26 +17,30 @@ TiFlashレプリカを持つテーブルの場合、TiDBオプティマイザー desc select count(*) from test.t; ``` - +--------------------------+---------+--------------+---------------+--------------------------------+ - | id | estRows | task | access object | operator info | - +--------------------------+---------+--------------+---------------+--------------------------------+ - | StreamAgg_9 | 1.00 | root | | funcs:count(1)->Column#4 | - | └─TableReader_17 | 1.00 | root | | data:TableFullScan_16 | - | └─TableFullScan_16 | 1.00 | cop[tiflash] | table:t | keep order:false, stats:pseudo | - +--------------------------+---------+--------------+---------------+--------------------------------+ - 3 rows in set (0.00 sec) +``` ++--------------------------+---------+--------------+---------------+--------------------------------+ +| id | estRows | task | access object | operator info | ++--------------------------+---------+--------------+---------------+--------------------------------+ +| StreamAgg_9 | 1.00 | root | | funcs:count(1)->Column#4 | +| └─TableReader_17 | 1.00 | root | | data:TableFullScan_16 | +| └─TableFullScan_16 | 1.00 | cop[tiflash] | table:t | keep order:false, stats:pseudo | ++--------------------------+---------+--------------+---------------+--------------------------------+ +3 rows in set (0.00 sec) +``` ```sql explain analyze select count(*) from test.t; ``` - +--------------------------+---------+---------+--------------+---------------+----------------------------------------------------------------------+--------------------------------+-----------+------+ - | id | estRows | actRows | task | access object | execution info | operator info | memory | disk | - +--------------------------+---------+---------+--------------+---------------+----------------------------------------------------------------------+--------------------------------+-----------+------+ - | StreamAgg_9 | 1.00 | 1 | root | | time:83.8372ms, loops:2 | funcs:count(1)->Column#4 | 372 Bytes | N/A | - | └─TableReader_17 | 1.00 | 1 | root | | time:83.7776ms, loops:2, rpc num: 1, rpc time:83.5701ms, proc keys:0 | data:TableFullScan_16 | 152 Bytes | N/A | - | └─TableFullScan_16 | 1.00 | 1 | cop[tiflash] | table:t | tiflash_task:{time:43ms, loops:1, threads:1}, tiflash_scan:{...} | keep order:false, stats:pseudo | N/A | N/A | - +--------------------------+---------+---------+--------------+---------------+----------------------------------------------------------------------+--------------------------------+-----------+------+ +``` ++--------------------------+---------+---------+--------------+---------------+----------------------------------------------------------------------+--------------------------------+-----------+------+ +| id | estRows | actRows | task | access object | execution info | operator info | memory | disk | ++--------------------------+---------+---------+--------------+---------------+----------------------------------------------------------------------+--------------------------------+-----------+------+ +| StreamAgg_9 | 1.00 | 1 | root | | time:83.8372ms, loops:2 | funcs:count(1)->Column#4 | 372 Bytes | N/A | +| └─TableReader_17 | 1.00 | 1 | root | | time:83.7776ms, loops:2, rpc num: 1, rpc time:83.5701ms, proc keys:0 | data:TableFullScan_16 | 152 Bytes | N/A | +| └─TableFullScan_16 | 1.00 | 1 | cop[tiflash] | table:t | tiflash_task:{time:43ms, loops:1, threads:1}, tiflash_scan:{...} | keep order:false, stats:pseudo | N/A | N/A | ++--------------------------+---------+---------+--------------+---------------+----------------------------------------------------------------------+--------------------------------+-----------+------+ +``` `cop[tiflash]`は、タスクが処理のためにTiFlashに送信されることを意味します。TiFlash レプリカを選択していない場合は、 `analyze table`ステートメントを使用して統計情報を更新し、 `explain analyze`ステートメントを使用して結果を確認できます。 @@ -52,8 +56,10 @@ explain analyze select count(*) from test.t; - TiDBインスタンスレベル、つまりINSTANCEレベル。TiDB設定ファイルに以下の設定項目を追加します。 - [isolation-read] - engines = ["tikv", "tidb", "tiflash"] + ``` + [isolation-read] + engines = ["tikv", "tidb", "tiflash"] + ``` **INSTANCE レベルのデフォルト設定は`["tikv", "tidb", "tiflash"]`です。** diff --git a/tiflash/use-tiflash-mpp-mode.md b/tiflash/use-tiflash-mpp-mode.md index c5d6c86b72eb0..d5f30ac63710e 100644 --- a/tiflash/use-tiflash-mpp-mode.md +++ b/tiflash/use-tiflash-mpp-mode.md @@ -73,11 +73,13 @@ set @@session.tidb_enforce_mpp=1; > show warnings; > ``` > -> +---------+------+-----------------------------------------------------------------------------+ -> | Level | Code | Message | -> +---------+------+-----------------------------------------------------------------------------+ -> | Warning | 1105 | MPP mode may be blocked because there aren't tiflash replicas of table `t`. | -> +---------+------+-----------------------------------------------------------------------------+ +> ``` +> +---------+------+-----------------------------------------------------------------------------+ +> | Level | Code | Message | +> +---------+------+-----------------------------------------------------------------------------+ +> | Warning | 1105 | MPP mode may be blocked because there aren't tiflash replicas of table `t`. | +> +---------+------+-----------------------------------------------------------------------------+ +> ``` ## MPPモードのアルゴリズムサポート {#algorithm-support-for-the-mpp-mode} diff --git a/tikv-in-memory-engine.md b/tikv-in-memory-engine.md index 0ea7997ffec3f..16bda249b1db5 100644 --- a/tikv-in-memory-engine.md +++ b/tikv-in-memory-engine.md @@ -123,16 +123,18 @@ LIMIT 5; 以下の結果は、 `db1.tbl1`テーブルに深刻な MVCC 増幅を伴うクエリが存在することを示しています。TiKV は 1358517 個の MVCC バージョンを処理し、2 つのバージョンのみを返します。 - +----------------------------+-----+-------------------+--------------+------------+-----------------------------------+--------------------+--------------------+--------------------+ - | Time | DB | Index_names | Process_keys | Total_keys | Query | Query_time | Cop_time | Process_time | - +----------------------------+-----+-------------------+--------------+------------+-----------------------------------+--------------------+--------------------+--------------------+ - | 2024-11-18 11:56:10.303228 | db1 | [tbl1:some_index] | 2 | 1358517 | SELECT * FROM tbl1 ... LIMIT 1 ; | 1.2581352350000001 | 1.25651062 | 1.251837479 | - | 2024-11-18 11:56:11.556257 | db1 | [tbl1:some_index] | 2 | 1358231 | SELECT * FROM tbl1 ... LIMIT 1 ; | 1.252694002 | 1.251129038 | 1.240532546 | - | 2024-11-18 12:00:10.553331 | db1 | [tbl1:some_index] | 2 | 1342914 | SELECT * FROM tbl1 ... LIMIT 1 ; | 1.473941872 | 1.4720495900000001 | 1.3666103170000001 | - | 2024-11-18 12:01:52.122548 | db1 | [tbl1:some_index] | 2 | 1128064 | SELECT * FROM tbl1 ... LIMIT 1 ; | 1.058942591 | 1.056853228 | 1.023483875 | - | 2024-11-18 12:01:52.107951 | db1 | [tbl1:some_index] | 2 | 1128064 | SELECT * FROM tbl1 ... LIMIT 1 ; | 1.044847031 | 1.042546122 | 0.934768555 | - +----------------------------+-----+-------------------+--------------+------------+-----------------------------------+--------------------+--------------------+--------------------+ - 5 rows in set (1.26 sec) +``` ++----------------------------+-----+-------------------+--------------+------------+-----------------------------------+--------------------+--------------------+--------------------+ +| Time | DB | Index_names | Process_keys | Total_keys | Query | Query_time | Cop_time | Process_time | ++----------------------------+-----+-------------------+--------------+------------+-----------------------------------+--------------------+--------------------+--------------------+ +| 2024-11-18 11:56:10.303228 | db1 | [tbl1:some_index] | 2 | 1358517 | SELECT * FROM tbl1 ... LIMIT 1 ; | 1.2581352350000001 | 1.25651062 | 1.251837479 | +| 2024-11-18 11:56:11.556257 | db1 | [tbl1:some_index] | 2 | 1358231 | SELECT * FROM tbl1 ... LIMIT 1 ; | 1.252694002 | 1.251129038 | 1.240532546 | +| 2024-11-18 12:00:10.553331 | db1 | [tbl1:some_index] | 2 | 1342914 | SELECT * FROM tbl1 ... LIMIT 1 ; | 1.473941872 | 1.4720495900000001 | 1.3666103170000001 | +| 2024-11-18 12:01:52.122548 | db1 | [tbl1:some_index] | 2 | 1128064 | SELECT * FROM tbl1 ... LIMIT 1 ; | 1.058942591 | 1.056853228 | 1.023483875 | +| 2024-11-18 12:01:52.107951 | db1 | [tbl1:some_index] | 2 | 1128064 | SELECT * FROM tbl1 ... LIMIT 1 ; | 1.044847031 | 1.042546122 | 0.934768555 | ++----------------------------+-----+-------------------+--------------+------------+-----------------------------------+--------------------+--------------------+--------------------+ +5 rows in set (1.26 sec) +``` ### TiKV MVCCのインメモリエンジンが有効になっているかどうかを確認するにはどうすればよいですか? {#how-can-i-check-whether-the-tikv-mvcc-in-memory-engine-is-enabled} @@ -142,19 +144,21 @@ TiKVの設定は、 [`SHOW CONFIG`](/sql-statements/sql-statement-show-config.md SHOW CONFIG WHERE Type='tikv' AND Name LIKE 'in-memory-engine\.%'; ``` - +------+-----------------+-----------------------------------------------+---------+ - | Type | Instance | Name | Value | - +------+-----------------+-----------------------------------------------+---------+ - | tikv | 127.0.0.1:20160 | in-memory-engine.capacity | 5GiB | - | tikv | 127.0.0.1:20160 | in-memory-engine.cross-check-interval | 0s | - | tikv | 127.0.0.1:20160 | in-memory-engine.enable | true | - | tikv | 127.0.0.1:20160 | in-memory-engine.evict-threshold | 4920MiB | - | tikv | 127.0.0.1:20160 | in-memory-engine.gc-run-interval | 3m | - | tikv | 127.0.0.1:20160 | in-memory-engine.load-evict-interval | 5m | - | tikv | 127.0.0.1:20160 | in-memory-engine.mvcc-amplification-threshold | 10 | - | tikv | 127.0.0.1:20160 | in-memory-engine.stop-load-threshold | 4208MiB | - +------+-----------------+-----------------------------------------------+---------+ - 8 rows in set (0.00 sec) +``` ++------+-----------------+-----------------------------------------------+---------+ +| Type | Instance | Name | Value | ++------+-----------------+-----------------------------------------------+---------+ +| tikv | 127.0.0.1:20160 | in-memory-engine.capacity | 5GiB | +| tikv | 127.0.0.1:20160 | in-memory-engine.cross-check-interval | 0s | +| tikv | 127.0.0.1:20160 | in-memory-engine.enable | true | +| tikv | 127.0.0.1:20160 | in-memory-engine.evict-threshold | 4920MiB | +| tikv | 127.0.0.1:20160 | in-memory-engine.gc-run-interval | 3m | +| tikv | 127.0.0.1:20160 | in-memory-engine.load-evict-interval | 5m | +| tikv | 127.0.0.1:20160 | in-memory-engine.mvcc-amplification-threshold | 10 | +| tikv | 127.0.0.1:20160 | in-memory-engine.stop-load-threshold | 4208MiB | ++------+-----------------+-----------------------------------------------+---------+ +8 rows in set (0.00 sec) +``` ### TiKV MVCCのインメモリエンジンを監視するにはどうすればよいですか? {#how-can-i-monitor-the-tikv-mvcc-in-memory-engine} diff --git a/time-to-live.md b/time-to-live.md index ccd37b6875261..7f9ff6b4bb72b 100644 --- a/time-to-live.md +++ b/time-to-live.md @@ -179,25 +179,27 @@ TiDBはTTLに関する実行時情報を定期的に収集し、Grafanaでこれ TABLE mysql.tidb_ttl_table_status LIMIT 1\G ``` - *************************** 1. row *************************** - table_id: 85 - parent_table_id: 85 - table_statistics: NULL - last_job_id: 0b4a6d50-3041-4664-9516-5525ee6d9f90 - last_job_start_time: 2023-02-15 20:43:46 - last_job_finish_time: 2023-02-15 20:44:46 - last_job_ttl_expire: 2023-02-15 19:43:46 - last_job_summary: {"total_rows":4369519,"success_rows":4369519,"error_rows":0,"total_scan_task":64,"scheduled_scan_task":64,"finished_scan_task":64} - current_job_id: NULL - current_job_owner_id: NULL - current_job_owner_addr: NULL - current_job_owner_hb_time: NULL - current_job_start_time: NULL - current_job_ttl_expire: NULL - current_job_state: NULL - current_job_status: NULL - current_job_status_update_time: NULL - 1 row in set (0.040 sec) + ``` + *************************** 1. row *************************** + table_id: 85 + parent_table_id: 85 + table_statistics: NULL + last_job_id: 0b4a6d50-3041-4664-9516-5525ee6d9f90 + last_job_start_time: 2023-02-15 20:43:46 + last_job_finish_time: 2023-02-15 20:44:46 + last_job_ttl_expire: 2023-02-15 19:43:46 + last_job_summary: {"total_rows":4369519,"success_rows":4369519,"error_rows":0,"total_scan_task":64,"scheduled_scan_task":64,"finished_scan_task":64} + current_job_id: NULL + current_job_owner_id: NULL + current_job_owner_addr: NULL + current_job_owner_hb_time: NULL + current_job_start_time: NULL + current_job_ttl_expire: NULL + current_job_state: NULL + current_job_status: NULL + current_job_status_update_time: NULL + 1 row in set (0.040 sec) + ``` 列`table_id`はパーティションテーブルの ID であり、列`parent_table_id`はテーブルの ID で、列[`information_schema.tables`](/information-schema/information-schema-tables.md)の ID に対応します。テーブルがパーティションテーブルでない場合、2 つの ID は同じになります。 @@ -211,21 +213,23 @@ TiDBはTTLに関する実行時情報を定期的に収集し、Grafanaでこれ TABLE mysql.tidb_ttl_job_history LIMIT 1\G ``` - *************************** 1. row *************************** - job_id: f221620c-ab84-4a28-9d24-b47ca2b5a301 - table_id: 85 - parent_table_id: 85 - table_schema: test_schema - table_name: TestTable - partition_name: NULL - create_time: 2023-02-15 17:43:46 - finish_time: 2023-02-15 17:45:46 - ttl_expire: 2023-02-15 16:43:46 - summary_text: {"total_rows":9588419,"success_rows":9588419,"error_rows":0,"total_scan_task":63,"scheduled_scan_task":63,"finished_scan_task":63} - expired_rows: 9588419 - deleted_rows: 9588419 - error_delete_rows: 0 - status: finished + ``` + *************************** 1. row *************************** + job_id: f221620c-ab84-4a28-9d24-b47ca2b5a301 + table_id: 85 + parent_table_id: 85 + table_schema: test_schema + table_name: TestTable + partition_name: NULL + create_time: 2023-02-15 17:43:46 + finish_time: 2023-02-15 17:45:46 + ttl_expire: 2023-02-15 16:43:46 + summary_text: {"total_rows":9588419,"success_rows":9588419,"error_rows":0,"total_scan_task":63,"scheduled_scan_task":63,"finished_scan_task":63} + expired_rows: 9588419 + deleted_rows: 9588419 + error_delete_rows: 0 + status: finished + ``` 列`table_id`はパーティションテーブルの ID であり、 `parent_table_id`はテーブルの ID で、 `information_schema.tables`の ID に対応します。 `table_schema` 、 `table_name` 、および`partition_name` 、データベース、テーブル名、およびパーティション名に対応します。 `create_time` 、 `finish_time` 、および`ttl_expire` 、TTL タスクの作成時刻、終了時刻、および有効期限を示します。 `expired_rows`と`deleted_rows` 、期限切れの行数と正常に削除された行数を示します。 diff --git a/tiproxy/tiproxy-command-line-flags.md b/tiproxy/tiproxy-command-line-flags.md index a64081eb83c18..c52f3cfac3f73 100644 --- a/tiproxy/tiproxy-command-line-flags.md +++ b/tiproxy/tiproxy-command-line-flags.md @@ -65,11 +65,15 @@ ls bin/tiproxyctl ### 構文 {#syntax} - tiproxyctl [flags] [command] +``` +tiproxyctl [flags] [command] +``` 例えば: - tiproxyctl --host 127.0.0.1 --port 3080 config get +``` +tiproxyctl --host 127.0.0.1 --port 3080 config get +``` ### オプション {#options} diff --git a/tiproxy/tiproxy-traffic-replay.md b/tiproxy/tiproxy-traffic-replay.md index b76b0fdc37e49..3c6bb1d433549 100644 --- a/tiproxy/tiproxy-traffic-replay.md +++ b/tiproxy/tiproxy-traffic-replay.md @@ -98,15 +98,17 @@ TiProxy v1.3.0以降では、TiProxyを使用してTiDB本番クラスタのア SELECT * FROM tiproxy_traffic_replay.fail LIMIT 1\G ``` - *************************** 1. row *************************** - cmd_type: StmtExecute - digest: 89c5c505772b8b7e8d5d1eb49f4d47ed914daa2663ed24a85f762daa3cdff43c - sample_stmt: INSERT INTO new_order (no_o_id, no_d_id, no_w_id) VALUES (?, ?, ?) params=[3077 6 1] - sample_err_msg: ERROR 1062 (23000): Duplicate entry '1-6-3077' for key 'new_order.PRIMARY' - sample_conn_id: 1356 - sample_capture_time: 2024-10-17 12:59:15 - sample_replay_time: 2024-10-17 13:05:05 - count: 4 + ``` + *************************** 1. row *************************** + cmd_type: StmtExecute + digest: 89c5c505772b8b7e8d5d1eb49f4d47ed914daa2663ed24a85f762daa3cdff43c + sample_stmt: INSERT INTO new_order (no_o_id, no_d_id, no_w_id) VALUES (?, ?, ?) params=[3077 6 1] + sample_err_msg: ERROR 1062 (23000): Duplicate entry '1-6-3077' for key 'new_order.PRIMARY' + sample_conn_id: 1356 + sample_capture_time: 2024-10-17 12:59:15 + sample_replay_time: 2024-10-17 13:05:05 + count: 4 + ``` `other_errors`テーブルには、ネットワーク エラーやデータベース接続エラーなどの予期しないエラーが次のフィールドに格納されます。 @@ -121,11 +123,13 @@ TiProxy v1.3.0以降では、TiProxyを使用してTiDB本番クラスタのア SELECT * FROM tiproxy_traffic_replay.other_errors LIMIT 1\G ``` - *************************** 1. row *************************** - err_type: failed to read the connection: EOF - sample_err_msg: this is an error from the backend connection: failed to read the connection: EOF - sample_replay_time: 2024-10-17 12:57:39 - count: 1 + ``` + *************************** 1. row *************************** + err_type: failed to read the connection: EOF + sample_err_msg: this is an error from the backend connection: failed to read the connection: EOF + sample_replay_time: 2024-10-17 12:57:39 + count: 1 + ``` > **Note:** > diff --git a/tiup/tiup-bench.md b/tiup/tiup-bench.md index b130bdd260100..17a95ff01982c 100644 --- a/tiup/tiup-bench.md +++ b/tiup/tiup-bench.md @@ -17,28 +17,30 @@ tiup bench rawsql # Benchmark a database using arbitrary SQL files `tpcc` 、 `tpch` 、 `ch` 、 `rawsql`は以下の共通コマンドフラグを共有します。ただし、 `ycsb`は主に`.properties`ファイルによって設定され、その[使用ガイド](https://github.com/pingcap/go-ycsb#usage)に記述されています。 - -t, --acThreads int OLAP client concurrency, only for CH-benCHmark (default to 1) - --conn-params string Session variables, such as setting `--conn-params tidb_isolation_read_engines='tiflash'` for TiDB queries and setting `--conn-params sslmode=disable` for PostgreSQL connections - --count int Total execution count (0 means infinite count) - -D, --db string Database name (default to "test") - -d, --driver string Database driver: mysql, postgres (default to "mysql") - --dropdata Clean up historical data before preparing - -H, --host strings Database host (default to [127.0.0.1]) - --ignore-error Ignore errors when running workload - --interval duration Output interval time (default to 10s) - --isolation int Isolation Level (0: Default; 1: ReadUncommitted; - 2: ReadCommitted; 3: WriteCommitted; 4: RepeatableRead; - 5: Snapshot; 6: Serializable; 7: Linerizable) - --max-procs int runtime.GOMAXPROCS of golang, the limits of how many cores can be used - --output string Output style. Valid values can be { plain | table | json } (default to "plain") - -p, --password string Database password - -P, --port ints Database port (default to [4000]) - --pprof string Address of pprof endpoint - --silence Don't print errors when running workload - -S, --statusPort int Database status port (default to 10080) - -T, --threads int Thread concurrency (default to 1) - --time duration Total execution time (default to 2562047h47m16.854775807s) - -U, --user string Database user (default to "root") +``` + -t, --acThreads int OLAP client concurrency, only for CH-benCHmark (default to 1) + --conn-params string Session variables, such as setting `--conn-params tidb_isolation_read_engines='tiflash'` for TiDB queries and setting `--conn-params sslmode=disable` for PostgreSQL connections + --count int Total execution count (0 means infinite count) + -D, --db string Database name (default to "test") + -d, --driver string Database driver: mysql, postgres (default to "mysql") + --dropdata Clean up historical data before preparing + -H, --host strings Database host (default to [127.0.0.1]) + --ignore-error Ignore errors when running workload + --interval duration Output interval time (default to 10s) + --isolation int Isolation Level (0: Default; 1: ReadUncommitted; + 2: ReadCommitted; 3: WriteCommitted; 4: RepeatableRead; + 5: Snapshot; 6: Serializable; 7: Linerizable) + --max-procs int runtime.GOMAXPROCS of golang, the limits of how many cores can be used + --output string Output style. Valid values can be { plain | table | json } (default to "plain") + -p, --password string Database password + -P, --port ints Database port (default to [4000]) + --pprof string Address of pprof endpoint + --silence Don't print errors when running workload + -S, --statusPort int Database status port (default to 10080) + -T, --threads int Thread concurrency (default to 1) + --time duration Total execution time (default to 2562047h47m16.854775807s) + -U, --user string Database user (default to "root") +``` - `--host`と`--port`にカンマ区切りの値を指定すると、クライアント側の負荷分散が有効になります。例えば`--host 172.16.4.1,172.16.4.2 --port 4000,4001`を指定すると、プログラムはラウンドロビン方式で選択された 172.16.4.1:4000、172.16.4.1:4001、172.16.4.2:4000、172.16.4.2:4001 に接続します。 - ローカルデプロイメントの場合、デフォルトのデータベースホストアドレスは`127.0.0.1`です。リモートデータベースに接続する場合は、ホストとその他の関連パラメータを指定する必要があります。例: `tiup bench tpcc -H 192.168.169.31 -P 4000 -D tpcc -U root -p tidb --warehouses 4 --parts 4 prepare` diff --git a/tiup/tiup-command-clean.md b/tiup/tiup-command-clean.md index 2b34c03dae2e7..cd7094bf28da7 100644 --- a/tiup/tiup-command-clean.md +++ b/tiup/tiup-command-clean.md @@ -25,6 +25,8 @@ tiup clean [name] [flags] ## 出力 {#output} - Clean instance of `%s`, directory: %s +``` +Clean instance of `%s`, directory: %s +``` [<< 前のページに戻る - TiUPリファレンスコマンドリスト](/tiup/tiup-reference.md#command-list) diff --git a/tiup/tiup-command-mirror-init.md b/tiup/tiup-command-mirror-init.md index 1bac57d2919f7..c25bb0c6eea23 100644 --- a/tiup/tiup-command-mirror-init.md +++ b/tiup/tiup-command-mirror-init.md @@ -7,16 +7,18 @@ summary: tiup mirror init` コマンドは空のミラーを初期化し、root. コマンド`tiup mirror init`空のミラーを初期化するために使用されます。初期化されたミラーには、コンポーネントやコンポーネントの所有者は含まれません。このコマンドは、初期化されたミラーに対して以下のファイルのみを生成します。 - + # Mirror's root directory - |-- root.json # Mirror's root certificate - |-- 1.index.json # Component/user index - |-- snapshot.json # Mirror's latest snapshot - |-- timestamp.json # Mirror's latest timestamp - |--+ keys # Mirror's private key (can be moved to other locations) - |-- {hash1..hashN}-root.json # Private key of the root certificate - |-- {hash}-index.json # Private key of the indexes - |-- {hash}-snapshot.json # Private key of the snapshots - |-- {hash}-timestamp.json # Private key of the timestamps +``` ++ # Mirror's root directory +|-- root.json # Mirror's root certificate +|-- 1.index.json # Component/user index +|-- snapshot.json # Mirror's latest snapshot +|-- timestamp.json # Mirror's latest timestamp +|--+ keys # Mirror's private key (can be moved to other locations) + |-- {hash1..hashN}-root.json # Private key of the root certificate + |-- {hash}-index.json # Private key of the indexes + |-- {hash}-snapshot.json # Private key of the snapshots + |-- {hash}-timestamp.json # Private key of the timestamps +``` 上記ファイルの具体的な使用方法や内容の形式については、 [TiUPミラーリファレンスガイド](/tiup/tiup-mirror-reference.md)を参照してください。 diff --git a/tiup/tiup-command-mirror-set.md b/tiup/tiup-command-mirror-set.md index b937733b45932..3ac4da9e03f33 100644 --- a/tiup/tiup-command-mirror-set.md +++ b/tiup/tiup-command-mirror-set.md @@ -28,11 +28,15 @@ tiup mirror set [flags] ミラーセキュリティにおいて最も重要な要素として、各ミラーのルート証明書は互いに異なります。ネットワークミラーを使用すると、中間者攻撃の被害を受ける可能性があります。このような攻撃を回避するには、ルートネットワークミラーのルート証明書を手動でローカルにダウンロードすることをお勧めします。 - wget /root.json -O /path/to/local/root.json +``` +wget /root.json -O /path/to/local/root.json +``` 手動でチェックを実行してルート証明書が正しいことを確認し、ルート証明書を手動で指定してミラーを切り替えます。 - tiup mirror set -r /path/to/local/root.json +``` +tiup mirror set -r /path/to/local/root.json +``` 上記の手順では、 `wget`コマンドの前にミラーが攻撃された場合、ルート証明書が正しくないことが分かります。`wget`コマンドの後にミラーが攻撃された場合、 TiUPはミラーがルート証明書と一致しないことを検出します。 diff --git a/tiup/tiup-component-cluster-check.md b/tiup/tiup-component-cluster-check.md index 9b68197f64faf..344a888aa77cf 100644 --- a/tiup/tiup-component-cluster-check.md +++ b/tiup/tiup-component-cluster-check.md @@ -54,7 +54,9 @@ summary: TiUP クラスタは、ハードウェアとソフトウェア環境が THP が有効になっているかどうかを確認するには、次のコマンドを実行します。 - cat /sys/kernel/mm/transparent_hugepage/enabled +``` +cat /sys/kernel/mm/transparent_hugepage/enabled +``` `never`に設定されていない場合は`grubby --update-kernel=ALL --args="transparent_hugepage=never"`に変更できます。 @@ -64,9 +66,11 @@ THP が有効になっているかどうかを確認するには、次のコマ `/etc/security/limits.conf`ファイル内の制限値を確認します。 - soft nofile 1000000 - hard nofile 1000000 - soft stack 10240 +``` + soft nofile 1000000 + hard nofile 1000000 + soft stack 10240 +``` ``は TiDB クラスターを展開して実行するユーザーであり、最後の列はシステムに必要な最小値です。 diff --git a/tiup/tiup-mirror.md b/tiup/tiup-mirror.md index c83d9d7878678..e9327ac6c8c79 100644 --- a/tiup/tiup-mirror.md +++ b/tiup/tiup-mirror.md @@ -187,9 +187,11 @@ tiup mirror grant jdoe $ tiup hello ``` - The component `hello` version is not installed; downloading from repository. - Starting component `hello`: /home/dvaneeden/.tiup/components/hello/v0.0.1/hello - hello + ``` + The component `hello` version is not installed; downloading from repository. + Starting component `hello`: /home/dvaneeden/.tiup/components/hello/v0.0.1/hello + hello + ``` `tiup mirror merge`を使用すると、カスタムコンポーネントを含むリポジトリを別のリポジトリにマージできます。これは、 `/data/my_custom_components`内のすべてのコンポーネントが現在の`$USER`によって署名されていることを前提としています。 diff --git a/tiup/tiup-overview.md b/tiup/tiup-overview.md index 8090b04077ebe..9cfcdf1264da1 100644 --- a/tiup/tiup-overview.md +++ b/tiup/tiup-overview.md @@ -46,54 +46,56 @@ TiUPエコシステムでは、任意のコマンドに`--help`を追加する tiup --help ``` - TiUP is a command-line component management tool that can help to download and install - TiDB platform components to the local system. You can run a specific version of a component via - "tiup [:version]". If no version number is specified, the latest version installed - locally will be used. If the specified component does not have any version installed locally, - the latest stable version will be downloaded from the repository. - - Usage: - tiup [flags] [args...] - tiup [flags] [args...] - tiup [command] - - Examples: - $ tiup playground # Quick start - $ tiup playground nightly # Start a playground with the latest nightly version - $ tiup install [:version] # Install a component of specific version - $ tiup update --all # Update all installed components to the latest version - $ tiup update --nightly # Update all installed components to the nightly version - $ tiup update --self # Update the "tiup" to the latest version - $ tiup list # Fetch the latest supported components list - $ tiup status # Display all running/terminated instances - $ tiup clean # Clean the data of running/terminated instance (Kill process if it's running) - $ tiup clean --all # Clean the data of all running/terminated instances - - Available Commands: - install Install a specific version of a component - list List the available TiDB components or versions - uninstall Uninstall components or versions of a component - update Update tiup components to the latest version - status List the status of instantiated components - clean Clean the data of instantiated components - mirror Manage a repository mirror for TiUP components - telemetry Controls things about telemetry - env Show the list of system environment variable that related to TiUP - history Display the historical execution record of TiUP, displays 100 lines by default - link Link component binary to $TIUP_HOME/bin/ - unlink Unlink component binary to $TIUP_HOME/bin/ - help Help about any command - completion Generate the autocompletion script for the specified shell - - Flags: - --binary [:version] Print binary path of a specific version of a component [:version] - and the latest version installed will be selected if no version specified - --binpath string Specify the binary path of component instance - -h, --help help for tiup - -T, --tag string [Deprecated] Specify a tag for component instance - -v, --version Print the version of tiup - - Use "tiup [command] --help" for more information about a command. +``` +TiUP is a command-line component management tool that can help to download and install +TiDB platform components to the local system. You can run a specific version of a component via +"tiup [:version]". If no version number is specified, the latest version installed +locally will be used. If the specified component does not have any version installed locally, +the latest stable version will be downloaded from the repository. + +Usage: + tiup [flags] [args...] + tiup [flags] [args...] + tiup [command] + +Examples: + $ tiup playground # Quick start + $ tiup playground nightly # Start a playground with the latest nightly version + $ tiup install [:version] # Install a component of specific version + $ tiup update --all # Update all installed components to the latest version + $ tiup update --nightly # Update all installed components to the nightly version + $ tiup update --self # Update the "tiup" to the latest version + $ tiup list # Fetch the latest supported components list + $ tiup status # Display all running/terminated instances + $ tiup clean # Clean the data of running/terminated instance (Kill process if it's running) + $ tiup clean --all # Clean the data of all running/terminated instances + +Available Commands: + install Install a specific version of a component + list List the available TiDB components or versions + uninstall Uninstall components or versions of a component + update Update tiup components to the latest version + status List the status of instantiated components + clean Clean the data of instantiated components + mirror Manage a repository mirror for TiUP components + telemetry Controls things about telemetry + env Show the list of system environment variable that related to TiUP + history Display the historical execution record of TiUP, displays 100 lines by default + link Link component binary to $TIUP_HOME/bin/ + unlink Unlink component binary to $TIUP_HOME/bin/ + help Help about any command + completion Generate the autocompletion script for the specified shell + +Flags: + --binary [:version] Print binary path of a specific version of a component [:version] + and the latest version installed will be selected if no version specified + --binpath string Specify the binary path of component instance + -h, --help help for tiup + -T, --tag string [Deprecated] Specify a tag for component instance + -v, --version Print the version of tiup + +Use "tiup [command] --help" for more information about a command. +``` 出力は長くなりますが、次の 2 つの部分だけに注目してください。 diff --git a/tiup/tiup-playground.md b/tiup/tiup-playground.md index 7ae80531e7c5b..3f2f6a71e8e64 100644 --- a/tiup/tiup-playground.md +++ b/tiup/tiup-playground.md @@ -125,12 +125,14 @@ tiup playground display 上記のコマンドを実行すると、以下の結果が返されます。 - Pid Role Uptime - --- ---- ------ - 84518 pd 35m22.929404512s - 84519 tikv 35m22.927757153s - 86189 tidb exited - 86526 tidb 34m28.293148663s +``` +Pid Role Uptime +--- ---- ------ +84518 pd 35m22.929404512s +84519 tikv 35m22.927757153s +86189 tidb exited +86526 tidb 34m28.293148663s +``` ## クラスターをスケールアウトする {#scale-out-a-cluster} @@ -156,7 +158,9 @@ TiUP v1.15.0以降では、 TiUP Playgroundを使用してクラスターにTiPr 1. ファイル`tidb.toml`を作成し、以下の設定を追加してください。 - graceful-wait-before-shutdown=15 + ``` + graceful-wait-before-shutdown=15 + ``` この設定項目は、TiDBがサーバーをシャットダウンするまでの待機時間(秒単位)を制御し、クラスタのスケールイン操作中にクライアントが切断されるのを防ぎます。 diff --git a/topn-limit-push-down.md b/topn-limit-push-down.md index 80504139c7a38..2f3510d8dfb59 100644 --- a/topn-limit-push-down.md +++ b/topn-limit-push-down.md @@ -24,15 +24,17 @@ create table t(id int primary key, a int not null); explain select * from t order by a limit 10; ``` - +----------------------------+----------+-----------+---------------+--------------------------------+ - | id | estRows | task | access object | operator info | - +----------------------------+----------+-----------+---------------+--------------------------------+ - | TopN_7 | 10.00 | root | | test.t.a, offset:0, count:10 | - | └─TableReader_15 | 10.00 | root | | data:TopN_14 | - | └─TopN_14 | 10.00 | cop[tikv] | | test.t.a, offset:0, count:10 | - | └─TableFullScan_13 | 10000.00 | cop[tikv] | table:t | keep order:false, stats:pseudo | - +----------------------------+----------+-----------+---------------+--------------------------------+ - 4 rows in set (0.00 sec) +``` ++----------------------------+----------+-----------+---------------+--------------------------------+ +| id | estRows | task | access object | operator info | ++----------------------------+----------+-----------+---------------+--------------------------------+ +| TopN_7 | 10.00 | root | | test.t.a, offset:0, count:10 | +| └─TableReader_15 | 10.00 | root | | data:TopN_14 | +| └─TopN_14 | 10.00 | cop[tikv] | | test.t.a, offset:0, count:10 | +| └─TableFullScan_13 | 10000.00 | cop[tikv] | table:t | keep order:false, stats:pseudo | ++----------------------------+----------+-----------+---------------+--------------------------------+ +4 rows in set (0.00 sec) +``` このクエリでは、TopN演算子ノードがデータフィルタリングのためにTiKVにプッシュダウンされ、各コプロセッサーは10件のレコードのみをTiDBに返します。TiDBがデータを集約した後、最終的なフィルタリングが実行されます。 @@ -44,19 +46,21 @@ create table s(id int primary key, a int not null); explain select * from t left join s on t.a = s.a order by t.a limit 10; ``` - +----------------------------------+----------+-----------+---------------+-------------------------------------------------+ - | id | estRows | task | access object | operator info | - +----------------------------------+----------+-----------+---------------+-------------------------------------------------+ - | TopN_12 | 10.00 | root | | test.t.a, offset:0, count:10 | - | └─HashJoin_17 | 12.50 | root | | left outer join, equal:[eq(test.t.a, test.s.a)] | - | ├─TopN_18(Build) | 10.00 | root | | test.t.a, offset:0, count:10 | - | │ └─TableReader_26 | 10.00 | root | | data:TopN_25 | - | │ └─TopN_25 | 10.00 | cop[tikv] | | test.t.a, offset:0, count:10 | - | │ └─TableFullScan_24 | 10000.00 | cop[tikv] | table:t | keep order:false, stats:pseudo | - | └─TableReader_30(Probe) | 10000.00 | root | | data:TableFullScan_29 | - | └─TableFullScan_29 | 10000.00 | cop[tikv] | table:s | keep order:false, stats:pseudo | - +----------------------------------+----------+-----------+---------------+-------------------------------------------------+ - 8 rows in set (0.01 sec) +``` ++----------------------------------+----------+-----------+---------------+-------------------------------------------------+ +| id | estRows | task | access object | operator info | ++----------------------------------+----------+-----------+---------------+-------------------------------------------------+ +| TopN_12 | 10.00 | root | | test.t.a, offset:0, count:10 | +| └─HashJoin_17 | 12.50 | root | | left outer join, equal:[eq(test.t.a, test.s.a)] | +| ├─TopN_18(Build) | 10.00 | root | | test.t.a, offset:0, count:10 | +| │ └─TableReader_26 | 10.00 | root | | data:TopN_25 | +| │ └─TopN_25 | 10.00 | cop[tikv] | | test.t.a, offset:0, count:10 | +| │ └─TableFullScan_24 | 10000.00 | cop[tikv] | table:t | keep order:false, stats:pseudo | +| └─TableReader_30(Probe) | 10000.00 | root | | data:TableFullScan_29 | +| └─TableFullScan_29 | 10000.00 | cop[tikv] | table:s | keep order:false, stats:pseudo | ++----------------------------------+----------+-----------+---------------+-------------------------------------------------+ +8 rows in set (0.01 sec) +``` このクエリでは、TopN演算子のソートルールは外部テーブル`t`の列のみに依存するため、TopNをJoinにプッシュダウンする前に計算を実行することで、Join操作の計算コストを削減できます。また、TiDBはTopNをストレージレイヤーにプッシュダウンします。 @@ -68,17 +72,19 @@ create table s(id int primary key, a int not null); explain select * from t join s on t.a = s.a order by t.id limit 10; ``` - +-------------------------------+----------+-----------+---------------+--------------------------------------------+ - | id | estRows | task | access object | operator info | - +-------------------------------+----------+-----------+---------------+--------------------------------------------+ - | TopN_12 | 10.00 | root | | test.t.id, offset:0, count:10 | - | └─HashJoin_16 | 12500.00 | root | | inner join, equal:[eq(test.t.a, test.s.a)] | - | ├─TableReader_21(Build) | 10000.00 | root | | data:TableFullScan_20 | - | │ └─TableFullScan_20 | 10000.00 | cop[tikv] | table:s | keep order:false, stats:pseudo | - | └─TableReader_19(Probe) | 10000.00 | root | | data:TableFullScan_18 | - | └─TableFullScan_18 | 10000.00 | cop[tikv] | table:t | keep order:false, stats:pseudo | - +-------------------------------+----------+-----------+---------------+--------------------------------------------+ - 6 rows in set (0.00 sec) +``` ++-------------------------------+----------+-----------+---------------+--------------------------------------------+ +| id | estRows | task | access object | operator info | ++-------------------------------+----------+-----------+---------------+--------------------------------------------+ +| TopN_12 | 10.00 | root | | test.t.id, offset:0, count:10 | +| └─HashJoin_16 | 12500.00 | root | | inner join, equal:[eq(test.t.a, test.s.a)] | +| ├─TableReader_21(Build) | 10000.00 | root | | data:TableFullScan_20 | +| │ └─TableFullScan_20 | 10000.00 | cop[tikv] | table:s | keep order:false, stats:pseudo | +| └─TableReader_19(Probe) | 10000.00 | root | | data:TableFullScan_18 | +| └─TableFullScan_18 | 10000.00 | cop[tikv] | table:t | keep order:false, stats:pseudo | ++-------------------------------+----------+-----------+---------------+--------------------------------------------+ +6 rows in set (0.00 sec) +``` TopN は`Inner Join`より前にプッシュダウンすることはできません。上記のクエリを例に挙げると、Join 後に 100 件のレコードを取得した場合、TopN 後には 10 件のレコードが残ります。しかし、最初に TopN を実行して 10 件のレコードを取得した場合、Join 後には 5 件のレコードしか残りません。このような場合、プッシュダウンの結果は異なります。 diff --git a/troubleshoot-hot-spot-issues.md b/troubleshoot-hot-spot-issues.md index 318ea18740404..d3ac5174da5b9 100644 --- a/troubleshoot-hot-spot-issues.md +++ b/troubleshoot-hot-spot-issues.md @@ -21,23 +21,29 @@ TiDBは各テーブルにTableID、各インデックスにIndexID、各行にRo 各データ行は、次の規則に従ってキーと値のペアとしてエンコードされます。 - Key: tablePrefix{TableID}_recordPrefixSep{RowID} - Value: [col1, col2, col3, col4] +``` +Key: tablePrefix{TableID}_recordPrefixSep{RowID} +Value: [col1, col2, col3, col4] +``` キーの`tablePrefix`と`recordPrefixSep`は特定の文字列定数であり、KV 空間内の他のデータと区別するために使用されます。 インデックス データの場合、キーと値のペアは次の規則に従ってエンコードされます。 - Key: tablePrefix{TableID}_indexPrefixSep{IndexID}_indexedColumnsValue - Value: rowID +``` +Key: tablePrefix{TableID}_indexPrefixSep{IndexID}_indexedColumnsValue +Value: rowID +``` インデックス データには、一意インデックスと非一意インデックスの 2 種類があります。 - 一意インデックスの場合は、上記のコーディング規則に従うことができます。 - 非一意インデックスの場合、このエンコーディングでは一意キーを構築できません。これは、同じインデックスの`tablePrefix{TableID}_indexPrefixSep{IndexID}`は同じですが、複数の行の`ColumnsValue`は同じになる可能性があるためです。非一意インデックスのエンコーディング規則は次のとおりです。 - Key: tablePrefix{TableID}_indexPrefixSep{IndexID}_indexedColumnsValue_rowID - Value: null + ``` + Key: tablePrefix{TableID}_indexPrefixSep{IndexID}_indexedColumnsValue_rowID + Value: null + ``` ### テーブルホットスポット {#table-hotspots} @@ -85,9 +91,11 @@ TiDBのコーディングルールによれば、同一テーブルのデータ [`SHARD_ROW_ID_BITS`](/shard-row-id-bits.md)を設定すると、行 ID が分散されて複数のリージョンに書き込まれるため、書き込みホットスポットの問題を軽減できます。 - SHARD_ROW_ID_BITS = 4 # Represents 16 shards. - SHARD_ROW_ID_BITS = 6 # Represents 64 shards. - SHARD_ROW_ID_BITS = 0 # Represents the default 1 shard. +``` +SHARD_ROW_ID_BITS = 4 # Represents 16 shards. +SHARD_ROW_ID_BITS = 6 # Represents 64 shards. +SHARD_ROW_ID_BITS = 0 # Represents the default 1 shard. +``` ステートメントの例: diff --git a/tso.md b/tso.md index 00f8ba7a7bfae..f9dd472d5e10d 100644 --- a/tso.md +++ b/tso.md @@ -88,7 +88,9 @@ FROM_UNIXTIME((@ts >> 18)/1000): 2023-08-27 20:33:41.6870 $ tiup ctl:v7.1.0 pd tso 443852055297916932 ``` - system: 2023-08-27 20:33:41.687 +0200 CEST - logic: 4 +``` +system: 2023-08-27 20:33:41.687 +0200 CEST +logic: 4 +``` ここでは、 `system:`で始まる行に物理タイムスタンプが表示され、 `logic:`で始まる行に論理タイムスタンプが表示されます。 diff --git a/tune-tikv-thread-performance.md b/tune-tikv-thread-performance.md index 213ddd2107c1b..3de9b35169e20 100644 --- a/tune-tikv-thread-performance.md +++ b/tune-tikv-thread-performance.md @@ -96,9 +96,11 @@ TiKV v5.0以降、すべての読み取りリクエストはデフォルトで - 理由が memtable 数に関連している場合は、すべての列の`max-write-buffer-number` (デフォルトでは`5` ) を増やすことをお勧めします。 - 理由がレベル 0 のファイル制限に関連している場合は、次のパラメータの値を`64`以上に増やすことをお勧めします。 - rocksdb.defaultcf.level0-slowdown-writes-trigger - rocksdb.writecf.level0-slowdown-writes-trigger - rocksdb.lockcf.level0-slowdown-writes-trigger - rocksdb.defaultcf.level0-stop-writes-trigger - rocksdb.writecf.level0-stop-writes-trigger - rocksdb.lockcf.level0-stop-writes-trigger + ``` + rocksdb.defaultcf.level0-slowdown-writes-trigger + rocksdb.writecf.level0-slowdown-writes-trigger + rocksdb.lockcf.level0-slowdown-writes-trigger + rocksdb.defaultcf.level0-stop-writes-trigger + rocksdb.writecf.level0-stop-writes-trigger + rocksdb.lockcf.level0-stop-writes-trigger + ``` diff --git a/two-data-centers-in-one-city-deployment.md b/two-data-centers-in-one-city-deployment.md index 4a9683b0277ef..69932529b1655 100644 --- a/two-data-centers-in-one-city-deployment.md +++ b/two-data-centers-in-one-city-deployment.md @@ -91,82 +91,84 @@ alertmanager_servers: 計画されたトポロジに基づいてクラスターをデプロイするには、 [配置ルール](/configure-placement-rules.md)を使用してクラスターレプリカの配置場所を決定する必要があります。4 つのレプリカ(Voter レプリカ 2 つをプライマリ AZ、Voter レプリカ 1 つをディザスタリカバリ AZ に、 Learnerレプリカ 1 つをディザスタリカバリ AZ に配置)のデプロイを例に挙げると、配置ルールを使用してレプリカを次のように設定できます。 - cat rule.json - [ +``` +cat rule.json +[ + { + "group_id": "pd", + "group_index": 0, + "group_override": false, + "rules": [ { "group_id": "pd", - "group_index": 0, - "group_override": false, - "rules": [ + "id": "az-east", + "start_key": "", + "end_key": "", + "role": "voter", + "count": 3, + "label_constraints": [ { - "group_id": "pd", - "id": "az-east", - "start_key": "", - "end_key": "", - "role": "voter", - "count": 3, - "label_constraints": [ - { - "key": "az", - "op": "in", - "values": [ - "east" - ] - } - ], - "location_labels": [ - "az", - "rack", - "host" + "key": "az", + "op": "in", + "values": [ + "east" ] - }, + } + ], + "location_labels": [ + "az", + "rack", + "host" + ] + }, + { + "group_id": "pd", + "id": "az-west-1", + "start_key": "", + "end_key": "", + "role": "follower", + "count": 2, + "label_constraints": [ { - "group_id": "pd", - "id": "az-west-1", - "start_key": "", - "end_key": "", - "role": "follower", - "count": 2, - "label_constraints": [ - { - "key": "az", - "op": "in", - "values": [ - "west" - ] - } - ], - "location_labels": [ - "az", - "rack", - "host" + "key": "az", + "op": "in", + "values": [ + "west" ] - }, + } + ], + "location_labels": [ + "az", + "rack", + "host" + ] + }, + { + "group_id": "pd", + "id": "az-west-2", + "start_key": "", + "end_key": "", + "role": "learner", + "count": 1, + "label_constraints": [ { - "group_id": "pd", - "id": "az-west-2", - "start_key": "", - "end_key": "", - "role": "learner", - "count": 1, - "label_constraints": [ - { - "key": "az", - "op": "in", - "values": [ - "west" - ] - } - ], - "location_labels": [ - "az", - "rack", - "host" + "key": "az", + "op": "in", + "values": [ + "west" ] } + ], + "location_labels": [ + "az", + "rack", + "host" ] } ] + } +] +``` `rule.json`の構成を使用するには、次のコマンドを実行して既存の構成を`default.json`ファイルにバックアップし、既存の構成を`rule.json`で上書きします。 @@ -177,24 +179,26 @@ pd-ctl config placement-rules rule-bundle save --in="rule.json" 以前の構成にロールバックする必要がある場合は、バックアップ ファイル`default.json`を復元するか、次の JSON ファイルを手動で作成し、この JSON ファイルで現在の構成を上書きします。 - cat default.json - [ +``` +cat default.json +[ + { + "group_id": "pd", + "group_index": 0, + "group_override": false, + "rules": [ { "group_id": "pd", - "group_index": 0, - "group_override": false, - "rules": [ - { - "group_id": "pd", - "id": "default", - "start_key": "", - "end_key": "", - "role": "voter", - "count": 5 - } - ] + "id": "default", + "start_key": "", + "end_key": "", + "role": "voter", + "count": 5 } ] + } +] +``` ### DR自動同期モードを有効にする {#enable-the-dr-auto-sync-mode} diff --git a/upgrade-monitoring-services.md b/upgrade-monitoring-services.md index c91bb62845b2b..09230da4b4d7e 100644 --- a/upgrade-monitoring-services.md +++ b/upgrade-monitoring-services.md @@ -30,7 +30,9 @@ TiDBとの互換性を高めるため、TiDBインストールパッケージに 1. TiDBサーバーパッケージをダウンロードし、解凍してください。ダウンロードすることにより、 [プライバシーポリシー](https://www.pingcap.com/privacy-policy/)に同意したことになります。 - https://download.pingcap.com/tidb-community-server-{version}-linux-{arch}.tar.gz + ``` + https://download.pingcap.com/tidb-community-server-{version}-linux-{arch}.tar.gz + ``` > **Tip:** > @@ -77,7 +79,9 @@ TiDBとの互換性を高めるため、TiDBインストールパッケージに 1. TiDBサーバーパッケージをダウンロードし、解凍してください。ダウンロードすることにより、 [プライバシーポリシー](https://www.pingcap.com/privacy-policy/)に同意したことになります。 - https://download.pingcap.com/tidb-community-server-{version}-linux-{arch}.tar.gz + ``` + https://download.pingcap.com/tidb-community-server-{version}-linux-{arch}.tar.gz + ``` > **Tip:** > diff --git a/upgrade-tidb-using-tiup.md b/upgrade-tidb-using-tiup.md index 1ba070245a2f9..4bb37a4d1d668 100644 --- a/upgrade-tidb-using-tiup.md +++ b/upgrade-tidb-using-tiup.md @@ -27,7 +27,9 @@ summary: TiUPを使用してTiDBをアップグレードする方法を学びま > > - `performance.force-init-stats`設定項目の値を確認してください。 > -> SHOW CONFIG WHERE type = 'tidb' AND name = 'performance.force-init-stats'; +> ``` +> SHOW CONFIG WHERE type = 'tidb' AND name = 'performance.force-init-stats'; +> ``` > > - TiUPの待機タイムアウトは、コマンドラインオプション[`--wait-timeout`](/tiup/tiup-component-cluster.md#--wait-timeout)を追加することで延長できます。例えば、以下のコマンドを実行すると、待機タイムアウトを1200秒(20分)に設定できます。 > @@ -37,7 +39,9 @@ summary: TiUPを使用してTiDBをアップグレードする方法を学びま > > 一般的に、ほとんどのシナリオでは20分の待機タイムアウトで十分です。より正確な見積もりについては、TiDBログで`init stats info time`を検索して、前回の起動時の統計読み込み時間を参考にしてください。例: > -> [domain.go:2271] ["init stats info time"] [lite=true] ["take time"=2.151333ms] +> ``` +> [domain.go:2271] ["init stats info time"] [lite=true] ["take time"=2.151333ms] +> ``` > > 元のクラスターが v7.1.0 以前の場合、v7.2.0 以降にアップグレードすると、 [`performance.lite-init-stats`](/tidb-configuration-file.md#lite-init-stats-new-in-v710)の導入により、統計情報の読み込み時間が大幅に短縮されます。この場合、アップグレード前の`init stats info time`は、アップグレード後の読み込み時間よりも長くなります。 > @@ -258,9 +262,11 @@ tiup cluster upgrade -h | grep "version" tiup cluster display ``` - Cluster type: tidb - Cluster name: - Cluster version: v8.5.4 +``` +Cluster type: tidb +Cluster name: +Cluster version: v8.5.4 +``` ## FAQ {#faq} diff --git a/user-account-management.md b/user-account-management.md index 81b5585537b68..e5fd4c8678483 100644 --- a/user-account-management.md +++ b/user-account-management.md @@ -106,11 +106,13 @@ CREATE USER 'dummy'@'localhost'; SHOW GRANTS FOR 'admin'@'localhost'; ``` - +-----------------------------------------------------+ - | Grants for admin@localhost | - +-----------------------------------------------------+ - | GRANT RELOAD, PROCESS ON *.* TO 'admin'@'localhost' | - +-----------------------------------------------------+ +``` ++-----------------------------------------------------+ +| Grants for admin@localhost | ++-----------------------------------------------------+ +| GRANT RELOAD, PROCESS ON *.* TO 'admin'@'localhost' | ++-----------------------------------------------------+ +``` To see the account definition for an account, use the [`SHOW CREATE USER`](/sql-statements/sql-statement-show-create-user.md) statement: @@ -118,12 +120,14 @@ To see the account definition for an account, use the [`SHOW CREATE USER`](/sql- SHOW CREATE USER 'admin'@'localhost'; ``` - +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | CREATE USER for admin@localhost | - +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | CREATE USER 'admin'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '*14E65567ABDB5135D0CFD9A70B3032C179A49EE7' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK PASSWORD HISTORY DEFAULT PASSWORD REUSE INTERVAL DEFAULT | - +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - 1 row in set (0.00 sec) +``` ++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| CREATE USER for admin@localhost | ++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| CREATE USER 'admin'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '*14E65567ABDB5135D0CFD9A70B3032C179A49EE7' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK PASSWORD HISTORY DEFAULT PASSWORD REUSE INTERVAL DEFAULT | ++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +1 row in set (0.00 sec) +``` ## ユーザーアカウントを削除する {#remove-user-accounts} @@ -173,8 +177,10 @@ TiDBはパスワードを[`mysql.user`](/mysql-schema/mysql-schema-user.md)シ 2. TiDB ノードのデプロイメント ディレクトリの下の`conf`ディレクトリに入り、 `tidb.toml`構成ファイルを見つけます。 3. 設定ファイルの[`security`](/tidb-configuration-file.md#security)セクションに設定項目[`skip-grant-table`](/tidb-configuration-file.md)を追加します。`security`がない場合は、 `tidb.toml`設定ファイルの末尾に次の2行を追加します。 - [security] - skip-grant-table = true + ``` + [security] + skip-grant-table = true + ``` 2. tidb-server プロセスを停止します。