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

4064 Коммитов

Автор SHA1 Сообщение Дата
Alain Jobart 987ec108c6 Merge pull request #705 from youtube/resharding
Resharding
2015-05-21 15:18:12 -07:00
Alain Jobart fb10d05bfd Exporting a couple methods for other modules to use. 2015-05-21 14:46:15 -07:00
Alain Jobart 8f2a4c71aa Removing extra log line. 2015-05-21 14:41:48 -07:00
Alain Jobart 794e034a08 Moving filebackupstorage into its own package. 2015-05-21 11:15:29 -07:00
Shengzhe 3df76885f9 Merge pull request #706 from yaoshengzhe/fix_schema_rework
schema rework
2015-05-21 11:13:27 -07:00
Alain Jobart d89f042c5a Fixing backup timestamp format to be UTC, human readable, and correctly comparable.
Example backup name: test_nj-0000062345.2015-05-21.163734
2015-05-21 09:39:28 -07:00
Alain Jobart a5fd0206c4 Making GetBackupStorage return en error, instead of Fatalf-ing out. 2015-05-21 09:28:45 -07:00
Alain Jobart 1d1d71354a Merge branch 'master' into resharding 2015-05-21 09:22:52 -07:00
Alain Jobart 3fd4524b3a Fixing contexts in these file. Short context is now
always named shortCtx, and never overrides the ctx variable.
Fixes vertical_split.py.
2015-05-21 09:03:15 -07:00
Alain Jobart d0cc07ae69 Simplifying file backup storage (implementation and plugins). 2015-05-21 08:54:52 -07:00
Shengzhe Yao f777f49938 monitor schema change dir in vtctld
1. Add two flags in vtctld: schemaChangeDir and schemaChangeController.
   schemaChangeDir specifies a parent directory that contains schema
   changes for all keyspaces.
   schemaChangeController controls how to get schema change sqls from
   schemaChangeDir and handle relevant schema change events.
2. Add RegisterControllerFactory in schemamanager that allows developers
   to register different Controller implementations.
3. Add test case to test when schema change failed on some shards.
2015-05-20 23:35:39 -07:00
Shengzhe Yao 318ebfc310 add GetKeyspace in the schemamanager.Controller interface
The idea is that sometimes a Controller implementation will take care all
keyspaces. In such case, schemamanager.Executor is not able to know keyspace
ahead.
2015-05-20 23:07:47 -07:00
Shengzhe Yao c1c3383834 remove uihandler and create UIController 2015-05-20 21:37:43 -07:00
Shengzhe Yao 1172c89697 merge DataSourcer and EventHandler interface
DataSourcer and EventHandler interfaces are good but often a concrete
EventHandler implementation needs some information only exists in DataSourcer.
e.g. A DataSourcer reads schema changes from a file system and an EventHandler
wants to move this file around to response different schema change events.
The information exchange would be hard to do with two separate interfaces, as
this level of abstraction introduces more boilerplate code.

This change combines these two interface into a single one: schemamanager.Controller,
which reduces one level of abstraction and the code looks more cleaner.
2015-05-20 21:07:18 -07:00
Alain Jobart 4c743918c0 Merge branch 'master' into resharding 2015-05-20 16:40:33 -07:00
Alain Jobart 90ff0d8535 Merge pull request #701 from youtube/log
Log
2015-05-20 16:39:45 -07:00
Alain Jobart cf568fdc28 Adding unit test for findFiles for backup.
Making other unit test simpler. Removing special case
for symlinks, unused.
2015-05-20 16:18:28 -07:00
Alain Jobart 85c2d155d6 Merge branch 'master' into resharding 2015-05-20 13:56:35 -07:00
Alain Jobart 9776e112ce Removing couple unused methods. 2015-05-20 13:54:55 -07:00
Alain Jobart a4bb4d36ad Removing now unused mysqld.GetMasterAddr and related uses. 2015-05-20 13:43:47 -07:00
Shengzhe 4dfb7e992f Merge pull request #702 from yaoshengzhe/fix_add_pk_column_in_split_query
add SplitColumn field to SplitQuery
2015-05-20 13:25:39 -07:00
Alain Jobart 979f0fdc4e Adding a unit test for backup/restore. Had to export a couple
flags so it's unit-testable.
2015-05-20 13:13:57 -07:00
Alain Jobart 9b9f96abd8 Deleting old Snapshot/Restore/Clone code. 2015-05-20 09:26:52 -07:00
Alain Jobart e15f38cd39 Removing clone.py & primecache.py, adding backup.py. 2015-05-20 09:00:23 -07:00
Alain Jobart dea26442d9 Merge branch 'master' into resharding 2015-05-20 08:57:06 -07:00
Alain Jobart bbf0916778 Few cosmetic changes, and addressing cancellation better. 2015-05-20 08:03:01 -07:00
Michael Berlin 1b8cbb90f1 Initial version of automation framework.
The automation framework allows to automate cluster operations which
require a series of manual steps e.g. resharding.

A Cluster Operation has a list of task containers which are processed
sequentially. Each task container can contain one or more tasks which
will be executed in parallel.

Here's an example of a cluster operation with two task containers. The
second task container has two tasks:
- step 1
- step 2a | step 2b

If the task container contains one task, the task can emit new task
containers which will be inserted after the current task container. This
mechanism is used to fully expand Cluster Operations by special tasks
which emit new task containers e.g. "ReshardingTask".

This patchset implements the minimal steps to automate "resharding"
whereas task implementations for "vtctl" and "vtworker" are missing.
These will be added in later, separate commits.
2015-05-19 18:03:59 -07:00
Shengzhe Yao 199aa60881 add SplitColumn field to SplitQuery
1. Add SplitColumn field to SplitQuery so that caller could hint SplitQuery endpoint
   which column is best for splitting query.
