Skip to content

Commit

Permalink
address the comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Yisaer committed Nov 29, 2022
1 parent 285950b commit 941cbe3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion planner/core/find_best_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ func (ds *DataSource) findBestTask(prop *property.PhysicalProperty, planCounter
}

// if the path is the point get range path with for update lock, we should forbid tiflash as it's store path.
if path.StoreType == kv.TiFlash && ds.isForUpdateRead {
if path.StoreType == kv.TiFlash && ds.isForUpdateRead && ds.ctx.GetSessionVars().InTxn() {
if ds.isPointGetConditions() {
continue
}
Expand Down
5 changes: 5 additions & 0 deletions planner/core/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7572,6 +7572,7 @@ func TestPointGetWithSelectLock(t *testing.T) {
tk.MustExec("set @@tidb_enable_tiflash_read_for_write_stmt = on;")
tk.MustExec("set @@tidb_isolation_read_engines='tidb,tiflash';")
tk.MustExec("begin;")
// assert point get condition with txn commit and tiflash store
tk.MustGetErrMsg("explain select a, b from t where a = 1 and b = 2 for update;", "[planner:1815]Internal : Can't find a proper physical plan for this query")
tk.MustGetErrMsg("explain select c, d from t1 where c = 1 for update;", "[planner:1815]Internal : Can't find a proper physical plan for this query")
tk.MustGetErrMsg("explain select c, d from t1 where c = 1 and d = 1 for update;", "[planner:1815]Internal : Can't find a proper physical plan for this query")
Expand All @@ -7581,6 +7582,10 @@ func TestPointGetWithSelectLock(t *testing.T) {
tk.MustQuery("explain select a, b from t where a = 1 and b = 2 for update;")
tk.MustQuery("explain select c, d from t1 where c = 1 for update;")
tk.MustExec("commit")
tk.MustExec("set tidb_isolation_read_engines='tidb,tiflash';")
// assert point get condition with auto commit and tiflash store
tk.MustQuery("explain select a, b from t where a = 1 and b = 2 for update;")
tk.MustQuery("explain select c, d from t1 where c = 1 for update;")
}

func TestTableRangeFallback(t *testing.T) {
Expand Down

0 comments on commit 941cbe3

Please sign in to comment.