Skip to content

Commit

Permalink
dumpling: fix incorrect progress report when dump with --sql (#30866)
Browse files Browse the repository at this point in the history
close #30532
  • Loading branch information
docsir authored Jan 12, 2022
1 parent d101fc0 commit 7b0ebc3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions dumpling/export/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func (d *Dumper) Dump() (dumpErr error) {
return err
}
} else {
d.dumpSQL(writerCtx, taskChan)
d.dumpSQL(writerCtx, metaConn, taskChan)
}
close(taskChan)
_ = metaConn.Close()
Expand Down Expand Up @@ -1148,11 +1148,14 @@ func dumpTableMeta(tctx *tcontext.Context, conf *Config, conn *sql.Conn, db stri
return meta, nil
}

func (d *Dumper) dumpSQL(tctx *tcontext.Context, taskChan chan<- Task) {
func (d *Dumper) dumpSQL(tctx *tcontext.Context, metaConn *sql.Conn, taskChan chan<- Task) {
conf := d.conf
meta := &tableMeta{}
data := newTableData(conf.SQL, 0, true)
task := NewTaskTableData(meta, data, 0, 1)
c := detectEstimateRows(tctx, metaConn, fmt.Sprintf("EXPLAIN %s", conf.SQL), []string{"rows", "estRows", "count"})
AddCounter(estimateTotalRowsCounter, conf.Labels, float64(c))
atomic.StoreInt64(&d.totalTables, int64(1))
d.sendTaskToChan(tctx, task, taskChan)
}

Expand Down

0 comments on commit 7b0ebc3

Please sign in to comment.