Skip to content

Commit 338a439

Browse files
committed
Remove GetDB from MigrationContext
1 parent d92c037 commit 338a439

1 file changed

Lines changed: 0 additions & 22 deletions

File tree

go/base/context.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,6 @@ type MigrationContext struct {
200200
recentBinlogCoordinates mysql.BinlogCoordinates
201201

202202
CanStopStreaming func() bool
203-
204-
knownDBs map[string]*gosql.DB
205-
knownDBsMutex *sync.Mutex
206203
}
207204

208205
type ContextConfig struct {
@@ -236,8 +233,6 @@ func NewMigrationContext() *MigrationContext {
236233
pointOfInterestTimeMutex: &sync.Mutex{},
237234
ColumnRenameMap: make(map[string]string),
238235
PanicAbort: make(chan error),
239-
knownDBsMutex: &sync.Mutex{},
240-
knownDBs: make(map[string]*gosql.DB),
241236
}
242237
}
243238

@@ -250,23 +245,6 @@ func getSafeTableName(baseName string, suffix string) string {
250245
return fmt.Sprintf("_%s_%s", baseName[0:len(baseName)-extraCharacters], suffix)
251246
}
252247

253-
// GetDB returns a DB instance based on uri.
254-
// bool result indicates whether the DB was returned from cache; err
255-
func (this *MigrationContext) GetDB(mysql_uri string) (*gosql.DB, bool, error) {
256-
this.knownDBsMutex.Lock()
257-
defer this.knownDBsMutex.Unlock()
258-
259-
var exists bool
260-
if _, exists = this.knownDBs[mysql_uri]; !exists {
261-
if db, err := sqlutils.GetDB(mysql_uri); err == nil {
262-
this.knownDBs[mysql_uri] = db
263-
} else {
264-
return db, exists, err
265-
}
266-
}
267-
return this.knownDBs[mysql_uri], exists, nil
268-
}
269-
270248
// GetGhostTableName generates the name of ghost table, based on original table name
271249
// or a given table name
272250
func (this *MigrationContext) GetGhostTableName() string {

0 commit comments

Comments
 (0)