server: add tiflash fallback testcase (#23248)

Co-authored-by: Yiding Cui <winoros@gmail.com>
This commit is contained in:
Yifan Xu
2021-03-12 14:39:05 +08:00
committed by GitHub
parent 6d258c708a
commit 413ba4c30e
3 changed files with 9 additions and 6 deletions

View File

@ -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;")

View File

@ -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())

View File

@ -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)
}
}
})