2. The split column must be indexed and this will be verified on the server side.
3. coding style fixes suggested by golint.
2015-05-19 17:13:43 -07:00
Alain Jobart b342856305 Moving a few things to MysqlDaemon. 2015-05-19 15:04:04 -07:00
Alain Jobart b047c8c87f Make mysqlctl.Backup work on MysqlDaemon.
(unit tests to follow).
2015-05-19 14:45:12 -07:00
Alain Jobart d5c0a692ba Making restore code only use MysqlDaemon.
(for easier soon-to-be unit testing)
2015-05-19 14:31:54 -07:00
Alain Jobart fec083cfce Add vtctl ListBackups and RemoveBackup commands, and tests. 2015-05-19 13:50:41 -07:00
Alain Jobart b53f7e508d Adding fast fail when one routine reports an error. 2015-05-19 11:50:14 -07:00
Alain Jobart 6e9d87f6e7 Renaming checkInterrupted to checkDone to be more correct. 2015-05-19 11:42:34 -07:00
Alain Jobart 715c3fcddc Adding restore code to vttablet start. 2015-05-19 11:35:52 -07:00
Alain Jobart c7a6896b30 Merge branch 'master' into resharding 2015-05-19 09:10:22 -07:00
Alain Jobart 7baba1c2f9 Refactoring worker code some more:
- worker error is remembered and displayed by the framework
- adding a StatusWorker that has common code for all workers
  which maintain a state with a mutex.
2015-05-19 08:32:32 -07:00
Alain Jobart bac1177fb6 Merge branch 'master' into log 2015-05-19 07:22:29 -07:00
Ammar Aijazi 383e2c52e4 Added worker.py to cover worker integration tests 2015-05-18 16:29:47 -07:00
Alain Jobart ded4a347c3 Refactoring Worker to have an explicit context.Context. 2015-05-18 16:22:26 -07:00
Alain Jobart f71c09363e Refactoring backup interface. 2015-05-18 12:20:32 -07:00
Alain Jobart 0dc6e4bdd7 Merge branch 'master' into resharding 2015-05-18 12:01:52 -07:00
Alain Jobart 60fc388dbf Implementation of the backup core functionnality.
New integration test only tests the backup appears to work,
nothing serious yet. Need to refactor a couple more things to
be much easier to test it all with unit tests.
2015-05-18 12:00:16 -07:00
Shengzhe Yao 01efe324e6 delete go/vt/concurrency/resource_constraint.go
resource_constraint.go is not used by other packages, delete it.
2015-05-17 20:14:59 -07:00
Shengzhe Yao d48c3188f7 detect big schema change and reject it
1. Detect big schema change based on table rows. A schema change is
   considered big if 1) alter more than 100,000 rows, or 2) change a
   table with more than 2,000,000 rows.
2. Add unit test for TabletExecutor and also improve existing test cases.
2015-05-14 19:37:31 -07:00
Shengzhe Yao 82a0a18ac1 add unit test for ConsolveEventHandler 2015-05-14 19:37:31 -07:00
Anthony Yeh 69540e5030 Report timings of fast external reparents.
Export counts and histogram as debug vars for:
* time until new master is visible
* time until full rebuild is complete
2015-05-14 16:22:03 -07:00
Shengzhe 7b3cd72183 Merge pull request #696 from yaoshengzhe/fix_schema_golint
enforce camel case for TABLE_VIEW and TABLE_BASE_TABLE
2015-05-14 12:54:52 -07:00
Alain Jobart d2acc23b5a Merge branch 'master' into resharding 2015-05-14 11:58:57 -07:00
Alain Jobart 0829bd0c85 Use ioutil.ReadDir, remove obsolete code. 2015-05-14 11:34:23 -07:00
Alain Jobart 333b9cd089 Removing dependency from go/vt/health and go/vt/mysqlctl to topo. 2015-05-14 11:26:18 -07:00
Shengzhe Yao db1c4be5f2 enforce camel case for TABLE_VIEW and TABLE_BASE_TABLE 2015-05-14 11:24:57 -07:00
Alain Jobart cf9f348d45 Using agent.MysqlDaemon when we can. 2015-05-14 11:18:14 -07:00
Shengzhe 6d4d890d12 Merge pull request #693 from yaoshengzhe/fix_autoschema_rework
autoschema rework
2015-05-14 11:14:09 -07:00
Alain Jobart bf3823d40f Adding unit tests for FileBackupStorage. 2015-05-14 10:41:35 -07:00
Alain Jobart a748c47b1d Let optional hooks also work when VTROOT is not set.
That's easier for unit tests.
2015-05-14 08:41:17 -07:00
Alain Jobart 7d69f86b1c Interface definition for BackupStorage, file implementation. 2015-05-14 08:39:08 -07:00
Alain Jobart 9c41207892 Merge pull request #691 from youtube/resharding
Resharding
2015-05-14 06:59:02 -07:00
Shengzhe Yao 86f64b6769 fix mysqlctl/proto/schema.go coding styles 2015-05-13 22:46:20 -07:00
Shengzhe Yao ce518953e8 add more test cases for DiffSchema
1. Remove ByReverseDataLength since no one uses it.
2. Add more test cases for DiffSchema
2015-05-13 22:36:15 -07:00
Shengzhe Yao 0245dfb5ae add schema diffs in schemamanager
1. Make DiffSchema compare table views.
2. Add schema diffs in schemamanager. Each schema changes have to change
   table structure and schemanager rejects a sql that does not change
   any table definition.
2015-05-13 19:00:59 -07:00
Shengzhe Yao 7bd078f8af return error when schema change fails 2015-05-13 19:00:00 -07:00
Alain Jobart 119dd1b310 Fixing comment. 2015-05-13 16:43:23 -07:00
Shengzhe Yao a6daf21bb8 add ValidateSchemaKeyspace and ValidateSchemaShard back 2015-05-13 13:49:16 -07:00
Alain Jobart 2dfa25ea4c Refactoring {Start,Stop}Slave in mysqlctl.
With new way of doing things, we keep replication flags
in mocks in sync better, and unit tests test more.
2015-05-13 11:24:28 -07:00
Shengzhe Yao de3f07fccb remove simple flag in vtctl.ApplySchema 2015-05-13 11:14:06 -07:00
Shengzhe Yao 18099a706b add vtctl ReloadSchema back 2015-05-13 10:40:26 -07:00
Alain Jobart 9ad065b906 Fixing reparent code to restart replication appropriately.
EmergencyReparent used to stop replication on all slaves,
then SetMaster would see replication is off, and not restart it.

