Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 0 additions & 2 deletions config/mycnf/default-fast.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ innodb_doublewrite=0
# These two settings are required for the testsuite to pass,
# but enabling them does not spark joy. They should be removed
# in the future. See:
# https://github.com/vitessio/vitess/issues/5395
# https://github.com/vitessio/vitess/issues/5396

binlog-format=statement
sql_mode = STRICT_TRANS_TABLES
2 changes: 1 addition & 1 deletion config/mycnf/rbr.cnf → config/mycnf/sbr.cnf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# This file is used to allow legacy tests to pass
# In theory it should not be required
binlog_format=row
binlog_format=statement
4 changes: 0 additions & 4 deletions examples/compose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,6 @@ DB_CHARSET=CHARACTER SET utf8 COLLATE utf8_general_ci
```

Ensure you have log bin enabled on your external database.
You may add the following configs to your conf.d directory and reload mysqld on your server
```
vitess/config/mycnf/rbr.cnf
```

### Start the cluster
```
Expand Down
1 change: 0 additions & 1 deletion examples/compose/vttablet-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ if [ $tablet_role != "master" ]; then
echo "CREATE USER IF NOT EXISTS '$DB_USER'@'%' IDENTIFIED BY '$DB_PASS';" >> $init_db_sql_file
echo "GRANT ALL ON *.* TO '$DB_USER'@'%';FLUSH PRIVILEGES;" >> $init_db_sql_file
# Prevent replication failures in case external db server has multiple databases which have not been created here
echo "replicate-do-db=$keyspace" >> $VTROOT/config/mycnf/rbr.cnf
else
echo "CREATE DATABASE IF NOT EXISTS $db_name;" >> $init_db_sql_file
fi
Expand Down
87 changes: 0 additions & 87 deletions go/mysql/endtoend/replication_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,93 +191,6 @@ func TestReplicationConnectionClosing(t *testing.T) {
wg.Wait()
}

func TestStatementReplicationWithRealDatabase(t *testing.T) {
conn, f := connectForReplication(t, false /* rbr */)
defer conn.Close()

// Create a table, insert some data in it.
ctx := context.Background()
dConn, err := mysql.Connect(ctx, &connParams)
if err != nil {
t.Fatal(err)
}
defer dConn.Close()
createTable := "create table replication(id int, name varchar(128), primary key(id))"
if _, err := dConn.ExecuteFetch(createTable, 0, false); err != nil {
t.Fatal(err)
}
insert := "insert into replication(id, name) values(10, 'nice name')"
result, err := dConn.ExecuteFetch(insert, 0, false)
if err != nil {
t.Fatalf("insert failed: %v", err)
}
if result.RowsAffected != 1 || len(result.Rows) != 0 {
t.Errorf("unexpected result for insert: %v", result)
}

// Get the new events from the binlogs.
// Make sure we get two GTIDs, the table creation event and the insert
// (with both a begin and a commit).
gtidCount := 0
gotCreateTable := false
gotBegin := false
gotInsert := false
gotCommit := false
for gtidCount < 2 || !gotCreateTable || !gotBegin || !gotInsert || !gotCommit {
be, err := conn.ReadBinlogEvent()
if err != nil {
t.Fatalf("ReadPacket failed: %v", err)
}
if !be.IsValid() {
t.Fatalf("read an invalid packet: %v", be)
}
be, _, err = be.StripChecksum(f)
if err != nil {
t.Fatalf("StripChecksum failed: %v", err)
}
switch {
case be.IsGTID():
// We expect one of these at least.
gtid, hasBegin, err := be.GTID(f)
if err != nil {
t.Fatalf("GTID event is broken: %v", err)
}
t.Logf("Got GTID event: %v %v", gtid, hasBegin)
gtidCount++
if hasBegin {
gotBegin = true
}
case be.IsQuery():
q, err := be.Query(f)
if err != nil {
t.Fatalf("Query event is broken: %v", err)
}
t.Logf("Got Query event: %v", q)
switch strings.ToLower(q.SQL) {
case createTable:
gotCreateTable = true
case insert:
gotInsert = true
case "begin":
gotBegin = true
case "commit":
gotCommit = true
}
case be.IsXID():
gotCommit = true
t.Logf("Got XID event")
default:
t.Logf("Got unrelated event: %v", be)
}
}

// Drop the table, we're done.
if _, err := dConn.ExecuteFetch("drop table replication", 0, false); err != nil {
t.Fatal(err)
}

}

func TestRowReplicationWithRealDatabase(t *testing.T) {
conn, f := connectForReplication(t, true /* rbr */)
defer conn.Close()
Expand Down
2 changes: 1 addition & 1 deletion go/test/endtoend/binlog/binlog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func TestMain(m *testing.M) {
exitcode, err := func() (int, error) {
localCluster = cluster.NewCluster(cell, hostname)
defer localCluster.Teardown()
os.Setenv("EXTRA_MY_CNF", path.Join(os.Getenv("VTROOT"), "config", "mycnf", "rbr.cnf"))

localCluster.Keyspaces = append(localCluster.Keyspaces, cluster.Keyspace{
Name: keyspaceName,
})
Expand Down
2 changes: 0 additions & 2 deletions go/vt/vtgate/endtoend/deletetest/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"flag"
"fmt"
"os"
"path"
"testing"

"vitess.io/vitess/go/mysql"
Expand Down Expand Up @@ -127,7 +126,6 @@ func TestMain(m *testing.M) {
}},
}},
}
cfg.ExtraMyCnf = []string{path.Join(os.Getenv("VTROOT"), "config/mycnf/rbr.cnf")}
if err := cfg.InitSchemas("ks", schema, vschema); err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.RemoveAll(cfg.SchemaDir)
Expand Down
2 changes: 0 additions & 2 deletions go/vt/vtgate/endtoend/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"flag"
"fmt"
"os"
"path"
"testing"

