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

950 Коммитов

Автор SHA1 Сообщение Дата
Ammar Aijazi 4974cf48ca Convert a couple of TabletErrors to ErrFail instead of ErrFatal, as they should not ever be retried 2015-08-25 18:26:13 -07:00
Ammar Aijazi 7a998a49ba Add vtrpc.ErrorCodes to TabletErrors everywhere 2015-08-25 18:26:13 -07:00
Bradley Heilbrun d2e71cd403 Merge branch 'master' of github.com:youtube/vitess 2015-08-25 17:08:56 -07:00
Bradley Heilbrun 39789cbf03 Track table_rows, data_length and index_length for each table.
These fields come from MySQL's built-in information_schema.tables table.
Descriptions can be found here,
https://dev.mysql.com/doc/refman/5.6/en/tables-table.html
2015-08-25 17:02:57 -07:00
Sugu Sougoumarane 9603c3fb36 tabletserver: move rowcache invalidator into SqlQuery
With the new upcoming API changes, the rowcache invalidator
life cycle is going to be different from query engine.
So, it's better that SqlQuery owns and manages it separately.
2015-08-25 13:50:25 -07:00
Shengzhe Yao 8bfb569cf3 integrate tableacl with callerid 2015-08-24 18:49:50 -07:00
Anthony Yeh e830e28dea Make grpc the default for Go binaries talking to queryservice.
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.
2015-08-22 16:01:45 -07:00
Dean Yasuda 5fa76ff6f5 Merge remote-tracking branch 'upstream/master' 2015-08-20 12:45:05 -07:00
sougou e7aacff203 Merge pull request #1013 from youtube/suguwork
Error message improvements
2015-08-20 12:19:06 -07:00
Sugu Sougoumarane 9a3fa8204d tabletserver: terse error change
If the original request doesn't have bind variables, there's
no point resorting to terse errors. Might as well return the
full mysql error.
2015-08-20 01:06:47 -07:00
Ammar Aijazi 2b96585758 Suppress or demote some Execute errors in logs 2015-08-19 16:00:06 -07:00
Ammar Aijazi 1ee4476925 Demote MySQL deadlocks to INFO logs 2015-08-19 15:39:06 -07:00
Michael Berlin a91c7fd43f Merge pull request #1008 from michael-berlin/auto_add_task_wffr
automation: Add task WaitForFilteredReplication.
2015-08-19 15:01:38 -07:00
sougou 1393f52249 Merge pull request #1006 from youtube/suguwork
tabletserver: INSERT IGNORE support
2015-08-18 23:11:51 -07:00
Michael Berlin db7daa47a1 vtctl: WaitForFilteredReplication no longer requires a "Target" message in the StreamHealthResponse.
Unfortunately, "Target" is not set in SqlQuery for the destination master during resharding because its QueryService state is "not serving".

Therefore, the health check does not include the "Target".

I've removed the "Target" check for now to unblock the automation task.

However, I think we should fix this and untangle the "Target" in SqlQuery from the serving state respectively the healthcheck.
2015-08-18 17:26:19 -07:00
Michael Berlin 8c5a1db7a0 tabletserver: Remove TODO.
We decided that it's not necessary to implement it because it's no problem in practice.
(The producer would have to close and drain the channel.)
2015-08-18 16:16:57 -07:00
Michael Berlin 411f518d72 Merge branch 'master' into wait_for_filtered_replication 2015-08-18 14:14:04 -07:00
Sugu Sougoumarane faa84e2afc Merge branch 'suguwork2' into suguwork 2015-08-18 13:59:33 -07:00
Sugu Sougoumarane 4809ba5bd4 tabletserver upsert: Add clarification comment 2015-08-18 13:38:03 -07:00
Sugu Sougoumarane 3685adf293 Merge branch 'master' into suguwork 2015-08-18 13:30:56 -07:00
Michael Berlin cd1821dc35 tabletserver: Add new RealTimeStats fields to the test.
This ensures that conversions tests will fail because they test that all fields get properly converted. To fix the tests, we'll have to update the internal conversion.
2015-08-18 13:28:32 -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
Shengzhe Yao 3736372fee fix splitquery related tests.
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.
2015-08-17 15:36:07 -07:00
Shengzhe Yao 0c03e61532 fix lint warnings in sqlquery_test.go 2015-08-17 11:08:26 -07:00
Shengzhe Yao 09bff85552 make SplitQuery support VARBINARY column.
1. SplitQuery will split a VARBINARY column as a hex string. That is, it assumes
   the key range is [0x0000000, 0xFFFFFFFF] and then divides the range into
   intervals based on split count.
2. Introduce splitBoundariesStringColumn to handle string column case.
3. Refactor existing SplitQuery in sqlquery.go: create two helper functions
   getColumnType and getColumnMinMax.
