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

135 Коммитов

Автор SHA1 Сообщение Дата
Alain Jobart fe65a3125d Fixing all context imports.
Except the go 1.8 database driver, that one needs the go 1.8 context.
2017-05-18 09:56:17 -07:00
Alain Jobart 1bed2e48e8 Merging go/mysql/replication into go/mysql. 2017-05-18 09:25:15 -07:00
Alain Jobart e931f5a158 De-dupping a few constants. 2017-05-18 08:48:25 -07:00
Alain Jobart 5057fb0658 Moving go/sqldb to go/mysql.
Last type was SQLError.
2017-05-18 08:35:48 -07:00
Alain Jobart 6fcf5eec08 Moving ConnParams to go/mysql.
And moving endtoend tests from go/mysql to go/mysql/endtoend.
This breaks the go/vt/vttest circular dependency, and makes the
tests that need a MySQL instance all in the same place, cleaner.
2017-05-18 08:09:31 -07:00
Alain Jobart 828939550b Removing the sqldb.Conn interface.
Now using *mysql.Conn everywhere.
2017-05-17 16:54:23 -07:00
Alain Jobart 5bf6248b73 Moving utility method from sqldb to mysql. 2017-05-17 16:01:23 -07:00
Alain Jobart 0c95e5eab1 Renaming go/mysqlconn to go/mysql. 2017-05-17 15:17:40 -07:00
Alain Jobart 27049b3bf1 Removing deprecated go/mysql package. 2017-05-17 13:58:33 -07:00
Alain Jobart fb628e54db Switching to new mysqlconn by default for all.
This is just to make sure all tests pass.
This is based on the other branch.
2017-05-15 10:22:32 -07:00
Sugu Sougoumarane 7af23e1dde license: BSD->Apache v2.0
Please refer to #2694 and #2670 for motivation and reasoning for
this change.

I've tried to follow best practice in inserting the copyright
headers. In other open source projects, not all files carry
the notice. For example documentation doesn't. I've followed
similar ground rules.

I did not change the php because there is a separate LICENSE
file there by Pixel Federation. We'll first need to notify
them our intent before changing anything there.

As for the presubmit check, it's going to be non-trivial
because of the number of exceptions, like file types,
directories and generated code. So, it will have to be
a separate project.
2017-05-06 00:38:56 -07:00
Alain Jobart 3a8719c40b Removing unused constants. 2017-02-01 09:00:44 -08:00
Alain Jobart b9fbf195af Using error codes from mysqlconn library.
That removes a bunch of dependencies, so have to do an anonymous import
in dbconfigs.
2017-02-01 08:49:48 -08:00
Alain Jobart 61b933c5da Moving SSL params to conn_params. 2017-02-01 07:57:24 -08:00
Alain Jobart 2d80e52381 Moving redacted password to where it belongs. 2017-02-01 07:48:51 -08:00
Alain Jobart b3730911c8 Adding a flag to control which client to use.
It ends up being controlled for each connection type (except repl which
is always the new client).
2017-01-30 09:30:54 -08:00
Alain Jobart 710d0f2465 Using mysqlconn for replication connections.
In the process:
- Fixing bug in SendCommand.
  Need to flush the command, doh!
- Move ComBinlogDump to go/mysqlconn.
- Move ComBinlogDumpGTID to go/mysqlconn.
- Consolidating mysqlconn.{r,R}eadPacket.
- Removing replication methods from sqldb.
  Removing SendCommand, ReadPacket, and Shutdown.
  They are now on mysqlconn.Conn only.
