diff --git a/br/pkg/lightning/backend/external/util.go b/br/pkg/lightning/backend/external/util.go index 34480e026f1e1..d433e4816998c 100644 --- a/br/pkg/lightning/backend/external/util.go +++ b/br/pkg/lightning/backend/external/util.go @@ -277,15 +277,7 @@ func (m *SortedKVMeta) Merge(other *SortedKVMeta) { // MergeSummary merges the WriterSummary into this SortedKVMeta. func (m *SortedKVMeta) MergeSummary(summary *WriterSummary) { - m.MinKey = NotNilMin(m.MinKey, summary.Min) - m.MaxKey = NotNilMax(m.MaxKey, summary.Max) - m.TotalKVSize += summary.TotalSize - for _, f := range summary.MultipleFilesStats { - for _, filename := range f.Filenames { - m.DataFiles = append(m.DataFiles, filename[0]) - m.StatFiles = append(m.StatFiles, filename[1]) - } - } + m.Merge(NewSortedKVMeta(summary)) } // NotNilMin returns the smallest of a and b, ignoring nil values. diff --git a/br/pkg/lightning/backend/local/local.go b/br/pkg/lightning/backend/local/local.go index ed26117bc669b..cf39bbfb73b52 100644 --- a/br/pkg/lightning/backend/local/local.go +++ b/br/pkg/lightning/backend/local/local.go @@ -1694,8 +1694,6 @@ func (local *Backend) GetExternalEngineKVStatistics(engineUUID uuid.UUID) ( totalKVSize int64, totalKVCount int64) { v, ok := local.externalEngine[engineUUID] if !ok { - // we get it after import, but before clean up, so this should not happen - // todo: return error return 0, 0 } return v.KVStatistics() diff --git a/executor/importer/table_import.go b/executor/importer/table_import.go index 6300d70eaba2e..cf441346c67db 100644 --- a/executor/importer/table_import.go +++ b/executor/importer/table_import.go @@ -150,12 +150,11 @@ func GetCachedKVStoreFrom(pdAddr string, tls *common.TLS) (tidbkv.Storage, error // GetRegionSplitSizeKeys gets the region split size and keys from PD. func GetRegionSplitSizeKeys(ctx context.Context) (regionSplitSize int64, regionSplitKeys int64, err error) { tidbCfg := tidb.GetGlobalConfig() - hostPort := net.JoinHostPort("127.0.0.1", strconv.Itoa(int(tidbCfg.Status.StatusPort))) tls, err := common.NewTLS( tidbCfg.Security.ClusterSSLCA, tidbCfg.Security.ClusterSSLCert, tidbCfg.Security.ClusterSSLKey, - hostPort, + "", nil, nil, nil, ) if err != nil {