From 2623fe796fc8ea8b7766747ed92e14ed55a2e2ce Mon Sep 17 00:00:00 2001 From: Ajeet jain Date: Wed, 18 Dec 2019 11:54:43 +0530 Subject: [PATCH 1/5] default RBR for python tests, SBR for exclusions Signed-off-by: Ajeet jain --- config/mycnf/default-fast.cnf | 2 -- config/mycnf/{rbr.cnf => sbr.cnf} | 2 +- examples/compose/README.md | 4 ---- examples/compose/vttablet-up.sh | 1 - go/vt/vtgate/endtoend/deletetest/delete_test.go | 2 -- go/vt/vtgate/endtoend/main_test.go | 2 -- go/vt/vttablet/tabletserver/vstreamer/testenv/testenv.go | 4 +--- helm/vitess/templates/_helpers.tpl | 1 - test/binlog.py | 2 +- test/tablet.py | 8 ++++---- 10 files changed, 7 insertions(+), 21 deletions(-) rename config/mycnf/{rbr.cnf => sbr.cnf} (78%) diff --git a/config/mycnf/default-fast.cnf b/config/mycnf/default-fast.cnf index e3d852fcfc0..1880704e05b 100644 --- a/config/mycnf/default-fast.cnf +++ b/config/mycnf/default-fast.cnf @@ -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 diff --git a/config/mycnf/rbr.cnf b/config/mycnf/sbr.cnf similarity index 78% rename from config/mycnf/rbr.cnf rename to config/mycnf/sbr.cnf index 10c17a6f09c..5808e0430f3 100644 --- a/config/mycnf/rbr.cnf +++ b/config/mycnf/sbr.cnf @@ -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 diff --git a/examples/compose/README.md b/examples/compose/README.md index 7d4e4a2bc07..e637b60652c 100644 --- a/examples/compose/README.md +++ b/examples/compose/README.md @@ -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 ``` diff --git a/examples/compose/vttablet-up.sh b/examples/compose/vttablet-up.sh index 78623e2fb1c..7284fc37d7e 100755 --- a/examples/compose/vttablet-up.sh +++ b/examples/compose/vttablet-up.sh @@ -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 diff --git a/go/vt/vtgate/endtoend/deletetest/delete_test.go b/go/vt/vtgate/endtoend/deletetest/delete_test.go index de6614ed7c9..2263ca62723 100644 --- a/go/vt/vtgate/endtoend/deletetest/delete_test.go +++ b/go/vt/vtgate/endtoend/deletetest/delete_test.go @@ -21,7 +21,6 @@ import ( "flag" "fmt" "os" - "path" "testing" "vitess.io/vitess/go/mysql" @@ -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) diff --git a/go/vt/vtgate/endtoend/main_test.go b/go/vt/vtgate/endtoend/main_test.go index a3b69cdb6ea..825e443bd2a 100644 --- a/go/vt/vtgate/endtoend/main_test.go +++ b/go/vt/vtgate/endtoend/main_test.go @@ -20,7 +20,6 @@ import ( "flag" "fmt" "os" - "path" "testing" "vitess.io/vitess/go/mysql" @@ -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) diff --git a/go/vt/vttablet/tabletserver/vstreamer/testenv/testenv.go b/go/vt/vttablet/tabletserver/vstreamer/testenv/testenv.go index 84b2365a75e..607ec3cc2a3 100644 --- a/go/vt/vttablet/tabletserver/vstreamer/testenv/testenv.go +++ b/go/vt/vttablet/tabletserver/vstreamer/testenv/testenv.go @@ -21,7 +21,6 @@ import ( "context" "fmt" "os" - "path" "vitess.io/vitess/go/json2" "vitess.io/vitess/go/vt/dbconfigs" @@ -92,8 +91,7 @@ func Init() (*Env, error) { }, }, }, - ExtraMyCnf: []string{path.Join(os.Getenv("VTROOT"), "config/mycnf/rbr.cnf")}, - OnlyMySQL: true, + OnlyMySQL: true, } te.cluster = &vttest.LocalCluster{ Config: cfg, diff --git a/helm/vitess/templates/_helpers.tpl b/helm/vitess/templates/_helpers.tpl index f83683c0e4d..695d198758f 100644 --- a/helm/vitess/templates/_helpers.tpl +++ b/helm/vitess/templates/_helpers.tpl @@ -123,7 +123,6 @@ elif [ "$VT_DB_FLAVOR" = "mariadb103" ]; then fi export MYSQL_FLAVOR -export EXTRA_MY_CNF="/vtdataroot/tabletdata/report-host.cnf:/vt/config/mycnf/rbr.cnf" {{ if . }} for filename in /vt/userconfig/*.cnf; do diff --git a/test/binlog.py b/test/binlog.py index 9b4f09cb2a8..7e1cc3230a4 100755 --- a/test/binlog.py +++ b/test/binlog.py @@ -45,7 +45,7 @@ def setUpModule(): try: environment.topo_server().setup() - setup_procs = [t.init_mysql() for t in all_tablets] + setup_procs = [t.init_mysql(use_rbr=False) for t in all_tablets] utils.Vtctld().start() utils.wait_procs(setup_procs) diff --git a/test/tablet.py b/test/tablet.py index ba7ff2716ee..714ca3ec022 100644 --- a/test/tablet.py +++ b/test/tablet.py @@ -170,7 +170,7 @@ def mysqlctld(self, cmd, extra_my_cnf=None, verbose=False, extra_args=None): return utils.run_bg(args, extra_env=extra_env) def init_mysql(self, extra_my_cnf=None, init_db=None, extra_args=None, - use_rbr=False): + use_rbr=True): """Init the mysql tablet directory, starts mysqld. Either runs 'mysqlctl init', or starts a mysqlctld process. @@ -184,11 +184,11 @@ def init_mysql(self, extra_my_cnf=None, init_db=None, extra_args=None, Returns: The forked process. """ - if use_rbr: + if not use_rbr: if extra_my_cnf: - extra_my_cnf += ':' + environment.vtroot + '/config/mycnf/rbr.cnf' + extra_my_cnf += ':' + environment.vtroot + '/config/mycnf/sbr.cnf' else: - extra_my_cnf = environment.vtroot + '/config/mycnf/rbr.cnf' + extra_my_cnf = environment.vtroot + '/config/mycnf/sbr.cnf' if not init_db: init_db = environment.vtroot + '/config/init_db.sql' From d5eab082dfa42f5d759d9876dbaac2bff2dd4205 Mon Sep 17 00:00:00 2001 From: Ajeet jain Date: Thu, 19 Dec 2019 12:37:53 +0530 Subject: [PATCH 2/5] fixed binlog test Signed-off-by: Ajeet jain --- go/test/endtoend/binlog/binlog_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/test/endtoend/binlog/binlog_test.go b/go/test/endtoend/binlog/binlog_test.go index e7855503a98..8914405df1a 100644 --- a/go/test/endtoend/binlog/binlog_test.go +++ b/go/test/endtoend/binlog/binlog_test.go @@ -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, }) From 1836426f1ee90b5fc8fb01bda903e807ea3447ce Mon Sep 17 00:00:00 2001 From: Ajeet jain Date: Thu, 2 Jan 2020 10:30:15 +0530 Subject: [PATCH 3/5] removing unrequired statement based test as it is deprecated Signed-off-by: Ajeet jain --- go/mysql/endtoend/replication_test.go | 87 --------------------------- 1 file changed, 87 deletions(-) diff --git a/go/mysql/endtoend/replication_test.go b/go/mysql/endtoend/replication_test.go index fa5697bcbf2..df5debcc3d3 100644 --- a/go/mysql/endtoend/replication_test.go +++ b/go/mysql/endtoend/replication_test.go @@ -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() From 0c6197c911d3aeff37636fcbe48582bb1904b267 Mon Sep 17 00:00:00 2001 From: Ajeet jain Date: Thu, 2 Jan 2020 11:20:01 +0530 Subject: [PATCH 4/5] fixing vttablet endtoend tests Signed-off-by: Ajeet jain --- go/vt/vttablet/endtoend/compatibility_test.go | 2 +- go/vt/vttablet/endtoend/config_test.go | 20 ++- go/vt/vttablet/endtoend/misc_test.go | 3 +- go/vt/vttablet/endtoend/queries_test.go | 119 +++++++++--------- go/vt/vttablet/endtoend/transaction_test.go | 6 +- 5 files changed, 69 insertions(+), 81 deletions(-) diff --git a/go/vt/vttablet/endtoend/compatibility_test.go b/go/vt/vttablet/endtoend/compatibility_test.go index 31974eaf841..e5837eda5b2 100644 --- a/go/vt/vttablet/endtoend/compatibility_test.go +++ b/go/vt/vttablet/endtoend/compatibility_test.go @@ -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)}, diff --git a/go/vt/vttablet/endtoend/config_test.go b/go/vt/vttablet/endtoend/config_test.go index 74828da4fa6..9c24bba2cb0 100644 --- a/go/vt/vttablet/endtoend/config_test.go +++ b/go/vt/vttablet/endtoend/config_test.go @@ -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) @@ -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) @@ -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) @@ -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) diff --git a/go/vt/vttablet/endtoend/misc_test.go b/go/vt/vttablet/endtoend/misc_test.go index f58e900e3b5..25e8ee6e8d8 100644 --- a/go/vt/vttablet/endtoend/misc_test.go +++ b/go/vt/vttablet/endtoend/misc_test.go @@ -217,7 +217,8 @@ func TestTrailingComment(t *testing.T) { } } -func TestUpsertNonPKHit(t *testing.T) { +// FIXME: Fix below test before merging +func UpsertNonPKHit(t *testing.T) { client := framework.NewClient() err := client.Begin(false) if err != nil { diff --git a/go/vt/vttablet/endtoend/queries_test.go b/go/vt/vttablet/endtoend/queries_test.go index 55fd20561e8..d9287359925 100644 --- a/go/vt/vttablet/endtoend/queries_test.go +++ b/go/vt/vttablet/endtoend/queries_test.go @@ -478,7 +478,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "insert /* simple */ into vitess_a values (2, 1, 'aaaa', 'bbbb')", Rewritten: []string{ - "insert /* simple */ into vitess_a(eid, id, name, foo) values (2, 1, 'aaaa', 'bbbb') /* _stream vitess_a (eid id ) (2 1 )", + "insert /* simple */ into vitess_a(eid, id, name, foo) values (2, 1, 'aaaa', 'bbbb')", }, RowsAffected: 1, }, @@ -501,7 +501,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "insert /* simple */ ignore into vitess_a values (2, 1, 'aaaa', 'bbbb')", Rewritten: []string{ - "insert /* simple */ ignore into vitess_a(eid, id, name, foo) values (2, 1, 'aaaa', 'bbbb') /* _stream vitess_a (eid id ) (2 1 )", + "insert /* simple */ ignore into vitess_a(eid, id, name, foo) values (2, 1, 'aaaa', 'bbbb')", }, RowsAffected: 1, }, @@ -516,7 +516,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "insert /* simple */ ignore into vitess_a values (2, 1, 'cccc', 'cccc')", Rewritten: []string{ - "insert /* simple */ ignore into vitess_a(eid, id, name, foo) values (2, 1, 'cccc', 'cccc') /* _stream vitess_a (eid id ) (2 1 )", + "insert /* simple */ ignore into vitess_a(eid, id, name, foo) values (2, 1, 'cccc', 'cccc')", }, }, framework.TestQuery("commit"), @@ -538,7 +538,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "insert /* qualified */ into vitess_a(eid, id, name, foo) values (3, 1, 'aaaa', 'cccc')", Rewritten: []string{ - "insert /* qualified */ into vitess_a(eid, id, name, foo) values (3, 1, 'aaaa', 'cccc') /* _stream vitess_a (eid id ) (3 1 )", + "insert /* qualified */ into vitess_a(eid, id, name, foo) values (3, 1, 'aaaa', 'cccc')", }, RowsAffected: 1, }, @@ -561,7 +561,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "insert into vitess_mixed_case(col1, col2) values(1, 2)", Rewritten: []string{ - "insert into vitess_mixed_case(col1, col2) values (1, 2) /* _stream vitess_mixed_case (Col1 ) (1 )", + "insert into vitess_mixed_case(col1, col2) values (1, 2)", }, RowsAffected: 1, }, @@ -585,7 +585,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "insert /* auto_increment */ into vitess_e(name, foo) values ('aaaa', 'cccc')", Rewritten: []string{ - "insert /* auto_increment */ into vitess_e(name, foo) values ('aaaa', 'cccc') /* _stream vitess_e (eid id name ) (null 1 'YWFhYQ==' )", + "insert /* auto_increment */ into vitess_e(name, foo) values ('aaaa', 'cccc')", }, RowsAffected: 1, }, @@ -609,7 +609,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "insert /* auto_increment */ into vitess_e(eid, name, foo) values (NULL, 'aaaa', 'cccc')", Rewritten: []string{ - "insert /* auto_increment */ into vitess_e(eid, name, foo) values (null, 'aaaa', 'cccc') /* _stream vitess_e (eid id name ) (null 1 'YWFhYQ==' )", + "insert /* auto_increment */ into vitess_e(eid, name, foo) values (null, 'aaaa', 'cccc')", }, RowsAffected: 1, }, @@ -632,7 +632,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "insert /* num default */ into vitess_a(eid, name, foo) values (3, 'aaaa', 'cccc')", Rewritten: []string{ - "insert /* num default */ into vitess_a(eid, name, foo) values (3, 'aaaa', 'cccc') /* _stream vitess_a (eid id ) (3 1 )", + "insert /* num default */ into vitess_a(eid, name, foo) values (3, 'aaaa', 'cccc')", }, RowsAffected: 1, }, @@ -655,7 +655,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "insert /* string default */ into vitess_f(id) values (1)", Rewritten: []string{ - "insert /* string default */ into vitess_f(id) values (1) /* _stream vitess_f (vb ) ('YWI=' )", + "insert /* string default */ into vitess_f(id) values (1)", }, RowsAffected: 1, }, @@ -684,7 +684,7 @@ func TestQueries(t *testing.T) { "id": sqltypes.Int64BindVariable(1), }, Rewritten: []string{ - "insert /* bind values */ into vitess_a(eid, id, name, foo) values (4, 1, 'aaaa', 'cccc') /* _stream vitess_a (eid id ) (4 1 )", + "insert /* bind values */ into vitess_a(eid, id, name, foo) values (4, 1, 'aaaa', 'cccc')", }, RowsAffected: 1, }, @@ -713,7 +713,7 @@ func TestQueries(t *testing.T) { "v4": sqltypes.StringBindVariable("cccc"), }, Rewritten: []string{ - "insert /* positional values */ into vitess_a(eid, id, name, foo) values (4, 1, 'aaaa', 'cccc') /* _stream vitess_a (eid id ) (4 1 )", + "insert /* positional values */ into vitess_a(eid, id, name, foo) values (4, 1, 'aaaa', 'cccc')", }, RowsAffected: 1, }, @@ -736,7 +736,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "insert into vitess_a(id, eid, foo, name) values (-1, 5, 'aaa', 'bbb')", Rewritten: []string{ - "insert into vitess_a(id, eid, foo, name) values (-1, 5, 'aaa', 'bbb') /* _stream vitess_a (eid id ) (5 -1 )", + "insert into vitess_a(id, eid, foo, name) values (-1, 5, 'aaa', 'bbb')", }, RowsAffected: 1, }, @@ -760,7 +760,7 @@ func TestQueries(t *testing.T) { Query: "insert /* subquery */ into vitess_a(eid, name, foo) select eid, name, foo from vitess_c", Rewritten: []string{ "select eid, name, foo from vitess_c limit 10001", - "insert /* subquery */ into vitess_a(eid, name, foo) values (10, 'abcd', '20'), (11, 'bcde', '30') /* _stream vitess_a (eid id ) (10 1 ) (11 1 )", + "insert /* subquery */ into vitess_a(eid, name, foo) values (10, 'abcd', '20'), (11, 'bcde', '30')", }, RowsAffected: 2, }, @@ -778,7 +778,7 @@ func TestQueries(t *testing.T) { Query: "insert into vitess_e(id, name, foo) select eid, name, foo from vitess_c", Rewritten: []string{ "select eid, name, foo from vitess_c limit 10001", - "insert into vitess_e(id, name, foo) values (10, 'abcd', '20'), (11, 'bcde', '30') /* _stream vitess_e (eid id name ) (null 10 'YWJjZA==' ) (null 11 'YmNkZQ==' )", + "insert into vitess_e(id, name, foo) values (10, 'abcd', '20'), (11, 'bcde', '30')", }, RowsAffected: 2, }, @@ -819,7 +819,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "insert into vitess_a(eid, id, name, foo) values (5, 1, '', ''), (7, 1, '', '')", Rewritten: []string{ - "insert into vitess_a(eid, id, name, foo) values (5, 1, '', ''), (7, 1, '', '') /* _stream vitess_a (eid id ) (5 1 ) (7 1 )", + "insert into vitess_a(eid, id, name, foo) values (5, 1, '', ''), (7, 1, '', '')", }, RowsAffected: 2, }, @@ -843,7 +843,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "insert into upsert_test(id1, id2) values (1, 1) on duplicate key update id2 = 1", Rewritten: []string{ - "insert into upsert_test(id1, id2) values (1, 1) /* _stream upsert_test (id1 ) (1 )", + "insert into upsert_test(id1, id2) values (1, 1) on duplicate key update id2 = 1", }, RowsAffected: 1, }, @@ -856,8 +856,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "insert into upsert_test(id1, id2) values (1, 2) on duplicate key update id2 = 2", Rewritten: []string{ - "insert into upsert_test(id1, id2) values (1, 2) /* _stream upsert_test (id1 ) (1 )", - "update upsert_test set id2 = 2 where id1 in (1) /* _stream upsert_test (id1 ) (1 )", + "insert into upsert_test(id1, id2) values (1, 2) on duplicate key update id2 = 2", }, RowsAffected: 2, }, @@ -870,15 +869,13 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "insert into upsert_test(id1, id2) values (1, 2) on duplicate key update id2 = 2", Rewritten: []string{ - "insert into upsert_test(id1, id2) values (1, 2) /* _stream upsert_test (id1 ) (1 )", - "update upsert_test set id2 = 2 where id1 in (1) /* _stream upsert_test (id1 ) (1 )", + "insert into upsert_test(id1, id2) values (1, 2) on duplicate key update id2 = 2", }, }, &framework.TestCase{ Query: "insert ignore into upsert_test(id1, id2) values (1, 3) on duplicate key update id2 = 3", Rewritten: []string{ - "insert into upsert_test(id1, id2) values (1, 3) /* _stream upsert_test (id1 ) (1 )", - "update upsert_test set id2 = 3 where id1 in (1) /* _stream upsert_test (id1 ) (1 )", + "insert ignore into upsert_test(id1, id2) values (1, 3) on duplicate key update id2 = 3", }, RowsAffected: 2, }, @@ -901,7 +898,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "insert into upsert_test(id1, id2) values (1, 1) on duplicate key update id1 = 1", Rewritten: []string{ - "insert into upsert_test(id1, id2) values (1, 1) /* _stream upsert_test (id1 ) (1 )", + "insert into upsert_test(id1, id2) values (1, 1) on duplicate key update id1 = 1", }, RowsAffected: 1, }, @@ -914,8 +911,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "insert into upsert_test(id1, id2) values (1, 2) on duplicate key update id1 = 2", Rewritten: []string{ - "insert into upsert_test(id1, id2) values (1, 2) /* _stream upsert_test (id1 ) (1 )", - "update upsert_test set id1 = 2 where id1 in (1) /* _stream upsert_test (id1 ) (1 ) (2 )", + "insert into upsert_test(id1, id2) values (1, 2) on duplicate key update id1 = 2", }, RowsAffected: 2, }, @@ -938,7 +934,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "insert into upsert_test(id1, id2) values (1, 1) on duplicate key update id2 = values(id2) + 1", Rewritten: []string{ - "insert into upsert_test(id1, id2) values (1, 1) /* _stream upsert_test (id1 ) (1 )", + "insert into upsert_test(id1, id2) values (1, 1) on duplicate key update id2 = values(id2) + 1", }, RowsAffected: 1, }, @@ -951,8 +947,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "insert into upsert_test(id1, id2) values (1, 2) on duplicate key update id2 = values(id2) + 1", Rewritten: []string{ - "insert into upsert_test(id1, id2) values (1, 2) /* _stream upsert_test (id1 ) (1 )", - "update upsert_test set id2 = (2) + 1 where id1 in (1) /* _stream upsert_test (id1 ) (1 )", + "insert into upsert_test(id1, id2) values (1, 2) on duplicate key update id2 = values(id2) + 1", }, RowsAffected: 2, }, @@ -965,8 +960,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "insert into upsert_test(id1, id2) values (1, 2) on duplicate key update id2 = values(id1)", Rewritten: []string{ - "insert into upsert_test(id1, id2) values (1, 2) /* _stream upsert_test (id1 ) (1 )", - "update upsert_test set id2 = (1) where id1 in (1) /* _stream upsert_test (id1 ) (1 )", + "insert into upsert_test(id1, id2) values (1, 2) on duplicate key update id2 = values(id1)", }, }, &framework.TestCase{ @@ -978,8 +972,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "insert ignore into upsert_test(id1, id2) values (1, 3) on duplicate key update id2 = greatest(values(id1), values(id2))", Rewritten: []string{ - "insert into upsert_test(id1, id2) values (1, 3) /* _stream upsert_test (id1 ) (1 )", - "update upsert_test set id2 = greatest((1), (3)) where id1 in (1) /* _stream upsert_test (id1 ) (1 )", + "insert ignore into upsert_test(id1, id2) values (1, 3) on duplicate key update id2 = greatest(values(id1), values(id2))", }, RowsAffected: 2, }, @@ -1002,7 +995,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "update /* pk */ vitess_a set foo='bar' where eid = 1 and id = 1", Rewritten: []string{ - "update /* pk */ vitess_a set foo = 'bar' where (eid = 1 and id = 1) /* _stream vitess_a (eid id ) (1 1 )", + "update /* pk */ vitess_a set foo = 'bar' where (eid = 1 and id = 1)", }, RowsAffected: 1, }, @@ -1025,7 +1018,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "update /* pk */ vitess_a set foo='bar' where eid = 1 and id in (1, 2)", Rewritten: []string{ - "update /* pk */ vitess_a set foo = 'bar' where (eid = 1 and id = 1) or (eid = 1 and id = 2) /* _stream vitess_a (eid id ) (1 1 ) (1 2 )", + "update /* pk */ vitess_a set foo = 'bar' where (eid = 1 and id = 1) or (eid = 1 and id = 2)", }, RowsAffected: 2, }, @@ -1050,7 +1043,7 @@ func TestQueries(t *testing.T) { Query: "update /* pk */ vitess_a set foo='bar' where eid in (1) and id in (1, 2)", Rewritten: []string{ "select eid, id from vitess_a where eid in (1) and id in (1, 2) limit 10001 for update", - "update /* pk */ vitess_a set foo = 'bar' where (eid = 1 and id = 1) or (eid = 1 and id = 2) /* _stream vitess_a (eid id ) (1 1 ) (1 2 )", + "update /* pk */ vitess_a set foo = 'bar' where (eid = 1 and id = 1) or (eid = 1 and id = 2)", }, RowsAffected: 2, }, @@ -1075,7 +1068,7 @@ func TestQueries(t *testing.T) { Query: "update /* pk */ vitess_a set foo='bar' where eid in (1, 2) and id in (1, 2)", Rewritten: []string{ "select eid, id from vitess_a where eid in (1, 2) and id in (1, 2) limit 10001 for update", - "update /* pk */ vitess_a set foo = 'bar' where (eid = 1 and id = 1) or (eid = 1 and id = 2) /* _stream vitess_a (eid id ) (1 1 ) (1 2 )", + "update /* pk */ vitess_a set foo = 'bar' where (eid = 1 and id = 1) or (eid = 1 and id = 2)", }, RowsAffected: 2, }, @@ -1099,7 +1092,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "update vitess_a set eid = 2 where eid = 1 and id = 1", Rewritten: []string{ - "update vitess_a set eid = 2 where (eid = 1 and id = 1) /* _stream vitess_a (eid id ) (1 1 ) (2 1 )", + "update vitess_a set eid = 2 where (eid = 1 and id = 1)", }, RowsAffected: 1, }, @@ -1123,7 +1116,7 @@ func TestQueries(t *testing.T) { Query: "update /* pk */ vitess_a set foo='bar' where id = 1", Rewritten: []string{ "select eid, id from vitess_a where id = 1 limit 10001 for update", - "update /* pk */ vitess_a set foo = 'bar' where (eid = 1 and id = 1) /* _stream vitess_a (eid id ) (1 1 )", + "update /* pk */ vitess_a set foo = 'bar' where (eid = 1 and id = 1)", }, RowsAffected: 1, }, @@ -1147,7 +1140,7 @@ func TestQueries(t *testing.T) { Query: "update /* pk */ vitess_a set foo='bar' where eid = 1 limit 1", Rewritten: []string{ "select eid, id from vitess_a where eid = 1 limit 1 for update", - "update /* pk */ vitess_a set foo = 'bar' where (eid = 1 and id = 1) /* _stream vitess_a (eid id ) (1 1 )", + "update /* pk */ vitess_a set foo = 'bar' where (eid = 1 and id = 1)", }, RowsAffected: 1, }, @@ -1171,7 +1164,7 @@ func TestQueries(t *testing.T) { Query: "update /* pk */ vitess_a set foo='bar' where eid = 1 order by id desc limit 1", Rewritten: []string{ "select eid, id from vitess_a where eid = 1 order by id desc limit 1 for update", - "update /* pk */ vitess_a set foo = 'bar' where (eid = 1 and id = 2) order by id desc /* _stream vitess_a (eid id ) (1 2 )", + "update /* pk */ vitess_a set foo = 'bar' where (eid = 1 and id = 2) order by id desc", }, RowsAffected: 1, }, @@ -1195,7 +1188,7 @@ func TestQueries(t *testing.T) { Query: "update vitess_a set foo='bar'", Rewritten: []string{ "select eid, id from vitess_a limit 10001 for update", - "update vitess_a set foo = 'bar' where (eid = 1 and id = 1) or (eid = 1 and id = 2) /* _stream vitess_a (eid id ) (1 1 ) (1 2 )", + "update vitess_a set foo = 'bar' where (eid = 1 and id = 1) or (eid = 1 and id = 2)", }, RowsAffected: 2, }, @@ -1223,7 +1216,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "update vitess_f set id=2 where vb='a'", Rewritten: []string{ - "update vitess_f set id = 2 where vb in ('a') /* _stream vitess_f (vb ) ('YQ==' )", + "update vitess_f set id = 2 where vb in ('a')", }, RowsAffected: 1, }, @@ -1250,7 +1243,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "update vitess_f set id=3 where vb in ('a', 'b')", Rewritten: []string{ - "update vitess_f set id = 3 where vb in ('a', 'b') /* _stream vitess_f (vb ) ('YQ==' ) ('Yg==' )", + "update vitess_f set id = 3 where vb in ('a', 'b')", }, RowsAffected: 2, }, @@ -1278,7 +1271,7 @@ func TestQueries(t *testing.T) { Query: "update vitess_f set id=4 where id >= 0", Rewritten: []string{ "select vb from vitess_f where id >= 0 limit 10001 for update", - "update vitess_f set id = 4 where vb in ('a', 'b') /* _stream vitess_f (vb ) ('YQ==' ) ('Yg==' )", + "update vitess_f set id = 4 where vb in ('a', 'b')", }, RowsAffected: 2, }, @@ -1329,7 +1322,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "delete /* pk */ from vitess_a where eid = 2 and id = 1", Rewritten: []string{ - "delete /* pk */ from vitess_a where (eid = 2 and id = 1) /* _stream vitess_a (eid id ) (2 1 )", + "delete /* pk */ from vitess_a where (eid = 2 and id = 1)", }, RowsAffected: 1, }, @@ -1347,7 +1340,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "delete /* pk */ from vitess_a where eid = 2 and id in (1, 2)", Rewritten: []string{ - "delete /* pk */ 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 /* pk */ from vitess_a where (eid = 2 and id = 1) or (eid = 2 and id = 2)", }, RowsAffected: 1, }, @@ -1366,7 +1359,7 @@ func TestQueries(t *testing.T) { Query: "delete /* pk */ from vitess_a where eid in (2) and id in (1, 2)", Rewritten: []string{ "select eid, id from vitess_a where eid in (2) and id in (1, 2) limit 10001 for update", - "delete /* pk */ from vitess_a where (eid = 2 and id = 1) /* _stream vitess_a (eid id ) (2 1 )", + "delete /* pk */ from vitess_a where (eid = 2 and id = 1)", }, RowsAffected: 1, }, @@ -1385,7 +1378,7 @@ func TestQueries(t *testing.T) { Query: "delete /* pk */ from vitess_a where eid in (2, 3) and id in (1, 2)", Rewritten: []string{ "select eid, id from vitess_a where eid in (2, 3) and id in (1, 2) limit 10001 for update", - "delete /* pk */ from vitess_a where (eid = 2 and id = 1) /* _stream vitess_a (eid id ) (2 1 )", + "delete /* pk */ from vitess_a where (eid = 2 and id = 1)", }, RowsAffected: 1, }, @@ -1404,7 +1397,7 @@ func TestQueries(t *testing.T) { Query: "delete from vitess_a where eid = 1+1 and id = 1", Rewritten: []string{ "select eid, id from vitess_a where eid = 1 + 1 and id = 1 limit 10001 for update", - "delete from vitess_a where (eid = 2 and id = 1) /* _stream vitess_a (eid id ) (2 1 )", + "delete from vitess_a where (eid = 2 and id = 1)", }, RowsAffected: 1, }, @@ -1423,7 +1416,7 @@ func TestQueries(t *testing.T) { Query: "delete from vitess_a where eid = 2", Rewritten: []string{ "select eid, id from vitess_a where eid = 2 limit 10001 for update", - "delete from vitess_a where (eid = 2 and id = 1) /* _stream vitess_a (eid id ) (2 1 )", + "delete from vitess_a where (eid = 2 and id = 1)", }, RowsAffected: 1, }, @@ -1442,7 +1435,7 @@ func TestQueries(t *testing.T) { Query: "delete from vitess_a where eid = 2 limit 1", Rewritten: []string{ "select eid, id from vitess_a where eid = 2 limit 1 for update", - "delete from vitess_a where (eid = 2 and id = 1) /* _stream vitess_a (eid id ) (2 1 )", + "delete from vitess_a where (eid = 2 and id = 1)", }, RowsAffected: 1, }, @@ -1462,7 +1455,7 @@ func TestQueries(t *testing.T) { Query: "delete from vitess_a where eid = 2 order by id desc", Rewritten: []string{ "select eid, id from vitess_a where eid = 2 order by id desc limit 10001 for update", - "delete from vitess_a where (eid = 2 and id = 2) or (eid = 2 and id = 1) order by id desc /* _stream vitess_a (eid id ) (2 2 ) (2 1 )", + "delete from vitess_a where (eid = 2 and id = 2) or (eid = 2 and id = 1) order by id desc", }, RowsAffected: 2, }, @@ -1492,7 +1485,7 @@ func TestQueries(t *testing.T) { "mediumu": sqltypes.Int64BindVariable(16777215), }, Rewritten: []string{ - "insert into vitess_ints(tiny, tinyu, small, smallu, medium, mediumu, normal, normalu, big, bigu, y) values (-128, 255, -32768, 65535, -8388608, 16777215, -2147483648, 4294967295, -9223372036854775808, 18446744073709551615, 2012) /* _stream vitess_ints (tiny ) (-128 )", + "insert into vitess_ints(tiny, tinyu, small, smallu, medium, mediumu, normal, normalu, big, bigu, y) values (-128, 255, -32768, 65535, -8388608, 16777215, -2147483648, 4294967295, -9223372036854775808, 18446744073709551615, 2012)", }, }, framework.TestQuery("commit"), @@ -1520,7 +1513,7 @@ func TestQueries(t *testing.T) { Query: "insert into vitess_ints select 2, tinyu, small, smallu, medium, mediumu, normal, normalu, big, bigu, y from vitess_ints", Rewritten: []string{ "select 2, tinyu, small, smallu, medium, mediumu, normal, normalu, big, bigu, y from vitess_ints limit 10001", - "insert into vitess_ints(tiny, tinyu, small, smallu, medium, mediumu, normal, normalu, big, bigu, y) values (2, 255, -32768, 65535, -8388608, 16777215, -2147483648, 4294967295, -9223372036854775808, 18446744073709551615, 2012) /* _stream vitess_ints (tiny ) (2 )", + "insert into vitess_ints(tiny, tinyu, small, smallu, medium, mediumu, normal, normalu, big, bigu, y) values (2, 255, -32768, 65535, -8388608, 16777215, -2147483648, 4294967295, -9223372036854775808, 18446744073709551615, 2012)", }, }, framework.TestQuery("commit"), @@ -1543,7 +1536,7 @@ func TestQueries(t *testing.T) { "deci": sqltypes.StringBindVariable("1.99"), }, Rewritten: []string{ - "insert into vitess_fracts(id, deci, num, f, d) values (1, '1.99', '2.99', 3.99, 4.99) /* _stream vitess_fracts (id ) (1 )", + "insert into vitess_fracts(id, deci, num, f, d) values (1, '1.99', '2.99', 3.99, 4.99)", }, }, framework.TestQuery("commit"), @@ -1571,7 +1564,7 @@ func TestQueries(t *testing.T) { Query: "insert into vitess_fracts select 2, deci, num, f, d from vitess_fracts", Rewritten: []string{ "select 2, deci, num, f, d from vitess_fracts limit 10001", - "insert into vitess_fracts(id, deci, num, f, d) values (2, 1.99, 2.99, 3.99, 4.99) /* _stream vitess_fracts (id ) (2 )", + "insert into vitess_fracts(id, deci, num, f, d) values (2, 1.99, 2.99, 3.99, 4.99)", }, }, framework.TestQuery("commit"), @@ -1599,7 +1592,7 @@ func TestQueries(t *testing.T) { "c": sqltypes.StringBindVariable("b"), }, Rewritten: []string{ - "insert into vitess_strings(vb, c, vc, b, tb, bl, ttx, tx, en, s) values ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'a', 'a,b') /* _stream vitess_strings (vb ) ('YQ==' )", + "insert into vitess_strings(vb, c, vc, b, tb, bl, ttx, tx, en, s) values ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'a', 'a,b')", }, }, framework.TestQuery("commit"), @@ -1627,7 +1620,7 @@ func TestQueries(t *testing.T) { Query: "insert into vitess_strings select 'b', c, vc, b, tb, bl, ttx, tx, en, s from vitess_strings", Rewritten: []string{ "select 'b', c, vc, b, tb, bl, ttx, tx, en, s from vitess_strings limit 10001", - "insert into vitess_strings(vb, c, vc, b, tb, bl, ttx, tx, en, s) values ('b', 'b', 'c', 'd\\0\\0\\0', 'e', 'f', 'g', 'h', 'a', 'a,b') /* _stream vitess_strings (vb ) ('Yg==' )", + "insert into vitess_strings(vb, c, vc, b, tb, bl, ttx, tx, en, s) values ('b', 'b', 'c', 'd\\0\\0\\0', 'e', 'f', 'g', 'h', 'a', 'a,b')", }, }, framework.TestQuery("commit"), @@ -1650,7 +1643,7 @@ func TestQueries(t *testing.T) { "d": sqltypes.StringBindVariable("2012-01-01"), }, Rewritten: []string{ - "insert into vitess_misc(id, b, d, dt, t, g) values (1, '\x01', '2012-01-01', '2012-01-01 15:45:45', '15:45:45', point(1, 2)) /* _stream vitess_misc (id ) (1 )", + "insert into vitess_misc(id, b, d, dt, t, g) values (1, '\x01', '2012-01-01', '2012-01-01 15:45:45', '15:45:45', point(1, 2))", }, }, framework.TestQuery("commit"), @@ -1679,7 +1672,7 @@ func TestQueries(t *testing.T) { Query: "insert into vitess_misc(id, b, d, dt, t) select 2, b, d, dt, t from vitess_misc", Rewritten: []string{ "select 2, b, d, dt, t from vitess_misc limit 10001", - "insert into vitess_misc(id, b, d, dt, t) values (2, b'00000001', '2012-01-01', '2012-01-01 15:45:45', '15:45:45') /* _stream vitess_misc (id ) (2 )", + "insert into vitess_misc(id, b, d, dt, t) values (2, b'00000001', '2012-01-01', '2012-01-01 15:45:45', '15:45:45')", }, }, framework.TestQuery("commit"), @@ -1731,7 +1724,7 @@ func TestQueries(t *testing.T) { &framework.TestCase{ Query: "insert into vitess_bool(auto, bval, sval, ival) values (1, false, 'test2', 191) on duplicate key update bval = false", Rewritten: []string{ - "insert into vitess_bool(auto, bval, sval, ival) values (1, false, 'test2', 191) on duplicate key update bval = false /* _stream vitess_bool (auto ) (1 )", + "insert into vitess_bool(auto, bval, sval, ival) values (1, false, 'test2', 191) on duplicate key update bval = false", }, RowsAffected: 2, }, @@ -1760,7 +1753,7 @@ func TestQueries(t *testing.T) { Query: "update vitess_bool set sval = 'test' where bval is false or ival = 23", Rewritten: []string{ "select auto from vitess_bool where bval is false or ival = 23 limit 10001 for update", - "update vitess_bool set sval = 'test' where auto in (1, 2, 6, 7, 8, 9) /* _stream vitess_bool (auto ) (1 ) (2 ) (6 ) (7 ) (8 ) (9 )", + "update vitess_bool set sval = 'test' where auto in (1, 2, 6, 7, 8, 9)", }, RowsAffected: 6, }, @@ -1843,7 +1836,7 @@ func TestBitDefault(t *testing.T) { &framework.TestCase{ Query: "insert into vitess_bit_default values()", Rewritten: []string{ - "insert into vitess_bit_default(id) values ('\x05') /* _stream vitess_bit_default (id ) ('BQ==' )", + "insert into vitess_bit_default(id) values ('\x05')", }, RowsAffected: 1, }, diff --git a/go/vt/vttablet/endtoend/transaction_test.go b/go/vt/vttablet/endtoend/transaction_test.go index 691e474e9c7..e663fd63f70 100644 --- a/go/vt/vttablet/endtoend/transaction_test.go +++ b/go/vt/vttablet/endtoend/transaction_test.go @@ -67,7 +67,7 @@ func TestCommit(t *testing.T) { t.Error(err) return } - want := []string{"insert into vitess_test(intval, floatval, charval, binval) values (4, null, null, null) /* _stream vitess_test (intval ) (4 ); */"} + want := []string{"insert into vitess_test(intval, floatval, charval, binval) values (4, null, null, null)"} if !reflect.DeepEqual(tx.Queries, want) { t.Errorf("queries: %v, want %v", tx.Queries, want) } @@ -163,7 +163,7 @@ func TestRollback(t *testing.T) { t.Error(err) return } - want := []string{"insert into vitess_test(intval, floatval, charval, binval) values (4, null, null, null) /* _stream vitess_test (intval ) (4 ); */"} + want := []string{"insert into vitess_test(intval, floatval, charval, binval) values (4, null, null, null)"} if !reflect.DeepEqual(tx.Queries, want) { t.Errorf("queries: %v, want %v", tx.Queries, want) } @@ -227,7 +227,7 @@ func TestAutoCommit(t *testing.T) { t.Error(err) return } - want := []string{"insert into vitess_test(intval, floatval, charval, binval) values (4, null, null, null) /* _stream vitess_test (intval ) (4 ); */"} + want := []string{"insert into vitess_test(intval, floatval, charval, binval) values (4, null, null, null)"} // Sometimes, no queries will be returned by the querylog because reliability // is not guaranteed. If so, just move on without verifying. The subsequent // rowcount check will anyway verify that the insert succeeded. From 434f95a64005c43ac14b35b3bb041aa542a752f1 Mon Sep 17 00:00:00 2001 From: Ajeet jain Date: Fri, 3 Jan 2020 08:31:54 +0530 Subject: [PATCH 5/5] removing obsolete test as we are moving to RBR Signed-off-by: Ajeet jain --- go/vt/vttablet/endtoend/misc_test.go | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/go/vt/vttablet/endtoend/misc_test.go b/go/vt/vttablet/endtoend/misc_test.go index 25e8ee6e8d8..d35f2f1223f 100644 --- a/go/vt/vttablet/endtoend/misc_test.go +++ b/go/vt/vttablet/endtoend/misc_test.go @@ -217,32 +217,6 @@ func TestTrailingComment(t *testing.T) { } } -// FIXME: Fix below test before merging -func UpsertNonPKHit(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)