2015-08-17 11:08:26 -07:00
Michael Berlin a281f605a6 vtctl: Add command WaitForFilteredReplication. 2015-08-17 00:17:25 -07:00
Michael Berlin 49e5fadd07 tabletserver: Add TODO where it's not clear if a channel should be closed to prevent resource exhaustion. 2015-08-16 23:25:09 -07:00
Sugu Sougoumarane 4aba6f3b7a tabletserver: upsert handles dup key error better
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.
2015-08-14 23:02:44 -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
Alain Jobart 26210aa7ce Fixing a bunch of things. Most integration tests now pass. 2015-08-10 09:33:07 -07:00
Ammar Aijazi 21945ddfb6 Add back unit tests for error handling in tabletconn, fix gRPC StreamExecute to return errors correctly 2015-08-07 14:13:54 -07:00
Alain Jobart bcb1647b49 Adding better error handling for grpc tablet client.
Still seems to break vtgatev2_test.py in grpc though.
2015-08-07 11:41:11 -07:00
Ammar Aijazi 3fde459af2 Merge pull request #954 from youtube/aaijazi_add_vitess_error_enum
Reworked Vitess error codes
2015-08-06 16:49:25 -07:00
Alain Jobart 6813971a29 Adding tests for callerid in client -> vtgate connections.
Fixing all the places that broke, in bson and grpc.
2015-08-06 11:08:56 -07:00
Ammar Aijazi 416747e390 Merge remote-tracking branch 'origin/master' into aaijazi_add_vitess_error_enum 2015-08-05 22:36:37 -07:00
Alain Jobart ed0c4c9cf5 Adding tests for caller ids, and fixing grpc / bson to they work. 2015-08-05 20:41:21 -07:00
Alain Jobart 9c7241c70d Adding unit tests for target. 2015-08-05 16:43:39 -07:00
Alain Jobart 63fdce3438 Merge branch 'master' into replication 2015-08-05 14:50:44 -07:00
Alain Jobart a483c92c37 Removing error in the app-level responses for queryservice / proto3. 2015-08-05 14:49:58 -07:00
Alain Jobart 813e4f1de9 Merge pull request #965 from alainjobart/replication
Replication
2015-08-05 13:36:27 -07:00
Alain Jobart e58395c43b Adding a couple missing targets. 2015-08-05 11:50:01 -07:00
Michael Berlin d8fa5fabf3 Make sync2.AtomicDuration a struct instead of an int64. 2015-08-05 11:47:26 -07:00
Michael Berlin 44ed38c73f Make sync2.AtomicInt32 a struct instead of an int32. 2015-08-05 11:47:26 -07:00
Michael Berlin 7ab0dde538 Make sync2.AtomicInt64 a struct instead of an int64.
This fixes the problem that the wrapped integer value can be used without having to go through the interface.

Fixed all unit tests where this problem occurred.
2015-08-05 11:47:26 -07:00
Alain Jobart 77eb7bc633 Changing TabletDialer for tabletconn to properly support
Target. Also changing the unit tests so the framework does more.
2015-08-05 10:31:21 -07:00
Alain Jobart 9f9230ccd4 Passing target more on the sqlquery side. 2015-08-05 08:40:30 -07:00
sougou 75dbd27fa4 Merge pull request #955 from youtube/suguwork
sqlparser: escape keyword names correctly
2015-08-04 11:31:34 -07:00
Sugu Sougoumarane bfec1d59f1 sqlparser: fix broken unit test
The last commit broke one unit test because it was using
upper case INDEX names, which is not possible in vitess.
Only table names can contain upper case letters.
2015-08-04 08:34:59 -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
Ammar Aijazi 6f481919a2 Reworked Vitess error codes 2015-08-03 16:11:39 -07:00
Alain Jobart 75b74d5f27 Merge branch 'master' into resharding 2015-07-30 11:14:03 -07:00
Alain Jobart dd9651562e Merge branch 'master' into resharding 2015-07-29 14:23:19 -07:00
Shengzhe Yao 4aea25ca80 fix queryservice integration tests related to tableacl
1. Deny any table access by default if tableacl does not find a ACL entry.
2. Fix queryservice integration test config file.
3. Log tableacl error only when 'queryserver-config-strict-table-acl' flag
   is turned on (default: off)
2015-07-29 14:14:39 -07:00
Alain Jobart 0ac6e67c08 Changing port to int32 in JoinHostPort.
int32 is used in all of our proto3 files for port.
2015-07-28 12:08:46 -07:00
Alain Jobart c9d2544fde Replacing portmap with port_map in proto3. 2015-07-28 12:00:30 -07:00
Alain Jobart e1e4a86269 Dropping more support for vts / encrypted port. 2015-07-28 11:39:04 -07:00
Alain Jobart a0044c91b3 Now using proto3 EndPoint everywhere. 2015-07-28 11:05:29 -07:00
Shengzhe Yao d152332123 add tableacl monitoring and support dry run mode.
1. Add three varzs TableACLAllowed, TableACLDenied and TableACLPseudoDenied.
2. Each has labels: TableName, TableGroup, PlanID and Username
3. TableACLPseudoDenied varz will be set when a query would have been denied
   but wan't because the system is in dry-run mode or because the caller is a
   superuser.
