Skip to content

Commit 992eaa9

Browse files
authored
Merge branch 'pingcap:master' into fix_rollback_reorganize
2 parents 8f9949c + 1549ea6 commit 992eaa9

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

br/pkg/task/restore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func (cfg *RestoreCommonConfig) adjust() {
140140
func DefineRestoreCommonFlags(flags *pflag.FlagSet) {
141141
// TODO remove experimental tag if it's stable
142142
flags.Bool(flagOnline, false, "(experimental) Whether online when restore")
143-
flags.String(flagGranularity, string(restore.FineGrained), "Whether split & scatter regions using fine-grained way during restore")
143+
flags.String(flagGranularity, string(restore.CoarseGrained), "Whether split & scatter regions using fine-grained way during restore")
144144
flags.Uint(flagConcurrencyPerStore, 128, "The size of thread pool on each store that executes tasks, only enabled when `--granularity=coarse-grained`")
145145
flags.Uint32(flagConcurrency, 128, "(deprecated) The size of thread pool on BR that executes tasks, "+
146146
"where each task restores one SST file to TiKV")

pkg/distsql/select_result.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -603,14 +603,16 @@ func (r *selectResult) Close() error {
603603
if respSize > 0 {
604604
r.memConsume(-respSize)
605605
}
606-
if unconsumed, ok := r.resp.(copr.HasUnconsumedCopRuntimeStats); ok && unconsumed != nil {
607-
unconsumedCopStats := unconsumed.CollectUnconsumedCopRuntimeStats()
608-
for _, copStats := range unconsumedCopStats {
609-
_ = r.updateCopRuntimeStats(context.Background(), copStats, time.Duration(0))
610-
r.ctx.GetSessionVars().StmtCtx.MergeExecDetails(&copStats.ExecDetails, nil)
606+
if r.ctx != nil {
607+
if unconsumed, ok := r.resp.(copr.HasUnconsumedCopRuntimeStats); ok && unconsumed != nil {
608+
unconsumedCopStats := unconsumed.CollectUnconsumedCopRuntimeStats()
609+
for _, copStats := range unconsumedCopStats {
610+
_ = r.updateCopRuntimeStats(context.Background(), copStats, time.Duration(0))
611+
r.ctx.GetSessionVars().StmtCtx.MergeExecDetails(&copStats.ExecDetails, nil)
612+
}
611613
}
612614
}
613-
if r.stats != nil {
615+
if r.stats != nil && r.ctx != nil {
614616
defer func() {
615617
if ci, ok := r.resp.(copr.CopInfo); ok {
616618
r.stats.buildTaskDuration = ci.GetBuildTaskElapsed()

0 commit comments

Comments
 (0)