From 1bd785e49d237ba9fb15a4e93d77c5597c5c2f2c Mon Sep 17 00:00:00 2001 From: Frank945946 Date: Tue, 12 Nov 2024 14:15:47 +0800 Subject: [PATCH 1/6] Update schema-cache.md --- schema-cache.md | 1 + 1 file changed, 1 insertion(+) diff --git a/schema-cache.md b/schema-cache.md index b6b332f348868..1463a541e27f4 100644 --- a/schema-cache.md +++ b/schema-cache.md @@ -36,3 +36,4 @@ In scenarios with a large number of databases and tables, the following known is - `SHOW FULL TABLES` - `FLASHBACK` - `ALTER TABLE ... SET TIFLASH MODE ...` +- For tables that use "AUTO_INCREMENT" or "AUTO_RANDOM," if the Schema cache is set too small, these tables may frequently enter and exit the cache (which can be monitored by observing the Schema cache hit rate and size in TiDB Dashboard). This situation may cause allocated ID segments to expire before they are fully used, resulting in ID jumps. In scenarios with high write volumes, it may even lead to ID segment exhaustion. Therefore, it is recommended to increase the Schema cache size to avoid frequent cache evictions, or set AUTO_ID_CACHE=1 to prevent ID jumps. Additionally, it is recommended to properly configure the AUTO_RANDOM sharding bits and reserved bits to avoid an overly small range of assignable IDs. \ No newline at end of file From c74d36d8f3d99c508a02eb205ea5d73b61cadf01 Mon Sep 17 00:00:00 2001 From: xixirangrang Date: Tue, 12 Nov 2024 15:53:13 +0800 Subject: [PATCH 2/6] Update schema-cache.md --- schema-cache.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/schema-cache.md b/schema-cache.md index 1463a541e27f4..f7142543ed88b 100644 --- a/schema-cache.md +++ b/schema-cache.md @@ -36,4 +36,8 @@ In scenarios with a large number of databases and tables, the following known is - `SHOW FULL TABLES` - `FLASHBACK` - `ALTER TABLE ... SET TIFLASH MODE ...` -- For tables that use "AUTO_INCREMENT" or "AUTO_RANDOM," if the Schema cache is set too small, these tables may frequently enter and exit the cache (which can be monitored by observing the Schema cache hit rate and size in TiDB Dashboard). This situation may cause allocated ID segments to expire before they are fully used, resulting in ID jumps. In scenarios with high write volumes, it may even lead to ID segment exhaustion. Therefore, it is recommended to increase the Schema cache size to avoid frequent cache evictions, or set AUTO_ID_CACHE=1 to prevent ID jumps. Additionally, it is recommended to properly configure the AUTO_RANDOM sharding bits and reserved bits to avoid an overly small range of assignable IDs. \ No newline at end of file +- When using tables with `AUTO_INCREMENT` or `AUTO_RANDOM`, a small schema cache size might cause these tables to frequently enter and leave the cache (which can be monitored through the schema cache hit rate and size on the monitoring panel). This can result in the allocated ID range becoming invalid before being fully used, leading to ID jumps. In high-write scenarios, this might even exhaust the ID range. To minimize abnormal ID allocation behavior and improve system stability, consider the following measures: + + - Increase the schema cache size to reduce frequent evictions. + - Set [`AUTO_ID_CACHE`](/auto-increment.md#auto_id_cache) to `1` to prevent ID jumps. + - Properly configure the sharding bits and reserved bits for AUTO_RANDOM to avoid having a limited ID range. \ No newline at end of file From 1da0a3804a5348ad37a52efb629702b420febf50 Mon Sep 17 00:00:00 2001 From: xixirangrang Date: Tue, 12 Nov 2024 16:32:53 +0800 Subject: [PATCH 3/6] Update schema-cache.md --- schema-cache.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema-cache.md b/schema-cache.md index f7142543ed88b..45cc4fa2750c6 100644 --- a/schema-cache.md +++ b/schema-cache.md @@ -36,7 +36,7 @@ In scenarios with a large number of databases and tables, the following known is - `SHOW FULL TABLES` - `FLASHBACK` - `ALTER TABLE ... SET TIFLASH MODE ...` -- When using tables with `AUTO_INCREMENT` or `AUTO_RANDOM`, a small schema cache size might cause these tables to frequently enter and leave the cache (which can be monitored through the schema cache hit rate and size on the monitoring panel). This can result in the allocated ID range becoming invalid before being fully used, leading to ID jumps. In high-write scenarios, this might even exhaust the ID range. To minimize abnormal ID allocation behavior and improve system stability, consider the following measures: +- When you use tables with `AUTO_INCREMENT` or `AUTO_RANDOM`, a small schema cache size might cause these tables to frequently enter and leave the cache, which can be monitored through the schema cache hit rate and size on the monitoring panel. This can result in the allocated ID range becoming invalid before being fully used, leading to ID jumps. In write-intensive scenarios, this might even exhaust the ID range. To minimize abnormal ID allocation behavior and improve system stability, consider the following measures: - Increase the schema cache size to reduce frequent evictions. - Set [`AUTO_ID_CACHE`](/auto-increment.md#auto_id_cache) to `1` to prevent ID jumps. From f4a732f66956a185ad49e91e6a5d3f9e07ee4152 Mon Sep 17 00:00:00 2001 From: xixirangrang Date: Tue, 12 Nov 2024 16:40:12 +0800 Subject: [PATCH 4/6] Update schema-cache.md --- schema-cache.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema-cache.md b/schema-cache.md index 45cc4fa2750c6..44bcdc2e5b6ca 100644 --- a/schema-cache.md +++ b/schema-cache.md @@ -36,7 +36,7 @@ In scenarios with a large number of databases and tables, the following known is - `SHOW FULL TABLES` - `FLASHBACK` - `ALTER TABLE ... SET TIFLASH MODE ...` -- When you use tables with `AUTO_INCREMENT` or `AUTO_RANDOM`, a small schema cache size might cause these tables to frequently enter and leave the cache, which can be monitored through the schema cache hit rate and size on the monitoring panel. This can result in the allocated ID range becoming invalid before being fully used, leading to ID jumps. In write-intensive scenarios, this might even exhaust the ID range. To minimize abnormal ID allocation behavior and improve system stability, consider the following measures: +- When you use tables with the [`AUTO_INCREMENT`](/auto-increment.md) or [`AUTO_RANDOM`](/auto-random.md) attribute, a small schema cache size might cause these tables to frequently enter and leave the cache, which can be monitored through the schema cache hit rate and size on the monitoring panel. This can result in the allocated ID range becoming invalid before being fully used, leading to ID jumps. In write-intensive scenarios, this might even exhaust the ID range. To minimize abnormal ID allocation behavior and improve system stability, consider the following measures: - Increase the schema cache size to reduce frequent evictions. - Set [`AUTO_ID_CACHE`](/auto-increment.md#auto_id_cache) to `1` to prevent ID jumps. From a5de7ce7721981a7cbbfffa8c11b005a5b56dba0 Mon Sep 17 00:00:00 2001 From: xixirangrang Date: Tue, 12 Nov 2024 16:42:32 +0800 Subject: [PATCH 5/6] Update schema-cache.md --- schema-cache.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema-cache.md b/schema-cache.md index 44bcdc2e5b6ca..8dfe37d4a62f9 100644 --- a/schema-cache.md +++ b/schema-cache.md @@ -40,4 +40,4 @@ In scenarios with a large number of databases and tables, the following known is - Increase the schema cache size to reduce frequent evictions. - Set [`AUTO_ID_CACHE`](/auto-increment.md#auto_id_cache) to `1` to prevent ID jumps. - - Properly configure the sharding bits and reserved bits for AUTO_RANDOM to avoid having a limited ID range. \ No newline at end of file + - Properly configure the sharding bits and reserved bits for `AUTO_RANDOM` to avoid having a limited ID range. \ No newline at end of file From 12ef8721fb186d6dfd4290e05214412ef7171878 Mon Sep 17 00:00:00 2001 From: xixirangrang Date: Tue, 12 Nov 2024 17:08:27 +0800 Subject: [PATCH 6/6] Update schema-cache.md Co-authored-by: Lilian Lee --- schema-cache.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/schema-cache.md b/schema-cache.md index 8dfe37d4a62f9..6bfd650362bed 100644 --- a/schema-cache.md +++ b/schema-cache.md @@ -36,8 +36,8 @@ In scenarios with a large number of databases and tables, the following known is - `SHOW FULL TABLES` - `FLASHBACK` - `ALTER TABLE ... SET TIFLASH MODE ...` -- When you use tables with the [`AUTO_INCREMENT`](/auto-increment.md) or [`AUTO_RANDOM`](/auto-random.md) attribute, a small schema cache size might cause these tables to frequently enter and leave the cache, which can be monitored through the schema cache hit rate and size on the monitoring panel. This can result in the allocated ID range becoming invalid before being fully used, leading to ID jumps. In write-intensive scenarios, this might even exhaust the ID range. To minimize abnormal ID allocation behavior and improve system stability, consider the following measures: +- When you use tables with the [`AUTO_INCREMENT`](/auto-increment.md) or [`AUTO_RANDOM`](/auto-random.md) attribute, a small schema cache size might cause these tables to frequently enter and leave the cache. You can monitor it through the schema cache hit rate and size on the monitoring panel. This can result in the allocated ID range becoming invalid before being fully used, leading to ID jumps. In write-intensive scenarios, this might even exhaust the ID range. To minimize abnormal ID allocation behavior and improve system stability, it is recommended to take the following measures: - Increase the schema cache size to reduce frequent evictions. - Set [`AUTO_ID_CACHE`](/auto-increment.md#auto_id_cache) to `1` to prevent ID jumps. - - Properly configure the sharding bits and reserved bits for `AUTO_RANDOM` to avoid having a limited ID range. \ No newline at end of file + - Properly configure the shard bits and reserved bits of `AUTO_RANDOM` to avoid a too small ID range. \ No newline at end of file