2015-07-25 23:21:10 -07:00
Shengzhe Yao 8d24f719b7 add exempt acl feature in tableacl
1. an exempt user will skip tableacl checking and have access to all Vitess tables.
2. add queryservice flag "queryserver-config-acl-exempt-acl" to specify exempt acl name.
2015-07-24 00:24:43 -07:00
Alain Jobart 68426d028c Merge branch 'master' into resharding 2015-07-23 14:16:58 -07:00
Alain Jobart 1cdb3522eb Renaming position to transaction_id for binlog events.
They map to a single GTID, not a GTIDSet.
2015-07-23 10:12:20 -07:00
Alain Jobart 691993f486 Changing the returned position from update_stream to be a string too,
in API and in python 9was already changed in grpc).
2015-07-23 09:32:56 -07:00
Shengzhe Yao 34460004dc fix error code overridden and execDmlAutoCommit last return.
1. In non-tx Plan_Other execution workflow, should not use ":=" to create a local "err"
   variable since it is defined as return variable in qre.Execute(). The early code
   causes problem because the original "err" will be reset to nil after the switch clause
   and qre.Execute() will return (nil, nil) in such case.
2. execDmlAutoCommit should return "err" instead of "nil" in the last return statement.
2015-07-22 21:20:30 -07:00
Shengzhe Yao 0ba15caf20 remove panic out of queryservice
1. Remove panics out of QueryExecutor and return error instead.
2. Some places like TxPool, CachePool, SchemaInfo still panics and will be captured
   and handled in SqlQuery.
