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

308 Коммитов

Автор SHA1 Сообщение Дата
Rohit Nayak 0882f189b3 Fixed various py tests by removing web_dir references. Removed test for the old vtctld webapp 2020-01-02 20:35:27 +01:00
Morgan Tocker b25d149479 Merge VTTOP and VTROOT variables
Disable prepared_statement test
Add a check to examples to make sure etcd is not running

Signed-off-by: Morgan Tocker <tocker@gmail.com>
2019-12-07 12:11:06 -07:00
Anthony Yeh 9a09f820bc
PlannedReparentShard: Fix more known-recoverable problems. (#5376)
* PlannedReparentShard: Fix more known-recoverable problems.

PlannedReparentShard should be able to fix replication as long as all
tablets are reachable and all replication positions are in a
mutually-consistent state.

PRS also no longer trusts that the shard record contains up-to-date
information on the master, because we update that record asynchronously
now. Instead, it looks at MasterTermStartTime values stored in each
master tablet's record, so it makes the same choice of master as
vtgates.

Signed-off-by: Anthony Yeh <enisoc@planetscale.com>

* PlannedReparentShard: Add -lag_threshold flag.

Signed-off-by: Anthony Yeh <enisoc@planetscale.com>

* Fix expected error in reparent test.

Signed-off-by: Anthony Yeh <enisoc@planetscale.com>

* PRS: Add test case for graceful recovery.

Signed-off-by: Anthony Yeh <enisoc@planetscale.com>

* PRS: Measure replication progress instead of lag.

Signed-off-by: Anthony Yeh <enisoc@planetscale.com>
2019-10-31 12:39:03 -07:00
hwdef ff0d02b624 test: update license
Signed-off-by: hwdef <hwdef97@gmail.com>
2019-10-22 13:12:59 +08:00
Rafael Chacon 5f8dc86bda Adds tests and fixes typo in vtctl command
Signed-off-by: Rafael Chacon <rafael@slack-corp.com>
2019-04-01 19:45:53 -07:00
Rafael Chacon 13aa747940 Merge branch 'upstream-master' into 4496-topo-serving-shards-refactor 2019-03-07 13:16:12 -08:00
Rafael Chacon 7092679c93 Fix bugs in new srvKeyspace functions. Update tests to reflect new changes
Signed-off-by: Rafael Chacon <rafael@slack-corp.com>
2019-02-13 14:51:58 -08:00
deepthi 16ca2c34d3 #4481 rollback changes made during reparent if we encounter errors
Signed-off-by: deepthi <deepthi@planetscale.com>
2019-01-24 17:08:13 -08:00
Andres Taylor be97d690eb Add capability create consistent transactions
To make this possible, some things are added:
 - The capability to lock all tables on a tablet, to momenterily stop updates
 - Once the database is locked, we can create multiple consistent snapshot
   transactions that all share the same view of the data
 - Adds the capability to have replication move forward to a specific point
   in the transaction log

This commit also refactors tabletserver and tx_engine, moving logic of
state transitions into the tx engine.

Signed-off-by: Andres Taylor <antaylor@squareup.com>
2019-01-18 16:26:25 +01:00
Sugu Sougoumarane b9b8cf113c resharding: safer MigrateServedTypes
MigrateServedTypes has been made idempotent: if it fails in
the middle, you can safely retry the operation. If the operation
has previously succeeded, retrying it will be a no-op (except
for master migration).

For master migration. A new Frozen field has been added to the
tablet control record. This field signifies the point of no
return. If a migrate fails before reaching this state, then
we undo everything and re-enable the source shards. Once we
go past the 'frozen' state, you can only go forward. If there
are failures after the frozen state, the migrate can be safely
retried until successful. Once successful, a retry will return
an error saying that there's no resharding in progress.

The resharding end to end test has been updated to demonstrate
these behaviors.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2018-10-06 18:41:19 -07:00
Sugu Sougoumarane fa31ef4f2c vreplication: resharding tests are passing
Had to make a few changes for this:
* binlog_player reads its own start & stop position. This is
  a more correct design. Previously, the caller supplied this.
* On VReplication update, the new controller inherits the previous
  controller's blp stats. This gives better continuity.
* split clone workers still need to call refresh state to make
  the tablets non-serving.
* MigrateServedTypes/From need to delete the VReplication streams
  for master.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2018-08-12 16:08:38 -07:00
Michael Berlin d0a850cf1e test: Work-around Python exception when getting the hostname on my Macbook.
All Python tests fail on my Macbook without this:

> $ ./test/python_client_test.py
> Traceback (most recent call last):
>   File "./test/python_client_test.py", line 24, in <module>
>     import utils
>   File "/Users/mberlin/vitess/src/vitess.io/vitess/test/utils.py", line 55, in <module>
>     socket.getfqdn(), None, 0, 0, 0, socket.AI_CANONNAME)[0][3]
> socket.gaierror: [Errno 8] nodename nor servname provided, or not known

