Граф коммитов

756 Коммитов

Автор SHA1 Сообщение Дата
GuptaManan100 6b6bb1cf0a Change tests to use testRun instead of singleRun
Signed-off-by: GuptaManan100 <manan@planetscale.com>
2020-10-29 12:32:50 +05:30
Rohit Nayak 7b3767be20
Merge pull request #6967 from planetscale/jg_fixdecimal
Pad non-fractional part of DECIMAL type
2020-10-29 07:56:49 +01:00
GuptaManan100 bdbdc3c8fe Cleanup after test
Signed-off-by: GuptaManan100 <manan@planetscale.com>
2020-10-29 12:22:00 +05:30
GuptaManan100 60a3e1fb32 Empty queries now work correctly exactly like mysqld
Signed-off-by: GuptaManan100 <manan@planetscale.com>
2020-10-29 11:58:04 +05:30
Jacques Grove cf843d4193 Pad non-fractional part of DECIMAL type with
zeroes when extracting from binlogs, or DECIMAL
types with non-fractional part > 9 digits may
end up vreplicated as a broken number with
a space.

Signed-off-by: Jacques Grove <aquarapid@gmail.com>
2020-10-28 20:40:31 -07:00
Rohit Nayak 774b7ddf37
Binary PK: fix bug where padding of binary columns was being done incorrectly
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
2020-10-28 14:14:26 +01:00
Shlomi Noach f541b19de7 OnlineDDL bugfix: make sure schema is applied on tablet
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
2020-10-20 10:14:53 +03:00
Andres Taylor b3cf183b13
Merge pull request #6783 from planetscale/client-session-track
enable client session tracking in mysql protocol
2020-10-15 15:14:53 +02:00
Andres Taylor 901c429193 Stabilize test
The test code was assuming that configuration had not had a chance
to be reloaded, but sometimes magnetic red shift lead to this happening.

Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-10-14 19:28:01 +02:00
Harshit Gangal 8b5798dbde removed ClientSessionTrack as default client capability. It needs to be set explicility
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2020-10-14 12:37:48 +05:30
Harshit Gangal 70c877fe0a set clientsessiontracking capability on handshake
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2020-10-13 18:39:22 +05:30
Harshit Gangal 0ac0a8d689 set session state changed data to query result
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2020-10-12 19:36:40 +05:30
Harshit Gangal 22fb28eb49 add gtid in ok packet as client session tracking information
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2020-10-12 18:09:19 +05:30
Andres Taylor 84324e6cbc clean up unit test
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-10-12 10:44:10 +02:00
Andres Taylor 5cc9684de9 Merge remote-tracking branch 'upstream/master' into client-session-track
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-10-07 07:20:58 +02:00
Andres Taylor 646ff9d8db DRYed error packet writing
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-10-05 09:29:06 +02:00
Andres Taylor 85ef131871 refactored handleNextCommand to make it easier to read
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-10-05 09:13:55 +02:00
Andres Taylor 11a574b3e0 style nit
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-10-02 16:47:41 +02:00
Andres Taylor 5cb6e5f0e0 Fewer situations where vtgate drops connections
Both when preparing and when executing prepared statements, Vitess
was dropping the connection on most errors. This change makes it
so Vitess instead returns an error packet but keeps the connection open.

Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-10-02 16:11:08 +02:00
Andres Taylor 7a530bb5e5 clean up tests to make them less fragile
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-10-02 11:45:21 +02:00
Harshit Gangal c806144f7f refactor queryresult and queryresponse to use packetok
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2020-10-01 22:43:01 +05:30
Harshit Gangal 3bf6c420ca write ok packet based on enabled capabilities
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2020-10-01 22:41:28 +05:30
Harshit Gangal 498709c778 added gtid ok packet test
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2020-10-01 22:25:58 +05:30
Andres Taylor f022181414 debugging failing test
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-10-01 12:28:17 +02:00
Andres Taylor 4f0210a1b4 Fix error around breaking of multistatements
When a multistatement query is received, any errors should
abort the execution of the remaining queries.

The `execQuery` and `handleNextCommand` were returning an error,
but not actually using the error value - just checking if it was nil or not.

