Repository: pingcap/tidb
File: pkg/lightning/backend/local/local.go (Go)

Code before:
)

var (
	// Local backend is compatible with TiDB [4.0.0, NextMajorVersion).
	localMinTiDBVersion    = *semver.New("4.0.0")
	localMinTiKVVersion    = *semver.New("4.0.0")
	localMinPDVersion      = *semver.New("4.0.0")
	localMaxTiDBVersion    = version.NextMajorVersion()
	localMaxTiKVVersion    = version.NextMajorVersion()
	localMaxPDVersion      = version.NextMajorVersion()
	tiFlashMinVersion      = *semver.New("4.0.5")
	tikvSideFreeSpaceCheck = *semver.New("8.0.0")

	errorEngineClosed     = errors.New("engine is closed")
	maxRetryBackoffSecond = 30

	// MaxWriteAndIngestRetryTimes is the max retry times for write and ingest.
	// A large retry times is for tolerating tikv cluster failures.
	MaxWriteAndIngestRetryTimes = 30

	// Unlimited RPC receive message size for TiKV importer
	unlimitedRPCRecvMsgSize = math.MaxInt32

	// ForceTableSplitThreshold is the threshold of regions to force split table range.
	// It is exported for testing.
	ForceTableSplitThreshold = 100
)

// importClientFactory is factory to create new import client for specific store.
type importClientFactory interface {
	create(ctx context.Context, storeID uint64) (sst.ImportSSTClient, error)
	close()
}

type importClientFactoryImpl struct {
	conns           *common.GRPCConns
	splitCli        split.SplitClient
	tls             *common.TLS
	tcpConcurrency  int
	compressionType config.CompressionType
}

func newImportClientFactoryImpl(
	splitCli split.SplitClient,
	tls *common.TLS,
	tcpConcurrency int,
	compressionType config.CompressionType,
) *importClientFactoryImpl {
	return &importClientFactoryImpl{
		conns:           common.NewGRPCConns(),
		splitCli:        splitCli,

Review comment (suggestion):
```suggestion
	ForcePartitionRegionThreshold = 100
```

Code after:
)

var (
	// Local backend is compatible with TiDB [4.0.0, NextMajorVersion).
	localMinTiDBVersion    = *semver.New("4.0.0")
	localMinTiKVVersion    = *semver.New("4.0.0")
	localMinPDVersion      = *semver.New("4.0.0")
	localMaxTiDBVersion    = version.NextMajorVersion()
	localMaxTiKVVersion    = version.NextMajorVersion()
	localMaxPDVersion      = version.NextMajorVersion()
	tiFlashMinVersion      = *semver.New("4.0.5")
	tikvSideFreeSpaceCheck = *semver.New("8.0.0")

	errorEngineClosed     = errors.New("engine is closed")
	maxRetryBackoffSecond = 30

	// MaxWriteAndIngestRetryTimes is the max retry times for write and ingest.
	// A large retry times is for tolerating tikv cluster failures.
	MaxWriteAndIngestRetryTimes = 30

	// Unlimited RPC receive message size for TiKV importer
	unlimitedRPCRecvMsgSize = math.MaxInt32

	// ForcePartitionRegionThreshold is the threshold of regions to force partition range.
	// It is exported for testing.
	ForcePartitionRegionThreshold = 100
)

// importClientFactory is factory to create new import client for specific store.
type importClientFactory interface {
	create(ctx context.Context, storeID uint64) (sst.ImportSSTClient, error)
	close()
}

type importClientFactoryImpl struct {
	conns           *common.GRPCConns
	splitCli        split.SplitClient
	tls             *common.TLS
	tcpConcurrency  int
	compressionType config.CompressionType
}

func newImportClientFactoryImpl(
	splitCli split.SplitClient,
	tls *common.TLS,
	tcpConcurrency int,
	compressionType config.CompressionType,
) *importClientFactoryImpl {
	return &importClientFactoryImpl{
		conns:           common.NewGRPCConns(),
		splitCli:        splitCli,