Fixed unit and intergration tests to test this case.
MysqlDaemon fake now only has one place to store replication status.

API changes:
- SlaveStatus returns a myproto.ReplicationStatus (not a pointer any more)
- StopReplicationAndGetPosition is changed to StopReplicationAndGetStatus
- SetMaster has an extra forceStartSlave boolean.
2015-05-13 10:20:51 -07:00
Shengzhe Yao 56f3def562 make schemamanager unit test does not rely on go/vt/topo/test/faketopo
go/vt/topo/test/faketopo package replies on wrangler package which causes
an import cycle in tests.
2015-05-12 20:20:52 -07:00
Shengzhe Yao 85fae2e9be make vtctl.ApplySchema accept a list sqls separated by semicolon 2015-05-12 19:54:22 -07:00
Shengzhe Yao 8d5f43bb1c change wrangler.ApplySchemaKeyspace to use schemamanager 2015-05-12 19:24:36 -07:00
Shengzhe Yao 6a2257ed51 remove several schema commands out of vtctl
Remove ReloadSchema, ValidateSchemaShard, ValidateSchemaKeyspace,
PreflightSchema, ApplySchemaShard and ApplySchemaKeyspace commands
out of vtctl. Those endpoints are still presented in wrangler package
and will be removed once autoschema is mature.
2015-05-12 18:20:16 -07:00
Shengzhe Yao 100e7db414 add console event handler for schema manager 2015-05-12 13:57:25 -07:00
Alain Jobart 56c694b7df Merge branch 'master' of github.com:youtube/vitess 2015-05-12 08:50:08 -07:00
Alain Jobart c13f568bcd Backport of fix in google tree. 2015-05-12 08:49:43 -07:00
Shengzhe Yao 5d2cb62933 TabletExecutor.Validate should return err when sql syntax is invalid
Add a test case that schema change should fail if executor.Open returns error.
2015-05-11 16:15:14 -07:00
Shengzhe Yao 5716f02e81 remove VtGateExecutor and add TabletExecutor
1. Stop applying schema changes through VtGate, using tabletmanager instead.
2. Update Executor api to not accept a list of shards as input. Schema
   changes need to apply to all shards.
3. Fix topo in SimpleDataSourcer.
2015-05-11 15:48:44 -07:00
Alain Jobart ec7a73a2ac Adding better synchronization for this test. 2015-05-11 12:59:21 -07:00
Alain Jobart 9ebd91dfbb Adding a pause to prevent race condition. 2015-05-11 12:54:25 -07:00
Alain Jobart 8e0dc72010 Merge branch 'master' into resharding 2015-05-11 11:20:33 -07:00
Alain Jobart 7521d6fe59 Adding common panic handling for queryservice server side,
and unit tests to make sure the implementation is called.
2015-05-11 08:57:54 -07:00
Alain Jobart 4df0c2b603 Merge branch 'master' into resharding 2015-05-11 07:56:48 -07:00
Alain Jobart 9302678856 Add unit test for binlog player / streamer RPC. Handle panics correctly too. 2015-05-11 07:55:50 -07:00
Shengzhe Yao 067bb1f948 do not check error returned from use database call in ExecuteFetchAsDba
Use database statement is executed if caller specifies dbname. However,
sometimes the given query is trying to create this database and error
will be returned when executing the use database statement. It is okay
to ignore this error because the next ExecuteFetch will run the query and
it will also fail.
2015-05-10 17:45:41 -07:00
Shengzhe Yao 3b4afd4e9b remove dbconfigName param in ExecuteFetchAsApp
1. Remove dbconfigName param in ExecuteFetchAsApp.
2. Rename GetDbConnection api in MysqlDaemon interface to GetAppConnection.
2015-05-10 16:59:10 -07:00
Shengzhe Yao 42e0505d36 add DbName param to ExecuteFetchAsDba
ExecuteFetchAsDba will execute use database statement if given
dbName is not empty.
2015-05-08 23:26:50 -07:00
Shengzhe Yao 92f19bded8 add ExecuteFetchAsDba in tabletmanager server
1. Add ExecuteFetchAsDba api in tabletmanager server.
2. Rename the existing ExecuteFetch to ExecuteFetchAsApp.
3. ExecuteFetchAsDba creates a dba connection on demand and takes care
   of enable/disable binlog and reload schema.
4. Add GetDbaConnection func in MysqlDaemon interface.
5. Make sure fakesqldb package always store queries in lower case.
2015-05-08 22:59:57 -07:00
Shengzhe Yao fb42692c9e move fakesqldb package from tabletserver to vttest 2015-05-08 14:14:21 -07:00
Anthony Yeh a4e3c04cfe Implement mysqlctl flavor for MySQL 5.6. 2015-05-07 22:31:43 -07:00
Anthony Yeh 9339525b4f Add position command to mysqlctl.
This is a utility command to do GTID Set computations by calling into
the flavor implementations.
2015-05-07 22:28:20 -07:00
Anthony Yeh b99b654c93 Fix Mysqld.FindSlaves() for MySQL 5.6.
In MySQL 5.6 GTID mode, the command listed in SHOW PROCESSLIST for slaves
is "Binlog Dump GTID" rather than just "Binlog Dump".
2015-05-07 20:50:58 -07:00
Anthony Yeh 152f04eaae Fix MySQL 5.6 SIDBlock off-by-one error.
Why do they add 1 to the end value when storing and encoding intervals?
I don't know, but it was maddeningly unexpected. I'll never get those
hours of my life back...
2015-05-07 20:50:58 -07:00
Anthony Yeh 7efc7061e1 Fix Mysql56GTIDSet.AddGTID when GTID is already contained. 2015-05-07 20:50:58 -07:00
Anthony Yeh 6bb5de4049 Add test for ResetReplicationCommands. 2015-05-07 20:50:58 -07:00
Anthony Yeh 77db953826 Move checksum algorithm detection to base type.
It's the same for all flavors we support, now that we've dropped 5.1.
2015-05-07 20:50:58 -07:00
Shengzhe Yao 772dcfb9ef add EnableAutoCommit flag to allow one enable/disable autocommit feature
1. Add EnableAutoCommit in queryservice, false by default.
2. If EnableAutoCommit is true, a DML outsides a transaction will be accepted
   by querservice and it will starts a transaction to execute this DML.
3. Turn on this flag in integration tests to make existing tests pass.
2015-05-07 14:24:11 -07:00
Alain Jobart c4d1964e94 For PlannedReparentShard, restarting replication on old master
after reparent is done. Might as well try it if possible.
2015-05-06 16:24:09 -07:00
Alain Jobart 3c9db21671 Merge pull request #670 from youtube/replication
Replication
2015-05-06 11:31:23 -07:00
Ammar Aijazi bd3f465001 Merge pull request #650 from youtube/aaijazi_dont_log_cancels_as_errors
Queries that have their contexts cancelled are logged as Info, not Error...
2015-05-06 11:27:13 -07:00
Alain Jobart 4ce7839dad Updating reparent doc, and adding flag to disable active
reparents to protect externally reparented shards.
2015-05-06 10:48:11 -07:00
Anthony Yeh 3b90724a36 Merge pull request #668 from youtube/mysql56
Implement GTID and GTIDSet for MySQL 5.6.
2015-05-06 10:33:55 -07:00
Alain Jobart d5e132db64 Making MasterConnectRetry a command line parameter instead of hard-coding it. 2015-05-06 09:21:33 -07:00
Alain Jobart 00d5262fa8 Now reparent doesn't interfere with slave replication status.
If they were replicating, we stop / set master / start, if they were
not, we just set master. Side effect is ReparentTablet may not
start replication if it was stopped, but it's better that way.
2015-05-06 08:52:57 -07:00
Alain Jobart 9656807a14 Now shutting down query service when demoting a master.
So the set read-only() actually works.
2015-05-06 08:05:18 -07:00
Alain Jobart 71fb7c4943 Moving read-only flag set around so it can be unit-tested.
Adding unit test checks for it.
2015-05-06 07:53:27 -07:00
Liang b08603e4c8 Merge pull request #664 from youtube/vtgatecode
Add stats to track dangling tablet conn.
2015-05-05 20:59:49 -07:00
Anthony Yeh 927cddc3f7 Add parsers for MySQL 5.6 GTID and GTIDSet. 2015-05-05 15:30:56 -07:00
Anthony Yeh 1cd37f7ca0 Implement GTID and GTIDSet for MySQL 5.6. 2015-05-05 15:30:56 -07:00
Anthony Yeh 57290ce3d4 Golint recommendations in BinlogStreamer. 2015-05-05 15:30:56 -07:00
Anthony Yeh 76555b2878 Check error from StripChecksum in BinlogStreamer. 2015-05-05 15:30:56 -07:00
Anthony Yeh df633d8054 Functions for inspecting GTID components return interface{}.
Different flavors use different types for each component.
2015-05-05 15:30:56 -07:00
Anthony Yeh 132d8ba402 Remove Last() from GTIDSet interface.
It was unused anyway, and it is not possible to implement in all
flavors.
2015-05-05 15:30:56 -07:00
Anthony Yeh d3167865d8 Add error return to StripChecksum.
In some flavors, it's possible that StripChecksum will be unable to
determine which bytes to strip. It should return an error in that case
to avoid the possibility of interpreting the data incorrectly.
2015-05-05 15:30:56 -07:00
Anthony Yeh c8e7b871f1 Fix querylogz_test timezone dependency.
The test was failing in a Docker image whose timezone setting was
different.