Signed-off-by: Michael Berlin <mberlin@google.com>
2018-04-08 00:41:59 -07:00
Alain Jobart f77544f475 Fixing vtgatev2_test.
Which needed to:
- expose remote l2vtgate stats in a vars.
- add a vtgate flag to disable the local gateway, so vtgate can act as a
forwarder only.
2018-02-12 09:45:07 -08:00
Alain Jobart b18529cfa2 Folding l2vtgate into vtgate. Removing l2vtgate.
Now vtgate accepts the '--enable_forwarding' option. It exposes a
QueryService interface, that acts like the l2vtgate process used to.
Changed all the tests to work with vtgate in that mode now.

BUG=71858563
2018-02-12 09:45:07 -08:00
Michael Demmer 7389692af5 add a check that the refresh <= the ttl duration
The logic depends on the refresh being smaller than or equal to the
TTL so add a startup assertion that it is configured that way.

Also update all test cases that override the ttl to also override
the refresh interval to avoid hitting this assertion.
2018-02-04 21:34:20 -08:00
Alain Jobart 448c4f424d Fixing integration tests.
A 'not found' is not a vschema watch error any more.
2018-01-11 08:43:06 -08:00
Alain Jobart 62532cb0dc Raising a vtgate timeout in tests.
We may be waiting for initial state of tablets, that may take longer.
2017-12-14 10:56:53 -08:00
Alain Jobart bf746ab4f7 Removing mentions of 'zk cat' command.
ALso reworking the topology service doc in view of recent changes.
2017-12-06 10:20:50 -08:00
Sugu Sougoumarane 8baed2673a grpc: use FailFast as needed
Issues #3401, #3412
Now that we always dial asynchronously, we have to make sure that
requests don't fail fast. Otherwise, we sometimes see errors if
request is made immediately after dialing; Because the connection
is not ready yet.

Consequently, dial timeouts are obsolete. So, I've removed all
usage of it.
2017-12-02 14:44:19 -08:00
Sugu Sougoumarane e59f70bfe0 grpc: fix tests
Due to the changes to how fast-fail works, some tests
had to be changed to explicitly wait for vtworker to come up.
2017-10-17 14:40:26 -07:00
Michael Berlin 206666a376 test: Fix some pylint errors. 2017-09-22 20:52:33 -07:00
Michael Berlin e59a4c5d7d test: Move "set_log_level" to environment.py such that we can override it internally. 2017-09-22 20:48:18 -07:00
Michael Demmer 7b3427f694 add an end to end test for large grpc payloads
Set the max message size in tests to 5 MB which is larger than the
4MB default grpc max message size. Then add a test that ensures a
message larger than the default can be sent end to end using the
mysql client protocol.

