Skip to content

The dump stats and DDL event handling may conflict #58545

@0xPoe

Description

@0xPoe

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

func TestDumpStatsDeltaBeforeHandleDDLEvent(t *testing.T) {
	store, dom := testkit.CreateMockStoreAndDomain(t)
	tk := testkit.NewTestKit(t, store)
	tk.MustExec("use test")
	tk.MustExec("create table t (c1 int)")
	// Insert some data.
	tk.MustExec("insert into t values (1), (2), (3)")
	h := dom.StatsHandle()
	require.NoError(t, h.DumpStatsDeltaToKV(true))
	// Find the DDL event.
	event := findEvent(h.DDLEventCh(), model.ActionCreateTable)
	err := statstestutil.HandleDDLEventWithTxn(h, event)
	require.NoError(t, err)
}

2. What did you expect to see? (Required)

It works well and we can tolerate the error.

3. What did you see instead (Required)

It bails out an error.

4. What is your TiDB version? (Required)

master

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions