Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate enable-semi-sync in favour of RPC parameter #10695

Merged
merged 12 commits into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions config/mycnf/mariadb100.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions config/mycnf/mariadb101.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions config/mycnf/mariadb102.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 2 additions & 3 deletions config/mycnf/mysql57.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions config/mycnf/mysql80.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions doc/releasenotes/15_0_0_summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,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

Expand Down Expand Up @@ -155,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.
5 changes: 2 additions & 3 deletions examples/compose/external_db/mysql/mysql56.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions examples/compose/external_db/mysql/mysql57.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion examples/compose/vttablet-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
1 change: 0 additions & 1 deletion examples/local/scripts/vttablet-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
1 change: 0 additions & 1 deletion examples/operator/vtorc_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ spec:
extraFlags:
db_charset: utf8mb4
disable_active_reparents: "true"
enable_semi_sync: "false"
resources:
requests:
cpu: 100m
Expand Down
2 changes: 1 addition & 1 deletion go/flags/endtoend/vttablet.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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).
GuptaManan100 marked this conversation as resolved.
Show resolved Hide resolved
--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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion go/test/endtoend/backup/vtbackup/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion go/test/endtoend/backup/vtctlbackup/backup_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions go/test/endtoend/recovery/pitr/shardedpitr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions go/test/endtoend/recovery/pitrtls/shardedpitr_tls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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{
Expand Down
1 change: 0 additions & 1 deletion go/test/endtoend/recovery/unshardedrecovery/recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 13 additions & 13 deletions go/test/endtoend/reparent/emergencyreparent/ers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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]})
Expand Down Expand Up @@ -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]})
Expand Down Expand Up @@ -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]})
Expand Down Expand Up @@ -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]})
Expand Down
35 changes: 34 additions & 1 deletion go/test/endtoend/reparent/newfeaturetest/reparent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
Loading