Also ensure that queries larger than the max are properly flagged
as errors.
2017-08-28 17:03:19 -07:00
Pavel Ivanov ddf8d6e251 More fixes for tests that stopped working with new library versions. (#2911) 2017-06-02 20:31:12 -07:00
Pavel Ivanov b373bb21d3 Fix utils.py to not try to decode None. (#2909)
Some recent changes in python base64 library made it reject attempts to decode
None, which sometimes happens in tests.
2017-06-02 15:19:47 -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
Sugu Sougoumarane ea12c8f0f6 V3: new session-based protocol
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`?
2017-04-28 13:08:44 -07:00
Alain Jobart 16bc66f2c4 Linking mysql connector user to callerid.
Also adding an end-to-end test to validate the connector and the caller
id.
2017-02-27 09:40:36 -08:00
Sugu Sougoumarane 436882909e v3: query normalization DONE
normalize_queries flag and functionality in VTGate.
Also turned the flag on for local_database tests.
2016-12-27 16:56:55 -08:00
Alain Jobart c97b5be7d0 Merge pull request #2370 from michael-berlin/b26755052_vtgate_buffer
vtgate: Initial implementation of master buffer.
2016-12-22 16:37:47 -08:00
Alain Jobart 9c1edb6cbd Topology refactor: adding zk2 topology.
- Introducing topodata.CellInfo. Stored in the global topology server, it
describes a connection to a topology server for a cell. It has both a
server address and a root directory to use. Also adding vtctl commands
to deal with it. Existing zk and etcd implementations ignore these flags
for now.

- Now passing toplevel server address and root as generic topology
parameters. And using a topo server factory method.

- Changing the topo server registration to use a Factory method. It
creates a topology server implementation with a server address and a
root path. Existing zk and etcd implementations ignore these flags for
now.

- adding a zk2 topology implementation. It doesn't use any of the go/zk
code, and allows the specification of a root directory for both the
global cell, and each individual cell. It also is using a different
directory structure, consistent with what we want all new topo
implementations to use. And it stores the data as protobuf, not json.

- deprecating the legacy 'zookeeper' implementation. Adding instructions
to migrate from old server style to new server style.

- removing old janitor code, been replaced by topo validator workflow.

- Using a more generic vtctld topo explorer, will use it in all servers
soon.

- Fixing the ZK command line to decode protos and use new connection
library.

- topo2topo now also copies VSchema.
2016-12-15 16:40:53 -08:00
Michael Berlin 9a6793a67e test: utils.py: Add context managers for vtgate connections and cursor.
These will be used by the future vtgate buffer tests and should be used by all other future tests as well.
2016-12-14 00:50:54 -08:00
Michael Berlin 7027b75b7a test: utils.py: Set -stderrthreshold for vtgate.
After this change, test runs with -v will show the vtgate Go logs.
2016-12-14 00:50:54 -08:00
Pavel Ivanov a9dc7ef979 Add tests for schema swap code. (#2324)
This change adds a set of tests executing schema swaps with different error
conditions. This also fixes a few bugs in the schema swap code discovered while
running these tests.
2016-12-02 11:55:47 -08:00
Alain Jobart fa619007b5 Removing flag that combines begin+execute.
It is now the default. The RPC endpoints exist since before 2.0 GA was released.
2016-11-17 10:06:56 -08:00
Sugu Sougoumarane bef31d6405 go1.8 compliant functions in vitessdriver
I've left out the row support functions because most of them are
not supported by the protocol. The most important changes
are supported: contexts and named arguments.

* Deleted the deprecated shard specific connection support.
* Built go1.8, fixed compilation errors and added tests.
* Fixed documentation that was still stating support for v1 API.
* Fixed custom_sharding test that was relying on v1 API.
* Doc comments updated to explain isolation levels and named args.
* Code review comments addressed.
2016-11-04 13:28:56 -07:00
Alain Jobart 252eda49f7 Adding master election to vtctld.
- Including UI display of the redirect, and a fix in zk topology.
- Better Update support in vtctld2.
  Now always using a single Update structure, and json-encoding it.
  Omitting a bunch of fileds if empty in json encoding.
- Adding unit test for long polling.
2016-10-27 07:20:07 -07:00
Alain Jobart fe07e207aa Fixing resharding.py test for MySQL 5.6
It turns out we can receive an unrelated PREVIOUS_GTIDS_EVENT when
asking MySQL to stream from a given position. This is confusing our
state machine and has to be ignored.
2016-10-10 10:23:20 -07:00
Alain Jobart 20c57f85a5 Fixing a couple workflow minor things. 2016-10-04 17:55:19 -07:00
Alain Jobart 2ee2738bda Adding workflow library.
To manage long running workflows within Vitess.
It contains a sample Sleep workflow.
Wiring up the UI using WebSockets.
Also adding vtctl commands.
2016-10-04 14:09:31 -07:00
Michael Berlin 76c269e763 vtctl: MigrateServedTypes: Wait for several seconds for the old tablets to be drained before disabling their query service.
During a resharding, vtgate traffic is migrated from the old tablets to
the new tablets for each tablet type (RDONLY, REPLICA, MASTER).

Before this change, the query service of the old tablets was shut down
immediately and vtgate did serve errors until it noticed that it should
use the new tablets instead.

This is not necessary for RDONLY and REPLICA tablets where it is okay to
keep serving from old tablets for a limited time. (The MASTER is not
migrated yet and the old RDONLY and REPLICA tablets still get the latest
changes from the old MASTER.)

Therefore, we're waiting for some time now before we shutdown the query
service. During this time, the keyspace remains locked.

This change is a short-term solution. In the near future, it will be
replaced with the "vtctl WaitForDrain" command which actively watches
the QPS on all tablets and stops waiting once the QPS went to zero or a
timeout is reached.
2016-09-27 16:23:41 -07:00
Anthony Yeh 313d926f89 Update to gRPC 1.0.0 and protobuf 3.0.0. (#2012) 2016-09-23 11:41:17 -07:00
Alain Jobart 7b74d101df Adding ExecuteOptions to queries.
They are added to both to queryservice and vtgateservice.
Right now, they only contain the exclude_field_names option.

exclude_field_names is used by vttablet to strip the name from the
fields record. Note the clients don't use that yet, I want the ability
to do it first, then I'll add support for it in the clients.

Allowing ExecuteOptions in vtctl commands. That's how they're tested
now.

Side-changes:
- Removing wantFields from dbclient interface. We never want them.
- Small optimization on query fields for sequences.
2016-09-15 09:48:30 -07:00
Alain Jobart 7f4ed1c254 Adding l2vtgate flavor of initial_sharding.py.
I chose this test because it already uses vtgate, and we can test the
multiple l2vtgate case, as it interracts with resharding.
2016-07-27 09:51:03 -07:00
Alain Jobart a694f7f806 Adding l2vtgate mode to vtgatev2.py.
Everything passes with it, seems too easy.
2016-07-27 09:51:03 -07:00
David Slater 6b8270eb6e Added tests for shard organizer 2016-07-06 14:34:42 -07:00
Michael Berlin 38ecbd8a33 test: Improve documentation of the wait_step helper function. 2016-06-24 21:50:45 -07:00
thompsonja fa1c762560 Merge pull request #1809 from thompsonja/reparent_test_e2e
Update end2end Reparent test (kubernetes)
2016-06-24 14:40:27 -07:00
Joshua Thompson 5a25e5bea3 Move some shard name utility functions into its own file. 2016-06-17 16:07:14 -07:00
Michael Berlin 82b17c9750 test: Add throttler_client_protocol to protocol_flavor.py.
It is required for the vtctl throttler commands.
2016-06-08 23:01:26 -07:00