This addresses #2723.
This change is essentially a new protocol for V3. Although
backward compatible, it changes the connection model.
Basically, the newer V3 features will work only if you used
the new protocol.
The new model deprecates keyspace_shard, tablet_type and options
from ExecuteRequest and moves them into the Session. This means
that the Session is generally not empty, and may be updated
by any call to Execute or ExecuteBatch, even if the statements are
not transactional. Consequently, transactional methods like Begin,
etc. are deprecated in favor of Execute("begin").
Transaction modes will now be supported by new `SET` syntax, which
will correspondingly update the Session variable.
This also makes a connection that contains a session non-multiplexable.
We'll need to resolve whether it's still worth exposing this flexibility
to the clients, and if so, how.
For now, I've updated the Go driver to use the "modern" protocol.
However, the low level rpc (Impl) continues to support the older
functions like Begin, etc. This allows us to test the legacy
functionality.
All other clients: Python, PHP and Java are currently unchanged.
Given that this is a major protocol change, it hints at a 3.0,
but the changes are 2.1 compatible with the following exceptions:
* Go driver uses the new protocol.
* vtclient binary requires `-target` instead of `-tablet-type`, etc.
All tests are passing including PHP & Java clients. In terms
of upgrade:
* PHP and Java can be upgraded by just updating the code.
* Python will probably require a brand new library. The existing
vtdb contains way too much baggage, and it may not be worth
retrofitting this new incompatible protocol onto what's
currently there. I'm looking for a name. `vtdb2`, `vitessdb`?
StrictMode was an old flag and pretty much unsafe to turn off.
It's now been removed. Instead, if we detect that we're in RBR
mode, we use that to just pass-through queries that are otherwise
too complex.
Addresses #2530
This change makes VTTablet recognize that MySQL is running in RBR
mode. If this mode is detected, VTTablet will not rewrite
INSERT...ON DUPLICATE KEY constructs. It will just pass them
through instead. This allows MySQL to be run with CLIENT_FOUND_ROWS
option turned on, and the returned RowsAffected will be the
same as MySQL.
Additionally, if this mode is detected, VTTablet will also
skip adding update stream comments to other DMLs because
they're unnecessary.
initial WIP union commit
WIP: non-compiling, known not done; before branch for planbuilder.route.Select->SelectStatement type change
WIP checkpoint
WIP checkpoint...compiles
WIP on merge primitive
trivial test fix
support UNION in subqueries
preliminary tests
tests, responses to PR comments
copy queryConstruct to avoid data race
added tests for unsharded union
union distinct in unsharded cases; default in switch in from.go
We use this functionality to not send the log stats for the beginWaitForSameRangeTransactions() method.
NOTE: This is an automated export. Changes were already LGTM'd internally.
I've updated the code with a simple search and replace.
I also had to run "make proto" and regenerate the Python protobuf files because they include the Java class name in the generated code.
I fixed this by changing the JSON marshaller of the vtctl commands: For
protobuf messages we now use the "jsonpb" package which supports
emitting fields with zero values.
We already used this approach in the vtctld API endpoints. I've moved
the code to the "vtctl" package to make it more generic.
A drawback of this approach is that it doesn't cope well with our *Info
objects e.g. ShardInfo because the type switch recognizes them as
proto.Message and they have unexported fields which let jsonpb panic. To
work-around this, I've changed the vtctl code to marshal only the
embedded protobuf message and not the full *Info object anymore.
The previous parser changes explicitly disallowed constructs like:
SELECT...LIMIT UNION...
However, it turns out that 'some' people are using it. This change
accomodates such constructs without breaking the integrity of the
grammar.
With this change, we'll use the (potentially longer) -queryserver-config-query-timeout and not -queryserver-config-txpool-timeout (defaults to 1s) to limit the waiting.
This fixes the problem that waiting requests can fail too early with the error "deadline exceeded".
Also log the first error per error code.
I've also changed the behavior of the multi DML mode to continue executing more queries and not returning early if an error occurs.
vttest will start an actual MySQL instance and the vtcombo binary.
Then the test runs various queries and verifies that the number of rows affected is correct.
Due to the external processes, this test takes ~8 seconds to run.
This required several vtclient changes:
- return error instead of using exit.Return(1)
- enhanced "results" struct and always return it now
- moved DML logic into separate function and changed it to return a "results" as well
- moved non-DML logic into a function as well
The new option can be used to write unit tests with a specific vschema.
I also refactored the handling of the --schema_dir parameter and added the value as field to the Handle object because VSchema() needs to access it as well.
Before this change, a user could provide flags *after* the query and these would be ignored by the code. Now, the user gets an error and can fix the call.
1) fix typos in local env tutorial. Add the doc to left-menu
2) fix bug in error handling for vtworker's tasks
3) fix data racing issue in node.go
BUG=36510237
This change allows you to use parenthesized selects in insert
statements, which also includes selects in unions:
insert into a (select * from t)
insert into a(b, c) (select * from t)
insert into a (select * from t1) union (select * from t2)
This change also resolves the shift/reduce conflict introduced
by the previous change.
This change allows two extensions to the SQL syntax:
1. UNION statements can be followed by ORDER BY, LIMIT and LOCK clauses.
2. SELECT statements that are part of a UNION can be parenthesized.
The main purpose of allowing parenthesis for selects was to
support the following two constructs: (SELECT...) UNION (SELECT...)
and INSERT INTO a (SELECT...).
The initial approach was to allow parenthesizing of all SELECT
statements. However, just adding that as an additional rule
created conflicts. In particular, `((SELECT * FROM t))` could
be seen as a subquery with a parenthesized select, or a row
tuple with a subquery. We've avoided this conflict by allowing
parenthesis only for selects that are part of a union.
This change allows you to do the UNION construct. Additionally,
we go one step further and allow ORDER BY and LIMIT clauses
for unions which we didn't allow before. The tabletserver
planbuilder has also been extended accordingly. VTGate
support of unions will also need to be extended.
The construct for inserts will be addresed in the next PR.
If necessary, we could allow the top level statement to be
parenthesized, but that has no practical value. So, we can
skip that for now.
For now, the current grammar has 1 shift/reduce conflict, which will
be resolved once the support for the INSERT...(SELECT...) is added.
vtgate now gets the groups and sends them in the immediate caller id.
we store the time of the ldap query and refresh (in another goroutine) if
older than configurable threshold. this happens upon ComQuery. the simpleacl
implementation is now group aware, and the ldapacl plugin has been removed.
The authServerNone config lets you connect using no username & password
which is convenient for testing and demos. The example demo has been
changed to use this feature. This will allow people to just connect
to vtcombo using mysql and run ad-hoc queries.
This way any stray Go routines will be terminated before the test method finishes.
I needed this change to manually reproduce a problem where a bug did not cancel the context in case of an error.
There was a race where the throttlers were closed before ThreadFinished() on each throttler was called.
Therefore, ThreadFinished() did panic. This crashed vtworker and hid the actual error why SplitClone failed.