- Simplifying BinlogEvent interface.
  HasGTID was always equal to IsGTID (was not the case with Google MySQL
  5.1, but that's not supported any more).
  IsBeginGTID can then be returned by GTID().
2017-01-17 09:04:44 -08:00
Alain Jobart 094184e415 New go native MySQL protocol package.
It implements both client and server side of the MySQL binary protocol.
A few notes:
- SSL is not supported yet. It wouldn't be too hard to add, but our
  current client library code doesn't support it either.
- only the usual mysql native password authentication is supported.
  Again, would be easy to support more.
- vtgate now has the option to listen using the MySQL protocol.
  The local examples are configured to do so.
- The API is not great, but is close to sqldb.Conn. Will be refactored
  once go/mysql is retired.
2017-01-16 10:29:09 -08:00
Alain Jobart 21065d11b2 Changing query.Field.column_length to uint32.
That's what the actual protocol size for the field is. Also documenting
the other fields, as they are uint16 or uint8 in the protocol.
And rebuilding all proto docs too.
2017-01-11 08:46:43 -08:00
Bryan Beaudreault 41ab6fb544 Optionally send additional C API fields through in responses
Removes exclude_field_name from ExecuteOptions, replacing with an
IncludedFields enum. Enum values allow specifying whether to return
all fields, just type and name (default), or just type (perf optimization)
Adds and updates tests
2017-01-05 22:02:54 -05:00
Alain Jobart 863b5bd020 Fixing test/cache_invalidation.py for MySQL 5.6
In the process:
- fixing binlog replay starting from a timestamp: we just cannot skip
  the events at a lower level, as the binlogs may contain format event,
  binlog GTID set events, and so on. We need to parse them all.
- adding support for MySQL 5.6 PREVIOUS_GTIDS_EVENT event. It contains a
  SIDBlock, adding parsing for that (we already had code to generate it,
  as it's used to start replication from a GTIDSet).
- Some code in vtmysql_internals.h was incorrectly compiling for MySQL
  5.6 and higher, when it should have been 5.5.
2016-10-07 11:57:07 -07:00
Alain Jobart dd61c62279 Moving three methods out of sqldb.Conn.
They operate on the sqldb.Conn, but they shouldn't be part of the
interface, as noone will override them.
2016-09-15 11:08:58 -07:00
Anthony Yeh 9b93e53741 Merge pull request #1712 from enisoc/mysql57
Support MySQL 5.7
2016-05-20 22:56:53 -07:00
Sugu Sougoumarane 2219353220 bugs: 30->32 2016-05-20 18:34:14 -07:00
Sugu Sougoumarane f5f689e802 bugs: b/28851938, b/28888701
The mysql API bug seems to trigger for very large data sizes,
likely greater than 1<<20. This is because we make go think
that those slices can't be bigger than that value.

The other fix is to prevent a divide by 0 error.
2016-05-20 18:21:27 -07:00
Anthony Yeh 3d22fa35ee go/mysql: Support MySQL 5.7 2016-05-20 17:59:37 -07:00
Anthony Yeh f6d2c0dfc2 Transmit SQLSTATE error info from MySQL client to Vitess clients. 2016-05-04 21:03:05 -07:00
Sugu Sougoumarane cf3ff453e3 mysql: better error on unrecognized types
Addresses issue #1516
2016-04-09 13:04:38 -07:00
Alain Jobart 0e33839950 Removing gorpc callerid and mysql/proto. 2016-03-16 10:01:16 -07:00
Sugu Sougoumarane a822e5d7f3 sqltypes: new Value
The new Value implementation is now based on the vitess types.
* The inner interface has now been replaced by typ and val.
* All Values are expected to be consistent with their types.
  For example, an Int64 type must contain a number.
* The functions that build values generally ensure consistency.
* There is a set of 'Trusted' functions that can bypass this
  consistency check. They should be used with care.
* The proto3 conversion functions build the correct Value types
  based on the field types.
* The bson conversion function provides a Repair function that
  allows you to fix up the types after the fact. This should be
  deleted after bson is deprecated.
* The building of Values from a QueryResult is non-trivial because
  the field info is not part of the QueryResult for streaming
  queries. So, the API requires fields to be explicitly passed in.
* Fuctions that encode or convert to native types expect Value
  to be consistent. If not, they panic.
* proto3.QueryResult is considered to be trusted. If it contains
  inconsistent data, it will cause panics.
* The EventStreamer has been fixed to ensure that the fields and
  rows it publishes are trustable: They can used as parameters
  to the Trusted API.
* The Raw() function usage has been minimized. We should see if
  it can be deprecated. This way, we can make Result truly read-only.

There are a few more tweaks that need to be done:
* The Proto3ToResult call plumbing was hacked in to make everything
  work. That part needs cleaning.
* The bind vars don't need to be converted to their native types
  any more.
2015-11-17 12:59:45 -08:00
Sugu Sougoumarane 089e2bad40 more protos renamed
what's left: vtctldata vtctlservice vtgate vtgateservice vtrpc
vtworkerdata vtworkerservice
2015-11-12 01:13:51 -08:00
Sugu Sougoumarane 274cf0c29d proto/query -> querypb
I was bored.
2015-11-12 00:13:54 -08:00
Sugu Sougoumarane 71469f54c5 sqltypes: all code changed to use Result 2015-11-10 00:50:46 -08:00
Sugu Sougoumarane 03dd9b6f32 []mproto.Field -> []*query.Field
This part 1 of the QueryResult revamp. With this change,
vitess does not see any MySQL types. The BSON layer still
sends mysql types for backward compatibility, which will
be deleted once deprecated.
2015-11-09 01:52:07 -08:00
sougou 9ca1cc26e9 Merge pull request #1292 from youtube/suguwork
QueryResult transition: WIP
2015-11-06 09:35:44 -08:00
Sugu Sougoumarane 1fe934663f proto3 conversion: don't bounds check the lengths
It's better to panic if the proto3 lengths are invalid.
2015-11-05 23:52:05 -08:00
Sugu Sougoumarane ce67d707be sqltypes transition: MySQLToType panic on error 2015-11-05 23:37:27 -08:00
Sugu Sougoumarane 177277b53d sqltypes transition: missed a few inner refs 2015-11-05 21:45:19 -08:00
Alain Jobart 0754be310f Replacing Charset and BinlogTransaction with thier proto3 version. 2015-11-05 11:16:00 -08:00
Sugu Sougoumarane 1e20603a06 proto: bindvar, fields and rows tests 2015-10-25 21:06:29 -07:00
Sugu Sougoumarane 5aa0b5c830 proto: add error handling 2015-10-24 18:10:03 -07:00
Sugu Sougoumarane c7918063a3 New rows proto change
So far, unit tests are passing. Still need to look at clients.
2015-10-23 02:07:03 -07:00
Ammar Aijazi 8f032c6d0b Demote one more MySQL error from the logs 2015-10-07 16:44:42 -07:00
Sugu Sougoumarane 87a68455d6 mysql: some minor type tweaks 2015-09-28 22:04:43 -07:00
Sugu Sougoumarane c6aeeecbe8 tabletserver endtoend: rest of the types 2015-09-26 22:55:21 -07:00
Sugu Sougoumarane f9547c53f1 mysql: Fixed type constants to match 5.5 spec 2015-09-26 22:02:52 -07:00
Sugu Sougoumarane b5d1688e20 tabletserver endtoend: ints test
This change also introduces constants in mysql package for flags
and types. Additionally, I mask out flag bits that are not relevant.
This will help us be deterministic about what we do or don't support.
2015-09-26 21:38:15 -07:00
Sugu Sougoumarane d8b897afb0 tabletserver test: Fix up faking scheme
I found a few problems and shortcomings in the mocks:
1. A lock was being held while connecting to mysql, which should
be avoided.
3. Tests depended on a global variable (DefaultDB) being initialized
to different values at the beginning of each test. This would prevent
parallelization.
2. There was no way to use a real mysql connection in tests once
a fakesqldb was setup, which is needed for the queryservice tests
to be ported to go.

In the new scheme, I've added an Engine field to ConnParams. If it's
empty, then the default (MySQL) connection is used without locks.
If there is a name, then we use the map where other test engines
are registered.

The next change will convert the memcache faking to a similar scheme.
2015-09-22 16:28:44 -07:00
Alain Jobart 1f94d704cb Changing Sql in binlog to always be a string too. 2015-09-11 07:53:47 -07:00
Ammar Aijazi f8fb95ef83 Fix some golint errors; Sql => SQL 2015-08-30 17:04:40 -07:00