server: add tiflash fallback testcase (#23248)
Co-authored-by: Yiding Cui <winoros@gmail.com>
This commit is contained in:
@ -778,7 +778,11 @@ func (ts *ConnTestSuite) TestTiFlashFallback(c *C) {
|
||||
c.Assert(cc.handleQuery(ctx, "select * from t t1 join t t2 on t1.a = t2.a"), NotNil)
|
||||
c.Assert(failpoint.Disable("github.com/pingcap/tidb/server/secondNextErr"), IsNil)
|
||||
|
||||
// TODO: simple TiFlash query (unary + non-streaming)
|
||||
// simple TiFlash query (unary + non-streaming)
|
||||
tk.MustExec("set @@tidb_allow_batch_cop=0; set @@tidb_allow_mpp=0;")
|
||||
c.Assert(failpoint.Enable("github.com/pingcap/tidb/store/tikv/tikvStoreSendReqResult", "return(\"requestTiFlashError\")"), IsNil)
|
||||
testFallbackWork(c, tk, cc, "select sum(a) from t")
|
||||
c.Assert(failpoint.Disable("github.com/pingcap/tidb/store/tikv/tikvStoreSendReqResult"), IsNil)
|
||||
|
||||
// TiFlash query based on batch cop (batch + streaming)
|
||||
tk.MustExec("set @@tidb_allow_batch_cop=1; set @@tidb_allow_mpp=0;")
|
||||
|
||||
@ -223,11 +223,6 @@ func (c *RPCClient) SendRequest(ctx context.Context, addr string, req *tikvrpc.R
|
||||
case tikvrpc.CmdRawScan:
|
||||
resp.Resp, err = c.rawHandler.RawScan(ctx, req.RawScan())
|
||||
case tikvrpc.CmdCop:
|
||||
failpoint.Inject("copRpcErr"+addr, func(value failpoint.Value) {
|
||||
if value.(string) == addr {
|
||||
failpoint.Return(nil, errors.New("cop rpc error"))
|
||||
}
|
||||
})
|
||||
resp.Resp, err = c.usSvr.Coprocessor(ctx, req.Cop())
|
||||
case tikvrpc.CmdCopStream:
|
||||
resp.Resp, err = c.handleCopStream(ctx, req.Cop())
|
||||
|
||||
@ -254,6 +254,10 @@ func (s *RegionRequestSender) SendReqCtx(
|
||||
if sType == kv.TiDB {
|
||||
failpoint.Return(nil, nil, ErrTiKVServerTimeout)
|
||||
}
|
||||
case "requestTiFlashError":
|
||||
if sType == kv.TiFlash {
|
||||
failpoint.Return(nil, nil, ErrTiFlashServerTimeout)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user