It was using time.Unix(), which adds local timezone info after
converting.
2015-05-05 15:17:52 -07:00
Anthony Yeh d2a8c1452e Merge pull request #665 from youtube/docker-bootstrap
Fixes for Docker bootstrap images
2015-05-05 15:00:43 -07:00
Anthony Yeh 6e519640d0 code.google.com/p/goprotobuf has moved to GitHub 2015-05-05 14:33:10 -07:00
Alain Jobart cc423828a8 Merge pull request #663 from youtube/topo
Topo
2015-05-05 14:04:24 -07:00
Alain Jobart 292cef6723 Adding a couple comments. 2015-05-05 14:03:19 -07:00
Liang Guo 4dafe135f3 Add stats to track dangling tablet conn. 2015-05-05 13:57:25 -07:00
Alain Jobart f90ec8653b Merge branch 'master' into replication 2015-05-05 13:53:38 -07:00
Alain Jobart ac4ed8deab Fixing indent. 2015-05-05 13:53:05 -07:00
Alain Jobart 00767a2710 Merge branch 'master' into topo 2015-05-05 13:48:59 -07:00
Shengzhe Yao 7bda925730 support autocommit for single dml
For a single dml that does not run inside a transaction, queryservice
will wrap it with a Begin and a Commit. In a case that query plan is
not recognized, Rollback will be called.
2015-05-05 13:48:15 -07:00
Alain Jobart f60eb91a01 Merge branch 'master' into topo 2015-05-05 13:47:22 -07:00
Alain Jobart 055b35fbdf Moving shard creation to topotools, and taking the keyspace lock.
That way when multiple tablets at initialization try to create the
shard, they won't trip on eachother. Should make tabletmanager.py
not flaky at all.
2015-05-05 13:46:11 -07:00
Alain Jobart 02999dfb0c Merge pull request #662 from youtube/resharding
Adding queryservice proto definition for grpc.
2015-05-05 13:41:15 -07:00
zspencer fe3bd14b38 Updated locate.go to fail if glob search directory does not exist. 2015-05-05 11:50:23 -06:00
Alain Jobart d855c85c5c Adding queryservice proto definition for grpc.
(in order for this to compile, need to get the latest grpc, with this:
go get -u google.golang.org/grpc
)
2015-05-05 08:45:18 -07:00
Alain Jobart 4cfa425d23 Merge branch 'master' into replication 2015-05-05 07:04:05 -07:00
Shengzhe 34d0e6afdf Merge pull request #658 from yaoshengzhe/fix_add_reload_schema_flag
add enableReloadSchema flag to ExecuteFetchAsDba in tabletmanager
2015-05-04 14:25:31 -07:00
Shengzhe Yao adffc0cc54 add reloadSchema flag to ExecuteFetchAsDba in tabletmanager
reloadSchema is false by default. If it is set to be true, ExecuteFetchAsDba
will reload tablet schema once it finishes successfully. In addition, this change
also make CopySchemaShard trigger schema reload.
2015-05-04 14:01:23 -07:00
Shengzhe 8b44629e41 Merge pull request #655 from yaoshengzhe/fix_add_schemamanager
add schema manager tab in vtctld
2015-05-04 13:36:41 -07:00
Alain Jobart 983380bd14 Removing LAG and LAG_ORPHAN types, unused now. 2015-05-04 08:33:30 -07:00
Alain Jobart 2f5c8bc094 Refactoring wrangler.tabletReplicationStatuses. 2015-05-04 07:59:37 -07:00
Alain Jobart 5e0ccdfd28 Adding unit test for last reparent function. 2015-05-04 07:48:52 -07:00
Alain Jobart 799c470119 Adding unit test for ReparentTablet. 2015-05-04 07:31:57 -07:00
Alain Jobart 97194eb4ed Adding unit tests for EmergencyReparentShard. 2015-05-04 07:18:50 -07:00
Shengzhe Yao 88829077f6 add schema manager tab in vtctld ui
The idea is that user could apply schema changes (DDLs) via schema manager tab.
Current code uses vtgate to do the schema change and this will be replaced by
an executor that applies directly to all vttablets.
2015-05-03 19:16:56 -07:00
Alain Jobart f1a48c9dd9 Merge branch 'master' into replication 2015-05-01 17:23:16 -07:00
Ammar Aijazi 078b33d21d tabletError correctly handles canceled contexts now 2015-05-01 16:22:44 -07:00
Ammar Aijazi f7e10f785a Queries that have their contexts cancelled are logged as Info, not Error, in VTGate 2015-04-30 18:47:38 -07:00
Alain Jobart 9a3e8637bd Cosmetic changes and small clean-ups. 2015-04-30 17:35:00 -07:00
Alain Jobart cc21f33ad5 StopSlaveMinimum now just returns a ReplicationPosition.
It doesnt need to return a ReplicationStatus.
2015-04-30 17:19:04 -07:00
Alain Jobart 31226aad61 Removing now unused WaitSlavePosition. 2015-04-30 17:08:23 -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
Alain Jobart 8cac7ed4ed Removing ReparentPosition 2015-04-30 16:46:55 -07:00
Alain Jobart 971dfa3d89 Remove RestartSlave. 2015-04-30 16:44:22 -07:00
Ammar Aijazi c42b2bfe90 Don't increment tablet ErrorCount in VTGate for duplicate keys 2015-04-30 16:42:00 -07:00
Alain Jobart a54a2f4d1a Removing BreakSlaves command. 2015-04-30 16:37:45 -07:00
Alain Jobart f838239e9b Removing PromoteSlave, renaming PromoteSlave2 to PromoteSlave. 2015-04-30 16:34:08 -07:00
Alain Jobart 32aede0709 Removing wrangler old reparent code. 2015-04-30 16:24:22 -07:00
Alain Jobart 2e819961fe Fixing schema to use new reparenting. 2015-04-30 16:23:24 -07:00
Alain Jobart 7aed36184d Reviving ReparentTablet, with its integration test. 2015-04-30 15:52:43 -07:00
Alain Jobart 1b281bd858 Addign event dispatch to new reparenting paths. 2015-04-30 15:11:41 -07:00
Alain Jobart a728be90df Removing external 'vtctl ReparentShard' command. 2015-04-30 15:11:17 -07:00
Alain Jobart 7d4b7699b2 First pass at EmergencyReparentShard. 2015-04-30 14:03:41 -07:00
Ammar Aijazi b79d0a56ef Merge pull request #647 from youtube/aaijazi_vtgate_dont_log_tablet_errors
Inside VTGate, log tabletconn.ServerErrors to Infof instead of Errorf
2015-04-29 17:47:10 -07:00
Shengzhe Yao 16b2c08b23 fix flaky querylogz tests
Go's select will randomly pick a case if one or more of the communications can
proceed. In querylogz_test.go, timeout is set to zero and then it inserts a
message to the channel. This sometimes trigers timeout and thus message is not
retrieved and rendered.

1. double check the timeout condition when there is a message in the channel.
2. add a large timeout in the unit test to avoid run into the race condition.
2015-04-29 15:25:13 -07:00
Shengzhe Yao c4cd624c41 fix flaky codex unit test
codex_test.go uses createTableInfo func to create a TableInfo instance
for testing; however, it uses a map to store columns and then iterates
that map to add columns into TableInfo instance. This is not deterministic
because map iteration order is not guaranteed to be the insertion order.
2015-04-29 15:24:04 -07:00
Ammar Aijazi 0cf64ebf00 Inside VTGate, log tabletconn.ServerErrors to Infof instead of Errorf 2015-04-29 15:00:42 -07:00
Shengzhe Yao f7b469540a remove queryservice global stats variables
1. remove global stats variables defined in query_engine.go.
2. introduce QueryServiceStats struct to be a holder of these stats.
3. use a dependency injection way to push QueryServiceStats instance from
   QueryEngine to ConnPool, DBConn, TxPool, etc.
