MCPcopy
hub / github.com/pingcap/tidb / TestBuildRegionQueriesWithPartitions

Function TestBuildRegionQueriesWithPartitions

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

Source from the content-addressed store, hash-verified

1096}
1097
1098func TestBuildRegionQueriesWithPartitions(t *testing.T) {
1099 db, mock, err := sqlmock.New()
1100 require.NoError(t, err)
1101 defer func() {
1102 require.NoError(t, db.Close())
1103 }()
1104
1105 conn, err := db.Conn(context.Background())
1106 require.NoError(t, err)
1107 baseConn := newBaseConn(conn, true, nil)
1108 tctx, cancel := tcontext.Background().WithLogger(appLogger).WithCancel()
1109 metrics := newMetrics(promutil.NewDefaultFactory(), nil)
1110
1111 d := &Dumper{
1112 tctx: tctx,
1113 conf: DefaultConfig(),
1114 cancelCtx: cancel,
1115 metrics: metrics,
1116 selectTiDBTableRegionFunc: selectTiDBTableRegion,
1117 }
1118 d.conf.ServerInfo = version.ServerInfo{
1119 HasTiKV: true,
1120 ServerType: version.ServerTypeTiDB,
1121 ServerVersion: gcSafePointVersion,
1122 }
1123 partitions := []string{"p0", "p1", "p2"}
1124
1125 testCases := []struct {
1126 regionResults [][][]driver.Value
1127 handleColNames []string
1128 handleColTypes []string
1129 expectedWhereClauses [][]string
1130 hasTiDBRowID bool
1131 dumpWholeTable bool
1132 }{
1133 {
1134 [][][]driver.Value{
1135 {
1136 {6009, "t_121_i_1_0380000000000ea6010380000000000ea601", "t_121_", 6010, 1, 6010, 0, 0, 0, 74, 1052002},
1137 {6011, "t_121_", "t_121_i_1_0380000000000ea6010380000000000ea601", 6012, 1, 6012, 0, 0, 0, 68, 972177},
1138 },
1139 {
1140 {6015, "t_122_i_1_0380000000002d2a810380000000002d2a81", "t_122_", 6016, 1, 6016, 0, 0, 0, 77, 1092962},
1141 {6017, "t_122_", "t_122_i_1_0380000000002d2a810380000000002d2a81", 6018, 1, 6018, 0, 0, 0, 66, 939975},
1142 },
1143 {
1144 {6021, "t_123_i_1_0380000000004baf010380000000004baf01", "t_123_", 6022, 1, 6022, 0, 0, 0, 85, 1206726},
1145 {6023, "t_123_", "t_123_i_1_0380000000004baf010380000000004baf01", 6024, 1, 6024, 0, 0, 0, 65, 927576},
1146 },
1147 },
1148 []string{"_tidb_rowid"},
1149 []string{"BIGINT"},
1150 [][]string{
1151 {""}, {""}, {""},
1152 },
1153 true,
1154 true,
1155 },

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