Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
*.swp
tags

# emacs
*~

# Eclipse files
.classpath
.project
Expand Down Expand Up @@ -72,4 +75,4 @@ releases


# Vagrant
.vagrant
.vagrant
18 changes: 0 additions & 18 deletions config/mycnf/default.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ innodb_log_file_size = 64M
innodb_log_files_in_group = 2
innodb_log_group_home_dir = {{.InnodbLogGroupHomeDir}}
innodb_max_dirty_pages_pct = 75
innodb_support_xa = 0
innodb_thread_concurrency = 20
key_buffer_size = 32M
log-error = {{.ErrorLogPath}}
Expand Down Expand Up @@ -56,20 +55,3 @@ thread_cache_size = 200
tmpdir = {{.TmpDir}}
tmp_table_size = 32M
transaction-isolation = REPEATABLE-READ

# Semi-sync replication is required for automated unplanned failover
# (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.
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
# if you get no ack, or have no slaves. This is necessary to
# prevent alternate futures when doing a failover in response to
# a master that becomes unresponsive.
rpl_semi_sync_master_timeout = 1000000000000000000
rpl_semi_sync_master_wait_no_slave = 1

17 changes: 17 additions & 0 deletions config/mycnf/master_mariadb.cnf
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# enable strict mode so it's safe to compare sequence numbers across different server IDs.
gtid_strict_mode = 1
innodb_stats_persistent = 0
innodb_support_xa = 0

# Semi-sync replication is required for automated unplanned failover
# (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.
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
# if you get no ack, or have no slaves. This is necessary to
# prevent alternate futures when doing a failover in response to
# a master that becomes unresponsive.
rpl_semi_sync_master_timeout = 1000000000000000000
rpl_semi_sync_master_wait_no_slave = 1
21 changes: 21 additions & 0 deletions config/mycnf/master_mariadb103.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# enable strict mode so it's safe to compare sequence numbers across different server IDs.
gtid_strict_mode = 1
innodb_stats_persistent = 0

# Semi-sync replication is required for automated unplanned failover
# (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.

# semi_sync has been merged into master as of mariadb 10.3 so this is no longer needed
#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
# if you get no ack, or have no slaves. This is necessary to
# prevent alternate futures when doing a failover in response to
# a master that becomes unresponsive.
rpl_semi_sync_master_timeout = 1000000000000000000
rpl_semi_sync_master_wait_no_slave = 1
16 changes: 16 additions & 0 deletions config/mycnf/master_mysql56.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,19 @@ relay_log_recovery = 1

# Native AIO tends to run into aio-max-nr limit during test startup.
innodb_use_native_aio = 0

# Semi-sync replication is required for automated unplanned failover
# (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.
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
# if you get no ack, or have no slaves. This is necessary to
# prevent alternate futures when doing a failover in response to
# a master that becomes unresponsive.
rpl_semi_sync_master_timeout = 1000000000000000000
rpl_semi_sync_master_wait_no_slave = 1
1 change: 1 addition & 0 deletions docker/k8s/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ COPY --from=base $VTTOP/config/init_db.sql /vt/config/
# mysql flavor files for db specific .cnf settings
COPY --from=base $VTTOP/config/mycnf/master_mysql56.cnf /vt/config/mycnf/
COPY --from=base $VTTOP/config/mycnf/master_mariadb.cnf /vt/config/mycnf/
COPY --from=base $VTTOP/config/mycnf/master_mariadb103.cnf /vt/config/mycnf/

# settings for different types of instances
COPY --from=base $VTTOP/config/mycnf/default.cnf /vt/config/mycnf/
Expand Down
28 changes: 28 additions & 0 deletions go/vt/mysqlctl/mysqld.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,15 @@ func (mysqld *Mysqld) initConfig(root string, cnf *Mycnf, outFile string) error
return ioutil.WriteFile(outFile, []byte(configData), 0664)
}

func contains(haystack []string, needle string) bool {
for _, v := range haystack {
if v == needle {
return true
}
}
return false
}

func getMycnfTemplates(root string) []string {
if *mycnfTemplateFile != "" {
return []string{*mycnfTemplateFile}
Expand All @@ -627,6 +636,25 @@ func getMycnfTemplates(root string) []string {
cnfTemplatePaths = append(cnfTemplatePaths, parts...)
}

switch mysqlFlavor := os.Getenv("MYSQL_FLAVOR"); mysqlFlavor {
case "MariaDB":
path := path.Join(root, "config/mycnf/master_mariadb.cnf")
if !contains(cnfTemplatePaths, path) {
cnfTemplatePaths = append(cnfTemplatePaths, path)
}
case "MariaDB103":
path := path.Join(root, "config/mycnf/master_mariadb103.cnf")
if !contains(cnfTemplatePaths, path) {
cnfTemplatePaths = append(cnfTemplatePaths, path)
}
default:
path := path.Join(root, "config/mycnf/master_mysql56.cnf")
// By default we assume Mysql56 compatable
if !contains(cnfTemplatePaths, path) {
cnfTemplatePaths = append(cnfTemplatePaths, path)
}
}

return cnfTemplatePaths
}

Expand Down
Loading