2015-04-29 14:59:50 -07:00
Shengzhe Yao 2527cf5423 delete duplicate ErrConnPoolClosed defined in ConnPool
1. move ErrConnPoolClosed from query_engine.go to tablet_error.go.
2. delete duplicate ErrConnPoolClosed in ConnPool.
2015-04-29 10:19:00 -07:00
Shengzhe Yao cbba2bfa2c add dbconn unit test
add test cases to improve dbconn.go code coverage
2015-04-29 10:18:11 -07:00
Shengzhe Yao 703d954f2b add error as killable.Kill's return value
DBConn implements killable interface, it logs error but then ignores it. It is
better to let Kill func has error as return value.
2015-04-29 10:16:22 -07:00
Shengzhe Yao cb99c724d6 make sure queryservice not publish stats when not required
1. queryservice should not publish stats if either flag EnablePublishStats
    is enabled or var name is empty.
2. stats.NewInt should call Publish if name is empty.
3. mysqlctl.NewMysqld publishes dba stats only if dbaName is not empty.
4. mysqlctl.NewMysqld publishes app stats only if appName is not empty.
5. QueryEngine publishes stats only if flag EnablePublishStats is enabled.
6. RowCacheInvalidator publishes stats only if flag EnablePublishStats is enabled.
2015-04-28 15:49:46 -07:00
Shengzhe Yao 7f06896b6b sleep 100 millis for the second attempt
CachePool launches a memcache process, if failed, it will sleep 100 millis
before the next attempt. This slows down the unit test since a fake memcache
service is guaranteed to succeed.
2015-04-28 15:48:58 -07:00
Alain Jobart 4d9ce2465c Merge branch 'master' into replication 2015-04-28 12:50:24 -07:00
Alain Jobart 35793ce605 Adding basic unit test for PlannedReparentShard. 2015-04-28 10:31:27 -07:00
Shengzhe Yao 29ceae242c remove error as one of return values from DBConn.setDeadline
By inspecting the DBConn code, it seems error returned from DBConn.setDeadline
will always be nil.
2015-04-28 10:00:15 -07:00
Shengzhe Yao 6660741a1f impove connpool unit test
1. remove old unit test rely on local mysql instance
2. add unit test using fake mysql db implementation
2015-04-28 09:07:33 -07:00
Shengzhe Yao 6d3d128bae add test case for restoreTrailing 2015-04-28 09:05:31 -07:00
Shengzhe 5d290bbd03 Merge pull request #632 from yaoshengzhe/fix_codex_unit_test
improve codex unit test coverage
2015-04-28 09:03:38 -07:00
Shengzhe Yao 55c1ae101c improve codex unit test coverage
1. use TabletError for panics in resolvePKValues and resolveValue.
2. add test cases to test error scenarios.
2015-04-27 19:27:38 -07:00
Michael Berlin 92a7984ce2 Merge pull request #618 from youtube/mysql_flags
Pass "Flags" from MySQL field from the result set e.g. to preserve if integers are unsigned.
2015-04-27 17:16:56 -07:00
Michael Berlin 7169dbfb15 pools: Fix problem that Err() must not be called before Done was closed. 2015-04-27 15:57:43 -07:00
Alain Jobart af206c9ad7 Updating comments. 2015-04-27 14:55:06 -07:00
Alain Jobart 851c044067 Merge branch 'master' into replication 2015-04-27 14:53:17 -07:00
sougou 277310c9ae Merge pull request #625 from youtube/suguwork
grace period for tx pool Begin and other misc fixes
2015-04-27 11:37:46 -07:00
Shengzhe c3b687bd1f Merge pull request #627 from yaoshengzhe/fix_querylogz_race_condition
fix querylogz test race conditions
2015-04-25 00:13:58 -07:00
Shengzhe Yao fd9685b0e2 fix querylogz test race conditions
go/streamlog/streamlog.go starts a separate go routine for each new logger instance.
In the querylogz_test.go, it tries to call logger.Send(logStats) and then assumes this
logStats has been delivered. Then it calls querylogzHandler and verifies the result.
However, it is not guaranteed the message will be delivered after Send call, because Send
just put the message into dataQueue and only the go routine delivers it to each consumers.
2015-04-24 19:42:44 -07:00
Alain Jobart 184abfad8f Fixing tm unit tests, and shortening a constant. 2015-04-24 16:55:02 -07:00
Alain Jobart b4c2b12135 Moving code around so it makes more sense.
We don't STOP SLAVE, RESET SLAVE in InitSlave any more.
We don't use BreakSlaves on new master in InitMaster
any more, we just use a couple SQL statements to init binlogs.
2015-04-24 16:35:39 -07:00
Alain Jobart f865f43e97 Fixing merge from master, and unit test. 2015-04-24 15:59:02 -07:00
Alain Jobart a4e5068cfd Merge branch 'master' into replication 2015-04-24 15:49:32 -07:00
Sugu Sougoumarane bc30358eab Fix build issue with mysql.go
Including errmsg.h causes build problems on import.
So, punting on this for now by hardcoding the error code.
2015-04-24 15:03:22 -07:00
Michael Berlin 68ddcf73ae Pass "Flags" from MySQL field from the result set e.g. to preserve if
integers are unsigned.
2015-04-24 14:59:48 -07:00
Sugu Sougoumarane e89a1b8c0a tabletserver: grace period for tx pool Begin
Under load, Begin gets occasionally called just when the context
is about to expire. In such cases, the query gets killed as soon
as it's issued. However, The Begin call itself almost never fails
because it's too fast. So, this just results in the connection
getting closed, which isn't seen until the next statement executes,
and results in a confusing 2006 error.
So, we give ourselves a 10ms grace period to make sure that we
give Begin enough time to succeed. This way, we won't see as many
confusing error messages.
2015-04-24 14:55:51 -07:00
Sugu Sougoumarane 81b8b48520 Fix race conditions in ResourcePool
There's a race condition between context and resource pool.
If a context is already expired, there's still a chance that
a Get will succeed because both channels are ready to communicate.
This bug also masked another bug in dbconnpool and some other
bugs in our tests.
All fixed now.
2015-04-24 14:15:48 -07:00
Anthony Yeh 09a33831a7 Add tabletmanager StateChange event.
This event triggers based on actual state changes, rather than updates
to topology like the existing topo TabletChange event.
2015-04-24 14:11:36 -07:00
Anthony Yeh df7f6d0b30 Merge pull request #621 from youtube/mysql51
Deprecate Google MySQL 5.1 with extreme prejudice.
2015-04-24 10:58:08 -07:00
sougou c88513e39a Merge pull request #619 from youtube/suguwork
tabletserver: verbose error for killed queries
2015-04-24 00:44:18 -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
Alain Jobart a77526dea2 Adding a ResetReplication command (nuclear command for replication
logs and state). Calling it at InitShardMaster time.
2015-04-23 16:11:40 -07:00
Sugu Sougoumarane 9a8f8b8a35 tabletserver: verbose error for killed queries 2015-04-23 15:35:32 -07:00
Shengzhe e702c3744a Merge pull request #617 from yaoshengzhe/fix_add_querylogz_test
add querylogz unit test
2015-04-23 09:36:05 -07:00
Alain Jobart 26086e4c1f Fixing an initialization race condition in vttablet.
the mysql replication health reporter should be initialized
before ActionAgent, so the initial health check uses it.
2015-04-23 08:13:33 -07:00
Alain Jobart 651e804fc7 Handling a race condition better, and better error message. 2015-04-23 07:50:32 -07:00
Shengzhe Yao 0ebfea2b99 add comments to queryservice configs 2015-04-22 20:28:35 -07:00
Shengzhe Yao 23b0028599 add querylogz unit test
1. rename logzcss.go to logz_utils.go and move two util funcs from txlogz.go to it.
2. let querylogzHandler accept a streamlog.StreamLogger instance instead of always
   using SqlQueryLogger.