2015-07-22 14:14:31 -07:00
Shengzhe Yao 4cb2f6f28e Make sure QueryExecutor.execSQL always use given wantfields 2015-07-22 00:06:01 -07:00
jeffjiang b30fadb260 Merge pull request #894 from guokeno0/master
Context support for CallerID and Add CallerID to the Contexts of new VTTablet RPCs
2015-07-20 14:55:25 -07:00
Jeff (Zhefu) Jiang f3201f6625 Use proto3 types for all CallerIDs 2015-07-20 13:35:30 -07:00
Alain Jobart 3bde13bee2 Adding missing split_column to a whole bunch of APIs. 2015-07-20 10:50:49 -07:00
Jeff (Zhefu) Jiang c0f8be01f5 Merge remote-tracking branch 'upstream/master' 2015-07-20 10:35:12 -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
Jeff (Zhefu) Jiang 4fc49fed6f Add callerid to gRPC and BSON 2015-07-17 14:43:32 -07:00
Sugu Sougoumarane adf5cef13a vttablet: ExecuteBatch implementation
Looks like there are no integration transaction tests for
ExecuteBatch vttablet. I'm not going to add them since
vttablet will be an internal API. I'll instead add them
for vtgate when that implemenation completes.
2015-07-17 05:23:49 -07:00
Sugu Sougoumarane a89285b69c vttablet: AsTransaction for ExecuteBatch
As mentioned in the previous change, changing the vttablet
batch API to accept an AsTransacton flag.
Implementation and test changes will follow.
2015-07-17 04:14:33 -07:00
Michael Berlin 5547d1398e Merge pull request #876 from guokeno0/master
Full CallerID support for Bson/gRPC APIs and tabletconn
2015-07-14 15:25:44 -07:00
Jeff (Zhefu) Jiang ef321cc903 Full CallerID support for Bson/gRPC APIs and tabletconn 2015-07-14 13:50:12 -07:00
Alain Jobart 69b951b27d Now using gRPC for a lot of unit tests. 2015-07-14 11:28:09 -07:00
Alain Jobart 1a4408cbc6 Changing UpdateStream event to use sqltypes. Much cleaner,
and the parsing is already done.
2015-07-10 14:28:11 -07:00
Alain Jobart aa58b40296 Renaming context variables to ctx. 2015-07-09 11:34:28 -07:00
Alain Jobart 4bdc8cc417 Now sending health update at connection time.
Not sending tablet_externally_reparented_timestamp if TER was never called.
2015-07-08 14:09:31 -07:00
Alain Jobart 9bfe8bc038 More plumbing for support of Target:
- not asking for sessionId if no keyspace/shard is specified.
- adding target validation if present, superseeds sessionId.
2015-07-08 13:38:08 -07:00
Alain Jobart d354d2e800 Addign Target to health message, and plumbing it through. 2015-07-08 13:10:18 -07:00
Alain Jobart c80d6fd867 Removing old HealthStream in tabletmanager, as we now
use the StreamHealth in queryservice.
2015-07-08 11:21:33 -07:00
Alain Jobart 5a23e065ab Adding more plumbing for StreamHealth. 2015-07-07 15:30:15 -07:00
Alain Jobart b9da4f5efb Adding StreamHealth to tabletserver RPC service.
Not connected on the server side yet.
2015-07-07 14:49:51 -07:00
Ammar Aijazi f26dfd66cb Fix tests that depended on old schema_info.go behavior 2015-07-01 02:56:02 -07:00
Ammar Aijazi b6bbd46af5 Fix bug where a TabletError was wrapping another TabletError and changing the severity level 2015-07-01 02:22:08 -07:00
Ammar Aijazi b682400469 VTGate.Execute returns errors in RPC response 2015-06-28 23:59:32 -07:00
Ammar Aijazi 6bd1e5e73f No more need for error string parsing in gorpctabletconn 2015-06-28 23:59:32 -07:00
Ammar Aijazi 44b14802b4 More thorough testing of errors in tabletconntest.go 2015-06-28 23:59:32 -07:00
Alain Jobart 731fc7dc90 Adding proper grpc dial options. 2015-06-26 14:52:11 -07:00
Alain Jobart a23d4b8323 Fixing integration tests to pass with gRPC, both MariaDB and MySQL 5.6. 2015-06-24 13:01:06 -07:00
Alain Jobart 72dd02252e Moving mysql proto conversions to their own file. 2015-06-24 11:47:35 -07:00
Alain Jobart b69ed8e6ed Splitting out service map to protocol_flavors. That way non-default
protocols can be enabled more easily.
2015-06-19 14:01:03 -07:00
Alain Jobart 7f7373bfe5 Fixing package name. 2015-06-19 07:33:13 -07:00
Alain Jobart bb34ba9ee2 Merge branch 'master' into resharding 2015-06-18 14:48:43 -07:00
Ammar Aijazi bf9484316d Improvements to tabletconntest 2015-06-18 14:24:29 -07:00
Alain Jobart 3799e10fa8 Now registering grpc port for vttablet in portmap.
Also fixing bind variable conversions that were broken
(I need to figure out where to add unit tests for these).
2015-06-18 08:37:32 -07:00
Alain Jobart ba54cd4aa8 Merge branch 'master' into resharding 2015-06-18 07:38:03 -07:00
Alain Jobart 65ed3c6f6b Simplifying tablet error to RPC error. 2015-06-17 09:31:11 -07:00
Alain Jobart c7a126eb2b Refactoring error handling in gRPC. Now unit tests pass. 2015-06-17 08:24:46 -07:00
Alain Jobart 4c790a265c Add SplitColumn to proto3, implement most of server side. 2015-06-17 07:12:10 -07:00
Ammar Aijazi 5f43cc76ac Add a StreamResult2 end-point 2015-06-16 15:31:46 -07:00
Alain Jobart 9ff4793807 Finishing client implementation. 2015-06-16 12:30:35 -07:00
Alain Jobart 390bd77e42 WIP: proto3 gRPC query service client and server.
(It's a lot of changes, my WS is acting up, so committing this).
2015-06-16 11:44:24 -07:00
Ammar Aijazi 22559c79e3 Add Begin2 to tabletserver, rename to Commit2 and Rollback2 2015-06-15 15:47:57 -07:00
Ammar Aijazi 3da1d6d4de Change UnsupportedNewCommit and UnsupportedNewRollback to match the new proto3 interface, revert client changes to Rollback and Commit 2015-06-11 23:22:20 -07:00
Ammar Aijazi d0c935aa4e Add new Commit and Rollback RPC endpoints for QueryService 2015-06-10 12:52:17 -07:00
Ammar Aijazi 856856f234 Send Err in QueryService.StreamExecute's QueryResult responses, handle them in tabletconn 2015-06-10 12:52:17 -07:00
Ammar Aijazi 876c4a658b Add RPCErrors to more QueryService RPC responses 2015-06-10 12:52:15 -07:00
Ammar Aijazi 6a88960d0a Change all unused RPC args or replies to rpc.Unused instead of empty strings 2015-06-09 11:29:50 -07:00
Ammar Aijazi d339c32c49 Pass RPCErrors by pointer instead of value 2015-06-04 20:26:00 -07:00
Ammar Aijazi 4cca822417 Move rpc-error-only-in-reply flag to tabletserver instead of being implementation specific 2015-06-03 19:27:21 -07:00
Ammar Aijazi 6e0f5d68c3 Add a flag and some tests for returning RPC errors in RPC responses 2015-06-03 19:27:21 -07:00
Ammar Aijazi fb4c5fb10e queryservice's Execute should return RPCErrors as part of QueryResult 2015-06-03 19:27:21 -07:00
Shengzhe Yao b2d56113c0 make fakesqldb returns an error for unrecognized query
fakesqldb returns an empty QueryResult if a query is not recognized.
This behavior reduces typing in unit tests but also causes confusions.
In general, if caller does not set the mock result for a particular
query, fakesqldb should return an error.
2015-06-01 10:24:06 -07:00
Alain Jobart 9e4b91aef0 Removing TryGet from conn pool, seems unused. 2015-05-27 10:07:21 -07:00
Alain Jobart ce8aed335e tabletserver now uses MysqlDaemon too. 2015-05-22 11:09:36 -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 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 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
Shengzhe Yao fb42692c9e move fakesqldb package from tabletserver to vttest 2015-05-08 14:14:21 -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
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
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
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
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
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
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
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 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
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 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
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
sougou c88513e39a Merge pull request #619 from youtube/suguwork
tabletserver: verbose error for killed queries
2015-04-24 00:44:18 -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
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
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 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
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
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 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
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
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
Ammar Aijazi b8ce9e141f Merge pull request #583 from youtube/aaijazi_vtgate_use_callinfo
Use CallInfo in VTGate, and restore context HTML to vtgate status page
2015-04-15 13:51:49 -07:00
Shengzhe Yao b185e2bc38 add tableacl testlib
add testlib package under tableacl and then any tableacl implementation
could use this testlib to do unit test (instead of writing their own)
2015-04-15 11:17:47 -07:00
Shengzhe 5f67ae606c Merge pull request #575 from yaoshengzhe/fix_refactor_tableacl
refactor tableacl
2015-04-15 10:07:06 -07:00
Ammar Aijazi ee1d18dfed Use CallInfo in VTGate, and restore context HTML to vtgate status page 2015-04-14 19:14:38 -07:00
Shengzhe Yao b702dbf3d9 refactor tableacl
1. move simpleacl.go from go/vt/tableacl to go/vt/simpleacl
2. add an AclFactory interface.
3. move both ACL and AclFactory interfaces to go/vt/tableacl/acl
4. define a package level variable called "acls" in tableacl which
   contains all registered AclFactory.
5. enable simpleacl as the default tableacl mechanism.

To plugin the specific tableacl implementation other than simpleacl, one
could either modify all binaries (go/cmd/vtocc/vtocc.go and go/cmd/vttablet/vttablet.go)
to call tableacl.Register(...) and then point tableacl.DefaultACL to the
specific tableacl. Alternatively, one could also put the specific tableacl
implementation under go/vt/tableacl dir and use the init function to finish
the registeration.
2015-04-14 13:38:16 -07:00
Shengzhe Yao d0475d0754 add MemcacheStats unit test
1. remove cache pool dependency from MemcacheStats; instead, NewMemcacheStats func takes
   a func param to return memcache stats. This change makes MemcacheStats more lightweight
   and easy to unit test.
2. replace bool params in original NewMemcacheStats func by flags: enableMain, enableSlabs
   and enableItems.
3. Pre-allocate memory for MemcacheStats.main, slabs and items. This removes several null checks.
4. expose refresh freq to let caller decide how frequent to refresh the stats.
2015-04-14 13:21:18 -07:00
Liang Guo cd52aea0c3 Fix CallInfo related problem in test. 2015-04-14 10:58:12 -07:00
Liang 716aab9c13 Merge pull request #576 from youtube/vtgatecode
Make CallInfo an interface, and generate fields on demand.
2015-04-14 09:10:17 -07:00
Liang Guo 5799ae991a Make CallInfo an interface, and generate fields on demand. 2015-04-13 22:32:28 -07:00
Shengzhe Yao 1cdd1fc9e2 use meaningful user names in query executor unit test 2015-04-13 15:19:46 -07:00
Shengzhe Yao b966731256 add query executor unit test 2015-04-11 21:25:16 -07:00
Shengzhe Yao 540badbf4e make all fake cache service shares a common cache data
There is only one rowcache per queryservice and cache pool only creates
connections to the underlying cache service. Therefore, the fakecacheservice
should only have a single place for cached data and share it across multiple
connections.
2015-04-11 18:54:20 -07:00
Shengzhe Yao 539bbc9c63 add stats prefixes to SqlQuery and QueryEngine
this change allows code to create multiple SqlQuery instances by assigning different
values to newly added configs. This avoids using a global SqlQuery instance in unit
tests and also may benefit with other use cases.
2015-04-11 18:52:57 -07:00
Shengzhe Yao 2b568712fb add reject query support in fakesqldb
add the ability in fakesqldb.Conn to reject certain queries.
This helps to test failure modes in queryservice unit tests.
2015-04-11 18:50:00 -07:00
Shengzhe Yao 35e9f44c2d always return non nil Rows in fakesqldb.Conn
fakesqldb.Conn will not init proto.QueryResult.Rows if RowsAffected is zero.
However, according to go/mysql/mysql.go, the ideal response should be an empty
proto.QueryResult.Rows.
2015-04-11 18:49:00 -07:00
Shengzhe Yao bdc7b204ba fakecacheservice only returns keys hit the memcache
go/memcache only returns keys that hit the memcache, so make fakecacheservice
have the same behavior.
2015-04-11 18:47:32 -07:00
Shengzhe Yao 81e1ecf177 clean up tabletserver planbuilder
1. merge insert.go and select.go into dml.go
2. merge plan_type.go into plan.go
3. add some comments and rename variables to follow golint's suggestions
2015-04-11 18:46:13 -07:00
sougou 11f04fa487 Merge pull request #549 from youtube/suguwork
Support for terse error
2015-04-10 15:27:54 -07:00
Sugu Sougoumarane e96fbfbdcc address code review comments 2015-04-10 14:10:04 -07:00
Shengzhe Yao b7688672ae enable strict mode for sqlquery unit test 2015-04-05 16:35:12 -07:00
Sugu Sougoumarane 27c3b16ce6 tabletserver: add terse-error flag 2015-04-03 01:09:55 -07:00
Shengzhe Yao a91122c85c add schema info unit test 2015-04-02 19:51:49 -07:00
Shengzhe Yao 66a58dfd9e add a fake DB struct to make fakesqldb easy to use
fakesqldb.Register currently takes two params, one is a set of queries it supports
and the other is whether it returns a connection error. This make fakesqldb not very
intuitive to use for unit test.

1. Add a fakesqldb.DB struct that stores all queries supported by a fake sqldbconn.
   Let fakesqldb.Register return a *fakesqldb.DB
2. Unit test is able to add or remove a query via the returned *DB.
2015-04-02 18:50:53 -07:00
Shengzhe Yao a67b9674aa merge RequestContext into QueryExecutor
1. Merge RequestContext into QueryExecutor.
2. Change PoolConn to private interface.
2015-04-02 17:05:28 -07:00
sougou 8fe2772a39 Merge pull request #539 from youtube/suguwork
Misc fixes
2015-04-01 09:36:22 -07:00
Shengzhe Yao a755beec4f remove applyFieldFilter func in schema_info.go
applyFieldFilter func in schema_info.go has never been used in the
Vitess code base. Remove it.
2015-03-31 16:30:59 -07:00
Sugu Sougoumarane 765435cf3c rowcache: remove deprecated tcp port flag. 2015-03-31 10:27:39 -07:00
Shengzhe Yao bf49cf476d refactor schema info to make unit test easy to write
1. add statsPrefix to allow caller to add prefix for schema info stats
2. add endpoints param in NewSchemaInfo to allow caller provides a different
   http endpoints to serve
2015-03-30 15:15:29 -07:00
Shengzhe Yao b12f932fba add cache pool unit test
1. add cache pool unit test.
2. add a new statsURL param in NewCachePool function instead of
   using a statsURL constant.
2015-03-30 13:00:27 -07:00
脑残果粉 fcb01005d6 Merge pull request #525 from yaoshengzhe/fix_queryservice_unit_test_03_sqlquery
add sqlquery unit test
2015-03-30 12:58:13 -07:00
Shengzhe Yao 3fe9deffee add a fake implementation of CacheService 2015-03-30 07:43:45 -07:00
Shengzhe Yao 5fca7b0aee add CacheService interface
CacheService is an interface for cache services like memcache.
2015-03-27 17:45:58 -07:00
Shengzhe Yao 2d5ea2db03 add sqlquery unit test
1. Add a connFail param in fakesqldb.Register fuction so that it is possible to
   fail the dbconnpool.DBConnection intentionally in order to test error handling
   logic.
2. make fakesqldb.Conn return empty result if a request is unknown instead returns
   an error. This is mainly because schema_info and planbuilder send verious sql
   queries to mysql to get some infomation and put those queries to fakesqldb makes
   test hard to understand.
2015-03-26 23:50:20 -07:00
Shengzhe Yao 75a844e0e9 add name prefix for txStats
NewTxPool always creates a new txStats instance with a hard coded name.
This is good until some unit tests need to create two TxPool instances.
The second NewTxPool call will fail because of the hard coded stats variable
has been exported in the first call.

This happens when there are two unit tests for TxPool and SqlQuery, since SqlQuery
will implicitly create a TxPool instance.

One possible fix would be to add an extra txStatsPrefix in NewTxPool function
so that unit test is able to register its own txStats with an unique name.
Given the fact that NewTxPool function is only called once in QueryEngine, this
fix might be simpler than other alternative options.

In addition, this fix also allows unit test to create different TxPool instances
and makes each test function independent to each other.
2015-03-25 18:41:23 -07:00
Shengzhe Yao d2bcd92bb2 add tx_pool unit test 2015-03-25 12:41:36 -07:00
Shengzhe Yao 8aa1e89374 add fakesqldb package which provides a fake implementation of sqldb.Conn 2015-03-24 17:06:13 -07:00
Shengzhe Yao defc9d9398 add sqldb.Conn interface for low level db connection
1. add sqldb.Conn and move mysql.ConnectionParams to sqldb package.
2. change mysql.Connect function to return sqldb.Conn.
3. update places using *mysql.Connection to sqldb.Conn.
4. update places using *mysql.ConnectionParams to *sqldb.ConnParams.
5. changes places that use mysql.Connect to sqldb.Get().
6. Some randome go style fix (suggested by golint).
7. define package level variable DefaultDB in sqldb.
8. go/mysql will register its Connect func in init function.
2015-03-24 15:31:11 -07:00
Sugu Sougoumarane b66a87c47b rowcache: improved socket filename generation
It turns out that ioutil.Tempdir generates names that are
longer than the grte socket file name limit of 108. So,
we're instead using a socket filename hint passed in from
the command line.
2015-03-20 15:40:19 -07:00
Sugu Sougoumarane ba73c27687 tabletserver: bug fix on disallowQueries.
Ensure that the done channel is closed from all return
code paths. Otherwise, disallowQueries explodes sometimes.
2015-03-20 13:16:46 -07:00
Anand Henry 03d5254d70 SplitQuery: cosmetic changes 2015-03-18 15:28:53 -07:00
Anand Henry 7a65fb872f SplitQuery: Error handling and session validation
1. Add SessionId to SplitQueryRequest
2. Do not panic if a table contains no rows, just return empty set of
boundaries.
3. Remove panic style error handling and explicitly return errors
2015-03-17 17:00:00 -07:00
Sugu Sougoumarane 29bcd1c845 tabletserver: Undo SplitQuery bug fix
Some tests are failing because they're getting unexpected
errors from SplitQuery. Temporarily reverting this bug
fix until tests are fixed.
2015-03-16 22:29:02 -07:00
Sugu Sougoumarane 1234049536 rowcache: Generate unique socket file names
Reusing socket files seems to cause trouble occasionally.
The new scheme generates a unique socket file name every time
we launch memcache. This makes the memcache socket & port
obsolete, which will be removed later.
2015-03-15 21:32:59 -07:00
Sugu Sougoumarane d3e350f0e5 rowcache: don't set expiry for cache invalidations
It's risky to set an expiry for cache invalidations. There are
unlikely, but possible race conditions that could cause an
untimely query to populate the rowcache with stale data.
2015-03-15 20:17:45 -07:00
Sugu Sougoumarane f88cee6257 tabletserver: honor streaming context deadlines
Changed streaming queries to honor deadlines, if one was supplied.
Also, fixed some lint errors.
2015-03-15 20:00:19 -07:00
Sugu Sougoumarane 83638ddaee tabletserver: readable error messages
Truncate error messages to 5K, and make unprintable
characters printable.
2015-03-14 16:52:35 -07:00
Sugu Sougoumarane 63e3341f50 tabletserver: fix typo 2015-03-14 15:29:35 -07:00
Sugu Sougoumarane 67615c0e1f tabletserver: TableStats -> RowcacheStats
And some lint fixes.
2015-03-14 11:18:51 -07:00
Sugu Sougoumarane 0383757e2a tabletserver: crash if disallowQueries takes too long
If disallowQueries hangs, things generally go bad because
the server remains hung and there's no opportunity for it
to come back up. So, it's better to crash in such situations.
This should generally not happen, but it's a good failsafe.
2015-03-14 00:14:05 -07:00
Sugu Sougoumarane ecc7acf0ca sqlquery.go: resolved all lint errors except GetSessionId 2015-03-13 21:48:52 -07:00
Sugu Sougoumarane 9dfe2ae591 tabletserver: state management cleanup
The older state management code was in a confused state
with no clarity on how locks, atomic updates, and
wait groups interacted. It's all cleaned up now.
The rules are simpler now, the code is more readable
and all documented inline.
2015-03-13 15:47:38 -07:00
Alain Jobart 91136afb19 Making a method public. Used internally. 2015-03-10 10:05:01 -07:00
Alain Jobart 5af47a5d25 Updating CallInfo to be more in line with Context API.
And remove all the cast madness.
2015-03-09 07:37:37 -07:00
Alain Jobart 1fe8dbf355 Merge pull request #456 from youtube/resharding
Resharding
2015-03-05 12:51:17 -08:00
Alain Jobart 600296c99b Adding an error stub for QueryService, and using it all in worker test. 2015-03-05 10:47:04 -08:00
Alain Jobart 66634c1fc5 Adding all tabletserver API unit tests. 2015-03-05 09:47:46 -08:00
Alain Jobart ba8c172a30 Adding unit test framework for tabletconn, and one test. 2015-03-05 08:15:21 -08:00
Alain Jobart a96e6208c3 Adding QueryService interface for vttablet. 2015-03-05 07:47:18 -08:00
Sugu Sougoumarane 6237b883d0 tabletserver: contexts contexts contexts 2015-03-04 22:12:08 -08:00
Liang Guo ff817acde3 VTGate related changes:
Change default retryDelay to 2ms.
Only retry on tx_pool_full, retry, and fatal errors, while it is not in transaction, not cancelled, and not exceeding deadline.
Add integration tests to test retry logic with vttablet shutting down.
2015-02-26 16:02:44 -08:00
Liang 64329fdfb7 Merge pull request #411 from youtube/shardconn
Rework of VTGate retry and timeout
2015-02-18 12:07:54 -08:00
Liang Guo 16ba85cdfb Enable fail-fast test and other fixes. 2015-02-18 11:47:18 -08:00
Liang Guo d2300c57f4 Move consolidator, and related fix 2015-02-17 23:26:39 -08:00
Shengzhe Yao b6834199a2 add test case and two params for txlogz
1. timeout: txlogz will keep dumping transactions until timeout,
   default value: 10s
2. limit: txlogz will keep dumping transactions until it hits the limit,
   default value: 300
2015-02-17 12:49:12 -08:00
Liang Guo c7dfbf7b37 Rework of VTGate retry and timeout 2015-02-16 16:51:47 -08:00
Liang Guo d97b94c37e Add flag and enable rpc timeout for gorpctabletconn 2015-02-12 10:26:28 -08:00
Alain Jobart bfc0f77b81 Merge pull request #390 from youtube/replication
Adding QueryServiceControl interface, to handle registration
2015-02-11 07:03:46 -08:00
Sugu Sougoumarane a1dcfd6916 tabletserver: fix shutdown race conditions
- Fix race condition in ServiceManager.
- Change rowcache invalidator to check shutdown state before
  trying to restart binlog streamer.
2015-02-10 16:56:57 -08:00
Alain Jobart be7ddff91e Adding a comment. 2015-02-09 12:53:41 -08:00
Alain Jobart 02d627684c Simplifying the registration API a bit. 2015-02-09 10:40:20 -08:00
Alain Jobart ec6d0bd60a Making checkMysql private, removing unused method. 2015-02-09 10:11:13 -08:00
Alain Jobart 7cdeb1fb34 Adding QueryServiceControl interface, to handle registration
and mocking of the query service. Still needs some cleanup,
but it's a good time to get a review.
2015-02-09 10:00:41 -08:00
Sugu Sougoumarane 8ca331fe52 tabletserver: use new ConnPool & DBConn 2015-02-05 23:34:32 -08:00
Sugu Sougoumarane 23a9af9555 tabletserver: ConnPool tweaks.
The PoolConn abstraction does not need to be supported by
ConnPool. Only QueryEngine needs this. So, we'll move it there.
2015-02-05 19:46:53 -08:00
Sugu Sougoumarane 4a6da44d2e tabletserver: disable manual test 2015-02-05 14:47:02 -08:00
Sugu Sougoumarane edb546eb64 tabletserver: New connection pool and connection
Implementing a new pool and associated connection to
better manage connection problems. This new combination
addresses the following problems:
- On connection error, retry if allowed.
- CheckMySQL if necessary.
- New Exec API with deadline.
- Improved connection killer that kills the connection on
  both sides.
This is just the framework for now. The next CL will
actually change the tabletserver to use this.
The test is manual for now. So, it's disabled by default.
2015-02-05 13:20:15 -08:00
Anthony Yeh 9d8cbaaf63 Add proxy prefix to /debug/vars in JS update func.
e.g. if we're accessing the status page at:

http://my.proxy/vttablet-123/debug/status

then the JS on that page needs to request vars from:

/vttablet-123/debug/vars

instead of just /debug/vars.
2015-02-03 16:55:03 -08:00
sougou 4adc811903 Merge pull request #345 from youtube/suguwork
Improved connection error handling
2015-01-23 11:10:58 -08:00
Sugu Sougoumarane df45e137ed queryservice: shutdown if mysql is down
This CL has a few coordinated changes:
- Any connection failures trigger a CheckMySQL. The check tries
  to connect to MySQL. If it fails, the query service is shut down.
  This can be triggerred by the rowcache invalidator also.
  This check is rate-limited to once/second.
- To counter this behavior, vtocc tries restarting the query service
  every 30s. This also means that there's no need for the waitForMySQL
  flag in AllowQueries.
- Connection errors are now classified as FATAL. This will allow clients
  to more proactively go elsewhere.
2015-01-22 23:22:09 -08:00
Shengzhe Yao 0e740502e4 rename _vtocc, _vts and _mysql in vitess client 2015-01-20 16:33:37 -08:00
Jeff (Zhefu) Jiang 4ce1c666ec fix error generation 2015-01-13 19:15:15 -08:00
Jeff (Zhefu) Jiang bb9847b4b3 jeffjiang: export opmap for other implementation of dynamic query rules 2015-01-13 18:15:59 -08:00
Anand Henry 85f29d8eca Do not perform access check when table ACL is disabled 2015-01-09 13:05:50 -08:00