The test requires that some steps occur before shard_2 comes up,
so shard_2 has a separate setup function. However, the test was trying
to combine teardown of shard_2 with the rest, which was confusing and
resulted in attempting to init mysql twice without tearing it down.
This splits out teardown of shard_2 so it behaves correctly and is
easier to understand.
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.
The test does a planned reparent, but then later steps assume the old
tablet is still the master. After the reparent, we should update the
test's expectation of who the master is.
SrvKeyspace object doesn't exist. Fixing an issue with zktopo
that was not returning correct error for missing SrvKeyspace.
Also fixing some (but not all) pylint errors in the files
I touched.
- vttablet now uses query service to talk to other tablet for health check.
- making all retries and timeouts configurable (using short values in tests).
- doing a single manual health check on source tablets so their health is good.
The Makefile previously listed tests explicitly for groups like
site_test and worker_test. These lists got out of date when tests were
removed from test/config.json, and the make rules broke. Now the groups
are defined in config.json itself, so there is one place to update
everything.
This commit changes the following protocols:
- binlog_player_protocol
- vtctl_client_protocol
The only BSON protocol left is vtgate pending the implementation of the
gRPC vtgate client.
Note that we originally added this change in
https://github.com/youtube/vitess/pull/1230
However, we reverted it because the Kubernetes tutorial and images were
out of sync. Therefore, this commit technically is the revert of the
revert.
Revert "Revert "Change protocol defaults to grpc.""
This reverts commit 5e5f40a04e.
We assume the latest backup is the one that's at the end when the list
of directories is sorted. This assumption is violated if we put the
tablet alias first in the name.
It's been changed to use vttest, and there is a script
that brings up everything, and tears down at the end.
The one problem with the new scheme is that the querylog
doesn't tell you which tablet the query came frome. Something
to think about in the future.
I've written a code generator that converts the python cases
into go. Some massage is needed after the conversion.
The downside is that it's a brainless port. No re-interpretation,
regrouping or gap analysis.
The race detector found a bug in the QueryExecutor. It probably
hasn't failed on production because the racy code paths were always
trying to set the variable to the same value.
- now rebuild serving graph in vtcombo to allow range queries.
- adding vtctl VtGateExecuteKeyspaceIds command.
- added an 's' to vtctl VtGateExecuteShard to be consistent.
- pass in an empty Session to Begin in vtcombo, otherwise panics.
Change the vtgateclienttest/services/callerid.go test to always return
an error when callerid is handled. The error will contain word
"SUCCESS:" if callerid matches. This is necessary since falling through
breaks the expectations of the caller.
In the connection's _execute_batch call, some routing will be
keyspace_ids, and some will be by shards. This means that an
_execute_batch may create both a ExecuteBatchKeyspaceIds and
ExecuteBatchShard call. Merge the results back together.
Add tests for ExecuteBatchShard in python_client_test.py and
vtgatev2_test.py.
Since BatchVTGateCursor only adds executemany and nextset functionality,
just add that functionality to vtgate_cursor.VTGateCursor. Fix tests and
code that refers to BatchVTGateCursor.
To comply with PEP0249, remove the BatchVTGateCursor execute and flush
sequence and use executemany instead. The first argument to executemany
is sql if all commands share a common sql (this is supposed to be an
"operation" parameter). The params_list will supply sql if the first
argument is None.
Each params in the executeany params_list generates a result set.
Implement the nextset() to walk through the result_set.
Update tests to use the new BatchVTGateCursor API.
Always open a new connection for every stream_execute. Reusing an
existing connection may cause problems if you are in a transaction; this
logic is simpler.
Also, change the cursor._get_conn() method into a cursor.connection property.
Only cursor.set_effective_caller_id(effective_caller_id) is now
supported. Sending effective_caller_id as an argument to PEP0249
functions will fail or be ignored.
In base cursor classes, Make set_effective_caller_id a separate call
rather than passing effective_caller_id through interfaces (cleanup to
come later).
Remove some try-except log-and-raise wrappers in vtgatev2 test methods.
The default logging, and put the logging in get_connection instead.
Vtgate connection stream_execute now detaches the BsonRPCClient from the
connection and closes it after the generator exits. The connection will
quietly open a new BsonRPCClient if another execute is called.
Move some common code into base_cursor.py.
Make the third_party StreamCursor._stream_execute return generators and
migrate stage variables out of the vitess clients.
This is the first pass for some subdirectories.
Recurring issues include:
1. Inconsistent quote chars. Use the same quote character as the first
use in the file (usually single-quote). Double quotes are OK if the
quoted string contains single quotes.
2. Bad indentation. Indent 2 for logic, 4 for continuations if the
previous line ends with '(', '[', or '{'. If drop does not immediately
follow the group-symbol, align with the opening group-symbol. I suggest
immediate drops, since these are stable if the content of the first
line changes, while aligning with the opening group-symbol requires
shifting the continuation lines.
3. Bad docstrings. A full docstring looks like:
"""Initial line ending with punctuation.
Optional text.
Args:
Arg1: Description.
Arg2: Description with
indented continuation.
Returns:
Return text.
Raises:
ErrorClass: Description.
"""
4. Vertical spacing. Exactly two blank lines before top-level classes
or functions. Exactly one blank line before non-top-level classes or
functions. No more than one blank line within top-level constructs.
Some of the tests connect to vtgate, then kill the tablet,
and execute a vtgate call that's expected to fail. Out of those,
some of them then go on to try to continue using the vtgate conn.
The problem is that depending on how long it takes to fail, the
first vtgate call might end up hitting a client-side timeout,
which closes the vtgate conn. In the case of gRPC, there is a
set of non-configurable reconnection attempts, which means the
calls can take a while to fail (based on the server-side timeout).
This change increases the client-side timeout for those tests,
to avoid racing with the server-side timeout.
The rename makes it clear that this is to OR non-trivial statements
for a single column together, not a general purpose OR, and not to
be used when a simple IN statement could be used.
AfterPrevValues is used for multi-dimensional, ordered traversal after
a continuation point.
1. Stop using youtube specific name as caller id.
2. Set caller id as TabletConnection field and use it in the remaining methods.
3. Delete _stream_execute2 in tablet.py since it is now identical to _stream_execute.
I can't get signals to work on the child processes launched by bash,
even if I use a helper script that explicitly signals its children.
That meant that test timeouts didn't actually terminate the test in
non-Docker mode.
We were only using bash to split the command line into args anyway.
Instead, let's just have the config give us the args pre-split.
Sending signals without bash in the way seems to work better.
Since go/bson no longer encodes the non-standard uint64 type,
it's not safe to send uint64 over bsonrpc for a field that is
unmarshaled into interface{}, since it will be unmarshaled as int64.
The only case where this happens is bind vars. We could fix bsonrpc
by switching it to use bson-encoded proto3 structs, since those
use concrete field types for bind vars rather than interface{}.
However, bsonrpc is deprecated anyway so instead of fixing it,
we will just switch to grpc for all clients written in Go that
talk to queryservice.
I accidentally removed it here: https://github.com/youtube/vitess/pull/1020
Original commit was:
commit ddbbca247a
Author: Alain Jobart <alainjobart@google.com>
Date: Thu Aug 20 12:20:56 2015 -0700
Adding topo server setup to this test, required in some environments.
(after adding a rule to build before tests).
Global build takes about 2s to build all binaries, and it saves
about 4s in one run of mysqlctl.py, so it's gonna be good!
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.
A tablet is never started with -tablet_type master and therefore the manual health check shouldn't support this as well. Nonetheless, any "replica" can become a "master".
1. bind variables in SplitQuery should not contain leading ':'.
2. fix custom_sharding.py test to pass through returned bind variables from VTGate.
3. fix SplitQuery tests in Java.
Found a good way to know which index caused a dup key error.
The error message itself contains that info. This is better than
looking at RowsAffected because there are other conditions that cause
that field to be 0.
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.