@@ -96,15 +96,15 @@ func doWait(doneChan chan struct{}, start time.Time, jobCount int, workerCount i
9696 close (doneChan )
9797}
9898
99- func doDMLProcess (table * table , dbs [] * sql.DB , jobCount int , workerCount int , batch int ) {
99+ func doDMLProcess (table * table , db * sql.DB , jobCount int , workerCount int , batch int ) {
100100 jobChan := make (chan struct {}, 16 * workerCount )
101101 doneChan := make (chan struct {}, workerCount )
102102
103103 start := time .Now ()
104104 go addJobs (jobCount , jobChan )
105105
106106 for i := 0 ; i < workerCount ; i ++ {
107- go doJob (table , dbs [ i ] , batch , jobChan , doneChan )
107+ go doJob (table , db , batch , jobChan , doneChan )
108108 }
109109
110110 doWait (doneChan , start , jobCount , workerCount )
@@ -149,12 +149,12 @@ func doDDLProcess(table *table, db *sql.DB) {
149149 execSqls (db , []string {sql }, [][]interface {}{{}})
150150}
151151
152- func doProcess (table * table , dbs [] * sql.DB , jobCount int , workerCount int , batch int ) {
152+ func doProcess (table * table , db * sql.DB , jobCount int , workerCount int , batch int ) {
153153 if len (table .columns ) <= 2 {
154154 log .Fatal ("column count must > 2, and the first and second column are for primary key" )
155155 }
156156
157- doDMLProcess (table , dbs , jobCount / 2 , workerCount , batch )
158- doDDLProcess (table , dbs [ 0 ] )
159- doDMLProcess (table , dbs , jobCount / 2 , workerCount , batch )
157+ doDMLProcess (table , db , jobCount / 2 , workerCount , batch )
158+ doDDLProcess (table , db )
159+ doDMLProcess (table , db , jobCount / 2 , workerCount , batch )
160160}
0 commit comments