Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions go/vt/binlog/binlogplayer/binlog_player.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,11 @@ var AlterVReplicationTable = []string{
"ALTER TABLE _vt.vreplication ADD COLUMN db_name VARBINARY(255) NOT NULL",
}

// AlterVReplicationTableSourceToBlob changes source column of vreplication table to BLOB
var AlterVReplicationTableSourceToBlob = []string{
"ALTER TABLE _vt.vreplication MODIFY source BLOB NOT NULL",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should just be part of AlterVReplicationTable. The comment // AlterVReplicationTable adds new columns to vreplication table is misleading: AlterVReplicationTable is about all transformation post-CREATE.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, i debated whether it belongs there. i figured we wanted to keep order of all migration steps...just in case

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If anything, putting all statements into the same array is the best guarantee for order.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was wondering whether the Alter and Create should just be combined. i don't see any reason not to.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean like the CREATE should be part of the array itself? I think that makes sense.

}

// VRSettings contains the settings of a vreplication table.
type VRSettings struct {
StartPos mysql.Position
Expand Down
1 change: 1 addition & 0 deletions go/vt/vttablet/tabletmanager/vreplication/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func init() {
allddls := append([]string{}, binlogplayer.CreateVReplicationTable()...)
allddls = append(allddls, binlogplayer.AlterVReplicationTable...)
allddls = append(allddls, createReshardingJournalTable, createCopyState)
allddls = append(allddls, binlogplayer.AlterVReplicationTableSourceToBlob...)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed once query is moved into AlterVReplicationTable

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

withDDL = withddl.New(allddls)
}

Expand Down
1 change: 1 addition & 0 deletions go/vt/vttablet/tabletmanager/vreplication/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ func TestCreateDBAndTable(t *testing.T) {
dbClient.ExpectRequestRE("ALTER TABLE _vt.vreplication ADD COLUMN db_name.*", &sqltypes.Result{}, nil)
dbClient.ExpectRequestRE("create table if not exists _vt.resharding_journal.*", &sqltypes.Result{}, nil)
dbClient.ExpectRequestRE("create table if not exists _vt.copy_state.*", &sqltypes.Result{}, nil)
dbClient.ExpectRequestRE("ALTER TABLE _vt.vreplication MODIFY source.*", &sqltypes.Result{}, nil)
}
expectDDLs()
dbClient.ExpectRequest("use _vt", &sqltypes.Result{}, nil)
Expand Down