Skip to content

Commit

Permalink
Merge pull request #6164 from planetscale/schema-versioning
Browse files Browse the repository at this point in the history
VStreamer: Schema versioning
  • Loading branch information
sougou authored May 31, 2020
2 parents 8b159e0 + 81512fa commit b28fb8f
Show file tree
Hide file tree
Showing 32 changed files with 1,946 additions and 188 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ require (
github.com/krishicks/yaml-patch v0.0.10
github.com/magiconair/properties v1.8.1
github.com/minio/minio-go v0.0.0-20190131015406-c8a261de75c1
github.com/mitchellh/go-ps v1.0.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.0 // indirect
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5
github.com/onsi/ginkgo v1.10.3 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@ github.com/minio/minio-go v0.0.0-20190131015406-c8a261de75c1/go.mod h1:vuvdOZLJu
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc=
github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg=
github.com/mitchellh/go-testing-interface v1.14.0 h1:/x0XQ6h+3U3nAyk1yx+bHPURrKa9sVVvYbuqZ7pIAtI=
github.com/mitchellh/go-testing-interface v1.14.0/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8=
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
Expand Down
2 changes: 2 additions & 0 deletions go/test/endtoend/messaging/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ func TestMessage(t *testing.T) {

exec(t, conn, fmt.Sprintf("use %s", lookupKeyspace))
exec(t, conn, createMessage)
clusterInstance.VtctlProcess.ExecuteCommand(fmt.Sprintf("ReloadSchemaKeyspace %s", lookupKeyspace))

defer exec(t, conn, "drop table vitess_message")

exec(t, streamConn, "set workload = 'olap'")
Expand Down
4 changes: 2 additions & 2 deletions go/vt/binlog/binlogplayer/binlog_player.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,8 @@ func CreateVReplicationTable() []string {
}

// AlterVReplicationTable adds new columns to vreplication table
func AlterVReplicationTable() []string {
return []string{"ALTER TABLE _vt.vreplication ADD COLUMN db_name VARBINARY(255) NOT NULL"}
var AlterVReplicationTable = []string{
"ALTER TABLE _vt.vreplication ADD COLUMN db_name VARBINARY(255) NOT NULL",
}

// VRSettings contains the settings of a vreplication table.
Expand Down
333 changes: 219 additions & 114 deletions go/vt/proto/binlogdata/binlogdata.pb.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion go/vt/tableacl/tableacl.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (tacl *tableACL) init(configFile string, aclCB func()) error {
}
config := &tableaclpb.Config{}
if err := proto.Unmarshal(data, config); err != nil {
log.Infof("unable to parse tableACL config file as a protobuf file: %v", err)
log.Infof("unable to parse tableACL config file as a protobuf file: %v, will try as json", err)
// try to parse tableacl as json file
if jsonErr := json2.Unmarshal(data, config); jsonErr != nil {
log.Infof("unable to parse tableACL config file as a json file: %v", jsonErr)
Expand Down
7 changes: 6 additions & 1 deletion go/vt/vttablet/endtoend/framework/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"net/http"
"time"

"vitess.io/vitess/go/vt/topo"

"vitess.io/vitess/go/vt/topo/memorytopo"
"vitess.io/vitess/go/vt/vterrors"

Expand All @@ -47,6 +49,8 @@ var (
ServerAddress string
// ResolveChan is the channel that sends dtids that are to be resolved.
ResolveChan = make(chan string, 1)
// TopoServer is the topology for the server
TopoServer *topo.Server
)

// StartServer starts the server and initializes
Expand Down Expand Up @@ -76,8 +80,9 @@ func StartServer(connParams, connAppDebugParams mysql.ConnParams, dbName string)
Shard: "0",
TabletType: topodatapb.TabletType_MASTER,
}
TopoServer = memorytopo.NewServer("")

Server = tabletserver.NewTabletServer("", config, memorytopo.NewServer(""), topodatapb.TabletAlias{})
Server = tabletserver.NewTabletServer("", config, TopoServer, topodatapb.TabletAlias{})
Server.Register()
err := Server.StartService(Target, dbcfgs)
if err != nil {
Expand Down
21 changes: 21 additions & 0 deletions go/vt/vttablet/endtoend/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,27 @@ var tableACLConfig = `{
"table_names_or_prefixes": ["vitess_test_debuguser"],
"readers": ["dev", "vt_appdebug"],
"writers": ["dev", "vt_appdebug"]
},
{
"name": "version",
"table_names_or_prefixes": ["vitess_version"],
"readers": ["dev"],
"writers": ["dev"],
"admins": ["dev"]
},
{
"name": "schema_version",
"table_names_or_prefixes": ["schema_version"],
"readers": ["dev"],
"writers": ["dev"],
"admins": ["dev"]
},
{
"name": "historian_test1",
"table_names_or_prefixes": ["historian_test1"],
"readers": ["dev"],
"writers": ["dev"],
"admins": ["dev"]
}
]
}`
Loading

0 comments on commit b28fb8f

Please sign in to comment.