MCPcopy Index your code
hub / github.com/pingcap/tidb / TestBuildRegionQueriesWithoutPartition

Function TestBuildRegionQueriesWithoutPartition

dumpling/export/sql_test.go:937–1096  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

935}
936
937func TestBuildRegionQueriesWithoutPartition(t *testing.T) {
938 db, mock, err := sqlmock.New()
939 require.NoError(t, err)
940 defer func() {
941 require.NoError(t, db.Close())
942 }()
943
944 conn, err := db.Conn(context.Background())
945 require.NoError(t, err)
946 baseConn := newBaseConn(conn, true, nil)
947 tctx, cancel := tcontext.Background().WithLogger(appLogger).WithCancel()
948 metrics := newMetrics(promutil.NewDefaultFactory(), nil)
949
950 d := &Dumper{
951 tctx: tctx,
952 conf: DefaultConfig(),
953 cancelCtx: cancel,
954 metrics: metrics,
955 selectTiDBTableRegionFunc: selectTiDBTableRegion,
956 }
957 d.conf.ServerInfo = version.ServerInfo{
958 HasTiKV: true,
959 ServerType: version.ServerTypeTiDB,
960 ServerVersion: gcSafePointVersion,
961 }
962 d.conf.Rows = 200000
963 database := "foo"
964 table := "bar"
965
966 testCases := []struct {
967 regionResults [][]driver.Value
968 handleColNames []string
969 handleColTypes []string
970 expectedWhereClauses []string
971 hasTiDBRowID bool
972 }{
973 {
974 [][]driver.Value{
975 {"7480000000000000FF3300000000000000F8", "7480000000000000FF3300000000000000F8"},
976 },
977 []string{"a"},
978 []string{"BIGINT"},
979 []string{
980 "",
981 },
982 false,
983 },
984 {
985 [][]driver.Value{
986 {"7480000000000000FF3300000000000000F8", "7480000000000000FF3300000000000000F8"},
987 },
988 []string{"_tidb_rowid"},
989 []string{"BIGINT"},
990 []string{
991 "",
992 },
993 true,
994 },

Callers

nothing calls this directly

Calls 15

concurrentDumpTableMethod · 0.95
BackgroundFunction · 0.92
NewDefaultFactoryFunction · 0.92
newBaseConnFunction · 0.85
newMetricsFunction · 0.85
buildOrderByClauseStringFunction · 0.85
buildSelectQueryFunction · 0.85
buildWhereConditionFunction · 0.85
WithCancelMethod · 0.80
WithLoggerMethod · 0.80
LogfMethod · 0.80
DefaultConfigFunction · 0.70

Tested by

no test coverage detected