From 538cf09a50d3df48f32e1fb876c9b1a897b105b3 Mon Sep 17 00:00:00 2001 From: Roger Song Date: Fri, 29 Mar 2024 14:56:18 +0800 Subject: [PATCH] include the description of critical issue 51407 in doc (#16832) --- sql-prepared-plan-cache.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sql-prepared-plan-cache.md b/sql-prepared-plan-cache.md index 07786ff8d2e05..e70495ca1db9c 100644 --- a/sql-prepared-plan-cache.md +++ b/sql-prepared-plan-cache.md @@ -6,6 +6,13 @@ aliases: ['/tidb/dev/sql-prepare-plan-cache'] # SQL Prepared Execution Plan Cache +> **Warning:** +> +> If a cached `UPDATE` or `DELETE` statement encounters a DDL operation that modifies the relevant schema during execution, it might cause data inconsistency between tables and indexes. For more information, see [Issue #51407](https://github.com/pingcap/tidb/issues/51407). It is recommended to monitor the status of this issue and upgrade to [the latest LTS version](https://docs.pingcap.com/tidb/stable) to resolve this issue. Before upgrading, you can try the following workarounds: +> +> - Before executing DDL, temporarily [disable the prepared plan cache](/system-variables.md#tidb_enable_prepared_plan_cache-new-in-v610), and re-enable it after the DDL is complete. +> - Avoid executing DDL during business peak hours. After executing DDL, immediately run [`ADMIN CHECK TABLE`](/sql-statements/sql-statement-admin-check-table-index.md) to check the consistency between tables and indexes. If errors are found, rebuild the relevant indexes. + TiDB supports execution plan caching for `Prepare` and `Execute` queries. This includes both forms of prepared statements: - Using the `COM_STMT_PREPARE` and `COM_STMT_EXECUTE` protocol features.