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

168 Коммитов

Автор SHA1 Сообщение Дата
Anthony Yeh b89d988e30 Make MySQL users and privileges configurable.
This gets rid of the opaque mysql-db-dir.tbz archive, replacing it with
a .sql file. The .sql file approach makes it clear what state the DB is
initialized with, and also makes it easy to customize.
2015-11-10 11:41:24 -08:00
Sugu Sougoumarane aab1c7f9c2 tableacl: remove file dependency for test 2015-10-17 22:54:48 -07:00
Sugu Sougoumarane 478a515462 vtgate planbuilder: simplified tests 2015-10-17 12:15:37 -07:00
Sugu Sougoumarane 1c31fbfd6a tabletserver planbuilder: lint errors fixed 2015-10-17 11:02:28 -07:00
Sugu Sougoumarane 80ddd79fc4 tabletserver planbuilder: simplified tests 2015-10-17 00:16:30 -07:00
Sugu Sougoumarane 69e659a7c7 sqlparser: move test inputs into go files
Idiomatic go recommends avoiding input data files because the
test is more readable if the test cases are right where they're
being used.
2015-10-15 19:56:20 -07:00
Sugu Sougoumarane 3a7c4251f8 sqlparser: special handling for DUAL
MySQL table names are case-sensitive, but the fake
DUAL table is case-insensitive. So, I've changed the parser
to always lower case this id.
We don't want to treat this as a keyword because the AST
then tries to escape it with back-quotes. So, it's better
to just treat this as a case-insensitive ID.
2015-09-04 15:17:06 -07:00
Sugu Sougoumarane dcdc993b15 sqlparser: improved error message
Put quotes around the last token to make the error
message more readable.
2015-08-20 00:34:53 -07:00
Sugu Sougoumarane 1e37ca1a68 tabletserver: INSERT IGNORE support
This feature is needed for improving the usability of
ExecuteBatch. People may want a dup key error from insert
to be ignored so that they can follow it with other statements.
In the implementation, there's one caveat I had to handle, which
is that the ignore should be removed if it's an upsert. Otherwise,
we never get the dup key errror.
2015-08-18 13:22:24 -07:00
Sugu Sougoumarane f788a6f1d7 tabletserver: upsert disallow values function
This is a more correct fix for disallowing values function.
I've verified that this function is only supported for the
upsert construct:
https://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html#function_values.
So, it's safe to disallow this at the parser level, just as we
do for last_insert_id.
2015-08-15 15:14:10 -07:00
Sugu Sougoumarane d3fc76999f tabletserver: upsert WIP
Upsert is mostly feature complete. There are still two
issues to resolve:
1. RowsAffected is returned as 0 if no rows were modified. So, we cannot
assume that no rows were matched. So, the value cannot be used to verify
if the dup key matched a pk or a unique key.
2. I mistooke VALUES to be VALUE, and coded defense against using that
construct in the parser. It turns out that the parser already allows use
of VALUES. So, I'll have to find a different way to prevent that usage
for upserts.
2015-08-14 13:23:33 -07:00
Sugu Sougoumarane 67a82405f0 upsert: Make value & last_insert_id as keywords
vttablet cannot support those two functions in upserts.
Marking them as keywords automatically prevents their use.
This way, we don't have to explicitly look for these keywords
inside upserts to prevent them. If/when we decide to support
them, we can add these keywords to the keyword_as_func
rule in the parser.
2015-08-11 14:40:59 -07:00
Sugu Sougoumarane 1f44573f2e sqlparser: support << and >> operators 2015-08-04 14:50:00 -07:00
Sugu Sougoumarane bd0e43c139 sqlparser: add tests to improve coverage 2015-08-04 14:32:01 -07:00
Sugu Sougoumarane f9824de263 sqlparser: fix another double negative bug 2015-08-04 14:04:34 -07:00
Sugu Sougoumarane 1c59d2e9b6 sqlparser: escape keyword names correctly
Fix for issue https://github.com/youtube/vitess/issues/797.
Names that used keywords were not always getting back-quoted
correctly during codegen. This is a comprehensive fix that
covers all such possible cases.
2015-08-03 21:57:03 -07:00
Sugu Sougoumarane 92c3650bc0 sqlparser: fix binary unary operator bug
This fixes issue https://github.com/youtube/vitess/issues/798
where a construct like "a - -b" produced incorrect code.
I also found a related bug where a construct like "- -a"
also produced incorrect code.
This is also a potential vulnerability because "--" is
treated as a comment.
2015-07-30 09:50:24 -07:00
Shengzhe Yao 2814466f00 add tableacl proto and refactor go/vt/tableacl
In short, the tableacl configuration will be represented as a
tableacl.proto. tableacl module holds a global "currentACL" instance
which maps a table group to its ACLs.

1. Introduce tableacl.proto which defines acl per table group.
   A table group either contains only one table or many tables
   that share the same name prefix.
2. Remove "All" and "AllString" funcs from acl.Factory interface.
2015-07-19 22:30:42 -07:00
Sugu Sougoumarane 9f45f64fe0 sqplarser: Limit nesting for all parenthesized exprs
The previous change only handled nesting for one construt.
This change extends the limit to all parenthesized constructs.
2015-07-03 23:38:30 -07:00
Sugu Sougoumarane ccf0fcec25 sqlparser: Limit nesting of parenthesized exprs
This addresses https://github.com/youtube/vitess/issues/767
as well as other situations where there's possibility of
indefinite nesting of SQL constructs. There may be other
non-aprentheszed constructs that allow nesting, but this fix
doesn't address them for now.
I've also made a few lint fixes. sql.go is still in violation,
but that requires bigger work.
2015-07-02 06:31:34 -07:00
Anthony Yeh 682b1bfb94 Make vtctl print human-readable QueryResults.
The values within each row of a QueryResult were being JSON-encoded as
base64 byte arrays for every type. This JSON encoding was only being
used for tests, until the recent addition of vtctl commands that display
JSON-encoded QueryResults.

