gno, query: for debug use
(currentSchema string, table *common.Table, realSchema string, tableName string, gno int64, query string)
| 1391 | |
| 1392 | // gno, query: for debug use |
| 1393 | func (b *BinlogReader) updateTableMeta(currentSchema string, table *common.Table, realSchema string, tableName string, |
| 1394 | gno int64, query string) (*common.TableContext, error) { |
| 1395 | |
| 1396 | var err error |
| 1397 | |
| 1398 | if b.maybeSqleContext == nil { |
| 1399 | b.logger.Debug("ignore updating table meta", "schema", realSchema, "table", tableName) |
| 1400 | return nil, nil |
| 1401 | } |
| 1402 | |
| 1403 | columns, fkParent, err := base.GetTableColumnsSqle(b.maybeSqleContext, realSchema, tableName) |
| 1404 | if err != nil { |
| 1405 | b.logger.Warn("updateTableMeta: cannot get table info after ddl.", "err", err, |
| 1406 | "realSchema", realSchema, "tableName", tableName, "gno", gno, "query", query) |
| 1407 | return nil, err |
| 1408 | } |
| 1409 | b.logger.Debug("binlog_reader. new columns.", |
| 1410 | "schema", realSchema, "table", tableName, "columns", columns.String()) |
| 1411 | |
| 1412 | //var table *config.Table |
| 1413 | |
| 1414 | if table == nil { |
| 1415 | // a new table (it might be in all db copy since it is not ignored). |
| 1416 | table = common.NewTable(realSchema, tableName) |
| 1417 | table.TableType = "BASE TABLE" |
| 1418 | } |
| 1419 | table.OriginalTableColumns = columns |
| 1420 | table.ColumnMap, err = mysqlconfig.BuildColumnMapIndex(table.ColumnMapFrom, table.OriginalTableColumns.Ordinals) |
| 1421 | if err != nil { |
| 1422 | return nil, err |
| 1423 | } |
| 1424 | |
| 1425 | schemaContext := b.findCurrentSchema(realSchema) |
| 1426 | tableCtx, err := common.NewTableContext(table) |
| 1427 | if err != nil { |
| 1428 | return nil, err |
| 1429 | } |
| 1430 | schemaContext.TableMap[table.TableName] = tableCtx |
| 1431 | b.addFKChildren(currentSchema, fkParent, realSchema, tableName) |
| 1432 | |
| 1433 | return tableCtx, nil |
| 1434 | } |
| 1435 | |
| 1436 | func (b *BinlogReader) updateCurrentReplicateDoDb(schemaName string, tableName string) error { |
| 1437 | if schemaName == "" { |
no test coverage detected