We need to be able to know on the outside of `execQuery` if an error occured and if it was an error we need to close the connection for or if it was a simple execution error.

Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-10-01 10:33:13 +02:00
Harshit Gangal 37a9c9d9f0 added logic to extract all session tracking types
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2020-10-01 00:23:07 +05:30
Harshit Gangal da4eac613c writeokpacket to take packetok as parameter list
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2020-09-30 23:33:27 +05:30
Harshit Gangal 74c6843d6f added info to PacketOK
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2020-09-30 23:15:44 +05:30
Harshit Gangal 90d75fb22c return PacketOK from parseOKPacket
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2020-09-30 22:36:42 +05:30
Harshit Gangal bba2b17758 use connection as receiver in ok packer parsing to know the client capabilties flag settings
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2020-09-30 21:43:50 +05:30
Harshit Gangal ae20cc7010 added ok packet unit tests
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2020-09-30 20:16:06 +05:30
Andres Taylor 063d6c5e97 more work on writing packets correctly
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-09-28 14:11:04 +02:00
Andres Taylor 01154eac63 refactor byte array writing
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-09-25 11:23:09 +02:00
Andres Taylor f236234678 write session changed gtids to outgoing OK packet
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-09-25 11:00:03 +02:00
Andres Taylor 12933f7b28 refactor test
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-09-25 09:46:56 +02:00
Andres Taylor 58c54cff13 send session tracked gtids through sqltypes.Result
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-09-24 18:55:26 +02:00
Harshit Gangal 6776bb96bb added logic to extract session track gtids from mysql ok packet
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2020-09-24 19:25:59 +05:30
Harshit Gangal 9811d52fe3 added e2e test for session_track_gtids
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2020-09-24 19:18:32 +05:30
Harshit Gangal a5f509b5da added client session track capability flag when connecting to mysql
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2020-09-24 19:18:14 +05:30
GuptaManan100 aa0d1fcc75 Merged master
Signed-off-by: GuptaManan100 <manan@planetscale.com>
2020-09-24 13:04:57 +05:30
Richard fd4321845d
Change GRPC message limit SQL error type (#6630)
* impl+log

Signed-off-by: Richard Bailey <rbailey@slack-corp.com>

* correctly escape regex

Signed-off-by: Richard Bailey <rbailey@slack-corp.com>

* simple tests, remove logging

Signed-off-by: Richard Bailey <rbailey@slack-corp.com>

* years are dumb

Signed-off-by: Richard Bailey <rbailey@slack-corp.com>

* handle the other tow RE cases.

this is ... mabye a bit much with the factoring out but maybe not

Signed-off-by: Richard Bailey <rbailey@slack-corp.com>

* fix up comments, move impls around

Signed-off-by: Richard Bailey <rbailey@slack-corp.com>

* better better error comment <_<

Signed-off-by: Richard Bailey <rbailey@slack-corp.com>

* assert!

Signed-off-by: Richard Bailey <rbailey@slack-corp.com>

* to run test suite

Signed-off-by: Richard Bailey <rbailey@slack-corp.com>

* fix up testsv

Signed-off-by: Richard Bailey <rbailey@slack-corp.com>

* tests pass; remove dead code-as-comments

Signed-off-by: Richard Bailey <rbailey@slack-corp.com>

* pull out unnecessary processing

Signed-off-by: Richard Bailey <rbailey@slack-corp.com>

* don't differentiate trailing vs leading clarification

Signed-off-by: Richard Bailey <rbailey@slack-corp.com>
2020-09-17 13:43:22 +05:30
Vamsi Atluri 1302db066a mysql/client: Add support for caching_sha2_password plugin
caching_sha2_password plugin, unlike mysql_native_password, is a multi
step process. Client hashes the password using SHA2 algorithm and sends
it to the server. Server responds with either an AUTH_MORE_DATA (0x01)
packet or an Error packet.

Error packet is sent when authentication fails during "fast" auth (more
on this below).

The second byte of AUTH_MORE_DATA packet will either be 0x03 or 0x04.

0x03 represents a successful "fast" auth meaning that the server has a
cached hash of the password for the user and it matches the hash sent by
the client. Server will send an OK packet next.

Server sends 0x04 when the hash of the password is not yet cached. In
this case, client has to do a "full" authentication by sending un-hashed
password. If the client is connected using SSL or a Unix socket, client
can write the password in clear text. If this is not the case, client
has to request a public key from the server to encrypt the password.
Client should obfuscate the password using xor operation before
encrypting it with public key and sending it to the server. Server will
respond with an OK packet if autentication is successful or Error packet
otherwise.

Signed-off-by: Vamsi Atluri <vamc19@gmail.com>
2020-09-13 20:36:31 -07:00
Vamsi Atluri e91548e657 mysql/client: Initial handshake should not validate auth plugin
During the initial handshake, we are checking if the default auth plugin
of the server is supported by the client. In cases where the server
supports multiple auth plugins, this check is causing the handshake to
fail without giving the server a chance to send an Authentication Method
Switch Request.

This check happens anyway when handling the auth method switch request
and an error is thrown when server requests an unsupported auth method.

Signed-off-by: Vamsi Atluri <vamc19@gmail.com>
2020-09-13 18:12:56 -07:00
GuptaManan100 515122f27e Exporting Flavor constants from mysqlctl package
Signed-off-by: GuptaManan100 <manan@planetscale.com>
2020-09-09 16:21:13 +05:30
GuptaManan100 03cea8392f remove --ssl flag for later versions of mysql
Signed-off-by: GuptaManan100 <manan@planetscale.com>
2020-09-09 12:14:51 +05:30
Andres Taylor 8f50a63ab7 Handle arguments correctly for prepared statements
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-08-29 16:18:32 +02:00
Andres Taylor 361eec50b3 Rename SQLVal to literal
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-08-28 16:42:18 +02:00
Peter Farr 519c048f98 Resolved merge conflicts with master.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-08-19 16:55:08 -07:00
Jacques Grove 90b2f5e750 Trivial copy-pasta comment fixup
Signed-off-by: Jacques Grove <aquarapid@gmail.com>
2020-08-18 21:28:35 -07:00
Sugu Sougoumarane cac2ca7e5c
Merge pull request #6551 from planetscale/jacques_5825
Correctly report AUTOCOMMIT status in network packets
2020-08-17 13:22:42 -07:00
Andres Taylor 1a261b5ee4 Merge remote-tracking branch 'upstream/master' into jacques_5825
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-08-11 10:17:20 +02:00
Andres Taylor 20bfda5ab2 make sure to backtick db names properly
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-08-11 08:58:03 +02:00
deepthi f64c0af7fc replace more uses of slave with replica/replication
Signed-off-by: deepthi <deepthi@planetscale.com>
2020-07-31 09:01:25 -07:00
Jacques Grove 62b09bacb7 Issue #5825; reflect SERVER_STATUS_IN_TRANS and SERVER_STATUS_AUTOCOMMIT
flags correctly for queries.

Signed-off-by: Jacques Grove <aquarapid@gmail.com>
2020-07-28 21:20:59 -07:00
Peter Farr 70f7273f39 Finally passing. Hallelujah.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-07-27 16:23:37 -07:00
Andres Taylor a4739514ee clean up code
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-07-24 13:00:42 +05:30
Deepthi Sigireddi e86a967671
Merge pull request #6408 from arindamnayak/pitr-2
Implemented PITR-2
2020-07-18 13:28:56 -07:00
Arindam Nayak ecf278b381 improved the comment and rearrange the tests
Signed-off-by: Arindam Nayak <arindam.nayak@outlook.com>
2020-07-18 17:25:35 +05:30
Arindam Nayak eaf24547bf handle the case where upto snapshot time there is no binlog event
Signed-off-by: Arindam Nayak <arindam.nayak@outlook.com>
2020-07-17 20:08:55 +05:30
Arindam Nayak c500654d40 Implemented suggestion in PR comments
Signed-off-by: Arindam Nayak <arindam.nayak@outlook.com>
2020-07-16 20:11:59 +05:30
Sugu Sougoumarane 60322344fe
Merge pull request #6435 from planetscale/rn-schema-tracking-initial-schema
Schema tracking: initial schema insert
2020-07-15 21:08:14 -07:00
Arindam Nayak d24e79ea41 include changes for improving the error messages and comments, variable names
Signed-off-by: Arindam Nayak <arindam.nayak@outlook.com>
2020-07-15 23:55:01 +05:30
Peter Farr ce8945056f
Demote Master Refactor (#6365)
* Added a MasterStatus() method and carried it through the entire gRPC
chain, similar to what we do for SlaveStatus(). Other WIP changes to be
updated after getting approval on the MasterStatus() parts.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Small fixes per review suggestions.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Descriptive comments added per review suggestions.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Added unit tests and small fixes.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Refactored per review suggestion. Under new design, it's not possible to unit test anymore, since we don't have mock connections. Removed unit test because of this.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Fix very odd rebase issue I've never seen before, where rebase didn't show me conflicts in various files that it allowed to continue without fixing known conflicts.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Added new MasterStatus return for DemoteMaster and carried it through the entire call chain.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Remove deprecated field everywhere we possibly can, and ensure compatibility for newer client interacting with older server.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Remove copying of XXX fields, per review suggestion.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-07-14 14:58:06 -07:00
Arindam Nayak 0317a79ddf Merge branch 'master' into pitr-2
Signed-off-by: Arindam Nayak <arindam.nayak@outlook.com>
2020-07-14 11:09:11 +05:30
Sugu Sougoumarane b6c7ffcbd9
Merge pull request #6396 from planetscale/ss-ts1-state
tabletserver: improved state transitions with new stateManager
2020-07-13 19:03:26 -07:00
Rohit Nayak 648f93c6fe
Schema tracking: initial schema insert
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
2020-07-12 17:37:23 +02:00
Sugu Sougoumarane 3efba4be08 vttablet: stateManager tests WIP
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2020-07-11 14:07:48 -07:00
Harshit Gangal 820c56e85d savepoint: use session to store savepoints and pass on beginExecute
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2020-07-09 11:50:09 +05:30
Peter Farr 9f2b0fd0b7
Tablet Manager: Add Option To Stop IO Thread Only (#6335)
* Added the option to StopReplicationAndGetStatus() to stop only the IO Thread, and passed it all the way down the call chain to MysqlDaemon, where we can now call a new method (implemented in all flavors) which stops only the io thread, if that's what was requested.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Oops

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Remove hook per review suggestion.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Adjusted stop slave io thread to pass in a ctx because it's a new function. Adjusted StopReplicationAndGetStatus so that it stops the slave before getting slave status. This will ensure that the relay log information is correct.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Add back in logic to bail if slave is already stopped.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* We have to patch these in because after calling stop slave there won't be a master host and master port anymore when we grab slave status. Instead we need to patch in positions so we retain master host and master port, otherwise set master will assume the tablet is the master because it has no master host and master port. In retrospect its probably a bad idea that we assume no master host and no master port means we've found the master (in set master).

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Refactored per offline discussions. We now return before and after slave status, so we are more explicit, and don't nest business logic into subfields of a hybrid struct.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Fix issues that cropped up after merge conflict

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Change way we get this state to also pull in the Connecting state. We are either running, or attempting to run. Either way we are not not running.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Changed references from slave to replica per review suggestion.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Embed StopReplicationStatus into StopReplicationAndGetStatusResponse and rename fields to make it clear.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Various fixes per review suggestions.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Lets try out issuing a stop no matter what and see what happens.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Adding back in bailouts. They are necessary.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Get rid of more slave references.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Changed stopIOThreadOnly to an enum so we can change the way in which we stop replication in the future.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Add a test to ensure that we can stop the io thread only.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Fix incorrect test methodology.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Used a generated enum from proto per convention for the stop replication mode.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Scrub more references of slave without obfuscating MySQL statements that are being called under the hood.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-07-08 14:01:17 -07:00
Peter Farr 7d818333cc Updated logic to use dedicated method calls rather than faking the connection.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-07-07 17:48:27 -07:00
Sugu Sougoumarane c43bab5d68
Merge pull request #6416 from planetscale/ds-lint-fixes
linter fixes, remove staticcheck hook because golangci-lint includes it
2020-07-06 18:35:44 -07:00
deepthi 1b86928162 linter fixes, remove staticcheck hook because golangci-lint includes it
Signed-off-by: deepthi <deepthi@planetscale.com>
2020-07-06 17:23:15 -07:00
Sugu Sougoumarane 3754654f63 test: faster unit tests
The fakesqldb was waiting .25 seconds on every call to Close.
This speeds up the tabletserver test considerably.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2020-07-06 12:37:50 -07:00
Arindam Nayak d5bc7935db fix build issue
Signed-off-by: Arindam Nayak <arindam.nayak@outlook.com>
2020-07-05 16:32:06 +05:30
Arindam Nayak ca96cbc4a8 Added mariadb last gtid impl
Signed-off-by: Arindam Nayak <arindam.nayak@outlook.com>
2020-07-04 17:27:59 +05:30
Arindam Nayak 239ebb0a16 sync with vitess/master
Signed-off-by: Arindam Nayak <arindam.nayak@outlook.com>
2020-07-04 16:17:35 +05:30
deepthi 1acb6e0ad7 rename and deprecate RPCs, rename vars and files
Signed-off-by: deepthi <deepthi@planetscale.com>
2020-07-02 11:22:18 -07:00
akilan 1cc4907ddf fixing linter errors
Signed-off-by: akilan <as251@hw.ac.uk>
2020-07-01 05:58:16 +04:00
Arindam Nayak 6805b62189 added last method to gtid
Signed-off-by: Arindam Nayak <arindam.nayak@outlook.com>
2020-06-29 00:17:39 +05:30
akilan 5aa4709675 Handled ineffectual errors
Signed-off-by: akilan <as251@hw.ac.uk>
2020-06-23 23:03:24 +04:00
Deepthi Sigireddi aa909c5128
Merge pull request #6296 from vitessio/find-errant-gtids
Find Errant GTIDs
2020-06-17 11:56:30 -07:00
Peter Farr 703fe9bf37 Let's follow the same pattern here so the way that we throw out the master sid is consistent for both receiver and supplied SlaveStatus'
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-15 21:39:53 -07:00
Peter Farr e56a7c0b63 Check set for nil as well per review suggestion.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-15 20:42:11 -07:00
Peter Farr 1dd0f170d8 Just realized this was mutating our input. Fixed it to instead copy over to a new set rather than deleting master sid from existing set.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-15 18:25:15 -07:00
Peter Farr d315ef5127 Improve comment per review suggestions.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-15 18:13:52 -07:00
Peter Farr f1dc0b60b2 Added parsing of master uuid for MySQL flavor and wrote FindErrantGTIDs method on SlaveStatus. I think this belongs here because it's clear that we are referring to ErrantGTIDs of the receiver, and it gives us access to the MasterUUID when comparing relay log positions. Also added testing to verify correctness of new method.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-15 16:26:47 -07:00
Peter Farr 1c1cce0298 Added extra tests requested, and clarified a comment now that we no longer call the second stack s2, and instead just called it otherIntervals.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-15 13:44:36 -07:00
Sugu Sougoumarane 2bc5eac963
Merge pull request #6298 from luisfmcalado/prep-stmt-bind-variables
Fix prepared statements in column specs
2020-06-14 19:18:32 -07:00
Arindam Nayak 28df5988f9 PITR changes
- added ability to fetch the GTID from the restore time
- added ability to apply the binlogs till the above GTID

Signed-off-by: Arindam Nayak <arindam.nayak@outlook.com>
2020-06-14 20:39:41 +05:30
Peter Farr ec92f31349 Make Difference take and return concrete types, since it will only be used for Mysql56GTIDSet anyways.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-12 16:44:45 -07:00
Peter Farr 269689c87a Significant refactor to make code easier to follow, by defining the 6 possible combinations we might see when comparing two intervals. Expanded testing and filled out comments for clarity
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-12 16:37:27 -07:00
Peter Farr dbed330011 Completely refactored logic, and added multi-split test cases that pass.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-12 15:17:31 -07:00
Peter Farr fc586ef9cb Comment corrections.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-11 22:39:48 -07:00
Morgan Tocker ff3a33de5c Merge remote-tracking branch 'upstream/master' into fix-cmdline-flag-docs
Signed-off-by: Morgan Tocker <tocker@gmail.com>
2020-06-11 07:33:37 -06:00
Morgan Tocker bca8843abb Add additional flag fixes
Signed-off-by: Morgan Tocker <tocker@gmail.com>
2020-06-11 07:32:21 -06:00
Peter Farr bbb6148509 Clarifying comment.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-10 13:21:31 -07:00
Luis Calado 2c8bbcc173
shorter var statement
Signed-off-by: Luis Calado <luisfmcalado@gmail.com>
2020-06-10 19:29:47 +01:00
Luis Calado 63e2186ddb
Fix prepared statements in column specs
Signed-off-by: Luis Calado <luisfmcalado@gmail.com>
2020-06-10 18:39:55 +01:00
Peter Farr 807acd5960 Wrote a Difference method and added a unit test to check that it functions. Unfortunately the data structure of other GTIDSets does not allow for us to represent a proper diff for those flavors.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-10 00:20:25 -07:00
Sugu Sougoumarane 87db352b51
Merge pull request #6217 from vitessio/refactor/emergency-reparent
Add relay log position and file-based positions to SlaveStatus.
2020-06-08 19:37:39 -07:00
Peter Farr 221e5e6b1c Updated to using testing framework per review suggestion.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-08 17:05:21 -07:00
Peter Farr c7b2653c52 Fixed issue with mariadb flavor. It errors out if Gtid_Slave_Pos is absent.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-08 12:50:44 -07:00
Peter Farr 8fbf2a2dcd Broke out core logic for parsing flavor specific slave status into helper functions for easier unit testing. Added unit tests to enforce all invariants we expect, and check logic of retrieval for all new fields.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-08 11:29:40 -07:00
Sugu Sougoumarane e13de6f450
Merge pull request #6249 from planetscale/jacques_6240
Fix issue #6240.  PR #6130 did not take the header length offset into
2020-06-08 11:09:00 -07:00
Peter Farr b9a018c4c8 Re-check this out from master to avoid whitespace diffs.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-05 14:07:30 -07:00
Peter Farr 41b7bb027f Refactored tests so we still check that nil of concrete type works for contains, and fixed position at least zero because it was failing for a similar reason.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-03 16:57:08 -07:00
Peter Farr 852791b2c6 Updated test based on new requirement that we expect the inverse.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-03 12:35:47 -07:00
Peter Farr 66e10835f6 I discovered that 0 for bitSize actually means uint destination.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-02 22:03:34 -07:00
Peter Farr 6504220047 We can simply add FilePositiona nd FileRelayLogPosition fetching to the common parseSlaveStatus function, and remove a lot of duplicate code for flavor specific logic. This commit also flips flavor_filepos to grab the FilePosition and FileRelayLogPosition acquired when parseSlaveStatus is run, and use those values for its fake GTID positions.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-02 21:44:16 -07:00
Peter Farr a93949e591 Fixed a very dumb mistake.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-02 21:16:57 -07:00
Peter Farr 27327d168c Comment clarity.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-02 21:15:26 -07:00
deepthi 25b4e4a385 fix flag docs to be more readable
Signed-off-by: deepthi <deepthi@planetscale.com>
2020-06-02 17:42:29 -07:00
Peter Farr 89365a05ba Add doc comment explaining new requirement of Contains implementations.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-01 18:34:52 -07:00
Peter Farr bf119467bb Moved the atoi calls inside the if to clean up code. Updated error returns to use already allocated strings rather than hitting the map again. Only check if other is nil per review suggestion.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-01 18:33:18 -07:00
Peter Farr 031e3a39fc Per an offline discussion, we decided to push this logic down into contains, because fundamentally if either receiver or other are nil, then we can't accurately determine if one set contains another.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-01 12:36:57 -07:00
Peter Farr 7214d28e4c Fixed file position implementation. It should return false if other is not actually of filePosGTID type.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-01 12:25:55 -07:00
Peter Farr 5128401ce5 Add nil bailout in case either incoming GTIDSet is nil.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-01 12:23:22 -07:00
Peter Farr f82ab97802 Fix Contains implementations for all flavors. Most weren't correctly nil checking both the receiver and other GTIDSet.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-01 12:02:50 -07:00
Peter Farr 4912bde4be Copy these fields over so we don't leak flavor specific info into an abstract interface. Fixed map keys for all flavors per review suggestion, and other various fixes per review suggestions.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-06-01 11:26:55 -07:00
Andres Taylor 79e068d819 Merge remote-tracking branch 'upstream/master' into ds-replica-transaction
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-05-31 09:35:32 +02:00
Jacques Grove 28b13379c3 Fix issue #6240. PR #6130 did not take the header length offset into
account in writeBinaryRow().  Not an ideal fix, but something cleaner
will involve invasive cleanup.

Signed-off-by: Jacques Grove <aquarapid@gmail.com>
2020-05-30 17:06:23 -07:00
Andres Taylor be11233cae Make tx_engine use read only transactions when in replica mode
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-05-28 10:19:18 +02:00
Sugu Sougoumarane 734ed78e52
Merge pull request #6215 from inexplicable/tlsconfig
SIGHUP support for tls config update
2020-05-27 19:55:13 -07:00
Peter Farr 5c94c9b841 Added a Comparable method which returns whether one position is comparable with another position. Also added an AllPositionsComparable function that takes a list of positions and returns true if all positions are comparable with one another.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-05-26 21:03:04 -07:00
Andres Taylor ce8d72d347 Uncommented tests
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-05-25 10:10:21 +05:30
Peter Farr e94f3a692f Added a field for getting relay log position to Status. Implemented mapping this for all flavors, and updated proto so this gets mapped to the proto type. Added fields for getting file position and file relay log position to support looking at relay logs for flavors that dont support getting the retrieved GTIDSet.
Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-05-22 17:34:41 -07:00
huiqing 6496d15094 SIGHUP for tls config update
Signed-off-by: huiqing <hzhou@pinterest.com>
2020-05-22 11:01:25 -07:00
Deepthi Sigireddi eb211754f9
Merge pull request #6184 from planetscale/mariadb-gtid-set
go/mysql: Fix MariadbGTIDSet multi-domain support.
2020-05-15 10:43:36 -07:00
Anthony Yeh dc27fda151
go/mysql: Fix flaky TestConnectTimeout. (#6188)
Signed-off-by: Anthony Yeh <enisoc@planetscale.com>
2020-05-15 10:41:04 -07:00
Anthony Yeh aa865ea1c1 go/mysql: Fix MariadbGTIDSet multi-domain support.
This fixes two bugs:

1. AddGTID was mutating the original set. GTIDSet implementations are
supposed to be immutable.

2. AddGTID and parseMariadbGTIDSet did not enforce any order among
domains, yet Equal and other functions expected order to be enforced.

This switches from a list to a map to better represent the fact that the
order of domains doesn't matter, which also simplifies some code.
We always enforce order when serializing back to a string.

Signed-off-by: Anthony Yeh <enisoc@planetscale.com>
2020-05-15 09:37:52 -07:00
Anthony Yeh 1c81ac2636 go/mysql: Fix TLS test for Go 1.13+.
The default TLS version changed, so we need to check the appropriate
counter.

Signed-off-by: Anthony Yeh <enisoc@planetscale.com>
2020-05-14 19:17:38 -07:00
Peter Farr 17dd6c60d8
GTIDSet Union (#6180)
* Corrected comment type.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Added Union to the GTIDSet interface

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Wrote Union implementations for all current implementors of GTIDSet interface.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* We need to check if stacks are empty before making comparisons.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Added unit tests for mysql56 and mariadb implementations.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Multiple fixes per review suggestions.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Added helper method for popping intervals so this logic doesn't need to live inside the while loop itself.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Multiple fixes.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Added test to ensure that return from Union is sorted by domain correctly. Also ran formatting.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* We don't need to explicitely non-allocate the second assignment.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Let this panic because supplying nil inputs is an invalid function call.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Comment update per review suggestion.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Add check for receiver being nil but other being non-nil, in case of union always return non-nil set.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2020-05-14 14:31:08 -07:00
Harshit Gangal d90138eeec return unknown db message on mysql connect to vtgate
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2020-05-07 21:55:02 +05:30
Harshit Gangal f65943bd7b remove cominitdb call with comquery with use statement
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2020-05-07 19:54:20 +05:30
Harshit Gangal 8905ac0bbd send use statement to vtgate instead of cominitdb method
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2020-05-07 19:30:26 +05:30
Keyur Govande da9cfe06cb Reduce the number of packets sent from vttablet to MySQL when
using TCP by creating the write buffers with pre-allocated space
for the header.

Signed-off-by: Keyur Govande <keyur_govande@yahoo.com>
2020-04-29 01:02:09 -04:00
Andres Taylor cc4f257a7e
Merge pull request #6042 from planetscale/sa-expression-evalution
VTGate Expression Evaluation
2020-04-17 14:25:44 +02:00
Saif Alharthi d391f0a354 Move evaluation expression to its own package
Signed-off-by: Saif Alharthi <saif@saifalharthi.me>
2020-04-16 21:32:40 -07:00
Sugu Sougoumarane 1a38850cdc mysql: push conn timeout handling into mysql
Since the parameter is in mysql's conn params, that's the right
place to handle this.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2020-04-13 16:48:39 -07:00
Rafael Chacon 8cc5f430c3 Improves error codes
Signed-off-by: Rafael Chacon <rafael@slack-corp.com>
2020-04-06 12:00:59 -07:00
Sugu Sougoumarane b72fb5d0ad
Merge pull request #5949 from planetscale/vrepl-filter
Filtered Vreplication: support int and varbinary filters for columns
2020-03-26 17:10:20 -07:00
Saif Alharthi 19ba263158 Fix prepared statements results parsing for signed values
Signed-off-by: Saif Alharthi <saif@saifalharthi.me>
2020-03-25 15:05:40 -07:00
Rohit Nayak fd3374a538
Also treat binary/blob types as varbinary, gofmt-ed ...
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
2020-03-24 21:56:04 +01:00
Rohit Nayak a8ce1a0ba0
Also treat binary/blob types as varbinary
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
2020-03-24 21:54:07 +01:00
Rohit Nayak e5642dc20a
varchar type can have only varchar or varbinary column types
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
2020-03-24 20:24:24 +01:00
Rohit Nayak 7a3b317ac8
Merge branch 'master' into vrepl-filter 2020-03-24 00:11:09 +01:00
Rohit Nayak 1457bd9496
Removed extraneous log
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
2020-03-23 23:34:46 +01:00
Rohit Nayak 9445b2880f
Only use styp if not null
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
2020-03-23 23:34:46 +01:00
Rohit Nayak cdded8887c
Handle varbinary correctly
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
2020-03-23 23:34:46 +01:00
Sugu Sougoumarane ac251455a4 schema: fix integration tests
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2020-03-22 16:43:41 -07:00
Sugu Sougoumarane de34e694bf schema: other unit tests passing
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2020-03-22 16:43:41 -07:00
Sugu Sougoumarane 6d4cc87d7d schema: schema tests working
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2020-03-22 16:43:41 -07:00
Sugu Sougoumarane 1754e6f596 schema: simplification WIP
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2020-03-22 16:43:41 -07:00
Sugu Sougoumarane 6fab6f4fc1 schema: Columns to Fields
This gets rid of the per-table describe call.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2020-03-22 16:43:41 -07:00
Sugu Sougoumarane 77911a20fd schema: deprecate table stats
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2020-03-22 16:43:41 -07:00
Sugu Sougoumarane a4e107d0a5 deprecation: tabletserver tests WIP
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2020-03-17 17:53:50 -07:00
Jacques Grove 32146f0c6a Merge branch 'master' of github.com:planetscale/vitess
Signed-off-by: Jacques Grove <aquarapid@gmail.com>
2020-03-06 16:40:24 -08:00
Jacques Grove a9bed09340 Do not drop leading zeroes in microsecond timestamps for prepared
statements.  Fixes #5900

Signed-off-by: Jacques Grove <aquarapid@gmail.com>
2020-03-06 16:38:56 -08:00
Sugu Sougoumarane 124cc4399b
DBConfigs Refactor (#5833)
* Added wrapper struct, modified usage

Signed-off-by: Saif Alharthi <saif@saifalharthi.me>

* Add go.mod

Signed-off-by: Saif Alharthi <saif@saifalharthi.me>

* Refactor dbconfigs and its calls

Signed-off-by: Saif Alharthi <saif@saifalharthi.me>

* Fix failing vstreamer test

Signed-off-by: Saif Alharthi <saif@saifalharthi.me>

* Fix copy and paste mistakes

Signed-off-by: Saif Alharthi <saif@saifalharthi.me>

* Made withCredentials a private function and refactored the calls

Signed-off-by: Saif Alharthi <saif@saifalharthi.me>

* Fix Tests

Signed-off-by: Saif Alharthi <saif@saifalharthi.me>

* Clean up code

Signed-off-by: Saif Alharthi <saif@saifalharthi.me>

* Extend DbConfigs and change method name

Signed-off-by: Saif Alharthi <saif@saifalharthi.me>

* Add Connect Method

Signed-off-by: Saif Alharthi <saif@saifalharthi.me>

* Pass Context as parameter

Signed-off-by: Saif Alharthi <saif@saifalharthi.me>

* Modify definition of DBConfigs

Signed-off-by: Saif Alharthi <saif@saifalharthi.me>

* Make Connect function part of the Connector definition

Signed-off-by: Saif Alharthi <saif@saifalharthi.me>

* Remove obselete functions

Signed-off-by: Saif Alharthi <saif@saifalharthi.me>
2020-03-05 08:31:25 -08:00
Sugu Sougoumarane cd0191913c
Merge pull request #5832 from adsr/db-conn-timeout
Add `-db_connect_timeout_ms` for timing out mysqld conns.
2020-03-04 21:03:41 -08:00
Rafael Chacon f0797e741b
Merge pull request #5881 from tinyspeck/sp-log-conn-accept-err
Log when we fail to accept a conn
2020-03-02 16:30:18 -08:00
Serry Park de0e7c4733 Log when we fail to accept a conn
Signed-off-by: Serry Park <me@serry.co>
2020-03-02 15:38:35 -08:00
Deepthi Sigireddi 2abd04fed8
Merge pull request #5874 from abursavich/patch-1
Remove allocation of unused bytes
2020-03-02 14:10:35 -08:00
Sugu Sougoumarane 8383470c15 mysql: flush buffer on inactivity
The mysql server uses buffered I/O. This works fine if the results
are streamed all at once. But if the streaming is intermitent, like
in the case of messages, the client may not get timely responses.

This new change flushes any unsent data if no other data is sent
within mysql_server_flush_delay (100ms).

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2020-03-01 20:49:18 -08:00
Andy Bursavich 4bf6010876 mysql: remove allocation of unused bytes
Signed-off-by: Andy Bursavich <abursavich@gmail.com>
2020-02-28 16:07:05 -08:00
Adam Saponara e8b87f9469 Add `-db_connect_timeout_ms` for timing out mysqld conns.
While testing vttablet-mysqld over TCP, we noticed mysql.Connect
sometimes blocks forever if the backend mysqld hit max conns. This
patch adds a timeout to this codepath. It defaults to 0 (no timeout)
for back compatibility.

Signed-off-by: Adam Saponara <as@php.net>
2020-02-24 11:56:57 -05:00
Jacques Grove fdc3c6e738 Address #5734 by forming MySQL error packet on query parse error during
COM_PREPARE

Signed-off-by: Jacques Grove <aquarapid@gmail.com>
2020-01-17 17:08:33 -08:00
Rafael Chacon 61a8ed44a1 Updates how master gtid position is obtained for file:pos flavor
When generating masterGTIDSet in file:pos most likely you will have a topology
like the following:

  Source A -> Target B (B has a vreplication stream from A)

From the target perspective, the source A is the master and you want to generate
a gtid that is based on binlog file position of that server.

As an example, let's see this topology:

  Master A -> Source B -> Target C (C has vreplication stream from B)

Prior to this change, masterGTIDSet was returning the binlogfile:pos of A. But
in reality, the Target C wants the position of B.

Signed-off-by: Rafael Chacon <rafael@slack-corp.com>
2020-01-10 16:38:59 -08:00
Rafael Chacon 085b8702b3 Fixes bug in filepos flavor
* Prior to this commit, flavorpos was using lexicographical comparison of the gtids.
  Thas was a bug in this context.

Signed-off-by: Rafael Chacon <rafael@slack-corp.com>
2020-01-10 13:15:12 -08:00
Jacques Grove 4fc742e176 Add vttablet auth support for external Azure MySQL.
Azure ignores the mysql_native_password in
the MySQL Login Request packet, and then issues
a Auth Switch Request specifying the mysql_native_password
again, and passing a new salt.

Signed-off-by: Jacques Grove <aquarapid@gmail.com>
2020-01-09 23:00:42 -08:00
Toliver Jue 3df2fd9173 Fix order
Signed-off-by: Toliver Jue <toliver@planetscale.com>
2020-01-09 10:30:37 +01:00
Toliver Jue 01950c9450 Advertise support for FOUND ROWS from server
Signed-off-by: Toliver Jue <toliver@planetscale.com>
2020-01-09 10:04:48 +01:00
Deepthi Sigireddi cafd1094ef
Merge branch 'master' into mysql-replication-bugfix 2020-01-03 10:53:22 -08:00
Ajeet jain 1836426f1e
removing unrequired statement based test as it is deprecated
Signed-off-by: Ajeet jain <ajeet@planetscale.com>
2020-01-02 10:30:15 +05:30
deepthi fa5d43ca2f setMasterLocked: RESET SLAVE if START SLAVE throws SQL error 1872
Signed-off-by: deepthi <deepthi@planetscale.com>
2019-12-30 18:54:38 -08:00
Sugu Sougoumarane 9daae6d8c0 tests: fix unit_race
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2019-12-22 21:55:11 -08:00
Sugu Sougoumarane 92083793ac tests: fix various tests
Fixes #5532
Fixes #5569
Fixes #5571

With this fix, unit tests pass for all flavors.
Also fix test.go to cover the newer flavors.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2019-12-22 13:13:01 -08:00
deepthi ca800b388f fix unit tests
Signed-off-by: deepthi <deepthi@planetscale.com>
2019-12-19 12:25:06 -08:00
Jacques Grove 175bb6592c Add proxy protocol support for vtgate.
Signed-off-by: Jacques Grove <aquarapid@gmail.com>
2019-12-19 12:25:06 -08:00
Morgan Tocker e6a7e4abba Add additional flavors, move flaky test
Signed-off-by: Morgan Tocker <tocker@gmail.com>
2019-12-13 12:53:10 -07:00
Saif Alharthi 93e0b213d3 Fix prepared statment buffer overwriting bug
Signed-off-by: Saif Alharthi <saif@saifalharthi.me>
2019-12-12 15:39:47 -08:00
Rafael Chacon dc0f4a3a5d Merge branch 'master' of https://github.com/vitessio/vitess into vtshovel-poc 2019-12-04 14:56:00 -08:00
Morgan Tocker 399f23accc Merge remote-tracking branch 'upstream/master' into morgo-semi-sync-optional
Signed-off-by: Morgan Tocker <tocker@gmail.com>
2019-12-01 09:11:18 -07:00
Morgan Tocker dc34efab5b Merge remote-tracking branch 'upstream/master' into morgo-semi-sync-optional
Signed-off-by: Morgan Tocker <tocker@gmail.com>
2019-12-01 09:10:19 -07:00
Rafael Chacon 69a4dd0af6 Merge branch 'master' of https://github.com/vitessio/vitess into vtshovel-poc 2019-11-27 16:19:31 -08:00
Rafael Chacon b1a8772d8e Fixes bug in filepos and adds test for statement mode
* StripChecksum was changing the type of the event. This was a bug.
* Adds test to vstreamer to reflect new support for statement based replication

Signed-off-by: Rafael Chacon <rafael@slack-corp.com>
2019-11-27 16:08:04 -08:00
Morgan Tocker 3abebd8f3a Make semi sync extension optional
Signed-off-by: Morgan Tocker <tocker@gmail.com>
2019-11-27 13:26:41 -07:00
Morgan Tocker 3720fea3e0 Update MySQL Server Version to 5.7
Fixes #4119

Signed-off-by: Morgan Tocker <tocker@gmail.com>
2019-11-27 09:50:12 -07:00
Jacques Grove 5d5e150858 Fix vtexplain race by waiting around for the fakesqldb tabletserver
instances to exit cleanly.  Fixes #5474

Signed-off-by: Jacques Grove <aquarapid@gmail.com>
2019-11-26 18:15:26 -08:00
Rafael Chacon 166570176d Fixes per rebase with file:pos feature
Signed-off-by: Rafael Chacon <rafael@slack-corp.com>
2019-11-26 10:23:52 -08:00
Rafael Chacon 6593e5df30 Merge branch 'upstream-master' into vtshovel-poc 2019-11-22 17:09:45 -08:00
Rafael Chacon 848f82b493
Merge pull request #5432 from planetscale/ss-filepos
vreplication: file:pos flavor
2019-11-22 16:39:05 -08:00
Peter Farr f7205b8a67 Bug Fix: Prepared Statements Bind Variables Nil Error (#5441)
* Fixed nil bind variables error by resetting bindvars to an empty map.  Also added a recover to catch panics that occur inside Logf due to FormatBindVariables call potentially panicking.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Changed import order back.  Order was auto-changed by IDE on save

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Using stored ParamsCount for capacity per review suggestion.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Added explanation comment per review suggestion.

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>

* Removed explicit panic after offline talk with sougou and deepthi

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
2019-11-22 15:47:17 -08:00
Sugu Sougoumarane f0763d7cf4 vrepl: tests for filePos flavor
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2019-11-12 22:23:40 -08:00
Sugu Sougoumarane b5fdcecf01 mysql: standardize how GTID is sent
The vstreamer sent GTIDs "as they came". With the new change,
GTIDs are sent only when they matter: on COMMIT, DDL or OTHER.

This new approach makes the protocol easier to understand. Also,
it makes it easier for filePos to continuously send file and position.
The correct values will get used when significant events like
COMMIT are encountered.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2019-11-11 21:54:46 -08:00
Sugu Sougoumarane 550f702c48 mysql: make filePos handle transactions
In this scheme, the filePos reader detects whether we are in a
transaction or not, and emits appropriate GTID events.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2019-11-11 20:14:36 -08:00
Sugu Sougoumarane 30290b1719 mysql: conn params and flavor specific code
Add Flavor as a conn param.
Add code to handle flavor-specific GTID.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2019-11-11 20:14:36 -08:00
Sugu Sougoumarane 89350ee300 mysql: filepos initial pull from PS repo
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2019-11-11 20:14:36 -08:00
Rafael Chacon 4bd4904e83 Style improvements
* Fix typo in some comments.
* Make VReplicator private again. This change is no longer needed. Originally we
wanted "vtshovel" to be an external process. Given that this now hooks into the
existent engine, there is no need to make this public.

Signed-off-by: Rafael Chacon <rafael@slack-corp.com>
2019-11-06 13:46:27 -08:00
Sugu Sougoumarane 501862ade1 mysql: handle db name correctly
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>
2019-11-03 02:37:19 -08:00