-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add initial support for capabilities #4987
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
f336afe
Add initial support for capabilities
morgo 030c2fd
Removed MYSQL_FLAVOR variable precedence
morgo 118f3e7
Address PR feedback (WIP)
morgo a8343f9
Merge remote-tracking branch 'upstream/master' into morgo-mysql-capab…
morgo 469a94e
Fixed mysql_safe to not use capabilitities
morgo cd47164
fix version detection
morgo e1ff1b7
Fix style, re-add EXTRA_MY_CNF from review
morgo ed86bd5
Address review feedback
morgo 79dbc8e
address remaining feedback
morgo a02bbad
Remove rogue added space
morgo 5339cbb
Address PR feedback
morgo f881735
Address PR feedback
morgo 2fde7d4
Fix broken test
morgo 555f559
Fixed tests
morgo e7f7474
Addressed PR feedback
morgo 1ecd822
update copyright
morgo d4ca143
Remove unset MYSQL_FLAVOR
morgo e4b487b
Make sure error is caught.
morgo bc08f6a
Address PR Feedback
morgo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # This file is auto-included when MariaDB 10.0 is detected. | ||
|
|
||
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # This file is auto-included when MariaDB 10.1 is detected. | ||
|
|
||
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # This file is auto-included when MariaDB 10.2 is detected. | ||
|
|
||
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # This file is auto-included when MySQL 5.7 is detected. | ||
|
|
||
| # Options for enabling GTID | ||
| # https://dev.mysql.com/doc/refman/5.6/en/replication-gtids-howto.html | ||
| gtid_mode = ON | ||
| log_bin | ||
| log_slave_updates | ||
| enforce_gtid_consistency | ||
| innodb_use_native_aio = 0 | ||
|
|
||
| # Crash-safe replication settings. | ||
| master_info_repository = TABLE | ||
| relay_log_info_repository = TABLE | ||
| relay_log_purge = 1 | ||
| relay_log_recovery = 1 | ||
|
|
||
morgo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # 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 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| /* | ||
| Copyright 2019 The Vitess Authors | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| /* | ||
| Detect server flavors and capabilities | ||
| */ | ||
|
|
||
| package mysqlctl | ||
|
|
||
| type mysqlFlavor string | ||
|
|
||
| const ( | ||
| flavorMySQL mysqlFlavor = "mysql" | ||
| flavorPercona mysqlFlavor = "percona" | ||
| flavorMariaDB mysqlFlavor = "mariadb" | ||
| ) | ||
|
|
||
| // Mysqld is the object that represents a mysqld daemon running on this server. | ||
| type CapabilitySet struct { | ||
| flavor mysqlFlavor | ||
| version serverVersion | ||
| } | ||
|
|
||
| func NewCapabilitySet(f mysqlFlavor, v serverVersion) (c CapabilitySet) { | ||
| c.flavor = f | ||
| c.version = v | ||
| return | ||
| } | ||
|
|
||
| func (c *CapabilitySet) HasMySQLUpgradeInServer() bool { | ||
| return c.IsMySQLLike() && c.version.atLeast(serverVersion{Major: 8, Minor: 0, Patch: 16}) | ||
| } | ||
| func (c *CapabilitySet) HasInitializeInServer() bool { | ||
| return c.IsMySQLLike() && c.version.atLeast(serverVersion{Major: 5, Minor: 7, Patch: 0}) | ||
| } | ||
| func (c *CapabilitySet) HasMySQLxEnabledByDefault() bool { | ||
| return c.IsMySQLLike() && c.version.atLeast(serverVersion{Major: 8, Minor: 0, Patch: 11}) | ||
| } | ||
| func (c *CapabilitySet) HasPersistConfig() bool { | ||
| return c.IsMySQLLike() && c.version.atLeast(serverVersion{Major: 8, Minor: 0, Patch: 0}) | ||
| } | ||
| func (c *CapabilitySet) HasShutdownCommand() bool { | ||
| return (c.IsMySQLLike() && c.version.atLeast(serverVersion{Major: 5, Minor: 7, Patch: 9})) || (c.IsMariaDB() && c.version.atLeast(serverVersion{Major: 10, Minor: 0, Patch: 4})) | ||
| } | ||
| func (c *CapabilitySet) HasBackupLocks() bool { | ||
| return c.IsMySQLLike() && c.version.atLeast(serverVersion{Major: 8, Minor: 0, Patch: 0}) | ||
| } | ||
| func (c *CapabilitySet) HasDefaultUft8mb4() bool { | ||
| return c.IsMySQLLike() && c.version.atLeast(serverVersion{Major: 8, Minor: 0, Patch: 0}) | ||
| } | ||
| func (c *CapabilitySet) HasSemiSyncEnabledByDefault() bool { | ||
| return c.IsMariaDB() && c.version.atLeast(serverVersion{Major: 10, Minor: 3, Patch: 3}) | ||
| } | ||
|
|
||
| // IsMySQLLike tests if the server is either MySQL | ||
| // or Percona Server. At least currently, Vitess doesn't | ||
| // make use of any specific Percona Server features. | ||
| func (c *CapabilitySet) IsMySQLLike() bool { | ||
| return c.flavor == flavorMySQL || c.flavor == flavorPercona | ||
| } | ||
|
|
||
| // IsMariaDB tests if the server is MariaDB. | ||
| // IsMySQLLike() and IsMariaDB() are mutually exclusive | ||
| func (c *CapabilitySet) IsMariaDB() bool { | ||
| return c.flavor == flavorMariaDB | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.