3. add two params timeout and limit to /querylogz, this allows one to control how many
   queries the querylogz page shows.
2015-04-22 16:54:21 -07:00
Alain Jobart 810aca09a3 More PlannedShardReparent work. Need a fix in InitShardMaster to make
more progress, I want to do it in a separate commmit.
2015-04-22 16:05:35 -07:00
Anthony Yeh 7f444655db Implement vio_socket_shutdown for MySQL 5.6. 2015-04-22 14:21:40 -07:00
Shengzhe Yao 9cc1024142 move some test util funcs from sqlquery_test.go to testutils_test.go
1. add newQueryServiceConfig, newDBConfigs and newMysqld to testutils_test.go.
2. enforce these funcs under testUtils struct for better code readability.
2015-04-22 10:29:21 -07:00
Shengzhe Yao b87e7d0329 improve cache pool unit test
1. add verify tablet error test func in testutils_test.go
2. add methods to enable/disable fakecacheservice
2015-04-22 10:21:24 -07:00
Sugu Sougoumarane ee0236140c Fix flaky rand ticker test.
Looks like 3ms is too small as tolerance for error. Increased it
to 20ms and scaled the other values accordingly.
2015-04-21 21:23:30 -07:00
Sugu Sougoumarane 4571ab645f Fixing broken tests
My previous changes were outdated and broke some tests. Fixed now.
2015-04-21 21:14:57 -07:00
Sugu Sougoumarane fbbea854f8 Merge branch 'master' into suguwork 2015-04-21 21:09:16 -07:00
Shengzhe Yao cbd9ce27b3 add EnablePublishStats flag in queryctl.go
This change allows one to publish system variables optionally.
2015-04-21 20:28:20 -07:00
Alain Jobart 6ce9533b42 Merge branch 'master' into replication 2015-04-21 14:37:21 -07:00
Alain Jobart 765898055d Merge branch 'master' into replication 2015-04-21 13:12:10 -07:00
Alain Jobart 93082cf55b Removing Shards from SrvKeyspace, as it has been replaced
by ShardReferences.

Also making rebuilding SrvShards an option of RebuildKeyspaceGraph,
and not doing it for Migrate* calls, to speed them up.
2015-04-21 09:21:41 -07:00
Alain Jobart 23ab6de9e8 Initial plumbing for PlannedShardReparent. 2015-04-21 08:14:35 -07:00
Shengzhe Yao 7fa6ae0c6a move Commit func from transaction.go to QueryEngine
transaction.go only has a single func Commit, it might make more sense
to move Commit to QueryEngine since it uses the QueryEngine's tx pool
and schemaInfo.
2015-04-20 19:54:35 -07:00
Shengzhe Yao 489fd1a840 add queryz unit test
1. move registerQueryzHandler to queryctl.go
2. move newTestSchemaInfo from schema_info_test.go to testutils_test.go
2015-04-20 13:51:25 -07:00
Shengzhe Yao 99a0c2954b add table info unit test 2015-04-20 13:49:23 -07:00
Shengzhe Yao 2be9fc5762 add tablet error unit test 2015-04-20 13:47:36 -07:00
Shengzhe Yao e53d76b8ff improve tx_pool unit test
add more test cases to test tx pool failure modes, this increases the test
coverage to 100%.
2015-04-20 13:45:05 -07:00
Alain Jobart 2093a975ca Merge branch 'master' into replication 2015-04-20 10:56:43 -07:00
Shengzhe Yao 9b05e53682 refactor sqlquery unit test and improve coverage
this change effectively brings sqlquery.go test coverage to 99%

