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

205 Коммитов

Автор SHA1 Сообщение Дата
Alex Charis 573aaf573d refactor LDAP-backed ACLs
vtgate now gets the groups and sends them in the immediate caller id.
we store the time of the ldap query and refresh (in another goroutine) if
older than configurable threshold. this happens upon ComQuery. the simpleacl
implementation is now group aware, and the ldapacl plugin has been removed.
2017-03-24 10:06:47 -04:00
Michael Berlin eaa5cffc6d Merge pull request #2663 from michael-berlin/protobuf_readme
proto: Add README.md to document our required style guide.
2017-03-23 19:33:55 +01:00
Sugu Sougoumarane 021fbe0801 v3 keyrange: proto keyspace->keyspace_shard 2017-03-23 11:32:42 -07:00
Sugu Sougoumarane 5dedb90ac1 v3: autocommit support 2017-03-23 11:32:42 -07:00
Michael Berlin be7f12fe37 proto: Add README.md to document our required style guide. 2017-03-23 19:14:34 +01:00
wangyipei01 a4f4256f5c Merge branch 'master' into workflow-control 2017-02-22 19:02:59 -08:00
Sugu Sougoumarane ceaddb1f12 vterrors: simplify API
Also delete TabletError
2017-02-22 17:14:48 -08:00
Sugu Sougoumarane f91a867f04 vterrors: misc
* Renamed old error names to legacy.
* Changed all clients to handle legacy and new codes.
* Added tests for the conversions.
2017-02-22 17:14:48 -08:00
Sugu Sougoumarane 9855595bdc vterrors: use new vtrpcpb.Code everywhere
vtrpcpb.ErrorCode is used only at the grpc boundary for
legacy purposes.
2017-02-22 17:14:48 -08:00
Sugu Sougoumarane d3bb900514 vterrors: introduce vtrpcpb.Code
Created the Code enum to match grpc error codes, and renamed
all previous error codes to not have a name clash. Also renamed
The older field to LegacyCode.
2017-02-22 17:14:48 -08:00
Yipei Wang 414b051202 workflow: Implemented retry action in ParallelRunner. Created
unit test to verify this function. Implemented Horizontal Resharding
workflow and tested in unit test and e2e test for the happy path.
2017-02-13 19:48:34 -08:00
Yipei Wang 0e1023ab87 workflow: Using ParallelRunner to implement horizontal resharding
workflow. Complete the unit test and E2E test for happy path.
2017-02-13 19:48:34 -08:00
Yipei Wang 5210ead719 workflow: Defined structure to track status per tasks in workflowstate.proto.
Implement ParallelRunner and Checkpointer. Create a simple test for
ParallelRunner.
2017-02-13 19:48:34 -08:00
Sugu Sougoumarane d62146533a messages: review comments 2017-01-23 17:03:27 -08:00
Sugu Sougoumarane 2cd7e34c99 messages: WIP
Change MessageStream response to sqltypes.Result. This will allow
us to be more flexible in the future for supporting multiple columns.
2017-01-23 17:03:27 -08:00
Sugu Sougoumarane 16320b42ed messages: WIP
VTGate gRPC
2017-01-23 17:03:27 -08:00
Sugu Sougoumarane 86634c7469 messages: WIP
Some test fixes, and proto improvements.
2017-01-23 17:03:27 -08:00
Sugu Sougoumarane d1b9494c79 messages: WIP
gRPC for tabletserver.
2017-01-23 17:03:27 -08:00
Sugu Sougoumarane a9ba1dc31d messages: WIP
Simplified API.
2017-01-23 17:03:27 -08:00
Erez Louidor 8e57d2673a 1. Replaced the thread_throttler throttle() code with the golang.org/x/time/rate
token-bucket implementation.
2. Changed max_replication_lag_module to not increase the rate limit if the current
rate did not approach it.
2017-01-19 15:37:55 -08:00
sougou e9e960cdcb filtered replication: allow non-annotated dmls (#2441)
The new message feature in vttablet has to generate its own DMLs.
In the current design, vttablet does not access vindex. So, it may
not be able to generate keyspace id info for those DMLs.

OTOH, RBR also has similar limitations because the replication
event will not have keyspace id info.

This PR sprays such non-annotated DMLs to all target shards. This
is safe because vttablet rewrites all queries to be PK-based. So,
the replay will only affect the shards where the rows are present.

This is a backward compatible change that should not break existing
behavior.
2017-01-14 11:58:42 -08:00
Alain Jobart 21065d11b2 Changing query.Field.column_length to uint32.
That's what the actual protocol size for the field is. Also documenting
the other fields, as they are uint16 or uint8 in the protocol.
And rebuilding all proto docs too.
2017-01-11 08:46:43 -08:00
Bryan Beaudreault 8ffaf2e49e Add comment to document when new fields are included in response 2017-01-06 11:23:47 -05:00
Bryan Beaudreault 41ab6fb544 Optionally send additional C API fields through in responses
Removes exclude_field_name from ExecuteOptions, replacing with an
IncludedFields enum. Enum values allow specifying whether to return
all fields, just type and name (default), or just type (perf optimization)
Adds and updates tests
2017-01-05 22:02:54 -05:00
harshit-gangal 020530835b VTGate - Execute Batch V1 (#2304)
* Initial Changes

* Flow till router

* fixed test

* Code Refactor

* Adding QueryResponse type

* Resolved proto

* proto changes

* Revert "proto changes"

This reverts commit 736bc378b76853f2b5ab77ad3e850f3aa890d858.

* Comment changes

* fixed test

* Incorporated Comments
2016-12-19 23:29:19 -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
sougou 749b276aa0 2pc: refactored metadata tables (#2363)
* 2pc: refactored metadata tables

Changing the table names: This allows me to start with a clean slate.
Since the feature is not yet in use, I don't have to migrate the old
tables.

enums->ints: Enums looked like a good idea in the beginning. But it's
a pain if you have to add a new state, because it requires a schema
change. Switching to numbers in db and enums in code.

Dropping deprecated columns & indexes: During implementation, I made
some improvements to the prepare flow (compared to the design). That
allows me to simplify that table.

Summary:
redo_log_transaction -> redo_state, drop resolution, drop
state_time_idx.
redo_log_statement ->redo_statement.
transaction -> dt_state.
participant -> dt_participant, drop time_updated

* code review comments
2016-12-13 09:42:38 -08:00
sougou 7933b66e43 2pc: end-to-end (#2335)
A new SingleDb flag has been added to Begin, which would survive
through the Session. If set, any transaction that exceeds a single
shard will be failed.

VTGate acquires a command line flag: transaction_mode, which can be
single, multi or 2pc. In single mode, it will fail Begins that request
multi-shard. In multi mode, it will fail commits that request 2pc.
In 2pc mode, everything will be allowed.

The per-request flags specify what the app wants, and the vtgate flags
specify what it allows.

* 2pc: Go and python clients

For Go, the transaction mode settings are supported through
the context. This means that it will only work with go1.8.

For Python, it's a cursor constructor parameter.

* 2pc: end-to-end test
2016-12-05 16:28:44 -08:00
Sugu Sougoumarane 47a13b702d mysql: Support new types GEOMETRY & JSON 2016-11-22 16:09:46 -08:00
Sugu Sougoumarane ed1f2c53d8 2pc: export ResolveTransaction in grpc 2016-11-14 08:54:49 -08:00
Sugu Sougoumarane ba41641552 2pc: ResolveTransaction->ConcludeTransaction
The 'Resolve' name was misleading. It was implying that
some kind of resolution work was being performed. Conclude
is a more accurate description of this action.
2016-11-13 23:49:04 -08:00
Sugu Sougoumarane d92169cc27 2pc: export 2pc in grpc 2016-11-13 23:48:53 -08:00
Erez Louidor 3ca6beeabe Adding back the 'use_split_query_v2' field temporarily so
that clients can still use it until the new server code is released.
2016-11-11 13:58:49 -08:00
Erez Louidor 75c2397155 Removing SplitQuery plumbing and renaming SplitQueryV2 to SplitQuery 2016-11-04 15:09:55 -07:00
sougou 92c1dca28f 2pc (#2153)
2pc: export grpc functions

* govet issue: call cancel funcs from contexts.
* Export 2PC functions as gRPC methods
2016-10-18 09:50:14 -07:00
Pavel Ivanov 0135d7650a Rename WORKER tablet type into DRAINED
This will make the type look more generic, so that it could be used for other
purposes as well, not only for a worker during resharding. In particular I plan
to use the same tablet type for schema swap reserving a seed vttablet to execute
the schema change.
I also add a "drain_reason" tag that will be set by anyone setting the DRAINED
tablet type, so that it's easy to understand why it is drained.
2016-10-14 15:09:50 -07:00
sougou 370444e5e9 2pc: MM functionality (#2132)
* New proto var TransactionMetadata.
* Use 0 value to signify no timeout.
* Core MM functionality. A few more will be added later.
2016-10-10 13:09:07 -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
Pavel Ivanov db9e4c5643 Add support for Vitess 'allprivs' user.
This adds support for an 'allprivs' user which is supposed to have more
privileges than 'app' user, but unlike 'dba' user 'allprivs' won't have SUPER
privilege. New method ExecuteFetchAsAllPrivs() is added to TabletManager
service to be able to execute queries as this new 'allprivs' user.

'allprivs' user will be used for administrative tasks done by Vitess, such as
changes in metadata tables that schema swap process will be doing. 'allprivs'
user shouldn't have SUPER privilege so that schema swap could safely change
replicated metadata on the master without risk to commit the changes when
master has been already demoted to be a slave.
2016-09-26 17:47:12 -07:00
Alain Jobart f840e69b36 Adding ResultExtras to Result for Invalidation.
ResultExtras is part of Query Result. It contains:
- an optional EventToken (returned if ExecuteOptions.include_event_token
  is set)
- an optional 'fresher' flag (set if ExecuteOptions.compare_event_token
  is set, and that token is older than the current TabletServer event
  token.)

The flags are set by TabletServer, and merged by VtGate.ScatterConn.
2016-09-16 15:53:37 -07:00
Alain Jobart b3808aa8c0 Merge branch 'master' into queryoptions 2016-09-15 11:49:56 -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
Michael Berlin bbc5fe5a04 throttler: Add new configuration option "ignore_n_slowest_rdonlys".
The new setting is similar, but independent to the existing option "ignore_n_slowest_rdonlys".

For example, if both are set to 1, you can have one 1 slow REPLICA and 1 slow RDONLY tablet.
2016-09-14 22:58:08 -07:00
Michael Berlin 6196cdda97 Merge pull request #2046 from michael-berlin/throttler_more_fields
throttler: Split the throttler configuration into more fine-grained fields.
2016-09-13 13:15:41 -07:00
Alain Jobart cb78058965 Adding vttablet background binlog watcher.
It is enabled with the -watch_replication_stream command line
argument. It does two things:
- remember the last applied Event Token (and exposes it in vars).
- if the event is a DDL, it forces a schema reload.

Also ignoring local binlog connections in FindSlaves, as they have no
impact on reparenting.
2016-09-13 10:00:50 -07:00
Michael Berlin 7e53114818 throttler: Split the throttler configuration into more fine-grained fields.
min_duration_between_changes_sec was split into separate "increases" and "decreases" fields.

This is required because an insert test needs to wait longer than a decrease test.

Additionally, there is a new field "spread_backlog_across_sec". Before this change, the value of "min_duration_between_changes_sec" was used for this.
2016-09-12 21:11:10 -07:00
Alain Jobart b48a84ca64 Adding UpdateStream API to vtgate.
The vtgate API takes a starting timestamp, or a starting EventToken. It
will only use the starting EventToken if it's relevant. This is mostly
for tests, but could be used by real clients too to avoid the timestamp
search on the servers.

The only restriction in the vtgate routing implementation is that a
query can only end up on one shard. The stream aggregation code inside
vtgate will be added later.

This change includes:
- proto changes.
- implementing the server side interface.
- implementing the client side interface.
- adding a vtctl VtTabletUpdateStream command to stream from a given
  tablet. This is used in end-to-end tests.
- using the python vtgate_client update_stream API in all end-to-end
  tests.
- removing the python vttablet direct stream_update API.
- vtgate now better preserves remote errors through its API now, as
  withSuffix and withPrefix will preserve the error codes of all
  VtError, not just *VitessError.
- Also adding callerid vtgateclienttest tests for all API calls.
2016-09-08 07:44:41 -07:00
Alain Jobart e815e680b5 Moving UpdateStream to queryservice API.
The UpdateStream call makes a lot more sense in the QueryService part of
the API. It is meant to be used by vtgate. The Binlog side of the API is
then only used by filtered replication.

Adding vttablet support to start streaming from a timestamp, not just a
replication position. It finds the starting position by loking at the
binary logs.

In the process, change the following things:
- UpdateStream is now added to gateway.Gateway, so it flows through
  l2vtgate if needed.
- the python client now uses the new service.
- updated the tests as required.
- using Context instead of sync2.ServiceManager. Removing
  sync2.ServiceManager as it is now unused.
- tabletserver.TabletServer now remembers the ongoing UpdateStream
  connections, and closes them on state change.
2016-09-02 09:32:00 -07:00
Alain Jobart 7de2467675 Adding EventToken, using it in binlog services.
- Adding an EventToken structure in query.proto.
- Using it in Binlog Streamer and filtered replication.
- Using it in Update Stream in POS events as well.

Note the main change there is that an EventToken has a replication
position (GTIDSet), not a transaction ID (GTID). Both server and clients
were computing the position individually anyway by accumulating
transaction IDs, might as well just send the position. And it will make
more sense for later use of EventToken.

Also, we don't set the 'Shard' field of the EventToken just yet. I'm
still not sure vttablet should do it, as opposed to vtgate.
2016-08-30 09:27:54 -07:00
Alain Jobart 869b83b73c First version of Workflow object.
In order to do that, I had to:
- Adding File/Dir APIs to topo.Backend.
- Implementing them for all flavors: memorytopo, zk, etcd, tee.
  None of the backward compatible code is there yet,
  so these can only be used for new objects.
- Adding corresponding unit tests.
- Fixing a few fake etcd-specific bugs.

Also now using CancelFunc for all topo watches.
2016-08-26 17:02:30 -07:00