Skip to content

Commit

Permalink
Merge branch 'master' into master-msc-alter-idx
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkingrei authored Jul 14, 2022
2 parents 4f809b1 + bbc2e65 commit 83a4d3b
Show file tree
Hide file tree
Showing 14 changed files with 50 additions and 13 deletions.
8 changes: 4 additions & 4 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2502,8 +2502,8 @@ def go_deps():
name = "com_github_pingcap_kvproto",
build_file_proto_mode = "disable_global",
importpath = "github.com/pingcap/kvproto",
sum = "h1:nP2wmyw9JTRsk5rm+tZtfAso6c/1FvuaFNbXTaYz3FE=",
version = "v0.0.0-20220705053936-aa9c2d20cd2a",
sum = "h1:VKMmvYhtG28j1sCCBdq4s+V9UOYqNgQ6CQviQwOgTeg=",
version = "v0.0.0-20220705090230-a5d4ffd2ba33",
)
go_repository(
name = "com_github_pingcap_log",
Expand Down Expand Up @@ -3004,8 +3004,8 @@ def go_deps():
name = "com_github_tikv_client_go_v2",
build_file_proto_mode = "disable_global",
importpath = "github.com/tikv/client-go/v2",
sum = "h1:VAyYcN1Nw7RupQszUYqOkueEVapWSxKFU7uBaYY5Dv8=",
version = "v2.0.1-0.20220627063500-947d923945fd",
sum = "h1:RpH/obpgyNKkXV4Wt8PqSdcUTnqWyExPcla+qdTVgi0=",
version = "v2.0.1-0.20220711061028-1c198aab9585",
)
go_repository(
name = "com_github_tikv_pd_client",
Expand Down
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ go_rules_dependencies()

go_register_toolchains(
nogo = "@//build:tidb_nogo",
version = "1.18.3",
version = "1.18.4",
)

gazelle_dependencies()
Expand Down
4 changes: 4 additions & 0 deletions expression/expr_to_pb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,10 @@ func TestExprOnlyPushDownToFlash(t *testing.T) {
require.NoError(t, err)
exprs = append(exprs, function)

function, err = NewFunction(mock.NewContext(), ast.GetFormat, types.NewFieldType(mysql.TypeString), stringColumn, stringColumn)
require.NoError(t, err)
exprs = append(exprs, function)

function, err = NewFunction(mock.NewContext(), ast.TimestampDiff, types.NewFieldType(mysql.TypeLonglong), stringColumn, datetimeColumn, datetimeColumn)
require.NoError(t, err)
exprs = append(exprs, function)
Expand Down
2 changes: 2 additions & 0 deletions expression/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,8 @@ func scalarExprSupportedByFlash(function *ScalarFunction) bool {
}
case ast.IsTruthWithNull, ast.IsTruthWithoutNull, ast.IsFalsity:
return true
case ast.GetFormat:
return true
}
return false
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ require (
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.7.2-0.20220504104629-106ec21d14df
github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2
github.com/tikv/client-go/v2 v2.0.1-0.20220627063500-947d923945fd
github.com/tikv/client-go/v2 v2.0.1-0.20220711061028-1c198aab9585
github.com/tikv/pd/client v0.0.0-20220307081149-841fa61e9710
github.com/twmb/murmur3 v1.1.3
github.com/uber/jaeger-client-go v2.22.1+incompatible
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -791,8 +791,8 @@ github.com/tdakkota/asciicheck v0.1.1 h1:PKzG7JUTUmVspQTDqtkX9eSiLGossXTybutHwTX
github.com/tdakkota/asciicheck v0.1.1/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM=
github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2 h1:mbAskLJ0oJfDRtkanvQPiooDH8HvJ2FBh+iKT/OmiQQ=
github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2/go.mod h1:2PfKggNGDuadAa0LElHrByyrz4JPZ9fFx6Gs7nx7ZZU=
github.com/tikv/client-go/v2 v2.0.1-0.20220627063500-947d923945fd h1:VAyYcN1Nw7RupQszUYqOkueEVapWSxKFU7uBaYY5Dv8=
github.com/tikv/client-go/v2 v2.0.1-0.20220627063500-947d923945fd/go.mod h1:uoZHYWKB+PsDueEnZ0EvF5zvNJPEauEWN26Tgi7qvNI=
github.com/tikv/client-go/v2 v2.0.1-0.20220711061028-1c198aab9585 h1:RpH/obpgyNKkXV4Wt8PqSdcUTnqWyExPcla+qdTVgi0=
github.com/tikv/client-go/v2 v2.0.1-0.20220711061028-1c198aab9585/go.mod h1:uoZHYWKB+PsDueEnZ0EvF5zvNJPEauEWN26Tgi7qvNI=
github.com/tikv/pd/client v0.0.0-20220307081149-841fa61e9710 h1:jxgmKOscXSjaFEKQGRyY5qOpK8hLqxs2irb/uDJMtwk=
github.com/tikv/pd/client v0.0.0-20220307081149-841fa61e9710/go.mod h1:AtvppPwkiyUgQlR1W9qSqfTB+OsOIu19jDCOxOsPkmU=
github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs=
Expand Down
23 changes: 23 additions & 0 deletions planner/core/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7017,3 +7017,26 @@ func TestIssue36194(t *testing.T) {
" └─Selection 100.00 mpp[tiflash] gt(plus(test.t.a, 1), 20)",
" └─TableFullScan 125.00 mpp[tiflash] table:t keep order:false, stats:pseudo"))
}