Now that we are displaying these to humans, we should display the
results as strings instead of as byte arrays.
2015-06-25 14:57:39 -07:00
Anthony Yeh cfceb34a8e Remove auto-generated UUID from bootstrap data dir archive.
Otherwise, all servers come up with the same UUID...
2015-05-05 15:30:56 -07:00
Alain Jobart 17d42b4461 Removing the _vt bootstrap db creation.
(this is now done on-demand).
Removing unused RestartSlaveData structure.
2015-04-30 16:58:57 -07:00
Anthony Yeh 7ee9142d8e Deprecate Google MySQL 5.1 with extreme prejudice.
As part of removing googleBinlogEvent parsing support, I reworked the
binlog_streamer_test to use fake events instead of real ones. The actual
parsing of real events is already tested in its own unit test. Using
fake events simplifies the binlog_streamer_test, which really is only
meant to test the logic for converting a stream of events into a stream
of transaction objects.
2015-04-23 23:23:28 -07:00
Anthony Yeh 3b3d7c23b8 Add bootstrap data dir archive for MySQL 5.6.
Generated with data/bootstrap/upgrade.sh from inside the
vitess/bootstrap:mysql56 Docker image.
2015-04-22 15:31:51 -07:00
Shengzhe Yao 63032f0737 add tableacl unit test 2015-04-15 18:14:40 -07:00
Alain Jobart 16807a416e Now using ShardReferences fields in a few places instead of
Shards in the Keyspace.Partitions map.
2015-03-16 08:42:25 -07:00
Shengzhe Yao afe57a3b03 stop writing old portmap names to topo server 2015-03-10 11:07:12 -07:00
sougou 0a8cd2f91c Merge pull request #283 from youtube/vtgate
Vtgate
2015-01-05 19:55:45 -08:00
Sugu Sougoumarane 2072e812e8 v3 proto: added Classes to vindex schema 2015-01-01 14:30:02 -08:00
Anthony Yeh 6346a707c0 Fix upgrade.sh by setting db-config args whose defaults were removed.
mysqlctl connects with vt_dba as part of checking that mysqld is up.
2014-12-26 13:31:24 -08:00
Sugu Sougoumarane 267b0a99bc v3 proto: error tweaks and test cleanups 2014-12-23 14:52:29 -08:00
Sugu Sougoumarane 6f8d43db0e v3 proto: router insert failure tests WIP 2014-12-21 21:12:56 -08:00
Sugu Sougoumarane 48cc8a5c5b v3 proto: insert.go full coverage tests 2014-12-20 14:03:48 -08:00
Sugu Sougoumarane 619bca55a9 v3 proto: where.go full coverage tests 2014-12-20 13:59:51 -08:00
Sugu Sougoumarane 2c879dae1e v3 proto: VTGate tests and tweaks 2014-12-19 20:11:28 -08:00
Sugu Sougoumarane fe105a7013 v3 proto: keyrange tests for plan building 2014-12-14 13:06:20 -08:00
Sugu Sougoumarane bbbee66eb5 v3 proto: add support for KEYRANGE in parser
In order to support split queries for map-reduce jobs,
we need a way to send queries to specific shards. But
we cannot assume that there will be physical keyspace_id
column in the table, which will prevent us from specifying
a keyrange on it.
So, we introduce the KEYRANGE construct which is a boolean
expression that VTGate can use to match the range to a set
of shards. Since the construct is not understood by VTTablet
or MySQL, VTGate will also strip the construct before passing
the query down.
2014-12-14 12:20:53 -08:00
Sugu Sougoumarane 022b290469 v3 proto: LookupHashMulti vindex 2014-12-13 22:31:34 -08:00
Sugu Sougoumarane 1b1aa6fb86 v3 proto: delete end-to-end tests 2014-12-13 17:09:35 -08:00
Sugu Sougoumarane eea867666f v3 proto: add subquery for delete plans
For owned indexes, we have to know which rows are going
to be deleted so that we can delete the corresponding vindex
entries. So, deletes need to run a subquery to identify
these rows. An empty subquery means that the table does
not own any vindexes.
2014-12-12 13:42:05 -08:00
Sugu Sougoumarane 68f2282550 v3 proto: insert router unit tests 2014-12-08 00:25:08 -08:00
Sugu Sougoumarane 23122c5f38 v3 proto: execution for Unsharded plans 2014-12-06 17:30:36 -08:00
Sugu Sougoumarane d79c19f45f v3 proto: router SelectEqual 2014-11-30 18:04:20 -08:00
Sugu Sougoumarane 2552f3cb5b v3 proto: insert plans 2014-11-30 00:08:57 -08:00
Sugu Sougoumarane b090909cbb v3 proto: dml plans 2014-11-29 19:59:48 -08:00
Sugu Sougoumarane 765297f26d v3 proto: select plans 2014-11-29 19:35:24 -08:00
Sugu Sougoumarane 8c06776fb1 vtgate v3: add tests to cover new code paths 2014-11-07 12:19:30 -08:00
Sugu Sougoumarane 18cd4e6b68 vtgate v3: planbuilder cleanup 2014-11-07 01:15:25 -08:00
Sugu Sougoumarane 046e0ed4fa vtgate v3: planbuilder unit tests complete 2014-11-06 00:44:43 -08:00