1. add "queryCalled" in fakesqldb.DB so that tests could know number of
   times a query hits a database.
2. add testUtils struct in testutils_test and this struct contains common
   test funcs that could be used in tabletserver package.
3. add sqlquery tests to test SqlQuery.allowQueries failure modes.
4. add sqlquery tests to test SqlQuery.checkMySQL failure modes.
5. add sqlquery tests to test transaction failure modes.
6. add sqlquery tests to test SqlQuery.ExecuteBatch failure modes.
7. add sqlquery tests to test SqlQuery.SplitQuery failure modes.
2015-04-20 10:37:32 -07:00
Shengzhe Yao 699f376d5b add schemaz unit test 2015-04-20 10:35:54 -07:00
Shengzhe 0199cf0de2 Merge pull request #601 from yaoshengzhe/fix_rename_queryrules_test
rename query rules and query rule info tests
2015-04-20 10:30:42 -07:00
Alain Jobart 5c7dcccfb5 Removing SrvShard.ServedTypes field. It is unsued, and introduces
an unwanted dependency for rebuild.
2015-04-20 10:16:45 -07:00
Alain Jobart 6e0839f61a Merge branch 'master' into replication 2015-04-20 09:16:59 -07:00
Alain Jobart 25b168e609 Another batch of golint fixes 2015-04-20 08:59:32 -07:00
Alain Jobart 01a8e6097a Fixing a whole bunch of golint warnings. 2015-04-20 08:50:36 -07:00
Alain Jobart c23ec88a9e Switching a time.Now().Sub() to time.Since() 2015-04-20 07:19:45 -07:00
Alain Jobart 4e83c96cd2 Fixing a few things after comments. 2015-04-20 07:18:40 -07:00
Shengzhe Yao 4f3a6d6cbe rename query rules and query rule info tests
1. use panic in query rule info when registering a registered query rule.
2. fix a bug in query_rules.go that should get an error if "op" is < QR_IN or > QR_NOTIN.
3. add more test cases to test query rules failure cases.
4. fix a comment that the returned error should be "want bool for OnMismatch" when OnMismatched is not a boolean (instead of "want bool for OnAbsent").
2015-04-19 22:15:45 -07:00
Alain Jobart 1cd67f0224 Merge branch 'master' into replication 2015-04-17 13:13:47 -07:00
Alain Jobart 364907137a Merge branch 'master' into resharding 2015-04-17 13:13:34 -07:00
Alain Jobart 1a3f9122ec Merge pull request #587 from youtube/log
Log
2015-04-17 12:21:51 -07:00
Shengzhe 87973f1151 Merge pull request #595 from yaoshengzhe/fix_rename_streamlogger_and_add_unit_test
add streamlogger unit test
2015-04-17 11:27:17 -07:00
Shengzhe Yao 0219839503 add stream queryz unit test
1. Refactor stream_queryz.go, move registerStreamQueryzHandlers to queryctl.go.
2. Add two funcs: streamQueryzHandler and streamQueryzTerminateHandler.
2015-04-16 18:42:36 -07:00
Shengzhe Yao 0ff9188783 add streamlogger unit test
1. Rename streamlogger.go to sqlstats_stats.go since this matches file content better.
2. Rename QUERY_SOURCE_* contants to use camel case as suggested by golint.
3. Create a testutils_test.go to contain common test unitilies that could share among
   all queryservice unit tests.
2015-04-16 16:18:06 -07:00
Liang 9a66064719 Merge pull request #594 from youtube/vtgatecode
Do not connection_life to re-connect for master.
2015-04-16 16:02:55 -07:00
Liang Guo 781979e7d3 Break TestShardConnLife into two smaller tests. 2015-04-16 16:01:50 -07:00
Shengzhe 9024a88814 Merge pull request #593 from yaoshengzhe/fix_reenable_tableacl_test
re-enable tableacl test case: TestInitWithValidConfig
2015-04-16 15:51:37 -07:00
Shengzhe Yao de456ad0ee re-enable tableacl test case: TestInitWithValidConfig 2015-04-16 15:45:57 -07:00
Liang Guo 88a861cd47 Do not connection_life to re-connect for master. 2015-04-16 15:45:37 -07:00
Alain Jobart f153a7e33c MigrateServedTypes only rebuilds the cells it should.
(the change already existed in MigrateServedFrom, this was overlooked).
2015-04-16 14:47:02 -07:00
Alain Jobart 475fb4ff28 Merge branch 'master' into log 2015-04-16 14:23:10 -07:00
Ammar Aijazi 93cef85647 Add HTMLFromContext back into callinfo 2015-04-16 14:17:18 -07:00
Ammar Aijazi 6a8a5f209b Revert "Use CallInfo in VTGate, and restore context HTML to vtgate status page"
This reverts commit ee1d18dfed.
2015-04-16 14:12:38 -07:00
Liang Guo 9da3be63c2 Disable two failing tests. 2015-04-16 13:57:13 -07:00
Liang 5cdf8e8f76 Merge pull request #588 from youtube/vtgatecode
Allow client speficies if a query should not be in a transaction.
2015-04-16 09:54:36 -07:00
Shengzhe 0e7f266389 Merge pull request #589 from yaoshengzhe/fix_add_tableacl_unit_test
add tableacl unit test
2015-04-16 09:41:50 -07:00
Alain Jobart b9486a0b9e Merge branch 'master' into log 2015-04-16 08:27:49 -07:00
Shengzhe Yao 63032f0737 add tableacl unit test 2015-04-15 18:14:40 -07:00
Liang Guo c9d44e2b59 Allow client speficies if a query should not be in a transaction. 2015-04-15 17:11:15 -07:00
Ammar Aijazi fb0088b6a4 Add ContextHTML method back to SQLQueryStats 2015-04-15 16:37:12 -07:00
Ammar Aijazi d047fa8aca Catch and log errors for for whenever template.Execute() fails 2015-04-15 16:22:47 -07:00