At startup, we already avoid asking mysqld for its port if we were given
the port in DB configs. However, we would forget this port when we later
trigger a recheck of the MySQL port.
It's important to trust the port that was given to us because it might
be different from the port that mysqld is actually serving on, such as
in the case that the host we were given is actually a proxy.
Signed-off-by: Anthony Yeh <enisoc@planetscale.com>
Fixes#5206
The conn schemaname var can get set through a new connection
or a ComInitDB packet. However, a use statement bypasses this
mechanism and gets handled at the vtgate level. This causes
problems because schemaName in the connection disagrees with
TargetString in vtgate.
To fix this, the new scheme calls a new handler function: ComInitDB
every time schemaName is initialized or changed in the connection.
This way, the TargetString remains the authoritative source
for the current db name.
I couldn't write a test for this specific behavior change because
the mysql go client does not implement support for ComInitDB.
But I've verified the things generally work as expected.
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Some tests still depend on the healthcheck timeout options.
So, tablet picker still needs to accept them as arguments.
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
* WaitForPos previously worked only for replicas. It's been
updated to work correctly for masters also.
* resultReader keyspace was hardcoded to source. The keyspace
name is now passed as input param.
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
* PlannedReparentShard: Fix more known-recoverable problems.
PlannedReparentShard should be able to fix replication as long as all
tablets are reachable and all replication positions are in a
mutually-consistent state.
PRS also no longer trusts that the shard record contains up-to-date
information on the master, because we update that record asynchronously
now. Instead, it looks at MasterTermStartTime values stored in each
master tablet's record, so it makes the same choice of master as
vtgates.
Signed-off-by: Anthony Yeh <enisoc@planetscale.com>
* PlannedReparentShard: Add -lag_threshold flag.
Signed-off-by: Anthony Yeh <enisoc@planetscale.com>
* Fix expected error in reparent test.
Signed-off-by: Anthony Yeh <enisoc@planetscale.com>
* PRS: Add test case for graceful recovery.
Signed-off-by: Anthony Yeh <enisoc@planetscale.com>
* PRS: Measure replication progress instead of lag.
Signed-off-by: Anthony Yeh <enisoc@planetscale.com>
On OS X, the arch command returns "i386". However, "uname -m"
returns x86_64, which is the value the rest of the bootstrap.sh script
expects. This commit writes a function "get_arch" to wrap the "arch"
command, which calls uname on OS X and arch on Linux
Signed-off-by: Ben Muschol <ben.muschol@airbnb.com>
This temporarily stops setting the RestorePosition in local_metadata
because the table's value column is not big enough to fit typical
replication positions, and therefore tablets are blocked from restoring.
We plan to re-enable RestorePosition after altering the local_metadata
table to make the value column big enough.
Signed-off-by: Anthony Yeh <enisoc@planetscale.com>