From 386b46bfe2a961cae28698bcce48a0d39f4bee09 Mon Sep 17 00:00:00 2001 From: Manan Gupta Date: Mon, 11 Jul 2022 19:33:16 +0530 Subject: [PATCH 01/11] feat: deprecate enable_semi_sync flag Signed-off-by: Manan Gupta --- .../vttablet/tabletmanager/rpc_replication.go | 55 ++------ .../tabletmanager/rpc_replication_test.go | 119 ------------------ 2 files changed, 12 insertions(+), 162 deletions(-) diff --git a/go/vt/vttablet/tabletmanager/rpc_replication.go b/go/vt/vttablet/tabletmanager/rpc_replication.go index 58ab1113272..ce96ead8682 100644 --- a/go/vt/vttablet/tabletmanager/rpc_replication.go +++ b/go/vt/vttablet/tabletmanager/rpc_replication.go @@ -39,7 +39,7 @@ import ( ) var ( - enableSemiSync = flag.Bool("enable_semi_sync", false, "Enable semi-sync when configuring replication, on primary and replica tablets only (rdonly tablets will not ack).") + _ = flag.Bool("enable_semi_sync", false, "(DEPRECATED - Set the correct durability policy in the keyspace information instead) Enable semi-sync when configuring replication, on primary and replica tablets only (rdonly tablets will not ack).") setSuperReadOnly = flag.Bool("use_super_read_only", false, "Set super_read_only flag when performing planned failover.") ) @@ -985,45 +985,18 @@ func isPrimaryEligible(tabletType topodatapb.TabletType) bool { } func (tm *TabletManager) fixSemiSync(tabletType topodatapb.TabletType, semiSync SemiSyncAction) error { - if !*enableSemiSync { - // Semi-sync handling is not enabled. - if semiSync == SemiSyncActionSet { - log.Error("invalid configuration - semi-sync should be setup according to durability policies, but enable_semi_sync is not set") - } + switch semiSync { + case SemiSyncActionNone: return nil - } - - // Only enable if we're eligible for becoming primary (REPLICA type). - // Ineligible tablets (RDONLY) shouldn't ACK because we'll never promote them. - if !isPrimaryEligible(tabletType) { - if semiSync == SemiSyncActionSet { - log.Error("invalid configuration - semi-sync should be setup according to durability policies, but the tablet is not primaryEligible") - } + case SemiSyncActionSet: + // Always enable replica-side since it doesn't hurt to keep it on for a primary. + // The primary-side needs to be off for a replica, or else it will get stuck. + return tm.MysqlDaemon.SetSemiSyncEnabled(tabletType == topodatapb.TabletType_PRIMARY, true) + case SemiSyncActionUnset: return tm.MysqlDaemon.SetSemiSyncEnabled(false, false) + default: + return vterrors.Errorf(vtrpc.Code_INTERNAL, "Unknown SemiSyncAction - %v", semiSync) } - - if semiSync == SemiSyncActionUnset { - log.Error("invalid configuration - enabling semi sync even though not specified by durability policies. Possibly in the process of upgrading.") - } - // Always enable replica-side since it doesn't hurt to keep it on for a primary. - // The primary-side needs to be off for a replica, or else it will get stuck. - return tm.MysqlDaemon.SetSemiSyncEnabled(tabletType == topodatapb.TabletType_PRIMARY, true) - - // This following code will be uncommented and the above deleted when we are ready to use the - // durability policies for setting the semi_sync information - - //switch semiSync { - //case SemiSyncActionNone: - // return nil - //case SemiSyncActionSet: - // // Always enable replica-side since it doesn't hurt to keep it on for a primary. - // // The primary-side needs to be off for a replica, or else it will get stuck. - // return tm.MysqlDaemon.SetSemiSyncEnabled(tabletType == topodatapb.TabletType_PRIMARY, true) - //case SemiSyncActionUnset: - // return tm.MysqlDaemon.SetSemiSyncEnabled(false, false) - //default: - // return vterrors.Errorf(vtrpc.Code_INTERNAL, "Unknown SemiSyncAction - %v", semiSync) - //} } func (tm *TabletManager) isPrimarySideSemiSyncEnabled() bool { @@ -1032,14 +1005,10 @@ func (tm *TabletManager) isPrimarySideSemiSyncEnabled() bool { } func (tm *TabletManager) fixSemiSyncAndReplication(tabletType topodatapb.TabletType, semiSync SemiSyncAction) error { - if !*enableSemiSync { - // Semi-sync handling is not enabled. + if semiSync == SemiSyncActionNone { + // Semi-sync handling is not required. return nil } - //if semiSync == SemiSyncActionNone { - // // Semi-sync handling is not required. - // return nil - //} if tabletType == topodatapb.TabletType_PRIMARY { // Primary is special. It is always handled at the diff --git a/go/vt/vttablet/tabletmanager/rpc_replication_test.go b/go/vt/vttablet/tabletmanager/rpc_replication_test.go index 93bc8ccfbd2..b37d88518bf 100644 --- a/go/vt/vttablet/tabletmanager/rpc_replication_test.go +++ b/go/vt/vttablet/tabletmanager/rpc_replication_test.go @@ -17,16 +17,11 @@ limitations under the License. package tabletmanager import ( - "bytes" "context" "fmt" - "io" - "os" "testing" "time" - "vitess.io/vitess/go/vt/proto/topodata" - "github.com/stretchr/testify/require" "vitess.io/vitess/go/vt/mysqlctl/fakemysqldaemon" @@ -79,117 +74,3 @@ func TestPromoteReplicaReplicationManagerFailure(t *testing.T) { // At the end we expect the replication manager to be stopped. require.True(t, tm.replManager.ticks.Running()) } - -func captureStderr(f func()) (string, error) { - old := os.Stderr // keep backup of the real stderr - r, w, err := os.Pipe() - if err != nil { - return "", err - } - os.Stderr = w - - outC := make(chan string) - // copy the output in a separate goroutine so printing can't block indefinitely - go func() { - var buf bytes.Buffer - io.Copy(&buf, r) - outC <- buf.String() - }() - - // calling function which stderr we are going to capture: - f() - - // back to normal state - w.Close() - os.Stderr = old // restoring the real stderr - return <-outC, nil -} - -func TestTabletManager_fixSemiSync(t *testing.T) { - tests := []struct { - name string - tabletType topodata.TabletType - semiSync SemiSyncAction - logOutput string - shouldEnableSemiSync bool - }{ - { - name: "enableSemiSync=true(primary eligible),durabilitySemiSync=true", - tabletType: topodata.TabletType_REPLICA, - semiSync: SemiSyncActionSet, - logOutput: "", - shouldEnableSemiSync: true, - }, { - name: "enableSemiSync=true(primary eligible),durabilitySemiSync=false", - tabletType: topodata.TabletType_REPLICA, - semiSync: SemiSyncActionUnset, - logOutput: "invalid configuration - enabling semi sync even though not specified by durability policies.", - shouldEnableSemiSync: true, - }, { - name: "enableSemiSync=true(primary eligible),durabilitySemiSync=none", - tabletType: topodata.TabletType_REPLICA, - semiSync: SemiSyncActionNone, - logOutput: "", - shouldEnableSemiSync: true, - }, { - name: "enableSemiSync=true(primary not-eligible),durabilitySemiSync=true", - tabletType: topodata.TabletType_DRAINED, - semiSync: SemiSyncActionSet, - logOutput: "invalid configuration - semi-sync should be setup according to durability policies, but the tablet is not primaryEligible", - shouldEnableSemiSync: true, - }, { - name: "enableSemiSync=true(primary not-eligible),durabilitySemiSync=false", - tabletType: topodata.TabletType_DRAINED, - semiSync: SemiSyncActionUnset, - logOutput: "", - shouldEnableSemiSync: true, - }, { - name: "enableSemiSync=true(primary not-eligible),durabilitySemiSync=none", - tabletType: topodata.TabletType_DRAINED, - semiSync: SemiSyncActionNone, - logOutput: "", - shouldEnableSemiSync: true, - }, { - name: "enableSemiSync=false,durabilitySemiSync=true", - tabletType: topodata.TabletType_REPLICA, - semiSync: SemiSyncActionSet, - logOutput: "invalid configuration - semi-sync should be setup according to durability policies, but enable_semi_sync is not set", - shouldEnableSemiSync: false, - }, { - name: "enableSemiSync=false,durabilitySemiSync=false", - tabletType: topodata.TabletType_REPLICA, - semiSync: SemiSyncActionUnset, - logOutput: "", - shouldEnableSemiSync: false, - }, { - name: "enableSemiSync=false,durabilitySemiSync=none", - tabletType: topodata.TabletType_REPLICA, - semiSync: SemiSyncActionNone, - logOutput: "", - shouldEnableSemiSync: false, - }, - } - oldEnableSemiSync := *enableSemiSync - defer func() { - *enableSemiSync = oldEnableSemiSync - }() - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - *enableSemiSync = tt.shouldEnableSemiSync - fakeMysql := fakemysqldaemon.NewFakeMysqlDaemon(nil) - tm := &TabletManager{ - MysqlDaemon: fakeMysql, - } - logOutput, err := captureStderr(func() { - err := tm.fixSemiSync(tt.tabletType, tt.semiSync) - require.NoError(t, err) - }) - require.NoError(t, err) - if tt.logOutput != "" { - require.Contains(t, logOutput, tt.logOutput) - } else { - require.Equal(t, "", logOutput) - } - }) - } -} From 8a9f7fbac516f1ee6732999dee387fa9639f2040 Mon Sep 17 00:00:00 2001 From: Manan Gupta Date: Mon, 11 Jul 2022 19:33:41 +0530 Subject: [PATCH 02/11] docs: add the deprecation change to the summary Signed-off-by: Manan Gupta --- doc/releasenotes/15_0_0_summary.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/releasenotes/15_0_0_summary.md b/doc/releasenotes/15_0_0_summary.md index 4348468b6cc..6e815a98552 100644 --- a/doc/releasenotes/15_0_0_summary.md +++ b/doc/releasenotes/15_0_0_summary.md @@ -15,6 +15,7 @@ The following VTTablet flags were deprecated in 7.0. They have now been deleted #### vttablet startup flag deprecations - --enable-query-plan-field-caching is now deprecated. It will be removed in v16. +- --enable_semi_sync is now deprecated. It will be removed in v16. Instead, set the correct durability policy using `SetKeyspaceDurabilityPolicy` ### New command line flags and behavior From 6fe29a05ed0cbe55133b09cb315260c8e109c100 Mon Sep 17 00:00:00 2001 From: Manan Gupta Date: Thu, 14 Jul 2022 18:41:05 +0530 Subject: [PATCH 03/11] test: fix test expectation for vttablet flags Signed-off-by: Manan Gupta --- go/flags/endtoend/vttablet.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/flags/endtoend/vttablet.txt b/go/flags/endtoend/vttablet.txt index db8b824891f..c341e85ea1d 100644 --- a/go/flags/endtoend/vttablet.txt +++ b/go/flags/endtoend/vttablet.txt @@ -396,7 +396,7 @@ Usage of vttablet: --enable_replication_reporter Use polling to track replication lag. --enable_semi_sync - Enable semi-sync when configuring replication, on primary and replica tablets only (rdonly tablets will not ack). + (DEPRECATED - Set the correct durability policy in the keyspace information instead) Enable semi-sync when configuring replication, on primary and replica tablets only (rdonly tablets will not ack). --enable_transaction_limit If true, limit on number of transactions open at the same time will be enforced for all users. User trying to open a new transaction after exhausting their limit will receive an error immediately, regardless of whether there are available slots or not. --enable_transaction_limit_dry_run From 670615324c295d7136dd499356c83773461bfe79 Mon Sep 17 00:00:00 2001 From: Manan Gupta Date: Mon, 18 Jul 2022 16:45:19 +0530 Subject: [PATCH 04/11] feat: fix cnf files to not mention the deprecated flag Signed-off-by: Manan Gupta --- config/mycnf/mariadb100.cnf | 5 +- config/mycnf/mariadb101.cnf | 5 +- config/mycnf/mariadb102.cnf | 5 +- config/mycnf/mysql57.cnf | 5 +- config/mycnf/mysql80.cnf | 5 +- .../compose/external_db/mysql/mysql56.cnf | 5 +- .../compose/external_db/mysql/mysql57.cnf | 5 +- go/vt/mysqlctl/rice-box.go | 54 +++++++++---------- .../e2e/external_db/mysql/mysql56.cnf | 5 +- .../e2e/external_db/mysql/mysql57.cnf | 5 +- 10 files changed, 45 insertions(+), 54 deletions(-) diff --git a/config/mycnf/mariadb100.cnf b/config/mycnf/mariadb100.cnf index 4e202ea3183..3f840530566 100644 --- a/config/mycnf/mariadb100.cnf +++ b/config/mycnf/mariadb100.cnf @@ -4,9 +4,8 @@ # (when the primary goes away). Here we just load the plugin so it's # available if desired, but it's disabled at startup. # -# If the -enable_semi_sync flag is used, VTTablet will enable semi-sync -# at the proper time when replication is set up, or when a primary is -# promoted or demoted. +# VTTablet will enable semi-sync at the proper time when replication is set up, +# or when a primary is promoted or demoted based on the durability policy configured. plugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so slave_net_timeout = 60 diff --git a/config/mycnf/mariadb101.cnf b/config/mycnf/mariadb101.cnf index 40a358d85f2..1c660bf6f61 100644 --- a/config/mycnf/mariadb101.cnf +++ b/config/mycnf/mariadb101.cnf @@ -4,9 +4,8 @@ # (when the primary goes away). Here we just load the plugin so it's # available if desired, but it's disabled at startup. # -# If the -enable_semi_sync flag is used, VTTablet will enable semi-sync -# at the proper time when replication is set up, or when a primary is -# promoted or demoted. +# VTTablet will enable semi-sync at the proper time when replication is set up, +# or when a primary is promoted or demoted based on the durability policy configured. plugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so slave_net_timeout = 60 diff --git a/config/mycnf/mariadb102.cnf b/config/mycnf/mariadb102.cnf index efd165f18fb..ae1da3d9a71 100644 --- a/config/mycnf/mariadb102.cnf +++ b/config/mycnf/mariadb102.cnf @@ -4,9 +4,8 @@ # (when the primary goes away). Here we just load the plugin so it's # available if desired, but it's disabled at startup. # -# If the -enable_semi_sync flag is used, VTTablet will enable semi-sync -# at the proper time when replication is set up, or when a primary is -# promoted or demoted. +# VTTablet will enable semi-sync at the proper time when replication is set up, +# or when a primary is promoted or demoted based on the durability policy configured. plugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so # enable strict mode so it's safe to compare sequence numbers across different server IDs. diff --git a/config/mycnf/mysql57.cnf b/config/mycnf/mysql57.cnf index 5808b27b12b..7a8c45a187c 100644 --- a/config/mycnf/mysql57.cnf +++ b/config/mycnf/mysql57.cnf @@ -21,9 +21,8 @@ collation_server = utf8_general_ci # (when the primary goes away). Here we just load the plugin so it's # available if desired, but it's disabled at startup. # -# If the -enable_semi_sync flag is used, VTTablet will enable semi-sync -# at the proper time when replication is set up, or when a primary is -# promoted or demoted. +# VTTablet will enable semi-sync at the proper time when replication is set up, +# or when a primary is promoted or demoted based on the durability policy configured. plugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so # When semi-sync is enabled, don't allow fallback to async diff --git a/config/mycnf/mysql80.cnf b/config/mycnf/mysql80.cnf index 11341928e52..39fab576533 100644 --- a/config/mycnf/mysql80.cnf +++ b/config/mycnf/mysql80.cnf @@ -18,9 +18,8 @@ default_authentication_plugin = mysql_native_password # (when the primary goes away). Here we just load the plugin so it's # available if desired, but it's disabled at startup. # -# If the -enable_semi_sync flag is used, VTTablet will enable semi-sync -# at the proper time when replication is set up, or when a primary is -# promoted or demoted. +# VTTablet will enable semi-sync at the proper time when replication is set up, +# or when a primary is promoted or demoted based on the durability policy configured. plugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so # MySQL 8.0 will not load plugins during --initialize diff --git a/examples/compose/external_db/mysql/mysql56.cnf b/examples/compose/external_db/mysql/mysql56.cnf index 7454231c33d..fdd34b1bd2e 100644 --- a/examples/compose/external_db/mysql/mysql56.cnf +++ b/examples/compose/external_db/mysql/mysql56.cnf @@ -19,9 +19,8 @@ innodb_use_native_aio = 0 # (when the master goes away). Here we just load the plugin so it's # available if desired, but it's disabled at startup. # -# If the -enable_semi_sync flag is used, VTTablet will enable semi-sync -# at the proper time when replication is set up, or when masters are -# promoted or demoted. +# VTTablet will enable semi-sync at the proper time when replication is set up, +# or when a primary is promoted or demoted based on the durability policy configured. plugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so # When semi-sync is enabled, don't allow fallback to async diff --git a/examples/compose/external_db/mysql/mysql57.cnf b/examples/compose/external_db/mysql/mysql57.cnf index 08935674b37..ebf301187eb 100644 --- a/examples/compose/external_db/mysql/mysql57.cnf +++ b/examples/compose/external_db/mysql/mysql57.cnf @@ -21,9 +21,8 @@ collation_server = utf8_general_ci # (when the master goes away). Here we just load the plugin so it's # available if desired, but it's disabled at startup. # -# If the -enable_semi_sync flag is used, VTTablet will enable semi-sync -# at the proper time when replication is set up, or when masters are -# promoted or demoted. +# VTTablet will enable semi-sync at the proper time when replication is set up, +# or when a primary is promoted or demoted based on the durability policy configured. plugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so # When semi-sync is enabled, don't allow fallback to async diff --git a/go/vt/mysqlctl/rice-box.go b/go/vt/mysqlctl/rice-box.go index 4ec94bf2bb3..573c9aa1118 100644 --- a/go/vt/mysqlctl/rice-box.go +++ b/go/vt/mysqlctl/rice-box.go @@ -11,97 +11,97 @@ func init() { // define files file2 := &embedded.EmbeddedFile{ Filename: "gomysql.pc.tmpl", - FileModTime: time.Unix(1625867173, 0), + FileModTime: time.Unix(1650035622, 0), Content: string("Name: GoMysql\nDescription: Flags for using mysql C client in go\n"), } file3 := &embedded.EmbeddedFile{ Filename: "init_db.sql", - FileModTime: time.Unix(1656561956, 0), + FileModTime: time.Unix(1658125106, 0), Content: string("# This file is executed immediately after mysql_install_db,\n# to initialize a fresh data directory.\n\n###############################################################################\n# WARNING: This sql is *NOT* safe for production use,\n# as it contains default well-known users and passwords.\n# Care should be taken to change these users and passwords\n# for production.\n###############################################################################\n\n###############################################################################\n# Equivalent of mysql_secure_installation\n###############################################################################\n\n# Changes during the init db should not make it to the binlog.\n# They could potentially create errant transactions on replicas.\nSET sql_log_bin = 0;\n# Remove anonymous users.\nDELETE FROM mysql.user WHERE User = '';\n\n# Disable remote root access (only allow UNIX socket).\nDELETE FROM mysql.user WHERE User = 'root' AND Host != 'localhost';\n\n# Remove test database.\nDROP DATABASE IF EXISTS test;\n\n###############################################################################\n# Vitess defaults\n###############################################################################\n\n# Vitess-internal database.\nCREATE DATABASE IF NOT EXISTS _vt;\n# Note that definitions of local_metadata and shard_metadata should be the same\n# as in production which is defined in go/vt/mysqlctl/metadata_tables.go.\nCREATE TABLE IF NOT EXISTS _vt.local_metadata (\n name VARCHAR(255) NOT NULL,\n value VARCHAR(255) NOT NULL,\n db_name VARBINARY(255) NOT NULL,\n PRIMARY KEY (db_name, name)\n ) ENGINE=InnoDB;\nCREATE TABLE IF NOT EXISTS _vt.shard_metadata (\n name VARCHAR(255) NOT NULL,\n value MEDIUMBLOB NOT NULL,\n db_name VARBINARY(255) NOT NULL,\n PRIMARY KEY (db_name, name)\n ) ENGINE=InnoDB;\n\n# Admin user with all privileges.\nCREATE USER 'vt_dba'@'localhost';\nGRANT ALL ON *.* TO 'vt_dba'@'localhost';\nGRANT GRANT OPTION ON *.* TO 'vt_dba'@'localhost';\n\n# User for app traffic, with global read-write access.\nCREATE USER 'vt_app'@'localhost';\nGRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, FILE,\n REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES,\n LOCK TABLES, EXECUTE, REPLICATION CLIENT, CREATE VIEW,\n SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER\n ON *.* TO 'vt_app'@'localhost';\n\n# User for app debug traffic, with global read access.\nCREATE USER 'vt_appdebug'@'localhost';\nGRANT SELECT, SHOW DATABASES, PROCESS ON *.* TO 'vt_appdebug'@'localhost';\n\n# User for administrative operations that need to be executed as non-SUPER.\n# Same permissions as vt_app here.\nCREATE USER 'vt_allprivs'@'localhost';\nGRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, FILE,\n REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES,\n LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW,\n SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER\n ON *.* TO 'vt_allprivs'@'localhost';\n\n# User for slave replication connections.\nCREATE USER 'vt_repl'@'%';\nGRANT REPLICATION SLAVE ON *.* TO 'vt_repl'@'%';\n\n# User for Vitess VReplication (base vstreamers and vplayer).\nCREATE USER 'vt_filtered'@'localhost';\nGRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, FILE,\n REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES,\n LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW,\n SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER\n ON *.* TO 'vt_filtered'@'localhost';\n\n# User for general MySQL monitoring.\nCREATE USER 'vt_monitoring'@'localhost';\nGRANT SELECT, PROCESS, SUPER, REPLICATION CLIENT, RELOAD\n ON *.* TO 'vt_monitoring'@'localhost';\nGRANT SELECT, UPDATE, DELETE, DROP\n ON performance_schema.* TO 'vt_monitoring'@'localhost';\n\n# User for Orchestrator (https://github.com/openark/orchestrator).\nCREATE USER 'orc_client_user'@'%' IDENTIFIED BY 'orc_client_user_password';\nGRANT SUPER, PROCESS, REPLICATION SLAVE, RELOAD\n ON *.* TO 'orc_client_user'@'%';\nGRANT SELECT\n ON _vt.* TO 'orc_client_user'@'%';\n\nFLUSH PRIVILEGES;\n\nRESET SLAVE ALL;\nRESET MASTER;\n"), } file5 := &embedded.EmbeddedFile{ Filename: "mycnf/default.cnf", - FileModTime: time.Unix(1656560071, 0), + FileModTime: time.Unix(1650035622, 0), Content: string("# Global configuration that is auto-included for all MySQL/MariaDB versions\n\ndatadir = {{.DataDir}}\ninnodb_data_home_dir = {{.InnodbDataHomeDir}}\ninnodb_log_group_home_dir = {{.InnodbLogGroupHomeDir}}\nlog-error = {{.ErrorLogPath}}\nlog-bin = {{.BinLogPath}}\nrelay-log = {{.RelayLogPath}}\nrelay-log-index = {{.RelayLogIndexPath}}\npid-file = {{.PidFile}}\nport = {{.MysqlPort}}\n\n{{if .SecureFilePriv}}\nsecure-file-priv = {{.SecureFilePriv}}\n{{end}}\n\n# all db instances should start in read-only mode - once the db is started and\n# fully functional, we'll push it into read-write mode\nread-only\nserver-id = {{.ServerID}}\n\n# all db instances should skip starting replication threads - that way we can do any\n# additional configuration (like enabling semi-sync) before we connect to\n# the source.\nskip_slave_start\nsocket = {{.SocketFile}}\ntmpdir = {{.TmpDir}}\n\nslow-query-log-file = {{.SlowLogPath}}\n\n# These are sensible defaults that apply to all MySQL/MariaDB versions\n\nlong_query_time = 2\nslow-query-log\nskip-name-resolve\nconnect_timeout = 30\ninnodb_lock_wait_timeout = 20\nmax_allowed_packet = 64M\nmax_connections = 500\n\n\n"), } file6 := &embedded.EmbeddedFile{ Filename: "mycnf/mariadb100.cnf", - FileModTime: time.Unix(1636429180, 0), + FileModTime: time.Unix(1658142704, 0), - Content: string("# This file is auto-included when MariaDB 10.0 is detected.\n\n# Semi-sync replication is required for automated unplanned failover\n# (when the primary goes away). Here we just load the plugin so it's\n# available if desired, but it's disabled at startup.\n#\n# If the -enable_semi_sync flag is used, VTTablet will enable semi-sync\n# at the proper time when replication is set up, or when a primary is\n# promoted or demoted.\nplugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so\n\nslave_net_timeout = 60\n\n# MariaDB 10.0 is unstrict by default\nsql_mode = STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION\n\n# enable strict mode so it's safe to compare sequence numbers across different server IDs.\ngtid_strict_mode = 1\ninnodb_stats_persistent = 0\n\n# When semi-sync is enabled, don't allow fallback to async\n# if you get no ack, or have no replicas. This is necessary to\n# prevent alternate futures when doing a failover in response to\n# a primary that becomes unresponsive.\nrpl_semi_sync_master_timeout = 1000000000000000000\nrpl_semi_sync_master_wait_no_slave = 1\n\n\ncharacter_set_server = utf8\ncollation_server = utf8_general_ci\n\nexpire_logs_days = 3\n\nsync_binlog = 1\nbinlog_format = ROW\nlog_slave_updates\nexpire_logs_days = 3\n\n# In MariaDB the default charset is latin1\n\ncharacter_set_server = utf8\ncollation_server = utf8_general_ci\n\n"), + Content: string("# This file is auto-included when MariaDB 10.0 is detected.\n\n# Semi-sync replication is required for automated unplanned failover\n# (when the primary goes away). Here we just load the plugin so it's\n# available if desired, but it's disabled at startup.\n#\n# VTTablet will enable semi-sync at the proper time when replication is set up,\n# or when a primary is promoted or demoted based on the durability policy configured.\nplugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so\n\nslave_net_timeout = 60\n\n# MariaDB 10.0 is unstrict by default\nsql_mode = STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION\n\n# enable strict mode so it's safe to compare sequence numbers across different server IDs.\ngtid_strict_mode = 1\ninnodb_stats_persistent = 0\n\n# When semi-sync is enabled, don't allow fallback to async\n# if you get no ack, or have no replicas. This is necessary to\n# prevent alternate futures when doing a failover in response to\n# a primary that becomes unresponsive.\nrpl_semi_sync_master_timeout = 1000000000000000000\nrpl_semi_sync_master_wait_no_slave = 1\n\n\ncharacter_set_server = utf8\ncollation_server = utf8_general_ci\n\nexpire_logs_days = 3\n\nsync_binlog = 1\nbinlog_format = ROW\nlog_slave_updates\nexpire_logs_days = 3\n\n# In MariaDB the default charset is latin1\n\ncharacter_set_server = utf8\ncollation_server = utf8_general_ci\n\n"), } file7 := &embedded.EmbeddedFile{ Filename: "mycnf/mariadb101.cnf", - FileModTime: time.Unix(1636429180, 0), + FileModTime: time.Unix(1658142704, 0), - Content: string("# This file is auto-included when MariaDB 10.1 is detected.\n\n# Semi-sync replication is required for automated unplanned failover\n# (when the primary goes away). Here we just load the plugin so it's\n# available if desired, but it's disabled at startup.\n#\n# If the -enable_semi_sync flag is used, VTTablet will enable semi-sync\n# at the proper time when replication is set up, or when a primary is\n# promoted or demoted.\nplugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so\n\nslave_net_timeout = 60\n\n# MariaDB 10.1 default is only no-engine-substitution and no-auto-create-user\nsql_mode = STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER\n\n# enable strict mode so it's safe to compare sequence numbers across different server IDs.\ngtid_strict_mode = 1\ninnodb_stats_persistent = 0\n\n# When semi-sync is enabled, don't allow fallback to async\n# if you get no ack, or have no replicas. This is necessary to\n# prevent alternate futures when doing a failover in response to\n# a primary that becomes unresponsive.\nrpl_semi_sync_master_timeout = 1000000000000000000\nrpl_semi_sync_master_wait_no_slave = 1\n\n\ncharacter_set_server = utf8\ncollation_server = utf8_general_ci\n\nexpire_logs_days = 3\n\nsync_binlog = 1\nbinlog_format = ROW\nlog_slave_updates\nexpire_logs_days = 3\n\n# In MariaDB the default charset is latin1\n\ncharacter_set_server = utf8\ncollation_server = utf8_general_ci\n"), + Content: string("# This file is auto-included when MariaDB 10.1 is detected.\n\n# Semi-sync replication is required for automated unplanned failover\n# (when the primary goes away). Here we just load the plugin so it's\n# available if desired, but it's disabled at startup.\n#\n# VTTablet will enable semi-sync at the proper time when replication is set up,\n# or when a primary is promoted or demoted based on the durability policy configured.\nplugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so\n\nslave_net_timeout = 60\n\n# MariaDB 10.1 default is only no-engine-substitution and no-auto-create-user\nsql_mode = STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER\n\n# enable strict mode so it's safe to compare sequence numbers across different server IDs.\ngtid_strict_mode = 1\ninnodb_stats_persistent = 0\n\n# When semi-sync is enabled, don't allow fallback to async\n# if you get no ack, or have no replicas. This is necessary to\n# prevent alternate futures when doing a failover in response to\n# a primary that becomes unresponsive.\nrpl_semi_sync_master_timeout = 1000000000000000000\nrpl_semi_sync_master_wait_no_slave = 1\n\n\ncharacter_set_server = utf8\ncollation_server = utf8_general_ci\n\nexpire_logs_days = 3\n\nsync_binlog = 1\nbinlog_format = ROW\nlog_slave_updates\nexpire_logs_days = 3\n\n# In MariaDB the default charset is latin1\n\ncharacter_set_server = utf8\ncollation_server = utf8_general_ci\n"), } file8 := &embedded.EmbeddedFile{ Filename: "mycnf/mariadb102.cnf", - FileModTime: time.Unix(1636429180, 0), + FileModTime: time.Unix(1658142704, 0), - Content: string("# This file is auto-included when MariaDB 10.2 is detected.\n\n# Semi-sync replication is required for automated unplanned failover\n# (when the primary goes away). Here we just load the plugin so it's\n# available if desired, but it's disabled at startup.\n#\n# If the -enable_semi_sync flag is used, VTTablet will enable semi-sync\n# at the proper time when replication is set up, or when a primary is\n# promoted or demoted.\nplugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so\n\n# enable strict mode so it's safe to compare sequence numbers across different server IDs.\ngtid_strict_mode = 1\ninnodb_stats_persistent = 0\n\n# When semi-sync is enabled, don't allow fallback to async\n# if you get no ack, or have no replicas. This is necessary to\n# prevent alternate futures when doing a failover in response to\n# a primary that becomes unresponsive.\nrpl_semi_sync_master_timeout = 1000000000000000000\nrpl_semi_sync_master_wait_no_slave = 1\n\n\ncharacter_set_server = utf8\ncollation_server = utf8_general_ci\n\nexpire_logs_days = 3\n\nsync_binlog = 1\nbinlog_format = ROW\nlog_slave_updates\nexpire_logs_days = 3\n\n# In MariaDB the default charset is latin1\n\ncharacter_set_server = utf8\ncollation_server = utf8_general_ci\n"), + Content: string("# This file is auto-included when MariaDB 10.2 is detected.\n\n# Semi-sync replication is required for automated unplanned failover\n# (when the primary goes away). Here we just load the plugin so it's\n# available if desired, but it's disabled at startup.\n#\n# VTTablet will enable semi-sync at the proper time when replication is set up,\n# or when a primary is promoted or demoted based on the durability policy configured.\nplugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so\n\n# enable strict mode so it's safe to compare sequence numbers across different server IDs.\ngtid_strict_mode = 1\ninnodb_stats_persistent = 0\n\n# When semi-sync is enabled, don't allow fallback to async\n# if you get no ack, or have no replicas. This is necessary to\n# prevent alternate futures when doing a failover in response to\n# a primary that becomes unresponsive.\nrpl_semi_sync_master_timeout = 1000000000000000000\nrpl_semi_sync_master_wait_no_slave = 1\n\n\ncharacter_set_server = utf8\ncollation_server = utf8_general_ci\n\nexpire_logs_days = 3\n\nsync_binlog = 1\nbinlog_format = ROW\nlog_slave_updates\nexpire_logs_days = 3\n\n# In MariaDB the default charset is latin1\n\ncharacter_set_server = utf8\ncollation_server = utf8_general_ci\n"), } file9 := &embedded.EmbeddedFile{ Filename: "mycnf/mariadb103.cnf", - FileModTime: time.Unix(1636429180, 0), + FileModTime: time.Unix(1650035622, 0), Content: string("# This file is auto-included when MariaDB 10.3 is detected.\n\n# enable strict mode so it's safe to compare sequence numbers across different server IDs.\ngtid_strict_mode = 1\ninnodb_stats_persistent = 0\n\n# When semi-sync is enabled, don't allow fallback to async\n# if you get no ack, or have no replicas. This is necessary to\n# prevent alternate futures when doing a failover in response to\n# a primary that becomes unresponsive.\nrpl_semi_sync_master_timeout = 1000000000000000000\nrpl_semi_sync_master_wait_no_slave = 1\n\n\ncharacter_set_server = utf8\ncollation_server = utf8_general_ci\n\nexpire_logs_days = 3\n\nsync_binlog = 1\nbinlog_format = ROW\nlog_slave_updates\nexpire_logs_days = 3\n\n# In MariaDB the default charset is latin1\n\ncharacter_set_server = utf8\ncollation_server = utf8_general_ci\n\n\n"), } filea := &embedded.EmbeddedFile{ Filename: "mycnf/mariadb104.cnf", - FileModTime: time.Unix(1636429180, 0), + FileModTime: time.Unix(1650035622, 0), Content: string("# This file is auto-included when MariaDB 10.4 is detected.\n\n# enable strict mode so it's safe to compare sequence numbers across different server IDs.\ngtid_strict_mode = 1\ninnodb_stats_persistent = 0\n\n# When semi-sync is enabled, don't allow fallback to async\n# if you get no ack, or have no replicas. This is necessary to\n# prevent alternate futures when doing a failover in response to\n# a primary that becomes unresponsive.\nrpl_semi_sync_master_timeout = 1000000000000000000\nrpl_semi_sync_master_wait_no_slave = 1\n\n\ncharacter_set_server = utf8\ncollation_server = utf8_general_ci\n\nexpire_logs_days = 3\n\nsync_binlog = 1\nbinlog_format = ROW\nlog_slave_updates\nexpire_logs_days = 3\n\n# In MariaDB the default charset is latin1\n\ncharacter_set_server = utf8\ncollation_server = utf8_general_ci\n\n\n"), } fileb := &embedded.EmbeddedFile{ Filename: "mycnf/mysql57.cnf", - FileModTime: time.Unix(1656826694, 0), + FileModTime: time.Unix(1658142704, 0), - Content: string("# This file is auto-included when MySQL 5.7 is detected.\n\n# MySQL 5.7 does not enable the binary log by default, and \n# info repositories default to file\n\ngtid_mode = ON\nlog_slave_updates\nenforce_gtid_consistency\nexpire_logs_days = 3\nmaster_info_repository = TABLE\nrelay_log_info_repository = TABLE\nrelay_log_purge = 1\nrelay_log_recovery = 1\n\n# In MySQL 5.7 the default charset is latin1\n\ncharacter_set_server = utf8\ncollation_server = utf8_general_ci\n\n# Semi-sync replication is required for automated unplanned failover\n# (when the primary goes away). Here we just load the plugin so it's\n# available if desired, but it's disabled at startup.\n#\n# If the -enable_semi_sync flag is used, VTTablet will enable semi-sync\n# at the proper time when replication is set up, or when a primary is\n# promoted or demoted.\nplugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so\n\n# When semi-sync is enabled, don't allow fallback to async\n# if you get no ack, or have no replicas. This is necessary to\n# prevent alternate futures when doing a failover in response to\n# a primary that becomes unresponsive.\nrpl_semi_sync_master_timeout = 1000000000000000000\nrpl_semi_sync_master_wait_no_slave = 1\n\n"), + Content: string("# This file is auto-included when MySQL 5.7 is detected.\n\n# MySQL 5.7 does not enable the binary log by default, and \n# info repositories default to file\n\ngtid_mode = ON\nlog_slave_updates\nenforce_gtid_consistency\nexpire_logs_days = 3\nmaster_info_repository = TABLE\nrelay_log_info_repository = TABLE\nrelay_log_purge = 1\nrelay_log_recovery = 1\n\n# In MySQL 5.7 the default charset is latin1\n\ncharacter_set_server = utf8\ncollation_server = utf8_general_ci\n\n# Semi-sync replication is required for automated unplanned failover\n# (when the primary goes away). Here we just load the plugin so it's\n# available if desired, but it's disabled at startup.\n#\n# VTTablet will enable semi-sync at the proper time when replication is set up,\n# or when a primary is promoted or demoted based on the durability policy configured.\nplugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so\n\n# When semi-sync is enabled, don't allow fallback to async\n# if you get no ack, or have no replicas. This is necessary to\n# prevent alternate futures when doing a failover in response to\n# a primary that becomes unresponsive.\nrpl_semi_sync_master_timeout = 1000000000000000000\nrpl_semi_sync_master_wait_no_slave = 1\n\n"), } filec := &embedded.EmbeddedFile{ Filename: "mycnf/mysql80.cnf", - FileModTime: time.Unix(1656826694, 0), + FileModTime: time.Unix(1658142704, 0), - Content: string("# This file is auto-included when MySQL 8.0 is detected.\n\n# MySQL 8.0 enables binlog by default with sync_binlog and TABLE info repositories\n# It does not enable GTIDs or enforced GTID consistency\n\ngtid_mode = ON\nenforce_gtid_consistency\nrelay_log_recovery = 1\nbinlog_expire_logs_seconds = 259200\n\n# disable mysqlx\nmysqlx = 0\n\n# 8.0 changes the default auth-plugin to caching_sha2_password\ndefault_authentication_plugin = mysql_native_password\n\n# Semi-sync replication is required for automated unplanned failover\n# (when the primary goes away). Here we just load the plugin so it's\n# available if desired, but it's disabled at startup.\n#\n# If the -enable_semi_sync flag is used, VTTablet will enable semi-sync\n# at the proper time when replication is set up, or when a primary is\n# promoted or demoted.\nplugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so\n\n# MySQL 8.0 will not load plugins during --initialize\n# which makes these options unknown. Prefixing with --loose\n# tells the server it's fine if they are not understood.\nloose_rpl_semi_sync_master_timeout = 1000000000000000000\nloose_rpl_semi_sync_master_wait_no_slave = 1\n\n"), + Content: string("# This file is auto-included when MySQL 8.0 is detected.\n\n# MySQL 8.0 enables binlog by default with sync_binlog and TABLE info repositories\n# It does not enable GTIDs or enforced GTID consistency\n\ngtid_mode = ON\nenforce_gtid_consistency\nrelay_log_recovery = 1\nbinlog_expire_logs_seconds = 259200\n\n# disable mysqlx\nmysqlx = 0\n\n# 8.0 changes the default auth-plugin to caching_sha2_password\ndefault_authentication_plugin = mysql_native_password\n\n# Semi-sync replication is required for automated unplanned failover\n# (when the primary goes away). Here we just load the plugin so it's\n# available if desired, but it's disabled at startup.\n#\n# VTTablet will enable semi-sync at the proper time when replication is set up,\n# or when a primary is promoted or demoted based on the durability policy configured.\nplugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so\n\n# MySQL 8.0 will not load plugins during --initialize\n# which makes these options unknown. Prefixing with --loose\n# tells the server it's fine if they are not understood.\nloose_rpl_semi_sync_master_timeout = 1000000000000000000\nloose_rpl_semi_sync_master_wait_no_slave = 1\n\n"), } filed := &embedded.EmbeddedFile{ Filename: "mycnf/sbr.cnf", - FileModTime: time.Unix(1625867173, 0), + FileModTime: time.Unix(1650035622, 0), Content: string("# This file is used to allow legacy tests to pass\n# In theory it should not be required\nbinlog_format=statement\n"), } filee := &embedded.EmbeddedFile{ Filename: "mycnf/test-suite.cnf", - FileModTime: time.Unix(1636429180, 0), + FileModTime: time.Unix(1650035622, 0), Content: string("# This sets some unsafe settings specifically for \n# the test-suite which is currently MySQL 5.7 based\n# In future it should be renamed testsuite.cnf\n\ninnodb_buffer_pool_size = 32M\ninnodb_flush_log_at_trx_commit = 0\ninnodb_log_buffer_size = 1M\ninnodb_log_file_size = 5M\n\n# Native AIO tends to run into aio-max-nr limit during test startup.\ninnodb_use_native_aio = 0\n\nkey_buffer_size = 2M\nsync_binlog=0\ninnodb_doublewrite=0\n\n# These two settings are required for the testsuite to pass, \n# but enabling them does not spark joy. They should be removed\n# in the future. See:\n# https://github.com/vitessio/vitess/issues/5396\n\nsql_mode = STRICT_TRANS_TABLES\n\n# set a short heartbeat interval in order to detect failures quickly\nslave_net_timeout = 4\n"), } fileg := &embedded.EmbeddedFile{ Filename: "orchestrator/default.json", - FileModTime: time.Unix(1625867173, 0), + FileModTime: time.Unix(1650035622, 0), Content: string("{\n \"Debug\": true,\n \"MySQLTopologyUser\": \"orc_client_user\",\n \"MySQLTopologyPassword\": \"orc_client_user_password\",\n \"MySQLReplicaUser\": \"vt_repl\",\n \"MySQLReplicaPassword\": \"\",\n \"RecoveryPeriodBlockSeconds\": 5\n}\n"), } filei := &embedded.EmbeddedFile{ Filename: "tablet/default.yaml", - FileModTime: time.Unix(1636429180, 0), + FileModTime: time.Unix(1650035622, 0), Content: string("tabletID: zone-1234\n\ninit:\n dbName: # init_db_name_override\n keyspace: # init_keyspace\n shard: # init_shard\n tabletType: # init_tablet_type\n timeoutSeconds: 60 # init_timeout\n\ndb:\n socket: # db_socket\n host: # db_host\n port: 0 # db_port\n charSet: # db_charset\n flags: 0 # db_flags\n flavor: # db_flavor\n sslCa: # db_ssl_ca\n sslCaPath: # db_ssl_ca_path\n sslCert: # db_ssl_cert\n sslKey: # db_ssl_key\n serverName: # db_server_name\n connectTimeoutMilliseconds: 0 # db_connect_timeout_ms\n app:\n user: vt_app # db_app_user\n password: # db_app_password\n useSsl: true # db_app_use_ssl\n preferTcp: false\n dba:\n user: vt_dba # db_dba_user\n password: # db_dba_password\n useSsl: true # db_dba_use_ssl\n preferTcp: false\n filtered:\n user: vt_filtered # db_filtered_user\n password: # db_filtered_password\n useSsl: true # db_filtered_use_ssl\n preferTcp: false\n repl:\n user: vt_repl # db_repl_user\n password: # db_repl_password\n useSsl: true # db_repl_use_ssl\n preferTcp: false\n appdebug:\n user: vt_appdebug # db_appdebug_user\n password: # db_appdebug_password\n useSsl: true # db_appdebug_use_ssl\n preferTcp: false\n allprivs:\n user: vt_allprivs # db_allprivs_user\n password: # db_allprivs_password\n useSsl: true # db_allprivs_use_ssl\n preferTcp: false\n\noltpReadPool:\n size: 16 # queryserver-config-pool-size\n timeoutSeconds: 0 # queryserver-config-query-pool-timeout\n idleTimeoutSeconds: 1800 # queryserver-config-idle-timeout\n prefillParallelism: 0 # queryserver-config-pool-prefill-parallelism\n maxWaiters: 50000 # queryserver-config-query-pool-waiter-cap\n\nolapReadPool:\n size: 200 # queryserver-config-stream-pool-size\n timeoutSeconds: 0 # queryserver-config-query-pool-timeout\n idleTimeoutSeconds: 1800 # queryserver-config-idle-timeout\n prefillParallelism: 0 # queryserver-config-stream-pool-prefill-parallelism\n maxWaiters: 0\n\ntxPool:\n size: 20 # queryserver-config-transaction-cap\n timeoutSeconds: 1 # queryserver-config-txpool-timeout\n idleTimeoutSeconds: 1800 # queryserver-config-idle-timeout\n prefillParallelism: 0 # queryserver-config-transaction-prefill-parallelism\n maxWaiters: 50000 # queryserver-config-txpool-waiter-cap\n\noltp:\n queryTimeoutSeconds: 30 # queryserver-config-query-timeout\n txTimeoutSeconds: 30 # queryserver-config-transaction-timeout\n maxRows: 10000 # queryserver-config-max-result-size\n warnRows: 0 # queryserver-config-warn-result-size\n\nhealthcheck:\n intervalSeconds: 20 # health_check_interval\n degradedThresholdSeconds: 30 # degraded_threshold\n unhealthyThresholdSeconds: 7200 # unhealthy_threshold\n\ngracePeriods:\n shutdownSeconds: 0 # shutdown_grace_period\n transitionSeconds: 0 # serving_state_grace_period\n\nreplicationTracker:\n mode: disable # enable_replication_reporter\n heartbeatIntervalMilliseconds: 0 # heartbeat_enable, heartbeat_interval\n\nhotRowProtection:\n mode: disable|dryRun|enable # enable_hot_row_protection, enable_hot_row_protection_dry_run\n # Recommended value: same as txPool.size.\n maxQueueSize: 20 # hot_row_protection_max_queue_size\n maxGlobalQueueSize: 1000 # hot_row_protection_max_global_queue_size\n maxConcurrency: 5 # hot_row_protection_concurrent_transactions\n\nconsolidator: enable|disable|notOnPrimary # enable-consolidator, enable-consolidator-replicas\npassthroughDML: false # queryserver-config-passthrough-dmls\nstreamBufferSize: 32768 # queryserver-config-stream-buffer-size\nqueryCacheSize: 5000 # queryserver-config-query-cache-size\nschemaReloadIntervalSeconds: 1800 # queryserver-config-schema-reload-time\nwatchReplication: false # watch_replication_stream\nterseErrors: false # queryserver-config-terse-errors\nmessagePostponeParallelism: 4 # queryserver-config-message-postpone-cap\ncacheResultFields: true # enable-query-plan-field-caching\n\n\n# The following flags are currently not supported.\n# enforce_strict_trans_tables\n# queryserver-config-strict-table-acl\n# queryserver-config-enable-table-acl-dry-run\n# queryserver-config-acl-exempt-acl\n# enable-tx-throttler\n# tx-throttler-config\n# tx-throttler-healthcheck-cells\n# enable_transaction_limit\n# enable_transaction_limit_dry_run\n# transaction_limit_per_user\n# transaction_limit_by_username\n# transaction_limit_by_principal\n# transaction_limit_by_component\n# transaction_limit_by_subcomponent\n"), } filej := &embedded.EmbeddedFile{ Filename: "zk-client-dev.json", - FileModTime: time.Unix(1625867173, 0), + FileModTime: time.Unix(1650035622, 0), Content: string("{\n \"local\": \"localhost:3863\",\n \"global\": \"localhost:3963\"\n}\n"), } filel := &embedded.EmbeddedFile{ Filename: "zkcfg/zoo.cfg", - FileModTime: time.Unix(1653065346, 0), + FileModTime: time.Unix(1658125106, 0), Content: string("tickTime=2000\ndataDir={{.DataDir}}\nclientPort={{.ClientPort}}\ninitLimit=5\nsyncLimit=2\nmaxClientCnxns=0\n# enable commands like ruok by default\n4lw.commands.whitelist=*\n{{range .Servers}}\nserver.{{.ServerId}}={{.Hostname}}:{{.LeaderPort}}:{{.ElectionPort}}\n{{end}}\n"), } @@ -109,7 +109,7 @@ func init() { // define dirs dir1 := &embedded.EmbeddedDir{ Filename: "", - DirModTime: time.Unix(1656561956, 0), + DirModTime: time.Unix(1658125106, 0), ChildFiles: []*embedded.EmbeddedFile{ file2, // "gomysql.pc.tmpl" file3, // "init_db.sql" @@ -119,7 +119,7 @@ func init() { } dir4 := &embedded.EmbeddedDir{ Filename: "mycnf", - DirModTime: time.Unix(1656826694, 0), + DirModTime: time.Unix(1658142704, 0), ChildFiles: []*embedded.EmbeddedFile{ file5, // "mycnf/default.cnf" file6, // "mycnf/mariadb100.cnf" @@ -136,7 +136,7 @@ func init() { } dirf := &embedded.EmbeddedDir{ Filename: "orchestrator", - DirModTime: time.Unix(1625867173, 0), + DirModTime: time.Unix(1650035622, 0), ChildFiles: []*embedded.EmbeddedFile{ fileg, // "orchestrator/default.json" @@ -144,7 +144,7 @@ func init() { } dirh := &embedded.EmbeddedDir{ Filename: "tablet", - DirModTime: time.Unix(1636429180, 0), + DirModTime: time.Unix(1650035622, 0), ChildFiles: []*embedded.EmbeddedFile{ filei, // "tablet/default.yaml" @@ -152,7 +152,7 @@ func init() { } dirk := &embedded.EmbeddedDir{ Filename: "zkcfg", - DirModTime: time.Unix(1653065346, 0), + DirModTime: time.Unix(1658125106, 0), ChildFiles: []*embedded.EmbeddedFile{ filel, // "zkcfg/zoo.cfg" @@ -175,7 +175,7 @@ func init() { // register embeddedBox embedded.RegisterEmbeddedBox(`../../../config`, &embedded.EmbeddedBox{ Name: `../../../config`, - Time: time.Unix(1656561956, 0), + Time: time.Unix(1658125106, 0), Dirs: map[string]*embedded.EmbeddedDir{ "": dir1, "mycnf": dir4, diff --git a/vitess-mixin/e2e/external_db/mysql/mysql56.cnf b/vitess-mixin/e2e/external_db/mysql/mysql56.cnf index 7454231c33d..fdd34b1bd2e 100644 --- a/vitess-mixin/e2e/external_db/mysql/mysql56.cnf +++ b/vitess-mixin/e2e/external_db/mysql/mysql56.cnf @@ -19,9 +19,8 @@ innodb_use_native_aio = 0 # (when the master goes away). Here we just load the plugin so it's # available if desired, but it's disabled at startup. # -# If the -enable_semi_sync flag is used, VTTablet will enable semi-sync -# at the proper time when replication is set up, or when masters are -# promoted or demoted. +# VTTablet will enable semi-sync at the proper time when replication is set up, +# or when a primary is promoted or demoted based on the durability policy configured. plugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so # When semi-sync is enabled, don't allow fallback to async diff --git a/vitess-mixin/e2e/external_db/mysql/mysql57.cnf b/vitess-mixin/e2e/external_db/mysql/mysql57.cnf index 08935674b37..ebf301187eb 100644 --- a/vitess-mixin/e2e/external_db/mysql/mysql57.cnf +++ b/vitess-mixin/e2e/external_db/mysql/mysql57.cnf @@ -21,9 +21,8 @@ collation_server = utf8_general_ci # (when the master goes away). Here we just load the plugin so it's # available if desired, but it's disabled at startup. # -# If the -enable_semi_sync flag is used, VTTablet will enable semi-sync -# at the proper time when replication is set up, or when masters are -# promoted or demoted. +# VTTablet will enable semi-sync at the proper time when replication is set up, +# or when a primary is promoted or demoted based on the durability policy configured. plugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so # When semi-sync is enabled, don't allow fallback to async From fc95c4cb3e0aa04ea530a4f2b5091d8131a12e75 Mon Sep 17 00:00:00 2001 From: Manan Gupta Date: Mon, 18 Jul 2022 16:52:12 +0530 Subject: [PATCH 05/11] feat: remove enable_semi_sync from scripts of examples Signed-off-by: Manan Gupta --- examples/compose/vttablet-up.sh | 1 - examples/local/scripts/vttablet-up.sh | 1 - examples/operator/vtorc_example.yaml | 1 - vitess-mixin/e2e/vttablet-up.sh | 1 - 4 files changed, 4 deletions(-) diff --git a/examples/compose/vttablet-up.sh b/examples/compose/vttablet-up.sh index 72ac44fcd48..a4bf31a5c42 100755 --- a/examples/compose/vttablet-up.sh +++ b/examples/compose/vttablet-up.sh @@ -150,7 +150,6 @@ exec $VTROOT/bin/vttablet \ --tablet-path $alias \ --tablet_hostname "$vthost" \ --health_check_interval 5s \ - --enable_semi_sync=false \ --disable_active_reparents=true \ --port $web_port \ --grpc_port $grpc_port \ diff --git a/examples/local/scripts/vttablet-up.sh b/examples/local/scripts/vttablet-up.sh index d817ed82ab8..846f7788d8c 100755 --- a/examples/local/scripts/vttablet-up.sh +++ b/examples/local/scripts/vttablet-up.sh @@ -46,7 +46,6 @@ vttablet \ --init_shard $shard \ --init_tablet_type $tablet_type \ --health_check_interval 5s \ - --enable_semi_sync \ --enable_replication_reporter \ --backup_storage_implementation file \ --file_backup_storage_root $VTDATAROOT/backups \ diff --git a/examples/operator/vtorc_example.yaml b/examples/operator/vtorc_example.yaml index cb70e03219a..3084c2d59a5 100644 --- a/examples/operator/vtorc_example.yaml +++ b/examples/operator/vtorc_example.yaml @@ -74,7 +74,6 @@ spec: extraFlags: db_charset: utf8mb4 disable_active_reparents: "true" - enable_semi_sync: "false" resources: requests: cpu: 100m diff --git a/vitess-mixin/e2e/vttablet-up.sh b/vitess-mixin/e2e/vttablet-up.sh index 72ac44fcd48..a4bf31a5c42 100755 --- a/vitess-mixin/e2e/vttablet-up.sh +++ b/vitess-mixin/e2e/vttablet-up.sh @@ -150,7 +150,6 @@ exec $VTROOT/bin/vttablet \ --tablet-path $alias \ --tablet_hostname "$vthost" \ --health_check_interval 5s \ - --enable_semi_sync=false \ --disable_active_reparents=true \ --port $web_port \ --grpc_port $grpc_port \ From dd7d57b7c92dcc8f537235828fd6e2e0c45a5834 Mon Sep 17 00:00:00 2001 From: Manan Gupta Date: Mon, 18 Jul 2022 16:55:02 +0530 Subject: [PATCH 06/11] test: remove setting enable_semi_sync flag in testlib tests Signed-off-by: Manan Gupta --- go/vt/wrangler/testlib/semi_sync_test.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/go/vt/wrangler/testlib/semi_sync_test.go b/go/vt/wrangler/testlib/semi_sync_test.go index a9485742be9..bcb16b10836 100644 --- a/go/vt/wrangler/testlib/semi_sync_test.go +++ b/go/vt/wrangler/testlib/semi_sync_test.go @@ -17,7 +17,6 @@ limitations under the License. package testlib import ( - "flag" "testing" "github.com/stretchr/testify/assert" @@ -25,11 +24,6 @@ import ( "vitess.io/vitess/go/vt/topo/topoproto" ) -func init() { - // Enable semi-sync for all testlib tests. - flag.Set("enable_semi_sync", "true") -} - func checkSemiSyncEnabled(t *testing.T, primary, replica bool, tablets ...*FakeTablet) { for _, tablet := range tablets { assert.Equal(t, primary, tablet.FakeMysqlDaemon.SemiSyncPrimaryEnabled, "%v: SemiSyncPrimaryEnabled", topoproto.TabletAliasString(tablet.Tablet.Alias)) From 9250a47849e04286d6a91db84cd3a91b37cdd4de Mon Sep 17 00:00:00 2001 From: Manan Gupta Date: Mon, 18 Jul 2022 17:09:07 +0530 Subject: [PATCH 07/11] feat: remove enable_semi_sync from a bunch of tests Signed-off-by: Manan Gupta --- go/test/endtoend/backup/transform/backup_transform_utils.go | 1 - go/test/endtoend/backup/vtbackup/main_test.go | 1 - go/test/endtoend/backup/vtctlbackup/backup_utils.go | 1 - go/test/endtoend/recovery/pitr/shardedpitr_test.go | 3 +-- go/test/endtoend/recovery/pitrtls/shardedpitr_tls_test.go | 3 +-- go/test/endtoend/recovery/unshardedrecovery/recovery.go | 1 - go/test/endtoend/vault/vault_test.go | 1 - go/test/endtoend/vtorc/utils/utils.go | 2 -- 8 files changed, 2 insertions(+), 11 deletions(-) diff --git a/go/test/endtoend/backup/transform/backup_transform_utils.go b/go/test/endtoend/backup/transform/backup_transform_utils.go index 0661c65edbf..9236bc679cc 100644 --- a/go/test/endtoend/backup/transform/backup_transform_utils.go +++ b/go/test/endtoend/backup/transform/backup_transform_utils.go @@ -105,7 +105,6 @@ func TestMainSetup(m *testing.M, useMysqlctld bool) { tablet.VttabletProcess.DbPassword = dbPassword tablet.VttabletProcess.ExtraArgs = commonTabletArg tablet.VttabletProcess.SupportsBackup = true - tablet.VttabletProcess.EnableSemiSync = true if useMysqlctld { tablet.MysqlctldProcess = *cluster.MysqlCtldProcessInstance(tablet.TabletUID, tablet.MySQLPort, localCluster.TmpDirectory) diff --git a/go/test/endtoend/backup/vtbackup/main_test.go b/go/test/endtoend/backup/vtbackup/main_test.go index ce0720e77c4..a5fc9d23c8b 100644 --- a/go/test/endtoend/backup/vtbackup/main_test.go +++ b/go/test/endtoend/backup/vtbackup/main_test.go @@ -111,7 +111,6 @@ func TestMain(m *testing.M) { tablet.VttabletProcess.DbPassword = dbPassword tablet.VttabletProcess.ExtraArgs = commonTabletArg tablet.VttabletProcess.SupportsBackup = true - tablet.VttabletProcess.EnableSemiSync = true tablet.MysqlctlProcess = *cluster.MysqlCtlProcessInstance(tablet.TabletUID, tablet.MySQLPort, localCluster.TmpDirectory) tablet.MysqlctlProcess.InitDBFile = newInitDBFile diff --git a/go/test/endtoend/backup/vtctlbackup/backup_utils.go b/go/test/endtoend/backup/vtctlbackup/backup_utils.go index 19c73659d5f..91629a8d221 100644 --- a/go/test/endtoend/backup/vtctlbackup/backup_utils.go +++ b/go/test/endtoend/backup/vtctlbackup/backup_utils.go @@ -158,7 +158,6 @@ func LaunchCluster(setupType int, streamMode string, stripes int, cDetails *Comp tablet.VttabletProcess.DbPassword = dbPassword tablet.VttabletProcess.ExtraArgs = commonTabletArg tablet.VttabletProcess.SupportsBackup = true - tablet.VttabletProcess.EnableSemiSync = true if setupType == Mysqlctld { tablet.MysqlctldProcess = *cluster.MysqlCtldProcessInstance(tablet.TabletUID, tablet.MySQLPort, localCluster.TmpDirectory) diff --git a/go/test/endtoend/recovery/pitr/shardedpitr_test.go b/go/test/endtoend/recovery/pitr/shardedpitr_test.go index 9d4c0691b6d..a8aa20af66d 100644 --- a/go/test/endtoend/recovery/pitr/shardedpitr_test.go +++ b/go/test/endtoend/recovery/pitr/shardedpitr_test.go @@ -405,7 +405,7 @@ func initializeCluster(t *testing.T) { shard1.Vttablets = []*cluster.Vttablet{shard1Primary, shard1Replica} clusterInstance.VtTabletExtraArgs = append(clusterInstance.VtTabletExtraArgs, commonTabletArg...) - clusterInstance.VtTabletExtraArgs = append(clusterInstance.VtTabletExtraArgs, "--restore_from_backup", "--enable_semi_sync") + clusterInstance.VtTabletExtraArgs = append(clusterInstance.VtTabletExtraArgs, "--restore_from_backup") err = clusterInstance.SetupCluster(keyspace, []cluster.Shard{*shard, *shard0, *shard1}) require.NoError(t, err) @@ -516,7 +516,6 @@ func launchRecoveryTablet(t *testing.T, tablet *cluster.Vttablet, binlogServer * tablet.Alias = tablet.VttabletProcess.TabletPath tablet.VttabletProcess.SupportsBackup = true tablet.VttabletProcess.Keyspace = restoreKeyspaceName - tablet.VttabletProcess.EnableSemiSync = true tablet.VttabletProcess.ExtraArgs = []string{ "--disable_active_reparents", "--enable_replication_reporter=false", diff --git a/go/test/endtoend/recovery/pitrtls/shardedpitr_tls_test.go b/go/test/endtoend/recovery/pitrtls/shardedpitr_tls_test.go index eed826aa0a6..f323333ce1e 100644 --- a/go/test/endtoend/recovery/pitrtls/shardedpitr_tls_test.go +++ b/go/test/endtoend/recovery/pitrtls/shardedpitr_tls_test.go @@ -142,7 +142,7 @@ func initializeCluster(t *testing.T) { shard1.Vttablets = []*cluster.Vttablet{shard1Primary, shard1Replica} clusterInstance.VtTabletExtraArgs = append(clusterInstance.VtTabletExtraArgs, commonTabletArg...) - clusterInstance.VtTabletExtraArgs = append(clusterInstance.VtTabletExtraArgs, "--restore_from_backup", "--enable_semi_sync") + clusterInstance.VtTabletExtraArgs = append(clusterInstance.VtTabletExtraArgs, "--restore_from_backup") err = clusterInstance.SetupCluster(keyspace, []cluster.Shard{*shard, *shard0, *shard1}) require.NoError(t, err) @@ -495,7 +495,6 @@ func tlsLaunchRecoveryTablet(t *testing.T, tablet *cluster.Vttablet, tabletForBi tablet.Alias = tablet.VttabletProcess.TabletPath tablet.VttabletProcess.SupportsBackup = true tablet.VttabletProcess.Keyspace = restoreKeyspaceName - tablet.VttabletProcess.EnableSemiSync = true certDir := path.Join(os.Getenv("VTDATAROOT"), fmt.Sprintf("/ssl_%010d", tablet.MysqlctlProcess.TabletUID)) tablet.VttabletProcess.ExtraArgs = []string{ diff --git a/go/test/endtoend/recovery/unshardedrecovery/recovery.go b/go/test/endtoend/recovery/unshardedrecovery/recovery.go index db76cc3654f..68c66a7bbc0 100644 --- a/go/test/endtoend/recovery/unshardedrecovery/recovery.go +++ b/go/test/endtoend/recovery/unshardedrecovery/recovery.go @@ -124,7 +124,6 @@ SET GLOBAL old_alter_table = ON; tablet.VttabletProcess.ExtraArgs = append(tablet.VttabletProcess.ExtraArgs, recovery.XbArgs...) } tablet.VttabletProcess.SupportsBackup = true - tablet.VttabletProcess.EnableSemiSync = true tablet.MysqlctlProcess = *cluster.MysqlCtlProcessInstance(tablet.TabletUID, tablet.MySQLPort, localCluster.TmpDirectory) tablet.MysqlctlProcess.InitDBFile = newInitDBFile diff --git a/go/test/endtoend/vault/vault_test.go b/go/test/endtoend/vault/vault_test.go index 287124878bc..c741c1d5f93 100644 --- a/go/test/endtoend/vault/vault_test.go +++ b/go/test/endtoend/vault/vault_test.go @@ -282,7 +282,6 @@ func initializeClusterLate(t *testing.T) { _, err = tablet.VttabletProcess.QueryTablet(query, keyspace.Name, false) require.NoError(t, err) - tablet.VttabletProcess.EnableSemiSync = true err = tablet.VttabletProcess.Setup() require.NoError(t, err) diff --git a/go/test/endtoend/vtorc/utils/utils.go b/go/test/endtoend/vtorc/utils/utils.go index 8860cea956e..ed097cb004e 100644 --- a/go/test/endtoend/vtorc/utils/utils.go +++ b/go/test/endtoend/vtorc/utils/utils.go @@ -761,7 +761,6 @@ func SetupNewClusterSemiSync(t *testing.T) *VtOrcClusterInfo { clusterInstance.VtTabletExtraArgs = []string{ "--lock_tables_timeout", "5s", "--disable_active_reparents", - "--enable_semi_sync", } // Initialize Cluster @@ -840,7 +839,6 @@ func AddSemiSyncKeyspace(t *testing.T, clusterInfo *VtOrcClusterInfo) { clusterInfo.ClusterInstance.VtTabletExtraArgs = []string{ "--lock_tables_timeout", "5s", "--disable_active_reparents", - "--enable_semi_sync", } // Initialize Cluster From c29cf7c7ee96dbf7b9ad12b2ed84feb310a3857b Mon Sep 17 00:00:00 2001 From: Manan Gupta Date: Tue, 19 Jul 2022 19:57:22 +0530 Subject: [PATCH 08/11] test: refactor setup to take in durability policy instead of a boolean and add a test for cross cell durability policy Signed-off-by: Manan Gupta --- .../reparent/emergencyreparent/ers_test.go | 26 +++++++------- .../reparent/newfeaturetest/reparent_test.go | 35 ++++++++++++++++++- .../reparent/plannedreparent/reparent_test.go | 26 +++++++------- go/test/endtoend/reparent/utils/utils.go | 12 +++---- 4 files changed, 65 insertions(+), 34 deletions(-) diff --git a/go/test/endtoend/reparent/emergencyreparent/ers_test.go b/go/test/endtoend/reparent/emergencyreparent/ers_test.go index 6f103e60518..c007684c779 100644 --- a/go/test/endtoend/reparent/emergencyreparent/ers_test.go +++ b/go/test/endtoend/reparent/emergencyreparent/ers_test.go @@ -31,7 +31,7 @@ import ( func TestTrivialERS(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -56,7 +56,7 @@ func TestTrivialERS(t *testing.T) { func TestReparentIgnoreReplicas(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets var err error @@ -98,7 +98,7 @@ func TestReparentIgnoreReplicas(t *testing.T) { func TestReparentDownPrimary(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -134,7 +134,7 @@ func TestReparentDownPrimary(t *testing.T) { func TestReparentNoChoiceDownPrimary(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets var err error @@ -170,7 +170,7 @@ func TestReparentNoChoiceDownPrimary(t *testing.T) { func TestSemiSyncSetupCorrectly(t *testing.T) { t.Run("semi-sync enabled", func(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -198,7 +198,7 @@ func TestSemiSyncSetupCorrectly(t *testing.T) { t.Run("semi-sync disabled", func(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, false) + clusterInstance := utils.SetupReparentCluster(t, "none") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -228,7 +228,7 @@ func TestSemiSyncSetupCorrectly(t *testing.T) { // TestERSPromoteRdonly tests that we never end up promoting a rdonly instance as the primary func TestERSPromoteRdonly(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets var err error @@ -256,7 +256,7 @@ func TestERSPromoteRdonly(t *testing.T) { // TestERSPreventCrossCellPromotion tests that we promote a replica in the same cell as the previous primary if prevent cross cell promotion flag is set func TestERSPreventCrossCellPromotion(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets var err error @@ -279,7 +279,7 @@ func TestERSPreventCrossCellPromotion(t *testing.T) { // caught up to it by pulling transactions from it func TestPullFromRdonly(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets var err error @@ -344,7 +344,7 @@ func TestPullFromRdonly(t *testing.T) { // is stopped on the primary elect. func TestNoReplicationStatusAndIOThreadStopped(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets utils.ConfirmReplication(t, tablets[0], []*cluster.Vttablet{tablets[1], tablets[2], tablets[3]}) @@ -443,7 +443,7 @@ func TestERSForInitialization(t *testing.T) { func TestRecoverWithMultipleFailures(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets utils.ConfirmReplication(t, tablets[0], []*cluster.Vttablet{tablets[1], tablets[2], tablets[3]}) @@ -471,7 +471,7 @@ func TestRecoverWithMultipleFailures(t *testing.T) { // a tablet and hanging while inserting a row in the reparent journal on getting semi-sync ACKs func TestERSFailFast(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets utils.ConfirmReplication(t, tablets[0], []*cluster.Vttablet{tablets[1], tablets[2], tablets[3]}) @@ -503,7 +503,7 @@ func TestERSFailFast(t *testing.T) { // If there are more than 1, we also fail. func TestReplicationStopped(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets utils.ConfirmReplication(t, tablets[0], []*cluster.Vttablet{tablets[1], tablets[2], tablets[3]}) diff --git a/go/test/endtoend/reparent/newfeaturetest/reparent_test.go b/go/test/endtoend/reparent/newfeaturetest/reparent_test.go index f8ed707510c..94d4e96b20d 100644 --- a/go/test/endtoend/reparent/newfeaturetest/reparent_test.go +++ b/go/test/endtoend/reparent/newfeaturetest/reparent_test.go @@ -17,5 +17,38 @@ limitations under the License. package newfeaturetest import ( - _ "vitess.io/vitess/go/vt/log" + "testing" + + "github.com/stretchr/testify/require" + + "vitess.io/vitess/go/test/endtoend/cluster" + "vitess.io/vitess/go/test/endtoend/reparent/utils" ) + +func TestCrossCellDurability(t *testing.T) { + defer cluster.PanicHandler(t) + clusterInstance := utils.SetupReparentCluster(t, "cross_cell") + defer utils.TeardownCluster(clusterInstance) + tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets + + utils.ConfirmReplication(t, tablets[0], []*cluster.Vttablet{tablets[1], tablets[2], tablets[3]}) + + // When tablets[0] is the primary, the only tablet in a different cell is tablets[3]. + // So the other two should have semi-sync turned off + utils.CheckSemiSyncSetupCorrectly(t, tablets[0], "ON") + utils.CheckSemiSyncSetupCorrectly(t, tablets[3], "ON") + utils.CheckSemiSyncSetupCorrectly(t, tablets[1], "OFF") + utils.CheckSemiSyncSetupCorrectly(t, tablets[2], "OFF") + + // Run forced reparent operation, this should proceed unimpeded. + out, err := utils.Prs(t, clusterInstance, tablets[3]) + require.NoError(t, err, out) + + utils.ConfirmReplication(t, tablets[3], []*cluster.Vttablet{tablets[0], tablets[1], tablets[2]}) + + // All the tablets will have semi-sync setup since tablets[3] is in Cell2 and all + // others are in Cell1, so all of them are eligible to send semi-sync ACKs + for _, tablet := range tablets { + utils.CheckSemiSyncSetupCorrectly(t, tablet, "ON") + } +} diff --git a/go/test/endtoend/reparent/plannedreparent/reparent_test.go b/go/test/endtoend/reparent/plannedreparent/reparent_test.go index ce62a7bc116..0a1eaf409fa 100644 --- a/go/test/endtoend/reparent/plannedreparent/reparent_test.go +++ b/go/test/endtoend/reparent/plannedreparent/reparent_test.go @@ -34,7 +34,7 @@ import ( func TestPrimaryToSpareStateChangeImpossible(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -46,7 +46,7 @@ func TestPrimaryToSpareStateChangeImpossible(t *testing.T) { func TestReparentCrossCell(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -60,7 +60,7 @@ func TestReparentCrossCell(t *testing.T) { func TestReparentGraceful(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -83,7 +83,7 @@ func TestReparentGraceful(t *testing.T) { // TestPRSWithDrainedLaggingTablet tests that PRS succeeds even if we have a lagging drained tablet func TestPRSWithDrainedLaggingTablet(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -110,7 +110,7 @@ func TestPRSWithDrainedLaggingTablet(t *testing.T) { func TestReparentReplicaOffline(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -127,7 +127,7 @@ func TestReparentReplicaOffline(t *testing.T) { func TestReparentAvoid(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets utils.DeleteTablet(t, clusterInstance, tablets[2]) @@ -159,14 +159,14 @@ func TestReparentAvoid(t *testing.T) { func TestReparentFromOutside(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) reparentFromOutside(t, clusterInstance, false) } func TestReparentFromOutsideWithNoPrimary(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -255,7 +255,7 @@ func reparentFromOutside(t *testing.T, clusterInstance *cluster.LocalProcessClus func TestReparentWithDownReplica(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -298,7 +298,7 @@ func TestReparentWithDownReplica(t *testing.T) { func TestChangeTypeSemiSync(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -362,7 +362,7 @@ func TestChangeTypeSemiSync(t *testing.T) { func TestReparentDoesntHangIfPrimaryFails(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets @@ -381,7 +381,7 @@ func TestReparentDoesntHangIfPrimaryFails(t *testing.T) { func TestReplicationStatus(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets utils.ConfirmReplication(t, tablets[0], []*cluster.Vttablet{tablets[1], tablets[2], tablets[3]}) @@ -443,7 +443,7 @@ func TestReplicationStatus(t *testing.T) { // TestFullStatus tests that the RPC FullStatus works as intended. func TestFullStatus(t *testing.T) { defer cluster.PanicHandler(t) - clusterInstance := utils.SetupReparentCluster(t, true) + clusterInstance := utils.SetupReparentCluster(t, "semi_sync") defer utils.TeardownCluster(clusterInstance) tablets := clusterInstance.Keyspaces[0].Shards[0].Vttablets utils.ConfirmReplication(t, tablets[0], []*cluster.Vttablet{tablets[1], tablets[2], tablets[3]}) diff --git a/go/test/endtoend/reparent/utils/utils.go b/go/test/endtoend/reparent/utils/utils.go index a716183017d..096c4443844 100644 --- a/go/test/endtoend/reparent/utils/utils.go +++ b/go/test/endtoend/reparent/utils/utils.go @@ -68,13 +68,13 @@ var ( //region cluster setup/teardown // SetupReparentCluster is used to setup the reparent cluster -func SetupReparentCluster(t *testing.T, enableSemiSync bool) *cluster.LocalProcessCluster { - return setupCluster(context.Background(), t, ShardName, []string{cell1, cell2}, []int{3, 1}, enableSemiSync) +func SetupReparentCluster(t *testing.T, durability string) *cluster.LocalProcessCluster { + return setupCluster(context.Background(), t, ShardName, []string{cell1, cell2}, []int{3, 1}, durability) } // SetupRangeBasedCluster sets up the range based cluster func SetupRangeBasedCluster(ctx context.Context, t *testing.T) *cluster.LocalProcessCluster { - return setupCluster(ctx, t, ShardName, []string{cell1}, []int{2}, true) + return setupCluster(ctx, t, ShardName, []string{cell1}, []int{2}, "semi_sync") } // TeardownCluster is used to teardown the reparent cluster @@ -82,15 +82,13 @@ func TeardownCluster(clusterInstance *cluster.LocalProcessCluster) { clusterInstance.Teardown() } -func setupCluster(ctx context.Context, t *testing.T, shardName string, cells []string, numTablets []int, enableSemiSync bool) *cluster.LocalProcessCluster { +func setupCluster(ctx context.Context, t *testing.T, shardName string, cells []string, numTablets []int, durability string) *cluster.LocalProcessCluster { var tablets []*cluster.Vttablet clusterInstance := cluster.NewCluster(cells[0], Hostname) keyspace := &cluster.Keyspace{Name: KeyspaceName} - durability := "none" - if enableSemiSync { + if durability == "semi_sync" { clusterInstance.VtTabletExtraArgs = append(clusterInstance.VtTabletExtraArgs, "--enable_semi_sync") - durability = "semi_sync" } // Start topo server From 5f2384c26a28a2f408089207cdc1752eb771ac63 Mon Sep 17 00:00:00 2001 From: Manan Gupta Date: Tue, 19 Jul 2022 21:25:18 +0530 Subject: [PATCH 09/11] feat: add cross cell durability policy to the docs Signed-off-by: Manan Gupta --- doc/releasenotes/15_0_0_summary.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/releasenotes/15_0_0_summary.md b/doc/releasenotes/15_0_0_summary.md index 6b8d10aa27d..8f378d9dd12 100644 --- a/doc/releasenotes/15_0_0_summary.md +++ b/doc/releasenotes/15_0_0_summary.md @@ -156,3 +156,10 @@ $ curl -s http://127.0.0.1:15100/debug/vars | jq . | grep Throttler Added new parameter `multi_shard_autocommit` to lookup vindex definition in vschema, if enabled will send lookup vindex dml query as autocommit to all shards This is slighly different from `autocommit` parameter where the query is sent in its own transaction separate from the ongoing transaction if any i.e. begin -> lookup query execs -> commit/rollback + +### Durability Policy + +#### Cross Cell + +A new durabilty policy `cross_cell` is now supported. `cross_cell` durability policy only allows replica tablets from a different cell than the current primary to +send semi sync ACKs. This ensures that any committed write exists in atleast 2 tablets belonging to different cells. \ No newline at end of file From 2871455caf4f8dbc25f3e5fe7b957367bd9599b4 Mon Sep 17 00:00:00 2001 From: Manan Gupta Date: Thu, 21 Jul 2022 17:54:08 +0530 Subject: [PATCH 10/11] feat: fix flag help output Signed-off-by: Manan Gupta --- go/flags/endtoend/vttablet.txt | 2 +- go/vt/vttablet/tabletmanager/rpc_replication.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/go/flags/endtoend/vttablet.txt b/go/flags/endtoend/vttablet.txt index c341e85ea1d..ba85bb7689a 100644 --- a/go/flags/endtoend/vttablet.txt +++ b/go/flags/endtoend/vttablet.txt @@ -396,7 +396,7 @@ Usage of vttablet: --enable_replication_reporter Use polling to track replication lag. --enable_semi_sync - (DEPRECATED - Set the correct durability policy in the keyspace information instead) Enable semi-sync when configuring replication, on primary and replica tablets only (rdonly tablets will not ack). + DEPRECATED - Set the correct durability policy on the keyspace instead. --enable_transaction_limit If true, limit on number of transactions open at the same time will be enforced for all users. User trying to open a new transaction after exhausting their limit will receive an error immediately, regardless of whether there are available slots or not. --enable_transaction_limit_dry_run diff --git a/go/vt/vttablet/tabletmanager/rpc_replication.go b/go/vt/vttablet/tabletmanager/rpc_replication.go index ce96ead8682..5d1555d2886 100644 --- a/go/vt/vttablet/tabletmanager/rpc_replication.go +++ b/go/vt/vttablet/tabletmanager/rpc_replication.go @@ -39,7 +39,7 @@ import ( ) var ( - _ = flag.Bool("enable_semi_sync", false, "(DEPRECATED - Set the correct durability policy in the keyspace information instead) Enable semi-sync when configuring replication, on primary and replica tablets only (rdonly tablets will not ack).") + _ = flag.Bool("enable_semi_sync", false, "DEPRECATED - Set the correct durability policy on the keyspace instead.") setSuperReadOnly = flag.Bool("use_super_read_only", false, "Set super_read_only flag when performing planned failover.") ) From a94e98564e38c4413d313b1d172d0f176f5e7df9 Mon Sep 17 00:00:00 2001 From: Manan Gupta Date: Thu, 21 Jul 2022 20:31:15 +0530 Subject: [PATCH 11/11] test: we shouldn't remove enable_semi_sync from tests which are testing upgrades Signed-off-by: Manan Gupta --- go/test/endtoend/backup/transform/backup_transform_utils.go | 1 + go/test/endtoend/backup/vtbackup/main_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/go/test/endtoend/backup/transform/backup_transform_utils.go b/go/test/endtoend/backup/transform/backup_transform_utils.go index 9236bc679cc..0661c65edbf 100644 --- a/go/test/endtoend/backup/transform/backup_transform_utils.go +++ b/go/test/endtoend/backup/transform/backup_transform_utils.go @@ -105,6 +105,7 @@ func TestMainSetup(m *testing.M, useMysqlctld bool) { tablet.VttabletProcess.DbPassword = dbPassword tablet.VttabletProcess.ExtraArgs = commonTabletArg tablet.VttabletProcess.SupportsBackup = true + tablet.VttabletProcess.EnableSemiSync = true if useMysqlctld { tablet.MysqlctldProcess = *cluster.MysqlCtldProcessInstance(tablet.TabletUID, tablet.MySQLPort, localCluster.TmpDirectory) diff --git a/go/test/endtoend/backup/vtbackup/main_test.go b/go/test/endtoend/backup/vtbackup/main_test.go index a5fc9d23c8b..ce0720e77c4 100644 --- a/go/test/endtoend/backup/vtbackup/main_test.go +++ b/go/test/endtoend/backup/vtbackup/main_test.go @@ -111,6 +111,7 @@ func TestMain(m *testing.M) { tablet.VttabletProcess.DbPassword = dbPassword tablet.VttabletProcess.ExtraArgs = commonTabletArg tablet.VttabletProcess.SupportsBackup = true + tablet.VttabletProcess.EnableSemiSync = true tablet.MysqlctlProcess = *cluster.MysqlCtlProcessInstance(tablet.TabletUID, tablet.MySQLPort, localCluster.TmpDirectory) tablet.MysqlctlProcess.InitDBFile = newInitDBFile