"vitess.io/vitess/go/mysql"
Expand Down Expand Up @@ -171,7 +170,6 @@ func TestMain(m *testing.M) {
}},
}},
}
cfg.ExtraMyCnf = []string{path.Join(os.Getenv("VTROOT"), "config/mycnf/rbr.cnf")}
if err := cfg.InitSchemas("ks", schema, vschema); err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.RemoveAll(cfg.SchemaDir)
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vttablet/endtoend/compatibility_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ func TestTypeLimits(t *testing.T) {
}, {
query: "insert into vitess_ints(tiny) values(1.2)",
bv: nil,
out: "unsupported: cannot identify primary key of statement",
out: "Duplicate entry '1' for key 'PRIMARY'",
}, {
query: "insert into vitess_ints(tiny) values(:fl)",
bv: map[string]*querypb.BindVariable{"fl": sqltypes.Float64BindVariable(1.2)},
Expand Down
20 changes: 7 additions & 13 deletions go/vt/vttablet/endtoend/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,7 @@ func TestMaxDMLRows(t *testing.T) {
want := "begin; " +
"select eid, id from vitess_a where eid = 3 limit 10001 for update; " +
"update vitess_a set foo = 'fghi' where " +
"(eid = 3 and id = 1) or (eid = 3 and id = 2) or (eid = 3 and id = 3) " +
"/* _stream vitess_a (eid id ) (3 1 ) (3 2 ) (3 3 ); */; " +
"(eid = 3 and id = 1) or (eid = 3 and id = 2) or (eid = 3 and id = 3); " +
"commit"
if queryInfo.RewrittenSQL() != want {
t.Errorf("Query info: \n%s, want \n%s", queryInfo.RewrittenSQL(), want)
Expand All @@ -338,10 +337,8 @@ func TestMaxDMLRows(t *testing.T) {
want = "begin; " +
"select eid, id from vitess_a where eid = 3 limit 10001 for update; " +
"update vitess_a set eid = 2 where " +
"(eid = 3 and id = 1) or (eid = 3 and id = 2) " +
"/* _stream vitess_a (eid id ) (3 1 ) (3 2 ) (2 1 ) (2 2 ); */; " +
"update vitess_a set eid = 2 where (eid = 3 and id = 3) " +
"/* _stream vitess_a (eid id ) (3 3 ) (2 3 ); */; " +
"(eid = 3 and id = 1) or (eid = 3 and id = 2); " +
"update vitess_a set eid = 2 where (eid = 3 and id = 3); " +
"commit"
if queryInfo.RewrittenSQL() != want {
t.Errorf("Query info: \n%s, want \n%s", queryInfo.RewrittenSQL(), want)
Expand All @@ -361,9 +358,8 @@ func TestMaxDMLRows(t *testing.T) {
want = "begin; " +
"select eid, id from vitess_a where eid = 2 limit 10001 for update; " +
"update vitess_a set foo = 'fghi' where (eid = 2 and id = 1) or " +
"(eid = 2 and id = 2) /* _stream vitess_a (eid id ) (2 1 ) (2 2 ); */; " +
"update vitess_a set foo = 'fghi' where (eid = 2 and id = 3) " +
"/* _stream vitess_a (eid id ) (2 3 ); */; " +
"(eid = 2 and id = 2); " +
"update vitess_a set foo = 'fghi' where (eid = 2 and id = 3); " +
"commit"
if queryInfo.RewrittenSQL() != want {
t.Errorf("Query info: \n%s, want \n%s", queryInfo.RewrittenSQL(), want)
Expand All @@ -382,10 +378,8 @@ func TestMaxDMLRows(t *testing.T) {
}
want = "begin; " +
"select eid, id from vitess_a where eid = 2 limit 10001 for update; " +
"delete from vitess_a where (eid = 2 and id = 1) or (eid = 2 and id = 2) " +
"/* _stream vitess_a (eid id ) (2 1 ) (2 2 ); */; " +
"delete from vitess_a where (eid = 2 and id = 3) " +
"/* _stream vitess_a (eid id ) (2 3 ); */; " +
"delete from vitess_a where (eid = 2 and id = 1) or (eid = 2 and id = 2); " +
"delete from vitess_a where (eid = 2 and id = 3); " +
"commit"
if queryInfo.RewrittenSQL() != want {
t.Errorf("Query info: \n%s, want \n%s", queryInfo.RewrittenSQL(), want)
Expand Down
25 changes: 0 additions & 25 deletions go/vt/vttablet/endtoend/misc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,31 +217,6 @@ func TestTrailingComment(t *testing.T) {
}
}

func TestUpsertNonPKHit(t *testing.T) {
client := framework.NewClient()
err := client.Begin(false)
if err != nil {
t.Error(err)
return
}
defer client.Rollback()

_, err = client.Execute("insert into upsert_test(id1, id2) values (1, 1)", nil)
if err != nil {
t.Error(err)
return
}
_, err = client.Execute(
"insert into upsert_test(id1, id2) values "+
"(2, 1) on duplicate key update id2 = 2",
nil,
)
want := "Duplicate entry '1' for key 'id2_idx'"
if err == nil || !strings.HasPrefix(err.Error(), want) {
t.Errorf("Execute: %v, must start with %s", err, want)
}
}

func TestSchemaReload(t *testing.T) {
ctx := context.Background()
conn, err := mysql.Connect(ctx, &connParams)
Expand Down
Loading