Skip to content

Commit 1dc70ac

Browse files
Merge pull request #18 from y-trudeau/DISTMYSQL-226
Jira DISTMYSQL-226: added the parameter maxAllowedPacket=0 to force t…
2 parents 83e12da + a55e5f1 commit 1dc70ac

File tree

5 files changed

+14
-2
lines changed

5 files changed

+14
-2
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/cyberdelia/go-metrics-graphite v0.0.0-20161219230853-39f87cc3b432
1010
github.com/fatih/color v1.10.0 // indirect
1111
github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab
12-
github.com/go-sql-driver/mysql v1.6.0
12+
github.com/go-sql-driver/mysql v1.7.1
1313
github.com/google/btree v1.0.0 // indirect
1414
github.com/hashicorp/consul/api v1.7.0
1515
github.com/hashicorp/go-cleanhttp v0.5.2-0.20190406162018-d3fcbee8e181 // indirect

go/config/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ type Configuration struct {
103103
MySQLTopologySSLSkipVerify bool // If true, do not strictly validate mutual TLS certs for Topology mysql instances
104104
MySQLTopologyUseMutualTLS bool // Turn on TLS authentication with the Topology MySQL instances
105105
MySQLTopologyUseMixedTLS bool // Mixed TLS and non-TLS authentication with the Topology MySQL instances
106+
MySQLTopologyMaxAllowedPacket int32 // max_allowed_packet value to use when connecting to the Topology mysql instance
106107
TLSCacheTTLFactor uint // Factor of InstancePollSeconds that we set as TLS info cache expiry
107108
BackendDB string // EXPERIMENTAL: type of backend db; either "mysql" or "sqlite3"
108109
SQLite3DataFile string // when BackendDB == "sqlite3", full path to sqlite3 datafile
@@ -129,6 +130,7 @@ type Configuration struct {
129130
MySQLOrchestratorUseMutualTLS bool // Turn on TLS authentication with the Orchestrator MySQL instance
130131
MySQLOrchestratorReadTimeoutSeconds int // Number of seconds before backend mysql read operation is aborted (driver-side)
131132
MySQLOrchestratorRejectReadOnly bool // Reject read only connections https://github.com/go-sql-driver/mysql#rejectreadonly
133+
MySQLOrchestratorMaxAllowedPacket int32 // max_allowed_packet to use when connecting to the Orchestrator mysql instance
132134
MySQLConnectTimeoutSeconds int // Number of seconds before connection is aborted (driver-side)
133135
MySQLDiscoveryReadTimeoutSeconds int // Number of seconds before topology mysql read operation is aborted (driver-side). Used for discovery queries.
134136
MySQLTopologyReadTimeoutSeconds int // Number of seconds before topology mysql read operation is aborted (driver-side). Used for all but discovery queries.
@@ -316,10 +318,12 @@ func newConfiguration() *Configuration {
316318
MySQLOrchestratorPort: 3306,
317319
MySQLTopologyUseMutualTLS: false,
318320
MySQLTopologyUseMixedTLS: true,
321+
MySQLTopologyMaxAllowedPacket: -1,
319322
MySQLOrchestratorUseMutualTLS: false,
320323
MySQLConnectTimeoutSeconds: 2,
321324
MySQLOrchestratorReadTimeoutSeconds: 30,
322325
MySQLOrchestratorRejectReadOnly: false,
326+
MySQLOrchestratorMaxAllowedPacket: -1,
323327
MySQLDiscoveryReadTimeoutSeconds: 10,
324328
MySQLTopologyReadTimeoutSeconds: 600,
325329
MySQLConnectionLifetimeSeconds: 0,

go/db/db.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ func getMySQLURI() string {
7171
if config.Config.MySQLOrchestratorUseMutualTLS {
7272
mysqlURI, _ = SetupMySQLOrchestratorTLS(mysqlURI)
7373
}
74+
if config.Config.MySQLOrchestratorMaxAllowedPacket >= 0 {
75+
mysqlURI = fmt.Sprintf("%s&maxAllowedPacket=%d", mysqlURI, config.Config.MySQLOrchestratorMaxAllowedPacket)
76+
}
7477
return mysqlURI
7578
}
7679

@@ -95,6 +98,9 @@ func openTopology(host string, port int, readTimeout int) (db *sql.DB, err error
9598
readTimeout,
9699
)
97100

101+
if config.Config.MySQLTopologyMaxAllowedPacket >= 0 {
102+
mysqlURI = fmt.Sprintf("%s&maxAllowedPacket=%d", mysqlURI, config.Config.MySQLTopologyMaxAllowedPacket)
103+
}
98104
if config.Config.MySQLTopologyUseMutualTLS ||
99105
(config.Config.MySQLTopologyUseMixedTLS && requiresTLS(host, port, mysql_uri)) {
100106
if mysql_uri, err = SetupMySQLTopologyTLS(mysql_uri); err != nil {

tests/system/orchestrator-ci-system.conf.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"ListenAddress": ":3000",
55
"MySQLTopologyUser": "ci",
66
"MySQLTopologyPassword": "ci",
7+
"MySQLTopologyMaxAllowedPacket": 67108864,
78
"BackendDB": "sqlite",
89
"SQLite3DataFile": "/tmp/orchestrator.sqlite3",
910
"MySQLConnectTimeoutSeconds": 1,
@@ -12,6 +13,7 @@
1213
"InstancePollSeconds": 1,
1314
"HostnameResolveMethod": "none",
1415
"MySQLHostnameResolveMethod": "@@report_host",
16+
"MySQLMaxAllowedPacket": 67108864,
1517
"SkipBinlogServerUnresolveCheck": true,
1618
"ExpiryHostnameResolvesMinutes": 60,
1719
"VerifyReplicationFilters": false,

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ github.com/fatih/color
1818
# github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab
1919
## explicit
2020
github.com/go-martini/martini
21-
# github.com/go-sql-driver/mysql v1.6.0
21+
# github.com/go-sql-driver/mysql v1.7.1
2222
## explicit
2323
github.com/go-sql-driver/mysql
2424
# github.com/google/btree v1.0.0

0 commit comments

Comments
 (0)