From 9e61bd2ef5c0a25059638602e78dab435cdf7ae9 Mon Sep 17 00:00:00 2001 From: CbcWestwolf <1004626265@qq.com> Date: Thu, 13 Mar 2025 16:17:29 +0800 Subject: [PATCH] ddl: add a guard UT to limit the DefMaxOfIndexLimit to 512 (#60050) --- pkg/ddl/ddl_error_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/ddl/ddl_error_test.go b/pkg/ddl/ddl_error_test.go index c5e6afb7ba..940f353a61 100644 --- a/pkg/ddl/ddl_error_test.go +++ b/pkg/ddl/ddl_error_test.go @@ -19,6 +19,7 @@ import ( "testing" "github.com/pingcap/failpoint" + "github.com/pingcap/tidb/pkg/config" "github.com/pingcap/tidb/pkg/errno" "github.com/pingcap/tidb/pkg/testkit" "github.com/stretchr/testify/require" @@ -146,3 +147,9 @@ func TestCreateDatabaseError(t *testing.T) { tk.MustExec("create database db1;") require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/pkg/ddl/mockModifyJobSchemaId")) } + +// This is a hard-coded test to make sure that the DefMaxOfIndexLimit is 512 +// This limitation can not be loosened to a larger number until tidb can handle more indexes on one table. +func TestCreateIndexErrTooManyKeys(t *testing.T) { + require.Equal(t, 512, config.DefMaxOfIndexLimit) +}