func TestGetFormatPushDownToTiFlash(t *testing.T) {
store, dom, clean := testkit.CreateMockStoreAndDomain(t)
defer clean()
tk := testkit.NewTestKit(t, store)

tk.MustExec("use test")
tk.MustExec("create table t(location varchar(10));")
tk.MustExec("insert into t values('USA'), ('JIS'), ('ISO'), ('EUR'), ('INTERNAL')")
tk.MustExec("set @@tidb_enforce_mpp=1;")
tk.MustExec("set @@tidb_isolation_read_engines = 'tiflash';")

tbl, err := dom.InfoSchema().TableByName(model.CIStr{O: "test", L: "test"}, model.CIStr{O: "t", L: "t"})
require.NoError(t, err)
// Set the hacked TiFlash replica for explain tests.
tbl.Meta().TiFlashReplica = &model.TiFlashReplicaInfo{Count: 1, Available: true}

tk.MustQuery("explain format = 'brief' select GET_FORMAT(DATE, location) from t;").Check(testkit.Rows(
"TableReader 10000.00 root data:ExchangeSender",
"└─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 10000.00 mpp[tiflash] get_format(DATE, test.t.location)->Column#3",
" └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo"))
}
1 change: 1 addition & 0 deletions sessionctx/sessionstates/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ go_test(
"session_states_test.go",
"session_token_test.go",
],
race = "on",
embed = [":sessionstates"],
deps = [
"//config",
Expand Down
3 changes: 2 additions & 1 deletion sessionctx/sessionstates/session_token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,9 @@ func TestLoadAndReadConcurrently(t *testing.T) {
}
// the reader
for i := 0; i < 3; i++ {
id := i
wg.Run(func() {
username := fmt.Sprintf("test_user_%d", i)
username := fmt.Sprintf("test_user_%d", id)
for time.Now().Before(deadline) {
_, tokenBytes := createNewToken(t, username)
time.Sleep(10 * time.Millisecond)
Expand Down
2 changes: 1 addition & 1 deletion store/copr/coprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func buildCopTasks(bo *Backoffer, cache *RegionCache, ranges *KeyRanges, req *kv
// in paging request, a request will be returned in multi batches,
// enlarge the channel size to avoid the request blocked by buffer full.
if req.Paging {
chanSize = 128
chanSize = 18
}

var tasks []*copTask
Expand Down
2 changes: 1 addition & 1 deletion store/driver/txn/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (s *tikvSnapshot) SetOption(opt int, val interface{}) {
s.KVSnapshot.SetRuntimeStats(val.(*txnsnapshot.SnapshotRuntimeStats))
}
case kv.IsStalenessReadOnly:
s.KVSnapshot.SetIsStatenessReadOnly(val.(bool))
s.KVSnapshot.SetIsStalenessReadOnly(val.(bool))
case kv.MatchStoreLabels:
s.KVSnapshot.SetMatchStoreLabels(val.([]*metapb.StoreLabel))
case kv.ResourceGroupTag:
Expand Down
2 changes: 1 addition & 1 deletion store/driver/txn/txn_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (txn *tikvTxn) SetOption(opt int, val interface{}) {
case kv.TxnScope:
txn.SetScope(val.(string))
case kv.IsStalenessReadOnly:
txn.KVTxn.GetSnapshot().SetIsStatenessReadOnly(val.(bool))
txn.KVTxn.GetSnapshot().SetIsStalenessReadOnly(val.(bool))
case kv.MatchStoreLabels:
txn.KVTxn.GetSnapshot().SetMatchStoreLabels(val.([]*metapb.StoreLabel))
case kv.ResourceGroupTag:
Expand Down
5 changes: 5 additions & 0 deletions util/execdetails/execdetails.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ const (
CommitTimeStr = "Commit_time"
// GetCommitTSTimeStr means the time of getting commit ts.
GetCommitTSTimeStr = "Get_commit_ts_time"
// GetLatestTsTimeStr means the time of getting latest ts in async commit and 1pc.
GetLatestTsTimeStr = "Get_latest_ts_time"
// CommitBackoffTimeStr means the time of commit backoff.
CommitBackoffTimeStr = "Commit_backoff_time"
// BackoffTypesStr means the backoff type.
Expand Down Expand Up @@ -143,6 +145,9 @@ func (d ExecDetails) String() string {
if commitDetails.GetCommitTsTime > 0 {
parts = append(parts, GetCommitTSTimeStr+": "+strconv.FormatFloat(commitDetails.GetCommitTsTime.Seconds(), 'f', -1, 64))
}
if commitDetails.GetLatestTsTime > 0 {
parts = append(parts, GetLatestTsTimeStr+": "+strconv.FormatFloat(commitDetails.GetLatestTsTime.Seconds(), 'f', -1, 64))
}
commitDetails.Mu.Lock()
commitBackoffTime := commitDetails.Mu.CommitBackoffTime
if commitBackoffTime > 0 {
Expand Down
3 changes: 2 additions & 1 deletion util/execdetails/execdetails_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func TestString(t *testing.T) {
RequestCount: 1,
CommitDetail: &util.CommitDetails{
GetCommitTsTime: time.Second,
GetLatestTsTime: time.Second,
PrewriteTime: time.Second,
CommitTime: time.Second,
LocalLatchTime: time.Second,
Expand Down Expand Up @@ -70,7 +71,7 @@ func TestString(t *testing.T) {
},
}
expected := "Cop_time: 1.003 Process_time: 2.005 Wait_time: 1 Backoff_time: 1 Request_count: 1 Prewrite_time: 1 Commit_time: 1 " +
"Get_commit_ts_time: 1 Commit_backoff_time: 1 Backoff_types: [backoff1 backoff2] Resolve_lock_time: 1 Local_latch_wait_time: 1 Write_keys: 1 Write_size: 1 Prewrite_region: 1 Txn_retry: 1 " +
"Get_commit_ts_time: 1 Get_latest_ts_time: 1 Commit_backoff_time: 1 Backoff_types: [backoff1 backoff2] Resolve_lock_time: 1 Local_latch_wait_time: 1 Write_keys: 1 Write_size: 1 Prewrite_region: 1 Txn_retry: 1 " +
"Process_keys: 10 Total_keys: 100 Rocksdb_delete_skipped_count: 1 Rocksdb_key_skipped_count: 1 Rocksdb_block_cache_hit_count: 1 Rocksdb_block_read_count: 1 Rocksdb_block_read_byte: 100"
require.Equal(t, expected, detail.String())
detail = &ExecDetails{}
Expand Down

0 comments on commit 83a4d3b

Please sign in to comment.