Skip to content

Cannot make more than 1000 schema change in the test #58421

@YangKeao

Description

@YangKeao

When I'm developing #58110, I found that after making more than 1000 schema change, all DDL will be blocked.

The following test can be used as a simple reproduce:

func TestCreateAndDropTable(t *testing.T) {
	store, dom := testkit.CreateMockStoreAndDomain(t)
	tk := testkit.NewTestKit(t, store)

	for i := 0; i < 600; i++ {
		logutil.BgLogger().Info("round", zap.Int("round", i))
		tk.RefreshSession()

		tk.MustExec("use test")
		tk.MustExec("DROP TABLE if exists t")
		tk.MustExec("CREATE TABLE t (id INT PRIMARY KEY, created_at DATETIME) TTL = created_at + INTERVAL 1 HOUR TTL_ENABLE='OFF'")
		tbl, err := dom.InfoSchema().TableByName(context.Background(), pmodel.NewCIStr("test"), pmodel.NewCIStr("t"))
		require.NoError(t, err)
		logutil.BgLogger().Info("create table", zap.Int64("table_id", tbl.Meta().ID))

		tk.MustExec("ALTER TABLE t TTL_ENABLE='ON'")
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions