From 6b8cf9d5b29b160ecb20513895fab05bffb6ae3b Mon Sep 17 00:00:00 2001 From: dsdashun Date: Mon, 5 Sep 2022 15:58:56 +0800 Subject: [PATCH] lightning: enable nogo checks for restore-opts (#37615) close pingcap/tidb#37614 --- br/pkg/lightning/restore/opts/precheck_opts.go | 8 ++++++++ build/nogo_config.json | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/br/pkg/lightning/restore/opts/precheck_opts.go b/br/pkg/lightning/restore/opts/precheck_opts.go index 1a2de0daf19e7..504b803b8ef94 100644 --- a/br/pkg/lightning/restore/opts/precheck_opts.go +++ b/br/pkg/lightning/restore/opts/precheck_opts.go @@ -16,19 +16,27 @@ package opts import "github.com/pingcap/tidb/br/pkg/lightning/mydump" +// PrecheckItemBuilderConfig defines the config used in a precheck builder, +// which affects the behavior for executing precheck items. type PrecheckItemBuilderConfig struct { PreInfoGetterOptions []GetPreInfoOption MDLoaderSetupOptions []mydump.MDLoaderSetupOption } +// PrecheckItemBuilderOption defines the options when constructing a precheck builder, +// which affects the behavior for executing precheck items. type PrecheckItemBuilderOption func(c *PrecheckItemBuilderConfig) +// WithPreInfoGetterOptions generates a precheck item builder option +// to control the get pre info behaviors. func WithPreInfoGetterOptions(opts ...GetPreInfoOption) PrecheckItemBuilderOption { return func(c *PrecheckItemBuilderConfig) { c.PreInfoGetterOptions = append([]GetPreInfoOption{}, opts...) } } +// WithMDLoaderSetupOptions generates a precheck item builder option +// to control the mydumper loader setup behaviors. func WithMDLoaderSetupOptions(opts ...mydump.MDLoaderSetupOption) PrecheckItemBuilderOption { return func(c *PrecheckItemBuilderConfig) { c.MDLoaderSetupOptions = append([]mydump.MDLoaderSetupOption{}, opts...) diff --git a/build/nogo_config.json b/build/nogo_config.json index 94a3f6e13fa53..4a7de9dac0cde 100644 --- a/build/nogo_config.json +++ b/build/nogo_config.json @@ -198,6 +198,7 @@ }, "only_files": { "br/pkg/lightning/mydump/": "br/pkg/lightning/mydump/", + "br/pkg/lightning/restore/opts": "br/pkg/lightning/restore/opts", "executor/aggregate.go": "executor/aggregate.go", "types/json/binary_functions.go": "types/json/binary_functions.go", "types/json/binary_test.go": "types/json/binary_test.go", @@ -324,6 +325,7 @@ }, "only_files": { "br/pkg/lightning/mydump/": "br/pkg/lightning/mydump/", + "br/pkg/lightning/restore/opts": "br/pkg/lightning/restore/opts", "kv/": "kv code", "util/memory": "util/memory", "ddl/": "ddl", @@ -351,6 +353,7 @@ }, "only_files": { "br/pkg/lightning/mydump/": "br/pkg/lightning/mydump/", + "br/pkg/lightning/restore/opts": "br/pkg/lightning/restore/opts", "executor/aggregate.go": "executor/aggregate.go", "types/json/binary_functions.go": "types/json/binary_functions.go", "types/json/binary_test.go": "types/json/binary_test.go", @@ -713,6 +716,7 @@ }, "only_files": { "br/pkg/lightning/mydump/": "br/pkg/lightning/mydump/", + "br/pkg/lightning/restore/opts": "br/pkg/lightning/restore/opts", "executor/aggregate.go": "executor/aggregate.go", "types/json/binary_functions.go": "types/json/binary_functions.go", "types/json/binary_test.go": "types/json/binary_test.go",