From 57d778f0b1b6daebe0f330af2baa54e9e5310ea4 Mon Sep 17 00:00:00 2001 From: Luo Yangzhixin Date: Fri, 4 Aug 2023 13:20:40 +0800 Subject: [PATCH] lightning: revise the structure of table `conflict_error_v1` and add index for faster search (#45799) ref pingcap/tidb#45774 --- br/pkg/lightning/errormanager/errormanager.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/br/pkg/lightning/errormanager/errormanager.go b/br/pkg/lightning/errormanager/errormanager.go index ca5e37c154f7d..d8a25ebe40d6d 100644 --- a/br/pkg/lightning/errormanager/errormanager.go +++ b/br/pkg/lightning/errormanager/errormanager.go @@ -84,7 +84,8 @@ const ( raw_value mediumblob NOT NULL COMMENT 'the value of the conflicted key', raw_handle mediumblob NOT NULL COMMENT 'the data handle derived from the conflicted key or value', raw_row mediumblob NOT NULL COMMENT 'the data retrieved from the handle', - KEY (task_id, table_name) + KEY (task_id, table_name), + INDEX (index_name) ); ` @@ -321,7 +322,7 @@ func (em *ErrorManager) RecordDataConflictError( if em.conflictErrRemain.Sub(int64(len(conflictInfos))) < 0 { threshold := em.configConflict.Threshold // Still need to record this batch of conflict records, and then return this error at last. - // Otherwise, if the max-error.conflict is set a very small value, non of the conflict errors will be recorded + // Otherwise, if the max-error.conflict is set a very small value, none of the conflict errors will be recorded gerr = errors.Errorf( "The number of conflict errors exceeds the threshold configured by `conflict.threshold`: '%d'", threshold)