Merge pull request #2060 from alainjobart/queryoptions

Adding ExecuteOptions to queries.
This commit is contained in:
Alain Jobart 2016-09-15 18:35:09 -07:00 коммит произвёл GitHub
Родитель e6178b9657 c696236b16
Коммит 4edf1b231a
75 изменённых файлов: 2110 добавлений и 1110 удалений

Просмотреть файл

@ -100,6 +100,7 @@ ExecuteBatchKeyspaceIds executes the list of queries based on the specified keys
| <code>queries</code> <br>list &lt;[BoundKeyspaceIdQuery](#boundkeyspaceidquery)&gt;| BoundKeyspaceIdQuery represents a single query request for the specified list of keyspace ids. This is used in a list for ExecuteBatchKeyspaceIdsRequest. |
| <code>tablet_type</code> <br>[topodata.TabletType](#topodata.tablettype)| TabletType represents the type of a given tablet. |
| <code>as_transaction</code> <br>bool| as_transaction will execute the queries in this batch in a single transaction per shard, created for this purpose. (this can be seen as adding a 'begin' before and 'commit' after the queries). Only makes sense if tablet_type is master. If set, the Session is ignored. |
| <code>options</code> <br>[query.ExecuteOptions](#query.executeoptions)| ExecuteOptions is passed around for all Execute calls. |
#### Response
@ -133,6 +134,7 @@ ExecuteEntityIds executes the query based on the specified external id to keyspa
| <code>entity_keyspace_ids</code> <br>list &lt;[EntityId](#executeentityidsrequest.entityid)&gt;| entity_keyspace_ids are pairs of entity_column_name values associated with its corresponding keyspace_id. |
| <code>tablet_type</code> <br>[topodata.TabletType](#topodata.tablettype)| TabletType represents the type of a given tablet. |
| <code>not_in_transaction</code> <br>bool| not_in_transaction is deprecated and should not be used. |
| <code>options</code> <br>[query.ExecuteOptions](#query.executeoptions)| ExecuteOptions is passed around for all Execute calls. |
#### Messages
@ -177,6 +179,7 @@ ExecuteKeyRanges executes the query based on the specified key ranges.
| <code>key_ranges</code> <br>list &lt;[topodata.KeyRange](#topodata.keyrange)&gt;| KeyRange describes a range of sharding keys, when range-based sharding is used. |
| <code>tablet_type</code> <br>[topodata.TabletType](#topodata.tablettype)| TabletType represents the type of a given tablet. |
| <code>not_in_transaction</code> <br>bool| not_in_transaction is deprecated and should not be used. |
| <code>options</code> <br>[query.ExecuteOptions](#query.executeoptions)| ExecuteOptions is passed around for all Execute calls. |
#### Response
@ -209,6 +212,7 @@ ExecuteKeyspaceIds executes the query based on the specified keyspace ids.
| <code>keyspace_ids</code> <br>list &lt;bytes&gt;| keyspace_ids contains the list of keyspace_ids affected by this query. Will be used to find the shards to send the query to. |
| <code>tablet_type</code> <br>[topodata.TabletType](#topodata.tablettype)| TabletType represents the type of a given tablet. |
| <code>not_in_transaction</code> <br>bool| not_in_transaction is deprecated and should not be used. |
| <code>options</code> <br>[query.ExecuteOptions](#query.executeoptions)| ExecuteOptions is passed around for all Execute calls. |
#### Response
@ -239,6 +243,7 @@ StreamExecuteKeyRanges executes a streaming query based on key ranges. Use this
| <code>keyspace</code> <br>string| keyspace to target the query to. |
| <code>key_ranges</code> <br>list &lt;[topodata.KeyRange](#topodata.keyrange)&gt;| KeyRange describes a range of sharding keys, when range-based sharding is used. |
| <code>tablet_type</code> <br>[topodata.TabletType](#topodata.tablettype)| TabletType represents the type of a given tablet. |
| <code>options</code> <br>[query.ExecuteOptions](#query.executeoptions)| ExecuteOptions is passed around for all Execute calls. |
#### Response
@ -267,6 +272,7 @@ StreamExecuteKeyspaceIds executes a streaming query based on keyspace ids. Use t
| <code>keyspace</code> <br>string| keyspace to target the query to. |
| <code>keyspace_ids</code> <br>list &lt;bytes&gt;| keyspace_ids contains the list of keyspace_ids affected by this query. Will be used to find the shards to send the query to. |
| <code>tablet_type</code> <br>[topodata.TabletType](#topodata.tablettype)| TabletType represents the type of a given tablet. |
| <code>options</code> <br>[query.ExecuteOptions](#query.executeoptions)| ExecuteOptions is passed around for all Execute calls. |
#### Response
@ -369,6 +375,7 @@ ExecuteBatchShards executes the list of queries on the specified shards.
| <code>queries</code> <br>list &lt;[BoundShardQuery](#boundshardquery)&gt;| BoundShardQuery represents a single query request for the specified list of shards. This is used in a list for ExecuteBatchShardsRequest. |
| <code>tablet_type</code> <br>[topodata.TabletType](#topodata.tablettype)| TabletType represents the type of a given tablet. |
| <code>as_transaction</code> <br>bool| as_transaction will execute the queries in this batch in a single transaction per shard, created for this purpose. (this can be seen as adding a 'begin' before and 'commit' after the queries). Only makes sense if tablet_type is master. If set, the Session is ignored. |
| <code>options</code> <br>[query.ExecuteOptions](#query.executeoptions)| ExecuteOptions is passed around for all Execute calls. |
#### Response
@ -401,6 +408,7 @@ ExecuteShards executes the query on the specified shards.
| <code>shards</code> <br>list &lt;string&gt;| shards to target the query to. A DML can only target one shard. |
| <code>tablet_type</code> <br>[topodata.TabletType](#topodata.tablettype)| TabletType represents the type of a given tablet. |
| <code>not_in_transaction</code> <br>bool| not_in_transaction is deprecated and should not be used. |
| <code>options</code> <br>[query.ExecuteOptions](#query.executeoptions)| ExecuteOptions is passed around for all Execute calls. |
#### Response
@ -431,6 +439,7 @@ StreamExecuteShards executes a streaming query based on shards. Use this method
| <code>keyspace</code> <br>string| keyspace to target the query to. |
| <code>shards</code> <br>list &lt;string&gt;| shards to target the query to. |
| <code>tablet_type</code> <br>[topodata.TabletType](#topodata.tablettype)| TabletType represents the type of a given tablet. |
| <code>options</code> <br>[query.ExecuteOptions](#query.executeoptions)| ExecuteOptions is passed around for all Execute calls. |
#### Response
@ -549,6 +558,7 @@ Execute tries to route the query to the right shard. It depends on the query and
| <code>tablet_type</code> <br>[topodata.TabletType](#topodata.tablettype)| TabletType represents the type of a given tablet. |
| <code>not_in_transaction</code> <br>bool| not_in_transaction is deprecated and should not be used. |
| <code>keyspace</code> <br>string| keyspace to target the query to. |
| <code>options</code> <br>[query.ExecuteOptions](#query.executeoptions)| ExecuteOptions is passed around for all Execute calls. |
#### Response
@ -578,6 +588,7 @@ StreamExecute executes a streaming query based on shards. It depends on the quer
| <code>query</code> <br>[query.BoundQuery](#query.boundquery)| BoundQuery is a query with its bind variables |
| <code>tablet_type</code> <br>[topodata.TabletType](#topodata.tablettype)| TabletType represents the type of a given tablet. |
| <code>keyspace</code> <br>string| keyspace to target the query to. |
| <code>options</code> <br>[query.ExecuteOptions](#query.executeoptions)| ExecuteOptions is passed around for all Execute calls. |
#### Response
@ -745,6 +756,28 @@ BoundQuery is a query with its bind variables
| <code>sql</code> <br>string| sql is the SQL query to execute |
| <code>bind_variables</code> <br>map &lt;string, [BindVariable](#query.bindvariable)&gt;| bind_variables is a map of all bind variables to expand in the query |
### query.EventToken
EventToken is a structure that describes a point in time in a replication stream on one shard. The most recent known replication position can be retrieved from vttablet when executing a query. It is also sent with the replication streams from the binlog service.
#### Properties
| Name |Description |
| :-------- | :--------
| <code>timestamp</code> <br>int64| timestamp is the MySQL timestamp of the statements. Seconds since Epoch. |
| <code>shard</code> <br>string| The shard name that applied the statements. Note this is not set when streaming from a vttablet. It is only used on the client -> vtgate link. |
| <code>position</code> <br>string| The position on the replication stream after this statement was applied. It is not the transaction ID / GTID, but the position / GTIDSet. |
### query.ExecuteOptions
ExecuteOptions is passed around for all Execute calls.
#### Properties
| Name |Description |
| :-------- | :--------
| <code>exclude_field_names</code> <br>bool| If set, the resulting Field array wont have a Name, just a Type. This is an optimization for high-QPS queries where the client knows what it's getting. |
### query.Field
Field describes a single column returned by a query
@ -780,6 +813,45 @@ Row is a database row.
| <code>lengths</code> <br>list &lt;sint64&gt;| lengths contains the length of each value in values. A length of -1 means that the field is NULL. While reading values, you have to accummulate the length to know the offset where the next value begins in values. |
| <code>values</code> <br>bytes| values contains a concatenation of all values in the row. |
### query.StreamEvent
StreamEvent describes a set of transformations that happened as a single transactional unit on a server. It is streamed back by the Update Stream calls.
#### Properties
| Name |Description |
| :-------- | :--------
| <code>statements</code> <br>list &lt;[Statement](#streamevent.statement)&gt;| The statements in this transaction. |
| <code>event_token</code> <br>[EventToken](#query.eventtoken)| EventToken is a structure that describes a point in time in a replication stream on one shard. The most recent known replication position can be retrieved from vttablet when executing a query. It is also sent with the replication streams from the binlog service. |
#### Messages
##### StreamEvent.Statement
One individual Statement in a transaction.
<em>Properties</em>
| Name |Description |
| :-------- | :--------
| <code>category</code> <br>[Category](#streamevent.statement.category)| |
| <code>table_name</code> <br>string| table_name, primary_key_fields and primary_key_values are set for DML. |
| <code>primary_key_fields</code> <br>list &lt;[Field](#query.field)&gt;| Field describes a single column returned by a query |
| <code>primary_key_values</code> <br>list &lt;[Row](#query.row)&gt;| Row is a database row. |
| <code>sql</code> <br>bytes| sql is set for all queries. FIXME(alainjobart) we may not need it for DMLs. |
#### Enums
##### StreamEvent.Statement.Category
One individual Statement in a transaction. The category of one statement.
| Name |Value |Description |
| :-------- | :-------- | :--------
| <code>Error</code> | <code>0</code> | |
| <code>DML</code> | <code>1</code> | |
| <code>DDL</code> | <code>2</code> | |
### query.Target
Target describes what the client expects the tablet is. If the tablet does not match, an error is returned.

Просмотреть файл

@ -487,6 +487,7 @@ Blocks until no new queries were observed on all tablets with the given tablet t
* [VtTabletExecute](#vttabletexecute)
* [VtTabletRollback](#vttabletrollback)
* [VtTabletStreamHealth](#vttabletstreamhealth)
* [VtTabletUpdateStream](#vttabletupdatestream)
### VtGateExecute
@ -494,7 +495,7 @@ Executes the given SQL query with the provided bound variables against the vtgat
#### Example
<pre class="command-example">VtGateExecute -server &lt;vtgate&gt; [-bind_variables &lt;JSON map&gt;] [-connect_timeout &lt;connect timeout&gt;] [-keyspace &lt;default keyspace&gt;] [-tablet_type &lt;tablet type&gt;] [-json] &lt;sql&gt;</pre>
<pre class="command-example">VtGateExecute -server &lt;vtgate&gt; [-bind_variables &lt;JSON map&gt;] [-connect_timeout &lt;connect timeout&gt;] [-keyspace &lt;default keyspace&gt;] [-tablet_type &lt;tablet type&gt;] [-options &lt;proto text options&gt;] [-json] &lt;sql&gt;</pre>
#### Flags
@ -503,6 +504,7 @@ Executes the given SQL query with the provided bound variables against the vtgat
| connect_timeout | Duration | Connection timeout for vtgate client |
| json | Boolean | Output JSON instead of human-readable table |
| keyspace | string | default keyspace to use |
| options | string | execute options values as a text encoded proto of the ExecuteOptions structure |
| server | string | VtGate server to connect to |
| tablet_type | string | tablet type to query |
@ -525,7 +527,7 @@ Executes the given SQL query with the provided bound variables against the vtgat
#### Example
<pre class="command-example">VtGateExecuteKeyspaceIds -server &lt;vtgate&gt; -keyspace &lt;keyspace&gt; -keyspace_ids &lt;ks1 in hex&gt;,&lt;k2 in hex&gt;,... [-bind_variables &lt;JSON map&gt;] [-connect_timeout &lt;connect timeout&gt;] [-tablet_type &lt;tablet type&gt;] [-json] &lt;sql&gt;</pre>
<pre class="command-example">VtGateExecuteKeyspaceIds -server &lt;vtgate&gt; -keyspace &lt;keyspace&gt; -keyspace_ids &lt;ks1 in hex&gt;,&lt;k2 in hex&gt;,... [-bind_variables &lt;JSON map&gt;] [-connect_timeout &lt;connect timeout&gt;] [-tablet_type &lt;tablet type&gt;] [-options &lt;proto text options&gt;] [-json] &lt;sql&gt;</pre>
#### Flags
@ -535,6 +537,7 @@ Executes the given SQL query with the provided bound variables against the vtgat
| json | Boolean | Output JSON instead of human-readable table |
| keyspace | string | keyspace to send query to |
| keyspace_ids | string | comma-separated list of keyspace ids (in hex) that will map into shards to send query to |
| options | string | execute options values as a text encoded proto of the ExecuteOptions structure |
| server | string | VtGate server to connect to |
| tablet_type | string | tablet type to query |
@ -560,7 +563,7 @@ Executes the given SQL query with the provided bound variables against the vtgat
#### Example
<pre class="command-example">VtGateExecuteShards -server &lt;vtgate&gt; -keyspace &lt;keyspace&gt; -shards &lt;shard0&gt;,&lt;shard1&gt;,... [-bind_variables &lt;JSON map&gt;] [-connect_timeout &lt;connect timeout&gt;] [-tablet_type &lt;tablet type&gt;] [-json] &lt;sql&gt;</pre>
<pre class="command-example">VtGateExecuteShards -server &lt;vtgate&gt; -keyspace &lt;keyspace&gt; -shards &lt;shard0&gt;,&lt;shard1&gt;,... [-bind_variables &lt;JSON map&gt;] [-connect_timeout &lt;connect timeout&gt;] [-tablet_type &lt;tablet type&gt;] [-options &lt;proto text options&gt;] [-json] &lt;sql&gt;</pre>
#### Flags
@ -569,6 +572,7 @@ Executes the given SQL query with the provided bound variables against the vtgat
| connect_timeout | Duration | Connection timeout for vtgate client |
| json | Boolean | Output JSON instead of human-readable table |
| keyspace | string | keyspace to send query to |
| options | string | execute options values as a text encoded proto of the ExecuteOptions structure |
| server | string | VtGate server to connect to |
| shards | string | comma-separated list of shards to send query to |
| tablet_type | string | tablet type to query |
@ -685,7 +689,7 @@ Executes the given query on the given tablet.
#### Example
<pre class="command-example">VtTabletExecute [-bind_variables &lt;JSON map&gt;] [-connect_timeout &lt;connect timeout&gt;] [-transaction_id &lt;transaction_id&gt;] [-tablet_type &lt;tablet_type&gt;] [-json] -keyspace &lt;keyspace&gt; -shard &lt;shard&gt; &lt;tablet alias&gt; &lt;sql&gt;</pre>
<pre class="command-example">VtTabletExecute [-bind_variables &lt;JSON map&gt;] [-connect_timeout &lt;connect timeout&gt;] [-transaction_id &lt;transaction_id&gt;] [-tablet_type &lt;tablet_type&gt;] [-options &lt;proto text options&gt;] [-json] -keyspace &lt;keyspace&gt; -shard &lt;shard&gt; &lt;tablet alias&gt; &lt;sql&gt;</pre>
#### Flags
@ -693,6 +697,7 @@ Executes the given query on the given tablet.
| :-------- | :--------- | :--------- |
| connect_timeout | Duration | Connection timeout for vttablet client |
| json | Boolean | Output JSON instead of human-readable table |
| options | string | execute options values as a text encoded proto of the ExecuteOptions structure |
| transaction_id | Int | transaction id to use, if inside a transaction. |
@ -768,6 +773,36 @@ Executes the StreamHealth streaming query to a vttablet process. Will stop after
* stream ended early: %v
### VtTabletUpdateStream
Executes the UpdateStream streaming query to a vttablet process. Will stop after getting &lt;count&gt; answers.
#### Example
<pre class="command-example">VtTabletUpdateStream [-count &lt;count, default 1&gt;] [-connect_timeout &lt;connect timeout&gt;] [-position &lt;position&gt;] [-timestamp &lt;timestamp&gt;] &lt;tablet alias&gt;</pre>
#### Flags
| Name | Type | Definition |
| :-------- | :--------- | :--------- |
| connect_timeout | Duration | Connection timeout for vttablet client |
| count | Int | number of responses to wait for |
| position | string | position to start the stream from |
| timestamp | Int | timestamp to start the stream from |
#### Arguments
* <code>&lt;count default 1&gt;</code> &ndash; Required.
* <code>&lt;tablet alias&gt;</code> &ndash; Required. A Tablet Alias uniquely identifies a vttablet. The argument value is in the format <code>&lt;cell name&gt;-&lt;uid&gt;</code>.
#### Errors
* The <code>&lt;tablet alias&gt;</code> argument is required for the <code>&lt;VtTabletUpdateStream&gt;</code> command. This error occurs if the command is not called with exactly one argument.
* cannot connect to tablet %v: %v
* stream ended early: %v
## Replication Graph
* [GetShardReplication](#getshardreplication)
@ -792,8 +827,65 @@ Outputs a JSON structure that contains information about the ShardReplication.
## Resharding Throttler
* [GetThrottlerConfiguration](#getthrottlerconfiguration)
* [ResetThrottlerConfiguration](#resetthrottlerconfiguration)
* [ThrottlerMaxRates](#throttlermaxrates)
* [ThrottlerSetMaxRate](#throttlersetmaxrate)
* [UpdateThrottlerConfiguration](#updatethrottlerconfiguration)
### GetThrottlerConfiguration
Returns the current configuration of the MaxReplicationLag module. If no throttler name is specified, the configuration of all throttlers will be returned.
#### Example
<pre class="command-example">GetThrottlerConfiguration -server &lt;vtworker or vttablet&gt; [&lt;throttler name&gt;]</pre>
#### Flags
| Name | Type | Definition |
| :-------- | :--------- | :--------- |
| server | string | vtworker or vttablet to connect to |
#### Arguments
* <code>&lt;vtworker or vttablet&gt;</code> &ndash; Required.
* <code>&lt;throttler name&gt;</code> &ndash; Optional.
#### Errors
* the <code>&lt;GetThrottlerConfiguration&gt;</code> command accepts only <code>&lt;throttler name&gt;</code> as optional positional parameter This error occurs if the command is not called with more than 1 arguments.
* error creating a throttler client for <code>&lt;server&gt;</code> '%v': %v
* failed to get the throttler configuration from <code>&lt;server&gt;</code> '%v': %v
### ResetThrottlerConfiguration
Resets the current configuration of the MaxReplicationLag module. If no throttler name is specified, the configuration of all throttlers will be reset.
#### Example
<pre class="command-example">ResetThrottlerConfiguration -server &lt;vtworker or vttablet&gt; [&lt;throttler name&gt;]</pre>
#### Flags
| Name | Type | Definition |
| :-------- | :--------- | :--------- |
| server | string | vtworker or vttablet to connect to |
#### Arguments
* <code>&lt;vtworker or vttablet&gt;</code> &ndash; Required.
* <code>&lt;throttler name&gt;</code> &ndash; Optional.
#### Errors
* the <code>&lt;ResetThrottlerConfiguration&gt;</code> command accepts only <code>&lt;throttler name&gt;</code> as optional positional parameter This error occurs if the command is not called with more than 1 arguments.
* error creating a throttler client for <code>&lt;server&gt;</code> '%v': %v
* failed to get the throttler configuration from <code>&lt;server&gt;</code> '%v': %v
### ThrottlerMaxRates
@ -849,6 +941,34 @@ Sets the max rate for all active resharding throttlers on the server.
* failed to set the throttler rate on <code>&lt;server&gt;</code> '%v': %v
### UpdateThrottlerConfiguration
Updates the configuration of the MaxReplicationLag module. The configuration must be specified as protobuf text. If a field is omitted or has a zero value, it will be ignored unless -copy_zero_values is specified. If no throttler name is specified, all throttlers will be updated.
#### Example
<pre class="command-example">UpdateThrottlerConfiguration `-server &lt;vtworker or vttablet&gt; [-copy_zero_values] "&lt;configuration protobuf text&gt;" [&lt;throttler name&gt;]`</pre>
#### Flags
| Name | Type | Definition |
| :-------- | :--------- | :--------- |
| copy_zero_values | Boolean | If true, fields with zero values will be copied as well |
| server | string | vtworker or vttablet to connect to |
#### Arguments
* <code>&lt;vtworker or vttablet&gt;</code> &ndash; Required.
* <code>&lt;throttler name&gt;</code> &ndash; Optional.
#### Errors
* Failed to unmarshal the configuration protobuf text (%v) into a protobuf instance: %v
* error creating a throttler client for <code>&lt;server&gt;</code> '%v': %v
* failed to update the throttler configuration on <code>&lt;server&gt;</code> '%v': %v
## Schema, Version, Permissions
* [ApplySchema](#applyschema)
@ -1300,22 +1420,21 @@ Reparents the shard to the new master. Assumes the old master is dead and not re
#### Example
<pre class="command-example">EmergencyReparentShard &lt;keyspace/shard&gt; &lt;tablet alias&gt;</pre>
<pre class="command-example">EmergencyReparentShard -keyspace_shard=&lt;keyspace/shard&gt; -new_master=&lt;tablet alias&gt;</pre>
#### Flags
| Name | Type | Definition |
| :-------- | :--------- | :--------- |
| keyspace_shard | string | keyspace/shard of the shard that needs to be reparented |
| new_master | string | alias of a tablet that should be the new master |
| wait_slave_timeout | Duration | time to wait for slaves to catch up in reparenting |
#### Arguments
* <code>&lt;tablet alias&gt;</code> &ndash; Required. A Tablet Alias uniquely identifies a vttablet. The argument value is in the format <code>&lt;cell name&gt;-&lt;uid&gt;</code>.
#### Errors
* action <code>&lt;EmergencyReparentShard&gt;</code> requires <code>&lt;keyspace/shard&gt;</code> <code>&lt;tablet alias&gt;</code> This error occurs if the command is not called with exactly 2 arguments.
* action <code>&lt;EmergencyReparentShard&gt;</code> requires -keyspace_shard=<code>&lt;keyspace/shard&gt;</code> -new_master=<code>&lt;tablet alias&gt;</code> This error occurs if the command is not called with exactly 0 arguments.
* cannot use legacy syntax and flag -<code>&lt;new_master&gt;</code> for action <code>&lt;EmergencyReparentShard&gt;</code> at the same time
### GetShard
@ -1393,26 +1512,26 @@ Lists all tablets in the specified shard.
### PlannedReparentShard
Reparents the shard to the new master. Both old and new master need to be up and running.
Reparents the shard to the new master, or away from old master. Both old and new master need to be up and running.
#### Example
<pre class="command-example">PlannedReparentShard &lt;keyspace/shard&gt; &lt;tablet alias&gt;</pre>
<pre class="command-example">PlannedReparentShard -keyspace_shard=&lt;keyspace/shard&gt; [-new_master=&lt;tablet alias&gt;] [-avoid_master=&lt;tablet alias&gt;]</pre>
#### Flags
| Name | Type | Definition |
| :-------- | :--------- | :--------- |
| avoid_master | string | alias of a tablet that should not be the master, i.e. reparent to any other tablet if this one is the master |
| keyspace_shard | string | keyspace/shard of the shard that needs to be reparented |
| new_master | string | alias of a tablet that should be the new master |
| wait_slave_timeout | Duration | time to wait for slaves to catch up in reparenting |
#### Arguments
* <code>&lt;tablet alias&gt;</code> &ndash; Required. A Tablet Alias uniquely identifies a vttablet. The argument value is in the format <code>&lt;cell name&gt;-&lt;uid&gt;</code>.
#### Errors
* action <code>&lt;PlannedReparentShard&gt;</code> requires <code>&lt;keyspace/shard&gt;</code> <code>&lt;tablet alias&gt;</code> This error occurs if the command is not called with exactly 2 arguments.
* action <code>&lt;PlannedReparentShard&gt;</code> requires -keyspace_shard=<code>&lt;keyspace/shard&gt;</code> [-new_master=<code>&lt;tablet alias&gt;</code>] [-avoid_master=<code>&lt;tablet alias&gt;</code>] This error occurs if the command is not called with exactly 0 arguments.
* cannot use legacy syntax and flags -<code>&lt;keyspace_shard&gt;</code> and -<code>&lt;new_master&gt;</code> for action <code>&lt;PlannedReparentShard&gt;</code> at the same time
### RemoveBackup

Просмотреть файл

@ -274,7 +274,7 @@ type internalTabletConn struct {
// Execute is part of tabletconn.TabletConn
// We need to copy the bind variables as tablet server will change them.
func (itc *internalTabletConn) Execute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, transactionID int64) (*sqltypes.Result, error) {
func (itc *internalTabletConn) Execute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, transactionID int64, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
bv, err := querytypes.BindVariablesToProto3(bindVars)
if err != nil {
return nil, err
@ -283,7 +283,7 @@ func (itc *internalTabletConn) Execute(ctx context.Context, target *querypb.Targ
if err != nil {
return nil, err
}
reply, err := itc.tablet.qsc.QueryService().Execute(ctx, target, query, bindVars, transactionID)
reply, err := itc.tablet.qsc.QueryService().Execute(ctx, target, query, bindVars, transactionID, options)
if err != nil {
return nil, tabletconn.TabletErrorFromGRPC(vterrors.ToGRPCError(err))
}
@ -292,7 +292,7 @@ func (itc *internalTabletConn) Execute(ctx context.Context, target *querypb.Targ
// ExecuteBatch is part of tabletconn.TabletConn
// We need to copy the bind variables as tablet server will change them.
func (itc *internalTabletConn) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64) ([]sqltypes.Result, error) {
func (itc *internalTabletConn) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
q := make([]querytypes.BoundQuery, len(queries))
for i, query := range queries {
bv, err := querytypes.BindVariablesToProto3(query.BindVariables)
@ -306,7 +306,7 @@ func (itc *internalTabletConn) ExecuteBatch(ctx context.Context, target *querypb
q[i].Sql = query.Sql
q[i].BindVariables = bindVars
}
results, err := itc.tablet.qsc.QueryService().ExecuteBatch(ctx, target, q, asTransaction, transactionID)
results, err := itc.tablet.qsc.QueryService().ExecuteBatch(ctx, target, q, asTransaction, transactionID, options)
if err != nil {
return nil, tabletconn.TabletErrorFromGRPC(vterrors.ToGRPCError(err))
}
@ -331,7 +331,7 @@ func (a *streamExecuteAdapter) Recv() (*sqltypes.Result, error) {
// StreamExecute is part of tabletconn.TabletConn
// We need to copy the bind variables as tablet server will change them.
func (itc *internalTabletConn) StreamExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}) (sqltypes.ResultStream, error) {
func (itc *internalTabletConn) StreamExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error) {
bv, err := querytypes.BindVariablesToProto3(bindVars)
if err != nil {
return nil, err
@ -344,7 +344,7 @@ func (itc *internalTabletConn) StreamExecute(ctx context.Context, target *queryp
var finalErr error
go func() {
finalErr = itc.tablet.qsc.QueryService().StreamExecute(ctx, target, query, bindVars, func(reply *sqltypes.Result) error {
finalErr = itc.tablet.qsc.QueryService().StreamExecute(ctx, target, query, bindVars, options, func(reply *sqltypes.Result) error {
// We need to deep-copy the reply before returning,
// because the underlying buffers are reused.
result <- reply.Copy()
@ -382,22 +382,22 @@ func (itc *internalTabletConn) Rollback(ctx context.Context, target *querypb.Tar
}
// BeginExecute is part of tabletconn.TabletConn
func (itc *internalTabletConn) BeginExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}) (*sqltypes.Result, int64, error) {
func (itc *internalTabletConn) BeginExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, int64, error) {
transactionID, err := itc.Begin(ctx, target)
if err != nil {
return nil, 0, err
}
result, err := itc.Execute(ctx, target, query, bindVars, transactionID)
result, err := itc.Execute(ctx, target, query, bindVars, transactionID, options)
return result, transactionID, err
}
// BeginExecuteBatch is part of tabletconn.TabletConn
func (itc *internalTabletConn) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool) ([]sqltypes.Result, int64, error) {
func (itc *internalTabletConn) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, options *querypb.ExecuteOptions) ([]sqltypes.Result, int64, error) {
transactionID, err := itc.Begin(ctx, target)
if err != nil {
return nil, 0, err
}
results, err := itc.ExecuteBatch(ctx, target, queries, asTransaction, transactionID)
results, err := itc.ExecuteBatch(ctx, target, queries, asTransaction, transactionID, options)
return results, transactionID, err
}

Просмотреть файл

@ -35,19 +35,19 @@ func testCallerID(t *testing.T, conn *vtgateconn.VTGateConn) {
query := services.CallerIDPrefix + string(data)
// test Execute calls forward the callerID
_, err = conn.Execute(ctx, query, nil, topodatapb.TabletType_MASTER)
_, err = conn.Execute(ctx, query, nil, topodatapb.TabletType_MASTER, nil)
checkCallerIDError(t, "Execute", err)
_, err = conn.ExecuteShards(ctx, query, "", nil, nil, topodatapb.TabletType_MASTER)
_, err = conn.ExecuteShards(ctx, query, "", nil, nil, topodatapb.TabletType_MASTER, nil)
checkCallerIDError(t, "ExecuteShards", err)
_, err = conn.ExecuteKeyspaceIds(ctx, query, "", nil, nil, topodatapb.TabletType_MASTER)
_, err = conn.ExecuteKeyspaceIds(ctx, query, "", nil, nil, topodatapb.TabletType_MASTER, nil)
checkCallerIDError(t, "ExecuteKeyspaceIds", err)
_, err = conn.ExecuteKeyRanges(ctx, query, "", nil, nil, topodatapb.TabletType_MASTER)
_, err = conn.ExecuteKeyRanges(ctx, query, "", nil, nil, topodatapb.TabletType_MASTER, nil)
checkCallerIDError(t, "ExecuteKeyRanges", err)
_, err = conn.ExecuteEntityIds(ctx, query, "", "", nil, nil, topodatapb.TabletType_MASTER)
_, err = conn.ExecuteEntityIds(ctx, query, "", "", nil, nil, topodatapb.TabletType_MASTER, nil)
checkCallerIDError(t, "ExecuteEntityIds", err)
// test ExecuteBatch calls forward the callerID
@ -57,7 +57,7 @@ func testCallerID(t *testing.T, conn *vtgateconn.VTGateConn) {
Sql: query,
},
},
}, topodatapb.TabletType_MASTER, false)
}, topodatapb.TabletType_MASTER, false, nil)
checkCallerIDError(t, "ExecuteBatchShards", err)
_, err = conn.ExecuteBatchKeyspaceIds(ctx, []*vtgatepb.BoundKeyspaceIdQuery{
@ -66,20 +66,20 @@ func testCallerID(t *testing.T, conn *vtgateconn.VTGateConn) {
Sql: query,
},
},
}, topodatapb.TabletType_MASTER, false)
}, topodatapb.TabletType_MASTER, false, nil)
checkCallerIDError(t, "ExecuteBatchKeyspaceIds", err)
// test StreamExecute calls forward the callerID
err = getStreamError(conn.StreamExecute(ctx, query, nil, topodatapb.TabletType_MASTER))
err = getStreamError(conn.StreamExecute(ctx, query, nil, topodatapb.TabletType_MASTER, nil))
checkCallerIDError(t, "StreamExecute", err)
err = getStreamError(conn.StreamExecuteShards(ctx, query, "", nil, nil, topodatapb.TabletType_MASTER))
err = getStreamError(conn.StreamExecuteShards(ctx, query, "", nil, nil, topodatapb.TabletType_MASTER, nil))
checkCallerIDError(t, "StreamExecuteShards", err)
err = getStreamError(conn.StreamExecuteKeyspaceIds(ctx, query, "", nil, nil, topodatapb.TabletType_MASTER))
err = getStreamError(conn.StreamExecuteKeyspaceIds(ctx, query, "", nil, nil, topodatapb.TabletType_MASTER, nil))
checkCallerIDError(t, "StreamExecuteKeyspaceIds", err)
err = getStreamError(conn.StreamExecuteKeyRanges(ctx, query, "", nil, nil, topodatapb.TabletType_MASTER))
err = getStreamError(conn.StreamExecuteKeyRanges(ctx, query, "", nil, nil, topodatapb.TabletType_MASTER, nil))
checkCallerIDError(t, "StreamExecuteKeyRanges", err)
// test UpdateStream forwards the callerID

Просмотреть файл

@ -89,6 +89,11 @@ var (
callerID = callerid.NewEffectiveCallerID("test_principal", "test_component", "test_subcomponent")
callerIDEcho = "principal:\"test_principal\" component:\"test_component\" subcomponent:\"test_subcomponent\" "
options = &querypb.ExecuteOptions{
ExcludeFieldNames: true,
}
optionsEcho = "exclude_field_names:true "
timestamp int64 = 876543
position = "test_position"
updateStreamEcho = "map[callerId:" + callerIDEcho + " event:timestamp:876543 shard:\"-80\" position:\"" + position + "\" keyRange:" + keyRangeZeroEcho + " keyspace:conn_ks shard:echo://test query tabletType:REPLICA timestamp:0]"
@ -109,16 +114,17 @@ func testEchoExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := callerid.NewContext(context.Background(), callerID, nil)
qr, err = conn.Execute(ctx, echoPrefix+query, bindVars, tabletType)
qr, err = conn.Execute(ctx, echoPrefix+query, bindVars, tabletType, options)
checkEcho(t, "Execute", qr, err, map[string]string{
"callerId": callerIDEcho,
"query": echoPrefix + query,
"bindVars": bindVarsEcho,
"keyspace": connectionKeyspace,
"tabletType": tabletTypeEcho,
"options": optionsEcho,
})
qr, err = conn.ExecuteShards(ctx, echoPrefix+query, keyspace, shards, bindVars, tabletType)
qr, err = conn.ExecuteShards(ctx, echoPrefix+query, keyspace, shards, bindVars, tabletType, options)
checkEcho(t, "ExecuteShards", qr, err, map[string]string{
"callerId": callerIDEcho,
"query": echoPrefix + query,
@ -126,9 +132,10 @@ func testEchoExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
"shards": shardsEcho,
"bindVars": bindVarsEcho,
"tabletType": tabletTypeEcho,
"options": optionsEcho,
})
qr, err = conn.ExecuteKeyspaceIds(ctx, echoPrefix+query, keyspace, keyspaceIDs, bindVars, tabletType)
qr, err = conn.ExecuteKeyspaceIds(ctx, echoPrefix+query, keyspace, keyspaceIDs, bindVars, tabletType, options)
checkEcho(t, "ExecuteKeyspaceIds", qr, err, map[string]string{
"callerId": callerIDEcho,
"query": echoPrefix + query,
@ -136,9 +143,10 @@ func testEchoExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
"keyspaceIds": keyspaceIDsEcho,
"bindVars": bindVarsEcho,
"tabletType": tabletTypeEcho,
"options": optionsEcho,
})
qr, err = conn.ExecuteKeyRanges(ctx, echoPrefix+query, keyspace, keyRanges, bindVars, tabletType)
qr, err = conn.ExecuteKeyRanges(ctx, echoPrefix+query, keyspace, keyRanges, bindVars, tabletType, options)
checkEcho(t, "ExecuteKeyRanges", qr, err, map[string]string{
"callerId": callerIDEcho,
"query": echoPrefix + query,
@ -146,9 +154,10 @@ func testEchoExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
"keyRanges": keyRangesEcho,
"bindVars": bindVarsEcho,
"tabletType": tabletTypeEcho,
"options": optionsEcho,
})
qr, err = conn.ExecuteEntityIds(ctx, echoPrefix+query, keyspace, "column1", entityKeyspaceIDs, bindVars, tabletType)
qr, err = conn.ExecuteEntityIds(ctx, echoPrefix+query, keyspace, "column1", entityKeyspaceIDs, bindVars, tabletType, options)
checkEcho(t, "ExecuteEntityIds", qr, err, map[string]string{
"callerId": callerIDEcho,
"query": echoPrefix + query,
@ -157,6 +166,7 @@ func testEchoExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
"entityIds": entityKeyspaceIDsEcho,
"bindVars": bindVarsEcho,
"tabletType": tabletTypeEcho,
"options": optionsEcho,
})
var qrs []sqltypes.Result
@ -170,7 +180,7 @@ func testEchoExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
Keyspace: keyspace,
Shards: shards,
},
}, tabletType, true)
}, tabletType, true, options)
checkEcho(t, "ExecuteBatchShards", &qrs[0], err, map[string]string{
"callerId": callerIDEcho,
"query": echoPrefix + query,
@ -179,6 +189,7 @@ func testEchoExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
"bindVars": bindVarsP3Echo,
"tabletType": tabletTypeEcho,
"asTransaction": "true",
"options": optionsEcho,
})
qrs, err = conn.ExecuteBatchKeyspaceIds(ctx, []*vtgatepb.BoundKeyspaceIdQuery{
@ -190,7 +201,7 @@ func testEchoExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
Keyspace: keyspace,
KeyspaceIds: keyspaceIDs,
},
}, tabletType, true)
}, tabletType, true, options)
checkEcho(t, "ExecuteBatchKeyspaceIds", &qrs[0], err, map[string]string{
"callerId": callerIDEcho,
"query": echoPrefix + query,
@ -199,6 +210,7 @@ func testEchoExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
"bindVars": bindVarsP3Echo,
"tabletType": tabletTypeEcho,
"asTransaction": "true",
"options": optionsEcho,
})
}
@ -209,7 +221,7 @@ func testEchoStreamExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := callerid.NewContext(context.Background(), callerID, nil)
stream, err = conn.StreamExecute(ctx, echoPrefix+query, bindVars, tabletType)
stream, err = conn.StreamExecute(ctx, echoPrefix+query, bindVars, tabletType, options)
if err != nil {
t.Fatal(err)
}
@ -220,9 +232,10 @@ func testEchoStreamExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
"bindVars": bindVarsEcho,
"keyspace": connectionKeyspace,
"tabletType": tabletTypeEcho,
"options": optionsEcho,
})
stream, err = conn.StreamExecuteShards(ctx, echoPrefix+query, keyspace, shards, bindVars, tabletType)
stream, err = conn.StreamExecuteShards(ctx, echoPrefix+query, keyspace, shards, bindVars, tabletType, options)
if err != nil {
t.Fatal(err)
}
@ -234,9 +247,10 @@ func testEchoStreamExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
"shards": shardsEcho,
"bindVars": bindVarsEcho,
"tabletType": tabletTypeEcho,
"options": optionsEcho,
})
stream, err = conn.StreamExecuteKeyspaceIds(ctx, echoPrefix+query, keyspace, keyspaceIDs, bindVars, tabletType)
stream, err = conn.StreamExecuteKeyspaceIds(ctx, echoPrefix+query, keyspace, keyspaceIDs, bindVars, tabletType, options)
if err != nil {
t.Fatal(err)
}
@ -248,9 +262,10 @@ func testEchoStreamExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
"keyspaceIds": keyspaceIDsEcho,
"bindVars": bindVarsEcho,
"tabletType": tabletTypeEcho,
"options": optionsEcho,
})
stream, err = conn.StreamExecuteKeyRanges(ctx, echoPrefix+query, keyspace, keyRanges, bindVars, tabletType)
stream, err = conn.StreamExecuteKeyRanges(ctx, echoPrefix+query, keyspace, keyRanges, bindVars, tabletType, options)
if err != nil {
t.Fatal(err)
}
@ -262,6 +277,7 @@ func testEchoStreamExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
"keyRanges": keyRangesEcho,
"bindVars": bindVarsEcho,
"tabletType": tabletTypeEcho,
"options": optionsEcho,
})
}
@ -276,7 +292,7 @@ func testEchoTransactionExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
t.Fatalf("Begin error: %v", err)
}
qr, err = tx.Execute(ctx, echoPrefix+query, bindVars, tabletType)
qr, err = tx.Execute(ctx, echoPrefix+query, bindVars, tabletType, options)
checkEcho(t, "Execute", qr, err, map[string]string{
"callerId": callerIDEcho,
"query": echoPrefix + query,
@ -285,9 +301,10 @@ func testEchoTransactionExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
"tabletType": tabletTypeEcho,
"session": sessionEcho,
"notInTransaction": "false",
"options": optionsEcho,
})
qr, err = tx.ExecuteShards(ctx, echoPrefix+query, keyspace, shards, bindVars, tabletType)
qr, err = tx.ExecuteShards(ctx, echoPrefix+query, keyspace, shards, bindVars, tabletType, options)
checkEcho(t, "ExecuteShards", qr, err, map[string]string{
"callerId": callerIDEcho,
"query": echoPrefix + query,
@ -297,9 +314,10 @@ func testEchoTransactionExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
"tabletType": tabletTypeEcho,
"session": sessionEcho,
"notInTransaction": "false",
"options": optionsEcho,
})
qr, err = tx.ExecuteKeyspaceIds(ctx, echoPrefix+query, keyspace, keyspaceIDs, bindVars, tabletType)
qr, err = tx.ExecuteKeyspaceIds(ctx, echoPrefix+query, keyspace, keyspaceIDs, bindVars, tabletType, options)
checkEcho(t, "ExecuteKeyspaceIds", qr, err, map[string]string{
"callerId": callerIDEcho,
"query": echoPrefix + query,
@ -309,9 +327,10 @@ func testEchoTransactionExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
"tabletType": tabletTypeEcho,
"session": sessionEcho,
"notInTransaction": "false",
"options": optionsEcho,
})
qr, err = tx.ExecuteKeyRanges(ctx, echoPrefix+query, keyspace, keyRanges, bindVars, tabletType)
qr, err = tx.ExecuteKeyRanges(ctx, echoPrefix+query, keyspace, keyRanges, bindVars, tabletType, options)
checkEcho(t, "ExecuteKeyRanges", qr, err, map[string]string{
"callerId": callerIDEcho,
"query": echoPrefix + query,
@ -321,9 +340,10 @@ func testEchoTransactionExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
"tabletType": tabletTypeEcho,
"session": sessionEcho,
"notInTransaction": "false",
"options": optionsEcho,
})
qr, err = tx.ExecuteEntityIds(ctx, echoPrefix+query, keyspace, "column1", entityKeyspaceIDs, bindVars, tabletType)
qr, err = tx.ExecuteEntityIds(ctx, echoPrefix+query, keyspace, "column1", entityKeyspaceIDs, bindVars, tabletType, options)
checkEcho(t, "ExecuteEntityIds", qr, err, map[string]string{
"callerId": callerIDEcho,
"query": echoPrefix + query,
@ -334,6 +354,7 @@ func testEchoTransactionExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
"tabletType": tabletTypeEcho,
"session": sessionEcho,
"notInTransaction": "false",
"options": optionsEcho,
})
if err := tx.Rollback(ctx); err != nil {
@ -355,7 +376,7 @@ func testEchoTransactionExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
Keyspace: keyspace,
Shards: shards,
},
}, tabletType)
}, tabletType, options)
checkEcho(t, "ExecuteBatchShards", &qrs[0], err, map[string]string{
"callerId": callerIDEcho,
"query": echoPrefix + query,
@ -365,6 +386,7 @@ func testEchoTransactionExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
"tabletType": tabletTypeEcho,
"session": sessionEcho,
"asTransaction": "false",
"options": optionsEcho,
})
qrs, err = tx.ExecuteBatchKeyspaceIds(ctx, []*vtgatepb.BoundKeyspaceIdQuery{
@ -376,7 +398,7 @@ func testEchoTransactionExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
Keyspace: keyspace,
KeyspaceIds: keyspaceIDs,
},
}, tabletType)
}, tabletType, options)
checkEcho(t, "ExecuteBatchKeyspaceIds", &qrs[0], err, map[string]string{
"callerId": callerIDEcho,
"query": echoPrefix + query,
@ -386,6 +408,7 @@ func testEchoTransactionExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
"tabletType": tabletTypeEcho,
"session": sessionEcho,
"asTransaction": "false",
"options": optionsEcho,
})
}

Просмотреть файл

@ -47,23 +47,23 @@ func testExecuteErrors(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := context.Background()
checkExecuteErrors(t, func(query string) error {
_, err := conn.Execute(ctx, query, bindVars, tabletType)
_, err := conn.Execute(ctx, query, bindVars, tabletType, nil)
return err
})
checkExecuteErrors(t, func(query string) error {
_, err := conn.ExecuteShards(ctx, query, keyspace, shards, bindVars, tabletType)
_, err := conn.ExecuteShards(ctx, query, keyspace, shards, bindVars, tabletType, nil)
return err
})
checkExecuteErrors(t, func(query string) error {
_, err := conn.ExecuteKeyspaceIds(ctx, query, keyspace, keyspaceIDs, bindVars, tabletType)
_, err := conn.ExecuteKeyspaceIds(ctx, query, keyspace, keyspaceIDs, bindVars, tabletType, nil)
return err
})
checkExecuteErrors(t, func(query string) error {
_, err := conn.ExecuteKeyRanges(ctx, query, keyspace, keyRanges, bindVars, tabletType)
_, err := conn.ExecuteKeyRanges(ctx, query, keyspace, keyRanges, bindVars, tabletType, nil)
return err
})
checkExecuteErrors(t, func(query string) error {
_, err := conn.ExecuteEntityIds(ctx, query, keyspace, "column1", entityKeyspaceIDs, bindVars, tabletType)
_, err := conn.ExecuteEntityIds(ctx, query, keyspace, "column1", entityKeyspaceIDs, bindVars, tabletType, nil)
return err
})
checkExecuteErrors(t, func(query string) error {
@ -76,7 +76,7 @@ func testExecuteErrors(t *testing.T, conn *vtgateconn.VTGateConn) {
Keyspace: keyspace,
Shards: shards,
},
}, tabletType, true)
}, tabletType, true, nil)
return err
})
checkExecuteErrors(t, func(query string) error {
@ -89,7 +89,7 @@ func testExecuteErrors(t *testing.T, conn *vtgateconn.VTGateConn) {
Keyspace: keyspace,
KeyspaceIds: keyspaceIDs,
},
}, tabletType, true)
}, tabletType, true, nil)
return err
})
}
@ -98,16 +98,16 @@ func testStreamExecuteErrors(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := context.Background()
checkStreamExecuteErrors(t, func(query string) error {
return getStreamError(conn.StreamExecute(ctx, query, bindVars, tabletType))
return getStreamError(conn.StreamExecute(ctx, query, bindVars, tabletType, nil))
})
checkStreamExecuteErrors(t, func(query string) error {
return getStreamError(conn.StreamExecuteShards(ctx, query, keyspace, shards, bindVars, tabletType))
return getStreamError(conn.StreamExecuteShards(ctx, query, keyspace, shards, bindVars, tabletType, nil))
})
checkStreamExecuteErrors(t, func(query string) error {
return getStreamError(conn.StreamExecuteKeyspaceIds(ctx, query, keyspace, keyspaceIDs, bindVars, tabletType))
return getStreamError(conn.StreamExecuteKeyspaceIds(ctx, query, keyspace, keyspaceIDs, bindVars, tabletType, nil))
})
checkStreamExecuteErrors(t, func(query string) error {
return getStreamError(conn.StreamExecuteKeyRanges(ctx, query, keyspace, keyRanges, bindVars, tabletType))
return getStreamError(conn.StreamExecuteKeyRanges(ctx, query, keyspace, keyRanges, bindVars, tabletType, nil))
})
}
@ -123,23 +123,23 @@ func testTransactionExecuteErrors(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := context.Background()
checkTransactionExecuteErrors(t, conn, func(tx *vtgateconn.VTGateTx, query string) error {
_, err := tx.Execute(ctx, query, bindVars, tabletType)
_, err := tx.Execute(ctx, query, bindVars, tabletType, nil)
return err
})
checkTransactionExecuteErrors(t, conn, func(tx *vtgateconn.VTGateTx, query string) error {
_, err := tx.ExecuteShards(ctx, query, keyspace, shards, bindVars, tabletType)
_, err := tx.ExecuteShards(ctx, query, keyspace, shards, bindVars, tabletType, nil)
return err
})
checkTransactionExecuteErrors(t, conn, func(tx *vtgateconn.VTGateTx, query string) error {
_, err := tx.ExecuteKeyspaceIds(ctx, query, keyspace, keyspaceIDs, bindVars, tabletType)
_, err := tx.ExecuteKeyspaceIds(ctx, query, keyspace, keyspaceIDs, bindVars, tabletType, nil)
return err
})
checkTransactionExecuteErrors(t, conn, func(tx *vtgateconn.VTGateTx, query string) error {
_, err := tx.ExecuteKeyRanges(ctx, query, keyspace, keyRanges, bindVars, tabletType)
_, err := tx.ExecuteKeyRanges(ctx, query, keyspace, keyRanges, bindVars, tabletType, nil)
return err
})
checkTransactionExecuteErrors(t, conn, func(tx *vtgateconn.VTGateTx, query string) error {
_, err := tx.ExecuteEntityIds(ctx, query, keyspace, "column1", entityKeyspaceIDs, bindVars, tabletType)
_, err := tx.ExecuteEntityIds(ctx, query, keyspace, "column1", entityKeyspaceIDs, bindVars, tabletType, nil)
return err
})
checkTransactionExecuteErrors(t, conn, func(tx *vtgateconn.VTGateTx, query string) error {
@ -152,7 +152,7 @@ func testTransactionExecuteErrors(t *testing.T, conn *vtgateconn.VTGateConn) {
Keyspace: keyspace,
Shards: shards,
},
}, tabletType)
}, tabletType, nil)
return err
})
checkTransactionExecuteErrors(t, conn, func(tx *vtgateconn.VTGateTx, query string) error {
@ -165,7 +165,7 @@ func testTransactionExecuteErrors(t *testing.T, conn *vtgateconn.VTGateConn) {
Keyspace: keyspace,
KeyspaceIds: keyspaceIDs,
},
}, tabletType)
}, tabletType, nil)
return err
})
}

Просмотреть файл

@ -65,85 +65,85 @@ func (c *callerIDClient) checkCallerID(ctx context.Context, received string) (bo
return true, fmt.Errorf("SUCCESS: callerid matches")
}
func (c *callerIDClient) Execute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (c *callerIDClient) Execute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if ok, err := c.checkCallerID(ctx, sql); ok {
return nil, err
}
return c.fallbackClient.Execute(ctx, sql, bindVariables, keyspace, tabletType, session, notInTransaction)
return c.fallbackClient.Execute(ctx, sql, bindVariables, keyspace, tabletType, session, notInTransaction, options)
}
func (c *callerIDClient) ExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (c *callerIDClient) ExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if ok, err := c.checkCallerID(ctx, sql); ok {
return nil, err
}
return c.fallbackClient.ExecuteShards(ctx, sql, bindVariables, keyspace, shards, tabletType, session, notInTransaction)
return c.fallbackClient.ExecuteShards(ctx, sql, bindVariables, keyspace, shards, tabletType, session, notInTransaction, options)
}
func (c *callerIDClient) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (c *callerIDClient) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if ok, err := c.checkCallerID(ctx, sql); ok {
return nil, err
}
return c.fallbackClient.ExecuteKeyspaceIds(ctx, sql, bindVariables, keyspace, keyspaceIds, tabletType, session, notInTransaction)
return c.fallbackClient.ExecuteKeyspaceIds(ctx, sql, bindVariables, keyspace, keyspaceIds, tabletType, session, notInTransaction, options)
}
func (c *callerIDClient) ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (c *callerIDClient) ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if ok, err := c.checkCallerID(ctx, sql); ok {
return nil, err
}
return c.fallbackClient.ExecuteKeyRanges(ctx, sql, bindVariables, keyspace, keyRanges, tabletType, session, notInTransaction)
return c.fallbackClient.ExecuteKeyRanges(ctx, sql, bindVariables, keyspace, keyRanges, tabletType, session, notInTransaction, options)
}
func (c *callerIDClient) ExecuteEntityIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (c *callerIDClient) ExecuteEntityIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if ok, err := c.checkCallerID(ctx, sql); ok {
return nil, err
}
return c.fallbackClient.ExecuteEntityIds(ctx, sql, bindVariables, keyspace, entityColumnName, entityKeyspaceIDs, tabletType, session, notInTransaction)
return c.fallbackClient.ExecuteEntityIds(ctx, sql, bindVariables, keyspace, entityColumnName, entityKeyspaceIDs, tabletType, session, notInTransaction, options)
}
func (c *callerIDClient) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session) ([]sqltypes.Result, error) {
func (c *callerIDClient) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
if len(queries) == 1 {
if ok, err := c.checkCallerID(ctx, queries[0].Query.Sql); ok {
return nil, err
}
}
return c.fallbackClient.ExecuteBatchShards(ctx, queries, tabletType, asTransaction, session)
return c.fallbackClient.ExecuteBatchShards(ctx, queries, tabletType, asTransaction, session, options)
}
func (c *callerIDClient) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session) ([]sqltypes.Result, error) {
func (c *callerIDClient) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
if len(queries) == 1 {
if ok, err := c.checkCallerID(ctx, queries[0].Query.Sql); ok {
return nil, err
}
}
return c.fallbackClient.ExecuteBatchKeyspaceIds(ctx, queries, tabletType, asTransaction, session)
return c.fallbackClient.ExecuteBatchKeyspaceIds(ctx, queries, tabletType, asTransaction, session, options)
}
func (c *callerIDClient) StreamExecute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (c *callerIDClient) StreamExecute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
if ok, err := c.checkCallerID(ctx, sql); ok {
return err
}
return c.fallbackClient.StreamExecute(ctx, sql, bindVariables, keyspace, tabletType, sendReply)
return c.fallbackClient.StreamExecute(ctx, sql, bindVariables, keyspace, tabletType, options, sendReply)
}
func (c *callerIDClient) StreamExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (c *callerIDClient) StreamExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
if ok, err := c.checkCallerID(ctx, sql); ok {
return err
}
return c.fallbackClient.StreamExecuteShards(ctx, sql, bindVariables, keyspace, shards, tabletType, sendReply)
return c.fallbackClient.StreamExecuteShards(ctx, sql, bindVariables, keyspace, shards, tabletType, options, sendReply)
}
func (c *callerIDClient) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (c *callerIDClient) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
if ok, err := c.checkCallerID(ctx, sql); ok {
return err
}
return c.fallbackClient.StreamExecuteKeyspaceIds(ctx, sql, bindVariables, keyspace, keyspaceIds, tabletType, sendReply)
return c.fallbackClient.StreamExecuteKeyspaceIds(ctx, sql, bindVariables, keyspace, keyspaceIds, tabletType, options, sendReply)
}
func (c *callerIDClient) StreamExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (c *callerIDClient) StreamExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
if ok, err := c.checkCallerID(ctx, sql); ok {
return err
}
return c.fallbackClient.StreamExecuteKeyRanges(ctx, sql, bindVariables, keyspace, keyRanges, tabletType, sendReply)
return c.fallbackClient.StreamExecuteKeyRanges(ctx, sql, bindVariables, keyspace, keyRanges, tabletType, options, sendReply)
}
func (c *callerIDClient) SplitQuery(ctx context.Context, keyspace string, sql string, bindVariables map[string]interface{}, splitColumn string, splitCount int64) ([]*vtgatepb.SplitQueryResponse_Part, error) {

Просмотреть файл

@ -86,7 +86,7 @@ func echoQueryResult(vals map[string]interface{}) *sqltypes.Result {
return qr
}
func (c *echoClient) Execute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (c *echoClient) Execute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if strings.HasPrefix(sql, EchoPrefix) {
return echoQueryResult(map[string]interface{}{
"callerId": callerid.EffectiveCallerIDFromContext(ctx),
@ -96,12 +96,13 @@ func (c *echoClient) Execute(ctx context.Context, sql string, bindVariables map[
"tabletType": tabletType,
"session": session,
"notInTransaction": notInTransaction,
"options": options,
}), nil
}
return c.fallbackClient.Execute(ctx, sql, bindVariables, keyspace, tabletType, session, notInTransaction)
return c.fallbackClient.Execute(ctx, sql, bindVariables, keyspace, tabletType, session, notInTransaction, options)
}
func (c *echoClient) ExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (c *echoClient) ExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if strings.HasPrefix(sql, EchoPrefix) {
return echoQueryResult(map[string]interface{}{
"callerId": callerid.EffectiveCallerIDFromContext(ctx),
@ -112,12 +113,13 @@ func (c *echoClient) ExecuteShards(ctx context.Context, sql string, bindVariable
"tabletType": tabletType,
"session": session,
"notInTransaction": notInTransaction,
"options": options,
}), nil
}
return c.fallbackClient.ExecuteShards(ctx, sql, bindVariables, keyspace, shards, tabletType, session, notInTransaction)
return c.fallbackClient.ExecuteShards(ctx, sql, bindVariables, keyspace, shards, tabletType, session, notInTransaction, options)
}
func (c *echoClient) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (c *echoClient) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if strings.HasPrefix(sql, EchoPrefix) {
return echoQueryResult(map[string]interface{}{
"callerId": callerid.EffectiveCallerIDFromContext(ctx),
@ -128,12 +130,13 @@ func (c *echoClient) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVar
"tabletType": tabletType,
"session": session,
"notInTransaction": notInTransaction,
"options": options,
}), nil
}
return c.fallbackClient.ExecuteKeyspaceIds(ctx, sql, bindVariables, keyspace, keyspaceIds, tabletType, session, notInTransaction)
return c.fallbackClient.ExecuteKeyspaceIds(ctx, sql, bindVariables, keyspace, keyspaceIds, tabletType, session, notInTransaction, options)
}
func (c *echoClient) ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (c *echoClient) ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if strings.HasPrefix(sql, EchoPrefix) {
return echoQueryResult(map[string]interface{}{
"callerId": callerid.EffectiveCallerIDFromContext(ctx),
@ -144,12 +147,13 @@ func (c *echoClient) ExecuteKeyRanges(ctx context.Context, sql string, bindVaria
"tabletType": tabletType,
"session": session,
"notInTransaction": notInTransaction,
"options": options,
}), nil
}
return c.fallbackClient.ExecuteKeyRanges(ctx, sql, bindVariables, keyspace, keyRanges, tabletType, session, notInTransaction)
return c.fallbackClient.ExecuteKeyRanges(ctx, sql, bindVariables, keyspace, keyRanges, tabletType, session, notInTransaction, options)
}
func (c *echoClient) ExecuteEntityIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (c *echoClient) ExecuteEntityIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if strings.HasPrefix(sql, EchoPrefix) {
return echoQueryResult(map[string]interface{}{
"callerId": callerid.EffectiveCallerIDFromContext(ctx),
@ -161,12 +165,13 @@ func (c *echoClient) ExecuteEntityIds(ctx context.Context, sql string, bindVaria
"tabletType": tabletType,
"session": session,
"notInTransaction": notInTransaction,
"options": options,
}), nil
}
return c.fallbackClient.ExecuteEntityIds(ctx, sql, bindVariables, keyspace, entityColumnName, entityKeyspaceIDs, tabletType, session, notInTransaction)
return c.fallbackClient.ExecuteEntityIds(ctx, sql, bindVariables, keyspace, entityColumnName, entityKeyspaceIDs, tabletType, session, notInTransaction, options)
}
func (c *echoClient) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session) ([]sqltypes.Result, error) {
func (c *echoClient) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
if len(queries) > 0 && strings.HasPrefix(queries[0].Query.Sql, EchoPrefix) {
var result []sqltypes.Result
for _, query := range queries {
@ -179,14 +184,15 @@ func (c *echoClient) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb
"tabletType": tabletType,
"session": session,
"asTransaction": asTransaction,
"options": options,
}))
}
return result, nil
}
return c.fallbackClient.ExecuteBatchShards(ctx, queries, tabletType, asTransaction, session)
return c.fallbackClient.ExecuteBatchShards(ctx, queries, tabletType, asTransaction, session, options)
}
func (c *echoClient) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session) ([]sqltypes.Result, error) {
func (c *echoClient) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
if len(queries) > 0 && strings.HasPrefix(queries[0].Query.Sql, EchoPrefix) {
var result []sqltypes.Result
for _, query := range queries {
@ -199,14 +205,15 @@ func (c *echoClient) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtg
"tabletType": tabletType,
"session": session,
"asTransaction": asTransaction,
"options": options,
}))
}
return result, nil
}
return c.fallbackClient.ExecuteBatchKeyspaceIds(ctx, queries, tabletType, asTransaction, session)
return c.fallbackClient.ExecuteBatchKeyspaceIds(ctx, queries, tabletType, asTransaction, session, options)
}
func (c *echoClient) StreamExecute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (c *echoClient) StreamExecute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
if strings.HasPrefix(sql, EchoPrefix) {
sendReply(echoQueryResult(map[string]interface{}{
"callerId": callerid.EffectiveCallerIDFromContext(ctx),
@ -214,13 +221,14 @@ func (c *echoClient) StreamExecute(ctx context.Context, sql string, bindVariable
"bindVars": bindVariables,
"keyspace": keyspace,
"tabletType": tabletType,
"options": options,
}))
return nil
}
return c.fallbackClient.StreamExecute(ctx, sql, bindVariables, keyspace, tabletType, sendReply)
return c.fallbackClient.StreamExecute(ctx, sql, bindVariables, keyspace, tabletType, options, sendReply)
}
func (c *echoClient) StreamExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (c *echoClient) StreamExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
if strings.HasPrefix(sql, EchoPrefix) {
sendReply(echoQueryResult(map[string]interface{}{
"callerId": callerid.EffectiveCallerIDFromContext(ctx),
@ -229,13 +237,14 @@ func (c *echoClient) StreamExecuteShards(ctx context.Context, sql string, bindVa
"keyspace": keyspace,
"shards": shards,
"tabletType": tabletType,
"options": options,
}))
return nil
}
return c.fallbackClient.StreamExecuteShards(ctx, sql, bindVariables, keyspace, shards, tabletType, sendReply)
return c.fallbackClient.StreamExecuteShards(ctx, sql, bindVariables, keyspace, shards, tabletType, options, sendReply)
}
func (c *echoClient) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (c *echoClient) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
if strings.HasPrefix(sql, EchoPrefix) {
sendReply(echoQueryResult(map[string]interface{}{
"callerId": callerid.EffectiveCallerIDFromContext(ctx),
@ -244,13 +253,14 @@ func (c *echoClient) StreamExecuteKeyspaceIds(ctx context.Context, sql string, b
"keyspace": keyspace,
"keyspaceIds": keyspaceIds,
"tabletType": tabletType,
"options": options,
}))
return nil
}
return c.fallbackClient.StreamExecuteKeyspaceIds(ctx, sql, bindVariables, keyspace, keyspaceIds, tabletType, sendReply)
return c.fallbackClient.StreamExecuteKeyspaceIds(ctx, sql, bindVariables, keyspace, keyspaceIds, tabletType, options, sendReply)
}
func (c *echoClient) StreamExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (c *echoClient) StreamExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
if strings.HasPrefix(sql, EchoPrefix) {
sendReply(echoQueryResult(map[string]interface{}{
"callerId": callerid.EffectiveCallerIDFromContext(ctx),
@ -259,10 +269,11 @@ func (c *echoClient) StreamExecuteKeyRanges(ctx context.Context, sql string, bin
"keyspace": keyspace,
"keyRanges": keyRanges,
"tabletType": tabletType,
"options": options,
}))
return nil
}
return c.fallbackClient.StreamExecuteKeyRanges(ctx, sql, bindVariables, keyspace, keyRanges, tabletType, sendReply)
return c.fallbackClient.StreamExecuteKeyRanges(ctx, sql, bindVariables, keyspace, keyRanges, tabletType, options, sendReply)
}
func (c *echoClient) SplitQuery(ctx context.Context, keyspace string, sql string, bindVariables map[string]interface{}, splitColumn string, splitCount int64) ([]*vtgatepb.SplitQueryResponse_Part, error) {

Просмотреть файл

@ -123,57 +123,57 @@ func trimmedRequestToError(received string) error {
}
}
func (c *errorClient) Execute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (c *errorClient) Execute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if err := requestToPartialError(sql, session); err != nil {
return nil, err
}
if err := requestToError(sql); err != nil {
return nil, err
}
return c.fallbackClient.Execute(ctx, sql, bindVariables, keyspace, tabletType, session, notInTransaction)
return c.fallbackClient.Execute(ctx, sql, bindVariables, keyspace, tabletType, session, notInTransaction, options)
}
func (c *errorClient) ExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (c *errorClient) ExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if err := requestToPartialError(sql, session); err != nil {
return nil, err
}
if err := requestToError(sql); err != nil {
return nil, err
}
return c.fallbackClient.ExecuteShards(ctx, sql, bindVariables, keyspace, shards, tabletType, session, notInTransaction)
return c.fallbackClient.ExecuteShards(ctx, sql, bindVariables, keyspace, shards, tabletType, session, notInTransaction, options)
}
func (c *errorClient) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (c *errorClient) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if err := requestToPartialError(sql, session); err != nil {
return nil, err
}
if err := requestToError(sql); err != nil {
return nil, err
}
return c.fallbackClient.ExecuteKeyspaceIds(ctx, sql, bindVariables, keyspace, keyspaceIds, tabletType, session, notInTransaction)
return c.fallbackClient.ExecuteKeyspaceIds(ctx, sql, bindVariables, keyspace, keyspaceIds, tabletType, session, notInTransaction, options)
}
func (c *errorClient) ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (c *errorClient) ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if err := requestToPartialError(sql, session); err != nil {
return nil, err
}
if err := requestToError(sql); err != nil {
return nil, err
}
return c.fallbackClient.ExecuteKeyRanges(ctx, sql, bindVariables, keyspace, keyRanges, tabletType, session, notInTransaction)
return c.fallbackClient.ExecuteKeyRanges(ctx, sql, bindVariables, keyspace, keyRanges, tabletType, session, notInTransaction, options)
}
func (c *errorClient) ExecuteEntityIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (c *errorClient) ExecuteEntityIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if err := requestToPartialError(sql, session); err != nil {
return nil, err
}
if err := requestToError(sql); err != nil {
return nil, err
}
return c.fallbackClient.ExecuteEntityIds(ctx, sql, bindVariables, keyspace, entityColumnName, entityKeyspaceIDs, tabletType, session, notInTransaction)
return c.fallbackClient.ExecuteEntityIds(ctx, sql, bindVariables, keyspace, entityColumnName, entityKeyspaceIDs, tabletType, session, notInTransaction, options)
}
func (c *errorClient) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session) ([]sqltypes.Result, error) {
func (c *errorClient) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
if len(queries) == 1 {
if err := requestToPartialError(queries[0].Query.Sql, session); err != nil {
return nil, err
@ -182,10 +182,10 @@ func (c *errorClient) ExecuteBatchShards(ctx context.Context, queries []*vtgatep
return nil, err
}
}
return c.fallbackClient.ExecuteBatchShards(ctx, queries, tabletType, asTransaction, session)
return c.fallbackClient.ExecuteBatchShards(ctx, queries, tabletType, asTransaction, session, options)
}
func (c *errorClient) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session) ([]sqltypes.Result, error) {
func (c *errorClient) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
if len(queries) == 1 {
if err := requestToPartialError(queries[0].Query.Sql, session); err != nil {
return nil, err
@ -194,35 +194,35 @@ func (c *errorClient) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vt
return nil, err
}
}
return c.fallbackClient.ExecuteBatchKeyspaceIds(ctx, queries, tabletType, asTransaction, session)
return c.fallbackClient.ExecuteBatchKeyspaceIds(ctx, queries, tabletType, asTransaction, session, options)
}
func (c *errorClient) StreamExecute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (c *errorClient) StreamExecute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
if err := requestToError(sql); err != nil {
return err
}
return c.fallbackClient.StreamExecute(ctx, sql, bindVariables, keyspace, tabletType, sendReply)
return c.fallbackClient.StreamExecute(ctx, sql, bindVariables, keyspace, tabletType, options, sendReply)
}
func (c *errorClient) StreamExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (c *errorClient) StreamExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
if err := requestToError(sql); err != nil {
return err
}
return c.fallbackClient.StreamExecuteShards(ctx, sql, bindVariables, keyspace, shards, tabletType, sendReply)
return c.fallbackClient.StreamExecuteShards(ctx, sql, bindVariables, keyspace, shards, tabletType, options, sendReply)
}
func (c *errorClient) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (c *errorClient) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
if err := requestToError(sql); err != nil {
return err
}
return c.fallbackClient.StreamExecuteKeyspaceIds(ctx, sql, bindVariables, keyspace, keyspaceIds, tabletType, sendReply)
return c.fallbackClient.StreamExecuteKeyspaceIds(ctx, sql, bindVariables, keyspace, keyspaceIds, tabletType, options, sendReply)
}
func (c *errorClient) StreamExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (c *errorClient) StreamExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
if err := requestToError(sql); err != nil {
return err
}
return c.fallbackClient.StreamExecuteKeyRanges(ctx, sql, bindVariables, keyspace, keyRanges, tabletType, sendReply)
return c.fallbackClient.StreamExecuteKeyRanges(ctx, sql, bindVariables, keyspace, keyRanges, tabletType, options, sendReply)
}
func (c *errorClient) Begin(ctx context.Context) (*vtgatepb.Session, error) {

Просмотреть файл

@ -27,48 +27,48 @@ func newFallbackClient(fallback vtgateservice.VTGateService) fallbackClient {
return fallbackClient{fallback: fallback}
}
func (c fallbackClient) Execute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
return c.fallback.Execute(ctx, sql, bindVariables, keyspace, tabletType, session, notInTransaction)
func (c fallbackClient) Execute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
return c.fallback.Execute(ctx, sql, bindVariables, keyspace, tabletType, session, notInTransaction, options)
}
func (c fallbackClient) ExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
return c.fallback.ExecuteShards(ctx, sql, bindVariables, keyspace, shards, tabletType, session, notInTransaction)
func (c fallbackClient) ExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
return c.fallback.ExecuteShards(ctx, sql, bindVariables, keyspace, shards, tabletType, session, notInTransaction, options)
}
func (c fallbackClient) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
return c.fallback.ExecuteKeyspaceIds(ctx, sql, bindVariables, keyspace, keyspaceIds, tabletType, session, notInTransaction)
func (c fallbackClient) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
return c.fallback.ExecuteKeyspaceIds(ctx, sql, bindVariables, keyspace, keyspaceIds, tabletType, session, notInTransaction, options)
}
func (c fallbackClient) ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
return c.fallback.ExecuteKeyRanges(ctx, sql, bindVariables, keyspace, keyRanges, tabletType, session, notInTransaction)
func (c fallbackClient) ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
return c.fallback.ExecuteKeyRanges(ctx, sql, bindVariables, keyspace, keyRanges, tabletType, session, notInTransaction, options)
}
func (c fallbackClient) ExecuteEntityIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
return c.fallback.ExecuteEntityIds(ctx, sql, bindVariables, keyspace, entityColumnName, entityKeyspaceIDs, tabletType, session, notInTransaction)
func (c fallbackClient) ExecuteEntityIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
return c.fallback.ExecuteEntityIds(ctx, sql, bindVariables, keyspace, entityColumnName, entityKeyspaceIDs, tabletType, session, notInTransaction, options)
}
func (c fallbackClient) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session) ([]sqltypes.Result, error) {
return c.fallback.ExecuteBatchShards(ctx, queries, tabletType, asTransaction, session)
func (c fallbackClient) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
return c.fallback.ExecuteBatchShards(ctx, queries, tabletType, asTransaction, session, options)
}
func (c fallbackClient) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session) ([]sqltypes.Result, error) {
return c.fallback.ExecuteBatchKeyspaceIds(ctx, queries, tabletType, asTransaction, session)
func (c fallbackClient) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
return c.fallback.ExecuteBatchKeyspaceIds(ctx, queries, tabletType, asTransaction, session, options)
}
func (c fallbackClient) StreamExecute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
return c.fallback.StreamExecute(ctx, sql, bindVariables, keyspace, tabletType, sendReply)
func (c fallbackClient) StreamExecute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
return c.fallback.StreamExecute(ctx, sql, bindVariables, keyspace, tabletType, options, sendReply)
}
func (c fallbackClient) StreamExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
return c.fallback.StreamExecuteShards(ctx, sql, bindVariables, keyspace, shards, tabletType, sendReply)
func (c fallbackClient) StreamExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
return c.fallback.StreamExecuteShards(ctx, sql, bindVariables, keyspace, shards, tabletType, options, sendReply)
}
func (c fallbackClient) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
return c.fallback.StreamExecuteKeyspaceIds(ctx, sql, bindVariables, keyspace, keyspaceIds, tabletType, sendReply)
func (c fallbackClient) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
return c.fallback.StreamExecuteKeyspaceIds(ctx, sql, bindVariables, keyspace, keyspaceIds, tabletType, options, sendReply)
}
func (c fallbackClient) StreamExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
return c.fallback.StreamExecuteKeyRanges(ctx, sql, bindVariables, keyspace, keyRanges, tabletType, sendReply)
func (c fallbackClient) StreamExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
return c.fallback.StreamExecuteKeyRanges(ctx, sql, bindVariables, keyspace, keyRanges, tabletType, options, sendReply)
}
func (c fallbackClient) Begin(ctx context.Context) (*vtgatepb.Session, error) {

Просмотреть файл

@ -29,50 +29,50 @@ func newTerminalClient() *terminalClient {
return &terminalClient{}
}
func (c *terminalClient) Execute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (c *terminalClient) Execute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if sql == "quit://" {
log.Fatal("Received quit:// query. Going down.")
}
return nil, errTerminal
}
func (c *terminalClient) ExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (c *terminalClient) ExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
return nil, errTerminal
}
func (c *terminalClient) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (c *terminalClient) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
return nil, errTerminal
}
func (c *terminalClient) ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (c *terminalClient) ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
return nil, errTerminal
}
func (c *terminalClient) ExecuteEntityIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (c *terminalClient) ExecuteEntityIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
return nil, errTerminal
}
func (c *terminalClient) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session) ([]sqltypes.Result, error) {
func (c *terminalClient) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
return nil, errTerminal
}
func (c *terminalClient) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session) ([]sqltypes.Result, error) {
func (c *terminalClient) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
return nil, errTerminal
}
func (c *terminalClient) StreamExecute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (c *terminalClient) StreamExecute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
return errTerminal
}
func (c *terminalClient) StreamExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (c *terminalClient) StreamExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
return errTerminal
}
func (c *terminalClient) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (c *terminalClient) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
return errTerminal
}
func (c *terminalClient) StreamExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (c *terminalClient) StreamExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
return errTerminal
}

Просмотреть файл

@ -86,3 +86,26 @@ func MakeRowTrusted(fields []*querypb.Field, row *querypb.Row) []Value {
}
return sqlRow
}
// StripFieldNames will return a new Result that has the same Rows,
// but the Field objects will have their Name emptied. Note we don't
// proto.Copy each Field for performance reasons, but we only copy the
// Type field. If/when more fields are added to pb.Field, they will
// also need to be copied. Same for Result.
func (result *Result) StripFieldNames() *Result {
if len(result.Fields) == 0 {
return result
}
r := &Result{
Fields: make([]*querypb.Field, len(result.Fields)),
RowsAffected: result.RowsAffected,
InsertID: result.InsertID,
Rows: result.Rows,
}
newFieldsArray := make([]querypb.Field, len(result.Fields))
for i, f := range result.Fields {
r.Fields[i] = &newFieldsArray[i]
newFieldsArray[i].Type = f.Type
}
return r
}

Просмотреть файл

@ -72,3 +72,74 @@ func TestCopy(t *testing.T) {
t.Errorf("Copy:\n%#v, want\n%#v", out, want)
}
}
func TestStripFieldNames(t *testing.T) {
testcases := []struct {
name string
in *Result
expected *Result
}{{
name: "no fields",
in: &Result{},
expected: &Result{},
}, {
name: "empty fields",
in: &Result{
Fields: []*querypb.Field{},
},
expected: &Result{
Fields: []*querypb.Field{},
},
}, {
name: "no name",
in: &Result{
Fields: []*querypb.Field{{
Type: Int64,
}, {
Type: VarChar,
}},
},
expected: &Result{
Fields: []*querypb.Field{{
Type: Int64,
}, {
Type: VarChar,
}},
},
}, {
name: "names",
in: &Result{
Fields: []*querypb.Field{{
Name: "field1",
Type: Int64,
}, {
Name: "field2",
Type: VarChar,
}},
},
expected: &Result{
Fields: []*querypb.Field{{
Type: Int64,
}, {
Type: VarChar,
}},
},
}}
for _, tcase := range testcases {
inCopy := tcase.in.Copy()
out := inCopy.StripFieldNames()
if !reflect.DeepEqual(out, tcase.expected) {
t.Errorf("StripFieldNames unexpected result for %v: %v", tcase.name, out)
}
if len(tcase.in.Fields) > 0 {
// check the out array is different than the in array.
if out.Fields[0] == inCopy.Fields[0] {
t.Errorf("StripFieldNames modified original Field for %v", tcase.name)
}
}
// check we didn't change the original result.
if !reflect.DeepEqual(tcase.in, inCopy) {
t.Errorf("StripFieldNames modified original result")
}
}
}

Просмотреть файл

@ -197,7 +197,7 @@ func (blp *BinlogPlayer) writeRecoveryPosition(tx *binlogdatapb.BinlogTransactio
// the provided binlog player.
func ReadStartPosition(dbClient VtClient, uid uint32) (string, string, error) {
selectRecovery := QueryBlpCheckpoint(uid)
qr, err := dbClient.ExecuteFetch(selectRecovery, 1, true)
qr, err := dbClient.ExecuteFetch(selectRecovery, 1)
if err != nil {
return "", "", fmt.Errorf("error %v in selecting from recovery table %v", err, selectRecovery)
}
@ -211,7 +211,7 @@ func ReadStartPosition(dbClient VtClient, uid uint32) (string, string, error) {
// replication from the checkpoint table.
func (blp *BinlogPlayer) readThrottlerSettings() (int64, int64, error) {
selectThrottlerSettings := QueryBlpThrottlerSettings(blp.uid)
qr, err := blp.dbClient.ExecuteFetch(selectThrottlerSettings, 1, true)
qr, err := blp.dbClient.ExecuteFetch(selectThrottlerSettings, 1)
if err != nil {
return throttler.InvalidMaxRate, throttler.InvalidMaxReplicationLag, fmt.Errorf("error %v in selecting the throttler settings %v", err, selectThrottlerSettings)
}
@ -286,7 +286,7 @@ func (blp *BinlogPlayer) processTransaction(tx *binlogdatapb.BinlogTransaction)
func (blp *BinlogPlayer) exec(sql string) (*sqltypes.Result, error) {
queryStartTime := time.Now()
qr, err := blp.dbClient.ExecuteFetch(sql, 0, false)
qr, err := blp.dbClient.ExecuteFetch(sql, 0)
blp.blplStats.Timings.Record(BlplQuery, queryStartTime)
if d := time.Now().Sub(queryStartTime); d > SlowQueryThreshold {
log.Infof("SLOW QUERY (took %.2fs) '%s'", d.Seconds(), sql)

Просмотреть файл

@ -90,8 +90,8 @@ func (dc *DBClient) Close() {
}
// ExecuteFetch sends query to the db server and fetch the result
func (dc *DBClient) ExecuteFetch(query string, maxrows int, wantfields bool) (*sqltypes.Result, error) {
mqr, err := dc.dbConn.ExecuteFetch(query, maxrows, wantfields)
func (dc *DBClient) ExecuteFetch(query string, maxrows int) (*sqltypes.Result, error) {
mqr, err := dc.dbConn.ExecuteFetch(query, maxrows, false)
if err != nil {
log.Errorf("ExecuteFetch failed w/ error %v", err)
dc.handleError(err)

Просмотреть файл

@ -13,7 +13,7 @@ type VtClient interface {
Commit() error
Rollback() error
Close()
ExecuteFetch(query string, maxrows int, wantfields bool) (qr *sqltypes.Result, err error)
ExecuteFetch(query string, maxrows int) (qr *sqltypes.Result, err error)
}
// VtClientMock is a VtClient that writes to a writer instead of executing
@ -73,7 +73,7 @@ func (dc *VtClientMock) Close() {
}
// ExecuteFetch is part of the VtClient interface
func (dc *VtClientMock) ExecuteFetch(query string, maxrows int, wantfields bool) (qr *sqltypes.Result, err error) {
func (dc *VtClientMock) ExecuteFetch(query string, maxrows int) (qr *sqltypes.Result, err error) {
dc.Stdout = append(dc.Stdout, query)
if dc.currentResult+1 < len(dc.results) {
dc.currentResult++

Просмотреть файл

@ -403,17 +403,17 @@ func (fc *fakeConn) StreamHealth(ctx context.Context) (tabletconn.StreamHealthRe
}
// Execute implements tabletconn.TabletConn.
func (fc *fakeConn) Execute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, transactionID int64) (*sqltypes.Result, error) {
func (fc *fakeConn) Execute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, transactionID int64, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
return nil, fmt.Errorf("not implemented")
}
// ExecuteBatch implements tabletconn.TabletConn.
func (fc *fakeConn) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64) ([]sqltypes.Result, error) {
func (fc *fakeConn) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
return nil, fmt.Errorf("not implemented")
}
// StreamExecute implements tabletconn.TabletConn.
func (fc *fakeConn) StreamExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}) (sqltypes.ResultStream, error) {
func (fc *fakeConn) StreamExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error) {
return nil, fmt.Errorf("not implemented")
}
@ -433,12 +433,12 @@ func (fc *fakeConn) Rollback(ctx context.Context, target *querypb.Target, transa
}
// BeginExecute implements tabletconn.TabletConn.
func (fc *fakeConn) BeginExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}) (*sqltypes.Result, int64, error) {
func (fc *fakeConn) BeginExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, int64, error) {
return nil, 0, fmt.Errorf("not implemented")
}
// BeginExecuteBatch implements tabletconn.TabletConn.
func (fc *fakeConn) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool) ([]sqltypes.Result, int64, error) {
func (fc *fakeConn) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, options *querypb.ExecuteOptions) ([]sqltypes.Result, int64, error) {
return nil, 0, fmt.Errorf("not implemented")
}

Просмотреть файл

@ -15,6 +15,7 @@ It has these top-level messages:
Value
BindVariable
BoundQuery
ExecuteOptions
Field
Row
QueryResult
@ -287,7 +288,7 @@ func (x StreamEvent_Statement_Category) String() string {
return proto.EnumName(StreamEvent_Statement_Category_name, int32(x))
}
func (StreamEvent_Statement_Category) EnumDescriptor() ([]byte, []int) {
return fileDescriptor0, []int{9, 0, 0}
return fileDescriptor0, []int{10, 0, 0}
}
type SplitQueryRequest_Algorithm int32
@ -310,7 +311,7 @@ func (x SplitQueryRequest_Algorithm) String() string {
return proto.EnumName(SplitQueryRequest_Algorithm_name, int32(x))
}
func (SplitQueryRequest_Algorithm) EnumDescriptor() ([]byte, []int) {
return fileDescriptor0, []int{26, 0}
return fileDescriptor0, []int{27, 0}
}
// Target describes what the client expects the tablet is.
@ -414,6 +415,19 @@ func (m *BoundQuery) GetBindVariables() map[string]*BindVariable {
return nil
}
// ExecuteOptions is passed around for all Execute calls.
type ExecuteOptions struct {
// If set, the resulting Field array wont have a Name, just a Type.
// This is an optimization for high-QPS queries where the client knows
// what it's getting.
ExcludeFieldNames bool `protobuf:"varint,1,opt,name=exclude_field_names,json=excludeFieldNames" json:"exclude_field_names,omitempty"`
}
func (m *ExecuteOptions) Reset() { *m = ExecuteOptions{} }
func (m *ExecuteOptions) String() string { return proto.CompactTextString(m) }
func (*ExecuteOptions) ProtoMessage() {}
func (*ExecuteOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
// Field describes a single column returned by a query
type Field struct {
// name of the field as returned by mysql C API
@ -425,7 +439,7 @@ type Field struct {
func (m *Field) Reset() { *m = Field{} }
func (m *Field) String() string { return proto.CompactTextString(m) }
func (*Field) ProtoMessage() {}
func (*Field) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
func (*Field) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
// Row is a database row.
type Row struct {
@ -441,7 +455,7 @@ type Row struct {
func (m *Row) Reset() { *m = Row{} }
func (m *Row) String() string { return proto.CompactTextString(m) }
func (*Row) ProtoMessage() {}
func (*Row) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
func (*Row) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
// QueryResult is returned by Execute and ExecuteStream.
//
@ -462,7 +476,7 @@ type QueryResult struct {
func (m *QueryResult) Reset() { *m = QueryResult{} }
func (m *QueryResult) String() string { return proto.CompactTextString(m) }
func (*QueryResult) ProtoMessage() {}
func (*QueryResult) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
func (*QueryResult) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
func (m *QueryResult) GetFields() []*Field {
if m != nil {
@ -491,7 +505,7 @@ type StreamEvent struct {
func (m *StreamEvent) Reset() { *m = StreamEvent{} }
func (m *StreamEvent) String() string { return proto.CompactTextString(m) }
func (*StreamEvent) ProtoMessage() {}
func (*StreamEvent) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
func (*StreamEvent) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
func (m *StreamEvent) GetStatements() []*StreamEvent_Statement {
if m != nil {
@ -522,7 +536,7 @@ type StreamEvent_Statement struct {
func (m *StreamEvent_Statement) Reset() { *m = StreamEvent_Statement{} }
func (m *StreamEvent_Statement) String() string { return proto.CompactTextString(m) }
func (*StreamEvent_Statement) ProtoMessage() {}
func (*StreamEvent_Statement) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9, 0} }
func (*StreamEvent_Statement) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10, 0} }
func (m *StreamEvent_Statement) GetPrimaryKeyFields() []*Field {
if m != nil {
@ -545,12 +559,13 @@ type ExecuteRequest struct {
Target *Target `protobuf:"bytes,3,opt,name=target" json:"target,omitempty"`
Query *BoundQuery `protobuf:"bytes,4,opt,name=query" json:"query,omitempty"`
TransactionId int64 `protobuf:"varint,5,opt,name=transaction_id,json=transactionId" json:"transaction_id,omitempty"`
Options *ExecuteOptions `protobuf:"bytes,6,opt,name=options" json:"options,omitempty"`
}
func (m *ExecuteRequest) Reset() { *m = ExecuteRequest{} }
func (m *ExecuteRequest) String() string { return proto.CompactTextString(m) }
func (*ExecuteRequest) ProtoMessage() {}
func (*ExecuteRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
func (*ExecuteRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} }
func (m *ExecuteRequest) GetEffectiveCallerId() *vtrpc.CallerID {
if m != nil {
@ -580,6 +595,13 @@ func (m *ExecuteRequest) GetQuery() *BoundQuery {
return nil
}
func (m *ExecuteRequest) GetOptions() *ExecuteOptions {
if m != nil {
return m.Options
}
return nil
}
// ExecuteResponse is the returned value from Execute
type ExecuteResponse struct {
Result *QueryResult `protobuf:"bytes,1,opt,name=result" json:"result,omitempty"`
@ -588,7 +610,7 @@ type ExecuteResponse struct {
func (m *ExecuteResponse) Reset() { *m = ExecuteResponse{} }
func (m *ExecuteResponse) String() string { return proto.CompactTextString(m) }
func (*ExecuteResponse) ProtoMessage() {}
func (*ExecuteResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} }
func (*ExecuteResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} }
func (m *ExecuteResponse) GetResult() *QueryResult {
if m != nil {
@ -605,12 +627,13 @@ type ExecuteBatchRequest struct {
Queries []*BoundQuery `protobuf:"bytes,4,rep,name=queries" json:"queries,omitempty"`
AsTransaction bool `protobuf:"varint,5,opt,name=as_transaction,json=asTransaction" json:"as_transaction,omitempty"`
TransactionId int64 `protobuf:"varint,6,opt,name=transaction_id,json=transactionId" json:"transaction_id,omitempty"`
Options *ExecuteOptions `protobuf:"bytes,7,opt,name=options" json:"options,omitempty"`
}
func (m *ExecuteBatchRequest) Reset() { *m = ExecuteBatchRequest{} }
func (m *ExecuteBatchRequest) String() string { return proto.CompactTextString(m) }
func (*ExecuteBatchRequest) ProtoMessage() {}
func (*ExecuteBatchRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} }
func (*ExecuteBatchRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} }
func (m *ExecuteBatchRequest) GetEffectiveCallerId() *vtrpc.CallerID {
if m != nil {
@ -640,6 +663,13 @@ func (m *ExecuteBatchRequest) GetQueries() []*BoundQuery {
return nil
}
func (m *ExecuteBatchRequest) GetOptions() *ExecuteOptions {
if m != nil {
return m.Options
}
return nil
}
// ExecuteBatchResponse is the returned value from ExecuteBatch
type ExecuteBatchResponse struct {
Results []*QueryResult `protobuf:"bytes,1,rep,name=results" json:"results,omitempty"`
@ -648,7 +678,7 @@ type ExecuteBatchResponse struct {
func (m *ExecuteBatchResponse) Reset() { *m = ExecuteBatchResponse{} }
func (m *ExecuteBatchResponse) String() string { return proto.CompactTextString(m) }
func (*ExecuteBatchResponse) ProtoMessage() {}
func (*ExecuteBatchResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} }
func (*ExecuteBatchResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} }
func (m *ExecuteBatchResponse) GetResults() []*QueryResult {
if m != nil {
@ -663,12 +693,13 @@ type StreamExecuteRequest struct {
ImmediateCallerId *VTGateCallerID `protobuf:"bytes,2,opt,name=immediate_caller_id,json=immediateCallerId" json:"immediate_caller_id,omitempty"`
Target *Target `protobuf:"bytes,3,opt,name=target" json:"target,omitempty"`
Query *BoundQuery `protobuf:"bytes,4,opt,name=query" json:"query,omitempty"`
Options *ExecuteOptions `protobuf:"bytes,5,opt,name=options" json:"options,omitempty"`
}
func (m *StreamExecuteRequest) Reset() { *m = StreamExecuteRequest{} }
func (m *StreamExecuteRequest) String() string { return proto.CompactTextString(m) }
func (*StreamExecuteRequest) ProtoMessage() {}
func (*StreamExecuteRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} }
func (*StreamExecuteRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} }
func (m *StreamExecuteRequest) GetEffectiveCallerId() *vtrpc.CallerID {
if m != nil {
@ -698,6 +729,13 @@ func (m *StreamExecuteRequest) GetQuery() *BoundQuery {
return nil
}
func (m *StreamExecuteRequest) GetOptions() *ExecuteOptions {
if m != nil {
return m.Options
}
return nil
}
// StreamExecuteResponse is the returned value from StreamExecute
type StreamExecuteResponse struct {
Result *QueryResult `protobuf:"bytes,1,opt,name=result" json:"result,omitempty"`
@ -706,7 +744,7 @@ type StreamExecuteResponse struct {
func (m *StreamExecuteResponse) Reset() { *m = StreamExecuteResponse{} }
func (m *StreamExecuteResponse) String() string { return proto.CompactTextString(m) }
func (*StreamExecuteResponse) ProtoMessage() {}
func (*StreamExecuteResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} }
func (*StreamExecuteResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} }
func (m *StreamExecuteResponse) GetResult() *QueryResult {
if m != nil {
@ -725,7 +763,7 @@ type BeginRequest struct {
func (m *BeginRequest) Reset() { *m = BeginRequest{} }
func (m *BeginRequest) String() string { return proto.CompactTextString(m) }
func (*BeginRequest) ProtoMessage() {}
func (*BeginRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} }
func (*BeginRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} }
func (m *BeginRequest) GetEffectiveCallerId() *vtrpc.CallerID {
if m != nil {
@ -756,7 +794,7 @@ type BeginResponse struct {
func (m *BeginResponse) Reset() { *m = BeginResponse{} }
func (m *BeginResponse) String() string { return proto.CompactTextString(m) }
func (*BeginResponse) ProtoMessage() {}
func (*BeginResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} }
func (*BeginResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} }
// CommitRequest is the payload to Commit
type CommitRequest struct {
@ -769,7 +807,7 @@ type CommitRequest struct {
func (m *CommitRequest) Reset() { *m = CommitRequest{} }
func (m *CommitRequest) String() string { return proto.CompactTextString(m) }
func (*CommitRequest) ProtoMessage() {}
func (*CommitRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} }
func (*CommitRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} }
func (m *CommitRequest) GetEffectiveCallerId() *vtrpc.CallerID {
if m != nil {
@ -799,7 +837,7 @@ type CommitResponse struct {
func (m *CommitResponse) Reset() { *m = CommitResponse{} }
func (m *CommitResponse) String() string { return proto.CompactTextString(m) }
func (*CommitResponse) ProtoMessage() {}
func (*CommitResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} }
func (*CommitResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} }
// RollbackRequest is the payload to Rollback
type RollbackRequest struct {
@ -812,7 +850,7 @@ type RollbackRequest struct {
func (m *RollbackRequest) Reset() { *m = RollbackRequest{} }
func (m *RollbackRequest) String() string { return proto.CompactTextString(m) }
func (*RollbackRequest) ProtoMessage() {}
func (*RollbackRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} }
func (*RollbackRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} }
func (m *RollbackRequest) GetEffectiveCallerId() *vtrpc.CallerID {
if m != nil {
@ -842,7 +880,7 @@ type RollbackResponse struct {
func (m *RollbackResponse) Reset() { *m = RollbackResponse{} }
func (m *RollbackResponse) String() string { return proto.CompactTextString(m) }
func (*RollbackResponse) ProtoMessage() {}
func (*RollbackResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} }
func (*RollbackResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} }
// BeginExecuteRequest is the payload to BeginExecute
type BeginExecuteRequest struct {
@ -850,12 +888,13 @@ type BeginExecuteRequest struct {
ImmediateCallerId *VTGateCallerID `protobuf:"bytes,2,opt,name=immediate_caller_id,json=immediateCallerId" json:"immediate_caller_id,omitempty"`
Target *Target `protobuf:"bytes,3,opt,name=target" json:"target,omitempty"`
Query *BoundQuery `protobuf:"bytes,4,opt,name=query" json:"query,omitempty"`
Options *ExecuteOptions `protobuf:"bytes,5,opt,name=options" json:"options,omitempty"`
}
func (m *BeginExecuteRequest) Reset() { *m = BeginExecuteRequest{} }
func (m *BeginExecuteRequest) String() string { return proto.CompactTextString(m) }
func (*BeginExecuteRequest) ProtoMessage() {}
func (*BeginExecuteRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} }
func (*BeginExecuteRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} }
func (m *BeginExecuteRequest) GetEffectiveCallerId() *vtrpc.CallerID {
if m != nil {
@ -885,6 +924,13 @@ func (m *BeginExecuteRequest) GetQuery() *BoundQuery {
return nil
}
func (m *BeginExecuteRequest) GetOptions() *ExecuteOptions {
if m != nil {
return m.Options
}
return nil
}
// BeginExecuteResponse is the returned value from BeginExecute
type BeginExecuteResponse struct {
// error contains an application level error if necessary. Note the
@ -899,7 +945,7 @@ type BeginExecuteResponse struct {
func (m *BeginExecuteResponse) Reset() { *m = BeginExecuteResponse{} }
func (m *BeginExecuteResponse) String() string { return proto.CompactTextString(m) }
func (*BeginExecuteResponse) ProtoMessage() {}
func (*BeginExecuteResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} }
func (*BeginExecuteResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} }
func (m *BeginExecuteResponse) GetError() *vtrpc.RPCError {
if m != nil {
@ -922,12 +968,13 @@ type BeginExecuteBatchRequest struct {
Target *Target `protobuf:"bytes,3,opt,name=target" json:"target,omitempty"`
Queries []*BoundQuery `protobuf:"bytes,4,rep,name=queries" json:"queries,omitempty"`
AsTransaction bool `protobuf:"varint,5,opt,name=as_transaction,json=asTransaction" json:"as_transaction,omitempty"`
Options *ExecuteOptions `protobuf:"bytes,6,opt,name=options" json:"options,omitempty"`
}
func (m *BeginExecuteBatchRequest) Reset() { *m = BeginExecuteBatchRequest{} }
func (m *BeginExecuteBatchRequest) String() string { return proto.CompactTextString(m) }
func (*BeginExecuteBatchRequest) ProtoMessage() {}
func (*BeginExecuteBatchRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} }
func (*BeginExecuteBatchRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} }
func (m *BeginExecuteBatchRequest) GetEffectiveCallerId() *vtrpc.CallerID {
if m != nil {
@ -957,6 +1004,13 @@ func (m *BeginExecuteBatchRequest) GetQueries() []*BoundQuery {
return nil
}
func (m *BeginExecuteBatchRequest) GetOptions() *ExecuteOptions {
if m != nil {
return m.Options
}
return nil
}
// BeginExecuteBatchResponse is the returned value from BeginExecuteBatch
type BeginExecuteBatchResponse struct {
// error contains an application level error if necessary. Note the
@ -971,7 +1025,7 @@ type BeginExecuteBatchResponse struct {
func (m *BeginExecuteBatchResponse) Reset() { *m = BeginExecuteBatchResponse{} }
func (m *BeginExecuteBatchResponse) String() string { return proto.CompactTextString(m) }
func (*BeginExecuteBatchResponse) ProtoMessage() {}
func (*BeginExecuteBatchResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} }
func (*BeginExecuteBatchResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} }
func (m *BeginExecuteBatchResponse) GetError() *vtrpc.RPCError {
if m != nil {
@ -1013,7 +1067,7 @@ type SplitQueryRequest struct {
func (m *SplitQueryRequest) Reset() { *m = SplitQueryRequest{} }
func (m *SplitQueryRequest) String() string { return proto.CompactTextString(m) }
func (*SplitQueryRequest) ProtoMessage() {}
func (*SplitQueryRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} }
func (*SplitQueryRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} }
func (m *SplitQueryRequest) GetEffectiveCallerId() *vtrpc.CallerID {
if m != nil {
@ -1054,7 +1108,7 @@ type QuerySplit struct {
func (m *QuerySplit) Reset() { *m = QuerySplit{} }
func (m *QuerySplit) String() string { return proto.CompactTextString(m) }
func (*QuerySplit) ProtoMessage() {}
func (*QuerySplit) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} }
func (*QuerySplit) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} }
func (m *QuerySplit) GetQuery() *BoundQuery {
if m != nil {
@ -1072,7 +1126,7 @@ type SplitQueryResponse struct {
func (m *SplitQueryResponse) Reset() { *m = SplitQueryResponse{} }
func (m *SplitQueryResponse) String() string { return proto.CompactTextString(m) }
func (*SplitQueryResponse) ProtoMessage() {}
func (*SplitQueryResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} }
func (*SplitQueryResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} }
func (m *SplitQueryResponse) GetQueries() []*QuerySplit {
if m != nil {
@ -1088,7 +1142,7 @@ type StreamHealthRequest struct {
func (m *StreamHealthRequest) Reset() { *m = StreamHealthRequest{} }
func (m *StreamHealthRequest) String() string { return proto.CompactTextString(m) }
func (*StreamHealthRequest) ProtoMessage() {}
func (*StreamHealthRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} }
func (*StreamHealthRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} }
// RealtimeStats contains information about the tablet status
type RealtimeStats struct {
@ -1124,7 +1178,7 @@ type RealtimeStats struct {
func (m *RealtimeStats) Reset() { *m = RealtimeStats{} }
func (m *RealtimeStats) String() string { return proto.CompactTextString(m) }
func (*RealtimeStats) ProtoMessage() {}
func (*RealtimeStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} }
func (*RealtimeStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{31} }
// StreamHealthResponse is streamed by StreamHealth on a regular basis
type StreamHealthResponse struct {
@ -1148,7 +1202,7 @@ type StreamHealthResponse struct {
func (m *StreamHealthResponse) Reset() { *m = StreamHealthResponse{} }
func (m *StreamHealthResponse) String() string { return proto.CompactTextString(m) }
func (*StreamHealthResponse) ProtoMessage() {}
func (*StreamHealthResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{31} }
func (*StreamHealthResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{32} }
func (m *StreamHealthResponse) GetTarget() *Target {
if m != nil {
@ -1182,7 +1236,7 @@ type UpdateStreamRequest struct {
func (m *UpdateStreamRequest) Reset() { *m = UpdateStreamRequest{} }
func (m *UpdateStreamRequest) String() string { return proto.CompactTextString(m) }
func (*UpdateStreamRequest) ProtoMessage() {}
func (*UpdateStreamRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{32} }
func (*UpdateStreamRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{33} }
func (m *UpdateStreamRequest) GetEffectiveCallerId() *vtrpc.CallerID {
if m != nil {
@ -1213,7 +1267,7 @@ type UpdateStreamResponse struct {
func (m *UpdateStreamResponse) Reset() { *m = UpdateStreamResponse{} }
func (m *UpdateStreamResponse) String() string { return proto.CompactTextString(m) }
func (*UpdateStreamResponse) ProtoMessage() {}
func (*UpdateStreamResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{33} }
func (*UpdateStreamResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{34} }
func (m *UpdateStreamResponse) GetEvent() *StreamEvent {
if m != nil {
@ -1229,6 +1283,7 @@ func init() {
proto.RegisterType((*Value)(nil), "query.Value")
proto.RegisterType((*BindVariable)(nil), "query.BindVariable")
proto.RegisterType((*BoundQuery)(nil), "query.BoundQuery")
proto.RegisterType((*ExecuteOptions)(nil), "query.ExecuteOptions")
proto.RegisterType((*Field)(nil), "query.Field")
proto.RegisterType((*Row)(nil), "query.Row")
proto.RegisterType((*QueryResult)(nil), "query.QueryResult")
@ -1267,125 +1322,129 @@ func init() {
func init() { proto.RegisterFile("query.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 1917 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xec, 0x58, 0xed, 0x6f, 0x23, 0x47,
0x19, 0xbf, 0xf5, 0x5b, 0xec, 0xc7, 0x71, 0x32, 0x37, 0xc9, 0x81, 0x49, 0x0f, 0x1a, 0xb6, 0xbd,
0x36, 0x5c, 0x4f, 0xd6, 0xe1, 0x0b, 0xe1, 0x54, 0x0a, 0x9c, 0x9d, 0x38, 0x57, 0xab, 0x8e, 0xcf,
0x37, 0x5e, 0x47, 0x1c, 0x42, 0x5a, 0x6d, 0xec, 0x39, 0x67, 0x95, 0xf5, 0xee, 0x66, 0x67, 0x36,
0xa9, 0xbf, 0x85, 0xf2, 0xfe, 0xda, 0x22, 0x28, 0xe5, 0x45, 0x20, 0x24, 0xfe, 0x0e, 0x84, 0xc4,
0xff, 0x82, 0x10, 0x1f, 0x80, 0xff, 0x00, 0xa1, 0x99, 0x9d, 0x5d, 0xaf, 0x73, 0x6e, 0x0f, 0xfa,
0xed, 0x5a, 0x3e, 0x79, 0xe6, 0x79, 0x9e, 0x79, 0x5e, 0x7e, 0xcf, 0x8b, 0x77, 0x06, 0xca, 0xa7,
0x21, 0x0d, 0xa6, 0x35, 0x3f, 0xf0, 0xb8, 0x87, 0xf3, 0x72, 0xb3, 0xb1, 0xc2, 0x3d, 0xdf, 0x1b,
0x59, 0xdc, 0x8a, 0xc8, 0x1b, 0xe5, 0x33, 0x1e, 0xf8, 0xc3, 0x68, 0xa3, 0x9f, 0x42, 0xc1, 0xb0,
0x82, 0x31, 0xe5, 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, 0xab, 0x3b, 0xd8, 0x43, 0x7f, 0x40, 0x9c, 0xd8, 0x6f, 0xe9, 0xe8, 0x8f, 0x9c, 0x98,
0xd3, 0x07, 0xbd, 0x4e, 0x0b, 0x5d, 0x6d, 0xae, 0x43, 0x75, 0xe8, 0x4e, 0x6a, 0x53, 0x37, 0x64,
0xe1, 0x21, 0xad, 0x9d, 0x5a, 0x8c, 0x06, 0x41, 0xf4, 0xc7, 0xc4, 0x61, 0x5e, 0xfc, 0xdc, 0xfe,
0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x85, 0xe6, 0x02, 0xd7, 0xd2, 0x18, 0x00, 0x00,
}

Просмотреть файл

@ -120,6 +120,8 @@ type ExecuteRequest struct {
NotInTransaction bool `protobuf:"varint,5,opt,name=not_in_transaction,json=notInTransaction" json:"not_in_transaction,omitempty"`
// keyspace to target the query to.
Keyspace string `protobuf:"bytes,6,opt,name=keyspace" json:"keyspace,omitempty"`
// options
Options *query.ExecuteOptions `protobuf:"bytes,7,opt,name=options" json:"options,omitempty"`
}
func (m *ExecuteRequest) Reset() { *m = ExecuteRequest{} }
@ -148,6 +150,13 @@ func (m *ExecuteRequest) GetQuery() *query.BoundQuery {
return nil
}
func (m *ExecuteRequest) GetOptions() *query.ExecuteOptions {
if m != nil {
return m.Options
}
return nil
}
// ExecuteResponse is the returned value from Execute.
type ExecuteResponse struct {
// error contains an application level error if necessary. Note the
@ -204,6 +213,8 @@ type ExecuteShardsRequest struct {
TabletType topodata.TabletType `protobuf:"varint,6,opt,name=tablet_type,json=tabletType,enum=topodata.TabletType" json:"tablet_type,omitempty"`
// not_in_transaction is deprecated and should not be used.
NotInTransaction bool `protobuf:"varint,7,opt,name=not_in_transaction,json=notInTransaction" json:"not_in_transaction,omitempty"`
// options
Options *query.ExecuteOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"`
}
func (m *ExecuteShardsRequest) Reset() { *m = ExecuteShardsRequest{} }
@ -232,6 +243,13 @@ func (m *ExecuteShardsRequest) GetQuery() *query.BoundQuery {
return nil
}
func (m *ExecuteShardsRequest) GetOptions() *query.ExecuteOptions {
if m != nil {
return m.Options
}
return nil
}
// ExecuteShardsResponse is the returned value from ExecuteShards.
type ExecuteShardsResponse struct {
// error contains an application level error if necessary. Note the
@ -289,6 +307,8 @@ type ExecuteKeyspaceIdsRequest struct {
TabletType topodata.TabletType `protobuf:"varint,6,opt,name=tablet_type,json=tabletType,enum=topodata.TabletType" json:"tablet_type,omitempty"`
// not_in_transaction is deprecated and should not be used.
NotInTransaction bool `protobuf:"varint,7,opt,name=not_in_transaction,json=notInTransaction" json:"not_in_transaction,omitempty"`
// options
Options *query.ExecuteOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"`
}
func (m *ExecuteKeyspaceIdsRequest) Reset() { *m = ExecuteKeyspaceIdsRequest{} }
@ -317,6 +337,13 @@ func (m *ExecuteKeyspaceIdsRequest) GetQuery() *query.BoundQuery {
return nil
}
func (m *ExecuteKeyspaceIdsRequest) GetOptions() *query.ExecuteOptions {
if m != nil {
return m.Options
}
return nil
}
// ExecuteKeyspaceIdsResponse is the returned value from ExecuteKeyspaceIds.
type ExecuteKeyspaceIdsResponse struct {
// error contains an application level error if necessary. Note the
@ -374,6 +401,8 @@ type ExecuteKeyRangesRequest struct {
TabletType topodata.TabletType `protobuf:"varint,6,opt,name=tablet_type,json=tabletType,enum=topodata.TabletType" json:"tablet_type,omitempty"`
// not_in_transaction is deprecated and should not be used.
NotInTransaction bool `protobuf:"varint,7,opt,name=not_in_transaction,json=notInTransaction" json:"not_in_transaction,omitempty"`
// options
Options *query.ExecuteOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"`
}
func (m *ExecuteKeyRangesRequest) Reset() { *m = ExecuteKeyRangesRequest{} }
@ -409,6 +438,13 @@ func (m *ExecuteKeyRangesRequest) GetKeyRanges() []*topodata.KeyRange {
return nil
}
func (m *ExecuteKeyRangesRequest) GetOptions() *query.ExecuteOptions {
if m != nil {
return m.Options
}
return nil
}
// ExecuteKeyRangesResponse is the returned value from ExecuteKeyRanges.
type ExecuteKeyRangesResponse struct {
// error contains an application level error if necessary. Note the
@ -468,6 +504,8 @@ type ExecuteEntityIdsRequest struct {
TabletType topodata.TabletType `protobuf:"varint,7,opt,name=tablet_type,json=tabletType,enum=topodata.TabletType" json:"tablet_type,omitempty"`
// not_in_transaction is deprecated and should not be used.
NotInTransaction bool `protobuf:"varint,8,opt,name=not_in_transaction,json=notInTransaction" json:"not_in_transaction,omitempty"`
// options
Options *query.ExecuteOptions `protobuf:"bytes,9,opt,name=options" json:"options,omitempty"`
}
func (m *ExecuteEntityIdsRequest) Reset() { *m = ExecuteEntityIdsRequest{} }
@ -503,6 +541,13 @@ func (m *ExecuteEntityIdsRequest) GetEntityKeyspaceIds() []*ExecuteEntityIdsRequ
return nil
}
func (m *ExecuteEntityIdsRequest) GetOptions() *query.ExecuteOptions {
if m != nil {
return m.Options
}
return nil
}
type ExecuteEntityIdsRequest_EntityId struct {
// type is the type of the entity's value. Can be NULL_TYPE.
Type query.Type `protobuf:"varint,1,opt,name=type,enum=query.Type" json:"type,omitempty"`
@ -597,6 +642,8 @@ type ExecuteBatchShardsRequest struct {
// (this can be seen as adding a 'begin' before and 'commit' after the queries).
// Only makes sense if tablet_type is master. If set, the Session is ignored.
AsTransaction bool `protobuf:"varint,5,opt,name=as_transaction,json=asTransaction" json:"as_transaction,omitempty"`
// options
Options *query.ExecuteOptions `protobuf:"bytes,6,opt,name=options" json:"options,omitempty"`
}
func (m *ExecuteBatchShardsRequest) Reset() { *m = ExecuteBatchShardsRequest{} }
@ -625,6 +672,13 @@ func (m *ExecuteBatchShardsRequest) GetQueries() []*BoundShardQuery {
return nil
}
func (m *ExecuteBatchShardsRequest) GetOptions() *query.ExecuteOptions {
if m != nil {
return m.Options
}
return nil
}
// ExecuteBatchShardsResponse is the returned value from ExecuteBatchShards.
type ExecuteBatchShardsResponse struct {
// error contains an application level error if necessary. Note the
@ -703,6 +757,8 @@ type ExecuteBatchKeyspaceIdsRequest struct {
// (this can be seen as adding a 'begin' before and 'commit' after the queries).
// Only makes sense if tablet_type is master. If set, the Session is ignored.
AsTransaction bool `protobuf:"varint,5,opt,name=as_transaction,json=asTransaction" json:"as_transaction,omitempty"`
// options
Options *query.ExecuteOptions `protobuf:"bytes,6,opt,name=options" json:"options,omitempty"`
}
func (m *ExecuteBatchKeyspaceIdsRequest) Reset() { *m = ExecuteBatchKeyspaceIdsRequest{} }
@ -731,6 +787,13 @@ func (m *ExecuteBatchKeyspaceIdsRequest) GetQueries() []*BoundKeyspaceIdQuery {
return nil
}
func (m *ExecuteBatchKeyspaceIdsRequest) GetOptions() *query.ExecuteOptions {
if m != nil {
return m.Options
}
return nil
}
// ExecuteBatchKeyspaceIdsResponse is the returned value from ExecuteBatchKeyspaceId.
type ExecuteBatchKeyspaceIdsResponse struct {
// error contains an application level error if necessary. Note the
@ -782,6 +845,8 @@ type StreamExecuteRequest struct {
TabletType topodata.TabletType `protobuf:"varint,3,opt,name=tablet_type,json=tabletType,enum=topodata.TabletType" json:"tablet_type,omitempty"`
// keyspace to target the query to.
Keyspace string `protobuf:"bytes,4,opt,name=keyspace" json:"keyspace,omitempty"`
// options
Options *query.ExecuteOptions `protobuf:"bytes,5,opt,name=options" json:"options,omitempty"`
}
func (m *StreamExecuteRequest) Reset() { *m = StreamExecuteRequest{} }
@ -803,6 +868,13 @@ func (m *StreamExecuteRequest) GetQuery() *query.BoundQuery {
return nil
}
func (m *StreamExecuteRequest) GetOptions() *query.ExecuteOptions {
if m != nil {
return m.Options
}
return nil
}
// StreamExecuteResponse is the returned value from StreamExecute.
type StreamExecuteResponse struct {
// result contains the result data.
@ -836,6 +908,8 @@ type StreamExecuteShardsRequest struct {
Shards []string `protobuf:"bytes,4,rep,name=shards" json:"shards,omitempty"`
// tablet_type is the type of tablets that this query is targeted to.
TabletType topodata.TabletType `protobuf:"varint,5,opt,name=tablet_type,json=tabletType,enum=topodata.TabletType" json:"tablet_type,omitempty"`
// options
Options *query.ExecuteOptions `protobuf:"bytes,6,opt,name=options" json:"options,omitempty"`
}
func (m *StreamExecuteShardsRequest) Reset() { *m = StreamExecuteShardsRequest{} }
@ -857,6 +931,13 @@ func (m *StreamExecuteShardsRequest) GetQuery() *query.BoundQuery {
return nil
}
func (m *StreamExecuteShardsRequest) GetOptions() *query.ExecuteOptions {
if m != nil {
return m.Options
}
return nil
}
// StreamExecuteShardsResponse is the returned value from StreamExecuteShards.
type StreamExecuteShardsResponse struct {
// result contains the result data.
@ -891,6 +972,8 @@ type StreamExecuteKeyspaceIdsRequest struct {
KeyspaceIds [][]byte `protobuf:"bytes,4,rep,name=keyspace_ids,json=keyspaceIds,proto3" json:"keyspace_ids,omitempty"`
// tablet_type is the type of tablets that this query is targeted to.
TabletType topodata.TabletType `protobuf:"varint,5,opt,name=tablet_type,json=tabletType,enum=topodata.TabletType" json:"tablet_type,omitempty"`
// options
Options *query.ExecuteOptions `protobuf:"bytes,6,opt,name=options" json:"options,omitempty"`
}
func (m *StreamExecuteKeyspaceIdsRequest) Reset() { *m = StreamExecuteKeyspaceIdsRequest{} }
@ -914,6 +997,13 @@ func (m *StreamExecuteKeyspaceIdsRequest) GetQuery() *query.BoundQuery {
return nil
}
func (m *StreamExecuteKeyspaceIdsRequest) GetOptions() *query.ExecuteOptions {
if m != nil {
return m.Options
}
return nil
}
// StreamExecuteKeyspaceIdsResponse is the returned value from StreamExecuteKeyspaceIds.
type StreamExecuteKeyspaceIdsResponse struct {
// result contains the result data.
@ -950,6 +1040,8 @@ type StreamExecuteKeyRangesRequest struct {
KeyRanges []*topodata.KeyRange `protobuf:"bytes,4,rep,name=key_ranges,json=keyRanges" json:"key_ranges,omitempty"`
// tablet_type is the type of tablets that this query is targeted to.
TabletType topodata.TabletType `protobuf:"varint,5,opt,name=tablet_type,json=tabletType,enum=topodata.TabletType" json:"tablet_type,omitempty"`
// options
Options *query.ExecuteOptions `protobuf:"bytes,6,opt,name=options" json:"options,omitempty"`
}
func (m *StreamExecuteKeyRangesRequest) Reset() { *m = StreamExecuteKeyRangesRequest{} }
@ -978,6 +1070,13 @@ func (m *StreamExecuteKeyRangesRequest) GetKeyRanges() []*topodata.KeyRange {
return nil
}
func (m *StreamExecuteKeyRangesRequest) GetOptions() *query.ExecuteOptions {
if m != nil {
return m.Options
}
return nil
}
// StreamExecuteKeyRangesResponse is the returned value from StreamExecuteKeyRanges.
type StreamExecuteKeyRangesResponse struct {
// result contains the result data.
@ -1465,95 +1564,97 @@ func init() {
func init() { proto.RegisterFile("vtgate.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 1434 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xd4, 0x59, 0x4f, 0x6f, 0x1b, 0x45,
0x14, 0xd7, 0xae, 0xff, 0x24, 0x7e, 0xfe, 0x93, 0x74, 0xea, 0xb4, 0xc6, 0x94, 0xc6, 0x5d, 0x11,
0xd5, 0x85, 0xc8, 0xa8, 0x2e, 0xff, 0x84, 0x90, 0x80, 0x98, 0x08, 0x45, 0x85, 0xaa, 0x4c, 0x02,
0xe2, 0x00, 0x5a, 0x4d, 0xec, 0x51, 0xb2, 0xd8, 0xbb, 0xeb, 0xee, 0xcc, 0xba, 0x98, 0x03, 0x37,
0x24, 0x6e, 0x3d, 0x20, 0x24, 0x84, 0xb8, 0x20, 0xf1, 0x05, 0xf8, 0x06, 0x70, 0xe2, 0xc8, 0x81,
0x03, 0x37, 0x3e, 0x02, 0x7c, 0x01, 0x0e, 0x68, 0x67, 0x66, 0xbd, 0xeb, 0x8d, 0xed, 0xba, 0x4e,
0x1a, 0x39, 0xa7, 0xec, 0xcc, 0xbc, 0x99, 0x79, 0xef, 0xf7, 0xfb, 0xcd, 0x7b, 0x33, 0x31, 0x14,
0x06, 0xfc, 0x88, 0x70, 0xda, 0xe8, 0x7b, 0x2e, 0x77, 0x51, 0x56, 0xb6, 0xaa,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0xc6, 0xe4, 0xef, 0x56, 0x87, 0x59, 0xf1, 0xe7, 0xce, 0xff, 0x01, 0x00, 0x00,
0xff, 0xff, 0x78, 0xd5, 0x81, 0xef, 0x00, 0x1b, 0x00, 0x00,
// 1471 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xd4, 0x59, 0x5b, 0x6f, 0x1b, 0x45,
0x14, 0xd6, 0xae, 0x6f, 0xf1, 0xf1, 0x25, 0xe9, 0xd4, 0x69, 0x8d, 0x29, 0x8d, 0xbb, 0x22, 0xaa,
0x0b, 0x91, 0xab, 0xa6, 0xdc, 0x84, 0x90, 0x80, 0x98, 0x08, 0x45, 0x85, 0x52, 0x26, 0x01, 0xf1,
0x00, 0x5a, 0x6d, 0xec, 0x51, 0xb2, 0xd8, 0x7b, 0xe9, 0xce, 0xac, 0x8b, 0x79, 0x40, 0xfc, 0x83,
0x3e, 0x21, 0x21, 0x84, 0x84, 0x90, 0x78, 0xe5, 0x15, 0x89, 0x37, 0x1e, 0x90, 0xf8, 0x01, 0x3c,
0xf0, 0xce, 0x1f, 0x40, 0xf0, 0x0b, 0xd0, 0xce, 0xcc, 0x5e, 0xbc, 0x89, 0x1d, 0xc7, 0x49, 0x2a,
0xf7, 0xc9, 0x9e, 0x99, 0x33, 0x33, 0xdf, 0x7c, 0xe7, 0x9b, 0x73, 0xe6, 0x68, 0xa1, 0x3c, 0x64,
0x07, 0x06, 0x23, 0x6d, 0xd7, 0x73, 0x98, 0x83, 0xf2, 0xa2, 0xd5, 0x28, 0x3d, 0xf4, 0x89, 0x37,
0x12, 0x9d, 0x8d, 0x2a, 0x73, 0x5c, 0xa7, 0x67, 0x30, 0x43, 0xb6, 0x4b, 0x43, 0xe6, 0xb9, 0x5d,
0xd1, 0xd0, 0xfe, 0x54, 0xa0, 0xb0, 0x4b, 0x28, 0x35, 0x1d, 0x1b, 0xad, 0x43, 0xd5, 0xb4, 0x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0x73, 0x3f, 0xcf, 0x7f,
0xee, 0xfe, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xc2, 0xa9, 0x37, 0x98, 0x1b, 0x1d, 0x00, 0x00,
}

Просмотреть файл

@ -120,17 +120,17 @@ type fakeTabletConn struct {
}
// Execute is part of the TabletConn interface
func (ftc *fakeTabletConn) Execute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, transactionID int64) (*sqltypes.Result, error) {
func (ftc *fakeTabletConn) Execute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, transactionID int64, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
return nil, fmt.Errorf("not implemented in this test")
}
// Execute is part of the TabletConn interface
func (ftc *fakeTabletConn) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64) ([]sqltypes.Result, error) {
func (ftc *fakeTabletConn) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
return nil, fmt.Errorf("not implemented in this test")
}
// StreamExecute is part of the TabletConn interface
func (ftc *fakeTabletConn) StreamExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}) (sqltypes.ResultStream, error) {
func (ftc *fakeTabletConn) StreamExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error) {
return nil, fmt.Errorf("not implemented in this test")
}
@ -150,12 +150,12 @@ func (ftc *fakeTabletConn) Rollback(ctx context.Context, target *querypb.Target,
}
// BeginExecute is part of the TabletConn interface
func (ftc *fakeTabletConn) BeginExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}) (*sqltypes.Result, int64, error) {
func (ftc *fakeTabletConn) BeginExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, int64, error) {
return nil, 0, fmt.Errorf("not implemented in this test")
}
// BeginExecuteBatch is part of the TabletConn interface
func (ftc *fakeTabletConn) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool) ([]sqltypes.Result, int64, error) {
func (ftc *fakeTabletConn) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, options *querypb.ExecuteOptions) ([]sqltypes.Result, int64, error) {
return nil, 0, fmt.Errorf("not implemented in this test")
}

Просмотреть файл

@ -103,7 +103,7 @@ func (dbc *DBConn) ExecOnce(ctx context.Context, query string, maxrows int, want
}
// Stream executes the query and streams the results.
func (dbc *DBConn) Stream(ctx context.Context, query string, callback func(*sqltypes.Result) error, streamBufferSize int) error {
func (dbc *DBConn) Stream(ctx context.Context, query string, callback func(*sqltypes.Result) error, streamBufferSize int, excludeFieldNames bool) error {
span := trace.NewSpanFromContext(ctx)
span.StartClient("DBConn.Stream")
defer span.Finish()
@ -114,7 +114,12 @@ func (dbc *DBConn) Stream(ctx context.Context, query string, callback func(*sqlt
ctx,
query,
func(r *sqltypes.Result) error {
resultSent = true
if !resultSent {
resultSent = true
if excludeFieldNames {
r = r.StripFieldNames()
}
}
return callback(r)
},
streamBufferSize,

Просмотреть файл

@ -119,7 +119,7 @@ func TestDBConnStream(t *testing.T) {
ctx, sql, func(r *sqltypes.Result) error {
result = *r
return nil
}, 10)
}, 10, false /*excludeFieldNames*/)
if err != nil {
t.Fatalf("should not get an error, err: %v", err)
}
@ -129,7 +129,7 @@ func TestDBConnStream(t *testing.T) {
err = dbConn.Stream(
ctx, sql, func(r *sqltypes.Result) error {
return nil
}, 10)
}, 10, false /*excludeFieldNames*/)
db.DisableConnFail()
want := "connection fail"
if err == nil || !strings.Contains(err.Error(), want) {

Просмотреть файл

@ -73,10 +73,11 @@ func (client *QueryClient) Execute(query string, bindvars map[string]interface{}
query,
bindvars,
client.transactionID,
nil,
)
}
// StreamExecute executes a query & streams the results.
// StreamExecute executes a query & returns the results.
func (client *QueryClient) StreamExecute(query string, bindvars map[string]interface{}) (*sqltypes.Result, error) {
result := &sqltypes.Result{}
err := client.server.StreamExecute(
@ -84,6 +85,7 @@ func (client *QueryClient) StreamExecute(query string, bindvars map[string]inter
&client.target,
query,
bindvars,
nil,
func(res *sqltypes.Result) error {
if result.Fields == nil {
result.Fields = res.Fields
@ -99,13 +101,14 @@ func (client *QueryClient) StreamExecute(query string, bindvars map[string]inter
return result, nil
}
// Stream streams the resutls of a query.
// Stream streams the results of a query.
func (client *QueryClient) Stream(query string, bindvars map[string]interface{}, sendFunc func(*sqltypes.Result) error) error {
return client.server.StreamExecute(
client.ctx,
&client.target,
query,
bindvars,
nil,
sendFunc,
)
}
@ -118,5 +121,6 @@ func (client *QueryClient) ExecuteBatch(queries []querytypes.BoundQuery, asTrans
queries,
asTransaction,
client.transactionID,
nil,
)
}

Просмотреть файл

@ -36,7 +36,7 @@ func (q *query) Execute(ctx context.Context, request *querypb.ExecuteRequest) (r
if err != nil {
return nil, vterrors.ToGRPCError(err)
}
result, err := q.server.Execute(ctx, request.Target, request.Query.Sql, bv, request.TransactionId)
result, err := q.server.Execute(ctx, request.Target, request.Query.Sql, bv, request.TransactionId, request.Options)
if err != nil {
return nil, vterrors.ToGRPCError(err)
}
@ -56,7 +56,7 @@ func (q *query) ExecuteBatch(ctx context.Context, request *querypb.ExecuteBatchR
if err != nil {
return nil, vterrors.ToGRPCError(err)
}
results, err := q.server.ExecuteBatch(ctx, request.Target, bql, request.AsTransaction, request.TransactionId)
results, err := q.server.ExecuteBatch(ctx, request.Target, bql, request.AsTransaction, request.TransactionId, request.Options)
if err != nil {
return nil, vterrors.ToGRPCError(err)
}
@ -76,7 +76,7 @@ func (q *query) StreamExecute(request *querypb.StreamExecuteRequest, stream quer
if err != nil {
return vterrors.ToGRPCError(err)
}
if err := q.server.StreamExecute(ctx, request.Target, request.Query.Sql, bv, func(reply *sqltypes.Result) error {
if err := q.server.StreamExecute(ctx, request.Target, request.Query.Sql, bv, request.Options, func(reply *sqltypes.Result) error {
return stream.Send(&querypb.StreamExecuteResponse{
Result: sqltypes.ResultToProto3(reply),
})
@ -142,7 +142,7 @@ func (q *query) BeginExecute(ctx context.Context, request *querypb.BeginExecuteR
return nil, vterrors.ToGRPCError(err)
}
result, transactionID, err := q.server.BeginExecute(ctx, request.Target, request.Query.Sql, bv)
result, transactionID, err := q.server.BeginExecute(ctx, request.Target, request.Query.Sql, bv, request.Options)
if err != nil {
// if we have a valid transactionID, return the error in-band
if transactionID != 0 {
@ -171,7 +171,7 @@ func (q *query) BeginExecuteBatch(ctx context.Context, request *querypb.BeginExe
return nil, vterrors.ToGRPCError(err)
}
results, transactionID, err := q.server.BeginExecuteBatch(ctx, request.Target, bql, request.AsTransaction)
results, transactionID, err := q.server.BeginExecuteBatch(ctx, request.Target, bql, request.AsTransaction, request.Options)
if err != nil {
// if we have a valid transactionID, return the error in-band
if transactionID != 0 {

Просмотреть файл

@ -82,7 +82,7 @@ func DialTablet(tablet *topodatapb.Tablet, timeout time.Duration) (tabletconn.Ta
}
// Execute sends the query to VTTablet.
func (conn *gRPCQueryClient) Execute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, transactionID int64) (*sqltypes.Result, error) {
func (conn *gRPCQueryClient) Execute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, transactionID int64, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
conn.mu.RLock()
defer conn.mu.RUnlock()
if conn.cc == nil {
@ -100,6 +100,7 @@ func (conn *gRPCQueryClient) Execute(ctx context.Context, target *querypb.Target
ImmediateCallerId: callerid.ImmediateCallerIDFromContext(ctx),
Query: q,
TransactionId: transactionID,
Options: options,
}
er, err := conn.c.Execute(ctx, req)
if err != nil {
@ -109,7 +110,7 @@ func (conn *gRPCQueryClient) Execute(ctx context.Context, target *querypb.Target
}
// ExecuteBatch sends a batch query to VTTablet.
func (conn *gRPCQueryClient) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64) ([]sqltypes.Result, error) {
func (conn *gRPCQueryClient) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
conn.mu.RLock()
defer conn.mu.RUnlock()
if conn.cc == nil {
@ -123,6 +124,7 @@ func (conn *gRPCQueryClient) ExecuteBatch(ctx context.Context, target *querypb.T
Queries: make([]*querypb.BoundQuery, len(queries)),
AsTransaction: asTransaction,
TransactionId: transactionID,
Options: options,
}
for i, q := range queries {
qq, err := querytypes.BoundQueryToProto3(q.Sql, q.BindVariables)
@ -159,7 +161,7 @@ func (a *streamExecuteAdapter) Recv() (*sqltypes.Result, error) {
}
// StreamExecute starts a streaming query to VTTablet.
func (conn *gRPCQueryClient) StreamExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}) (sqltypes.ResultStream, error) {
func (conn *gRPCQueryClient) StreamExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error) {
conn.mu.RLock()
defer conn.mu.RUnlock()
if conn.cc == nil {
@ -175,6 +177,7 @@ func (conn *gRPCQueryClient) StreamExecute(ctx context.Context, target *querypb.
EffectiveCallerId: callerid.EffectiveCallerIDFromContext(ctx),
ImmediateCallerId: callerid.ImmediateCallerIDFromContext(ctx),
Query: q,
Options: options,
}
stream, err := conn.c.StreamExecute(ctx, req)
if err != nil {
@ -246,7 +249,7 @@ func (conn *gRPCQueryClient) Rollback(ctx context.Context, target *querypb.Targe
}
// BeginExecute starts a transaction and runs an Execute.
func (conn *gRPCQueryClient) BeginExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}) (result *sqltypes.Result, transactionID int64, err error) {
func (conn *gRPCQueryClient) BeginExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, options *querypb.ExecuteOptions) (result *sqltypes.Result, transactionID int64, err error) {
conn.mu.RLock()
defer conn.mu.RUnlock()
if conn.cc == nil {
@ -265,6 +268,7 @@ func (conn *gRPCQueryClient) BeginExecute(ctx context.Context, target *querypb.T
EffectiveCallerId: callerid.EffectiveCallerIDFromContext(ctx),
ImmediateCallerId: callerid.ImmediateCallerIDFromContext(ctx),
Query: q,
Options: options,
}
reply, err := conn.c.BeginExecute(ctx, req)
if err != nil {
@ -295,6 +299,7 @@ func (conn *gRPCQueryClient) BeginExecute(ctx context.Context, target *querypb.T
ImmediateCallerId: breq.ImmediateCallerId,
Query: q,
TransactionId: transactionID,
Options: options,
}
er, err := conn.c.Execute(ctx, ereq)
if err != nil {
@ -305,7 +310,7 @@ func (conn *gRPCQueryClient) BeginExecute(ctx context.Context, target *querypb.T
}
// BeginExecuteBatch starts a transaction and runs an ExecuteBatch.
func (conn *gRPCQueryClient) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool) (results []sqltypes.Result, transactionID int64, err error) {
func (conn *gRPCQueryClient) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, options *querypb.ExecuteOptions) (results []sqltypes.Result, transactionID int64, err error) {
conn.mu.RLock()
defer conn.mu.RUnlock()
if conn.cc == nil {
@ -320,6 +325,7 @@ func (conn *gRPCQueryClient) BeginExecuteBatch(ctx context.Context, target *quer
ImmediateCallerId: callerid.ImmediateCallerIDFromContext(ctx),
Queries: make([]*querypb.BoundQuery, len(queries)),
AsTransaction: asTransaction,
Options: options,
}
for i, q := range queries {
qq, err := querytypes.BoundQueryToProto3(q.Sql, q.BindVariables)
@ -357,6 +363,7 @@ func (conn *gRPCQueryClient) BeginExecuteBatch(ctx context.Context, target *quer
Queries: make([]*querypb.BoundQuery, len(queries)),
AsTransaction: asTransaction,
TransactionId: transactionID,
Options: options,
}
for i, q := range queries {
qq, err := querytypes.BoundQueryToProto3(q.Sql, q.BindVariables)

Просмотреть файл

@ -35,6 +35,13 @@ type QueryExecutor struct {
qe *QueryEngine
}
var sequenceFields = []*querypb.Field{
{
Name: "nextval",
Type: sqltypes.Int64,
},
}
func addUserTableQueryStats(queryServiceStats *QueryServiceStats, ctx context.Context, tableName string, queryType string, duration int64) {
username := callerid.GetPrincipal(callerid.EffectiveCallerIDFromContext(ctx))
if username == "" {
@ -131,7 +138,7 @@ func (qre *QueryExecutor) Execute() (reply *sqltypes.Result, err error) {
}
// Stream performs a streaming query execution.
func (qre *QueryExecutor) Stream(sendReply func(*sqltypes.Result) error) error {
func (qre *QueryExecutor) Stream(excludeFieldNames bool, sendReply func(*sqltypes.Result) error) error {
qre.logStats.OriginalSQL = qre.query
qre.logStats.PlanType = qre.plan.PlanID.String()
@ -154,7 +161,7 @@ func (qre *QueryExecutor) Stream(sendReply func(*sqltypes.Result) error) error {
qre.qe.streamQList.Add(qd)
defer qre.qe.streamQList.Remove(qd)
return qre.streamFetch(conn, qre.plan.FullQuery, qre.bindVars, nil, sendReply)
return qre.streamFetch(conn, qre.plan.FullQuery, qre.bindVars, nil, excludeFieldNames, sendReply)
}
func (qre *QueryExecutor) execDmlAutoCommit() (reply *sqltypes.Result, err error) {
@ -356,10 +363,7 @@ func (qre *QueryExecutor) execNextval() (*sqltypes.Result, error) {
ret := t.NextVal
t.NextVal += t.Increment
return &sqltypes.Result{
Fields: []*querypb.Field{{
Name: "nextval",
Type: sqltypes.Int64,
}},
Fields: sequenceFields,
Rows: [][]sqltypes.Value{{
sqltypes.MakeTrusted(sqltypes.Int64, strconv.AppendInt(nil, ret, 10)),
}},
@ -607,12 +611,12 @@ func (qre *QueryExecutor) dbConnFetch(conn *DBConn, parsedQuery *sqlparser.Parse
}
// streamFetch performs a streaming fetch.
func (qre *QueryExecutor) streamFetch(conn *DBConn, parsedQuery *sqlparser.ParsedQuery, bindVars map[string]interface{}, buildStreamComment []byte, callback func(*sqltypes.Result) error) error {
func (qre *QueryExecutor) streamFetch(conn *DBConn, parsedQuery *sqlparser.ParsedQuery, bindVars map[string]interface{}, buildStreamComment []byte, excludeFieldNames bool, callback func(*sqltypes.Result) error) error {
sql, err := qre.generateFinalSQL(parsedQuery, bindVars, buildStreamComment)
if err != nil {
return err
}
return qre.execStreamSQL(conn, sql, callback)
return qre.execStreamSQL(conn, sql, excludeFieldNames, callback)
}
func (qre *QueryExecutor) generateFinalSQL(parsedQuery *sqlparser.ParsedQuery, bindVars map[string]interface{}, buildStreamComment []byte) (string, error) {
@ -638,9 +642,9 @@ func (qre *QueryExecutor) execSQL(conn poolConn, sql string, wantfields bool) (*
return conn.Exec(qre.ctx, sql, int(qre.qe.maxResultSize.Get()), wantfields)
}
func (qre *QueryExecutor) execStreamSQL(conn *DBConn, sql string, callback func(*sqltypes.Result) error) error {
func (qre *QueryExecutor) execStreamSQL(conn *DBConn, sql string, excludeFieldNames bool, callback func(*sqltypes.Result) error) error {
start := time.Now()
err := conn.Stream(qre.ctx, sql, callback, int(qre.qe.streamBufferSize.Get()))
err := conn.Stream(qre.ctx, sql, callback, int(qre.qe.streamBufferSize.Get()), excludeFieldNames)
qre.logStats.AddRewrittenSQL(sql, start)
if err != nil {
// MySQL error that isn't due to a connection issue

Просмотреть файл

@ -35,27 +35,27 @@ func (e *ErrorQueryService) Rollback(ctx context.Context, target *querypb.Target
}
// Execute is part of QueryService interface
func (e *ErrorQueryService) Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, transactionID int64) (*sqltypes.Result, error) {
func (e *ErrorQueryService) Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, transactionID int64, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
return nil, fmt.Errorf("ErrorQueryService does not implement any method")
}
// StreamExecute is part of QueryService interface
func (e *ErrorQueryService) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sendReply func(*sqltypes.Result) error) error {
func (e *ErrorQueryService) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
return fmt.Errorf("ErrorQueryService does not implement any method")
}
// ExecuteBatch is part of QueryService interface
func (e *ErrorQueryService) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64) ([]sqltypes.Result, error) {
func (e *ErrorQueryService) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
return nil, fmt.Errorf("ErrorQueryService does not implement any method")
}
// BeginExecute is part of QueryService interface
func (e *ErrorQueryService) BeginExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}) (*sqltypes.Result, int64, error) {
func (e *ErrorQueryService) BeginExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, int64, error) {
return nil, 0, fmt.Errorf("ErrorQueryService does not implement any method")
}
// BeginExecuteBatch is part of QueryService interface
func (e *ErrorQueryService) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool) ([]sqltypes.Result, int64, error) {
func (e *ErrorQueryService) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, options *querypb.ExecuteOptions) ([]sqltypes.Result, int64, error) {
return nil, 0, fmt.Errorf("ErrorQueryService does not implement any method")
}

Просмотреть файл

@ -7,11 +7,12 @@
package queryservice
import (
"github.com/youtube/vitess/go/sqltypes"
"golang.org/x/net/context"
querypb "github.com/youtube/vitess/go/vt/proto/query"
"github.com/youtube/vitess/go/sqltypes"
"github.com/youtube/vitess/go/vt/tabletserver/querytypes"
querypb "github.com/youtube/vitess/go/vt/proto/query"
)
// QueryService is the interface implemented by the tablet's query service.
@ -28,16 +29,16 @@ type QueryService interface {
Rollback(ctx context.Context, target *querypb.Target, transactionID int64) error
// Query execution
Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, transactionID int64) (*sqltypes.Result, error)
StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sendReply func(*sqltypes.Result) error) error
ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64) ([]sqltypes.Result, error)
Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, transactionID int64, options *querypb.ExecuteOptions) (*sqltypes.Result, error)
StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error
ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64, options *querypb.ExecuteOptions) ([]sqltypes.Result, error)
// Combo methods, they also return the transactionID from the
// Begin part. If err != nil, the transactionID may still be
// non-zero, and needs to be propagated back (like for a DB
// Integrity Error)
BeginExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}) (*sqltypes.Result, int64, error)
BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool) ([]sqltypes.Result, int64, error)
BeginExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, int64, error)
BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, options *querypb.ExecuteOptions) ([]sqltypes.Result, int64, error)
// SplitQuery is a map reduce helper function
// TODO(erez): Remove this and rename the following func to SplitQuery

Просмотреть файл

@ -63,60 +63,60 @@ func (_mr *_MockQueryServiceRecorder) Rollback(arg0, arg1, arg2 interface{}) *go
return _mr.mock.ctrl.RecordCall(_mr.mock, "Rollback", arg0, arg1, arg2)
}
func (_m *MockQueryService) Execute(ctx context.Context, target *query.Target, sql string, bindVariables map[string]interface{}, transactionID int64) (*sqltypes.Result, error) {
ret := _m.ctrl.Call(_m, "Execute", ctx, target, sql, bindVariables, transactionID)
func (_m *MockQueryService) Execute(ctx context.Context, target *query.Target, sql string, bindVariables map[string]interface{}, transactionID int64, options *query.ExecuteOptions) (*sqltypes.Result, error) {
ret := _m.ctrl.Call(_m, "Execute", ctx, target, sql, bindVariables, transactionID, options)
ret0, _ := ret[0].(*sqltypes.Result)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockQueryServiceRecorder) Execute(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "Execute", arg0, arg1, arg2, arg3, arg4)
func (_mr *_MockQueryServiceRecorder) Execute(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "Execute", arg0, arg1, arg2, arg3, arg4, arg5)
}
func (_m *MockQueryService) StreamExecute(ctx context.Context, target *query.Target, sql string, bindVariables map[string]interface{}, sendReply func(*sqltypes.Result) error) error {
ret := _m.ctrl.Call(_m, "StreamExecute", ctx, target, sql, bindVariables, sendReply)
func (_m *MockQueryService) StreamExecute(ctx context.Context, target *query.Target, sql string, bindVariables map[string]interface{}, options *query.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
ret := _m.ctrl.Call(_m, "StreamExecute", ctx, target, sql, bindVariables, options, sendReply)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockQueryServiceRecorder) StreamExecute(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "StreamExecute", arg0, arg1, arg2, arg3, arg4)
func (_mr *_MockQueryServiceRecorder) StreamExecute(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "StreamExecute", arg0, arg1, arg2, arg3, arg4, arg5)
}
func (_m *MockQueryService) ExecuteBatch(ctx context.Context, target *query.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64) ([]sqltypes.Result, error) {
ret := _m.ctrl.Call(_m, "ExecuteBatch", ctx, target, queries, asTransaction, transactionID)
func (_m *MockQueryService) ExecuteBatch(ctx context.Context, target *query.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64, options *query.ExecuteOptions) ([]sqltypes.Result, error) {
ret := _m.ctrl.Call(_m, "ExecuteBatch", ctx, target, queries, asTransaction, transactionID, options)
ret0, _ := ret[0].([]sqltypes.Result)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockQueryServiceRecorder) ExecuteBatch(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ExecuteBatch", arg0, arg1, arg2, arg3, arg4)
func (_mr *_MockQueryServiceRecorder) ExecuteBatch(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ExecuteBatch", arg0, arg1, arg2, arg3, arg4, arg5)
}
func (_m *MockQueryService) BeginExecute(ctx context.Context, target *query.Target, sql string, bindVariables map[string]interface{}) (*sqltypes.Result, int64, error) {
ret := _m.ctrl.Call(_m, "BeginExecute", ctx, target, sql, bindVariables)
func (_m *MockQueryService) BeginExecute(ctx context.Context, target *query.Target, sql string, bindVariables map[string]interface{}, options *query.ExecuteOptions) (*sqltypes.Result, int64, error) {
ret := _m.ctrl.Call(_m, "BeginExecute", ctx, target, sql, bindVariables, options)
ret0, _ := ret[0].(*sqltypes.Result)
ret1, _ := ret[1].(int64)
ret2, _ := ret[2].(error)
return ret0, ret1, ret2
}
func (_mr *_MockQueryServiceRecorder) BeginExecute(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "BeginExecute", arg0, arg1, arg2, arg3)
func (_mr *_MockQueryServiceRecorder) BeginExecute(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "BeginExecute", arg0, arg1, arg2, arg3, arg4)
}
func (_m *MockQueryService) BeginExecuteBatch(ctx context.Context, target *query.Target, queries []querytypes.BoundQuery, asTransaction bool) ([]sqltypes.Result, int64, error) {
ret := _m.ctrl.Call(_m, "BeginExecuteBatch", ctx, target, queries, asTransaction)
func (_m *MockQueryService) BeginExecuteBatch(ctx context.Context, target *query.Target, queries []querytypes.BoundQuery, asTransaction bool, options *query.ExecuteOptions) ([]sqltypes.Result, int64, error) {
ret := _m.ctrl.Call(_m, "BeginExecuteBatch", ctx, target, queries, asTransaction, options)
ret0, _ := ret[0].([]sqltypes.Result)
ret1, _ := ret[1].(int64)
ret2, _ := ret[2].(error)
return ret0, ret1, ret2
}
func (_mr *_MockQueryServiceRecorder) BeginExecuteBatch(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "BeginExecuteBatch", arg0, arg1, arg2, arg3)
func (_mr *_MockQueryServiceRecorder) BeginExecuteBatch(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "BeginExecuteBatch", arg0, arg1, arg2, arg3, arg4)
}
func (_m *MockQueryService) SplitQuery(ctx context.Context, target *query.Target, sql string, bindVariables map[string]interface{}, splitColumn string, splitCount int64) ([]querytypes.QuerySplit, error) {

Просмотреть файл

@ -47,6 +47,9 @@ type SandboxConn struct {
// Each batch request is inlined as a slice of Queries.
BatchQueries [][]querytypes.BoundQuery
// Options stores the options received by all calls.
Options []*querypb.ExecuteOptions
// results specifies the results to be returned.
// They're consumed as results are returned. If there are
// no results left, SingleRowResult is returned.
@ -114,7 +117,7 @@ func (sbc *SandboxConn) SetResults(r []*sqltypes.Result) {
}
// Execute is part of the TabletConn interface.
func (sbc *SandboxConn) Execute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, transactionID int64) (*sqltypes.Result, error) {
func (sbc *SandboxConn) Execute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, transactionID int64, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
sbc.ExecCount.Add(1)
bv := make(map[string]interface{})
for k, v := range bindVars {
@ -124,6 +127,7 @@ func (sbc *SandboxConn) Execute(ctx context.Context, target *querypb.Target, que
Sql: query,
BindVariables: bv,
})
sbc.Options = append(sbc.Options, options)
if err := sbc.getError(); err != nil {
return nil, err
}
@ -131,7 +135,7 @@ func (sbc *SandboxConn) Execute(ctx context.Context, target *querypb.Target, que
}
// ExecuteBatch is part of the TabletConn interface.
func (sbc *SandboxConn) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64) ([]sqltypes.Result, error) {
func (sbc *SandboxConn) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
sbc.ExecCount.Add(1)
if asTransaction {
sbc.AsTransactionCount.Add(1)
@ -140,6 +144,7 @@ func (sbc *SandboxConn) ExecuteBatch(ctx context.Context, target *querypb.Target
return nil, err
}
sbc.BatchQueries = append(sbc.BatchQueries, queries)
sbc.Options = append(sbc.Options, options)
result := make([]sqltypes.Result, 0, len(queries))
for range queries {
result = append(result, *(sbc.getNextResult()))
@ -161,7 +166,7 @@ func (a *streamExecuteAdapter) Recv() (*sqltypes.Result, error) {
}
// StreamExecute is part of the TabletConn interface.
func (sbc *SandboxConn) StreamExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}) (sqltypes.ResultStream, error) {
func (sbc *SandboxConn) StreamExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error) {
sbc.ExecCount.Add(1)
bv := make(map[string]interface{})
for k, v := range bindVars {
@ -171,6 +176,7 @@ func (sbc *SandboxConn) StreamExecute(ctx context.Context, target *querypb.Targe
Sql: query,
BindVariables: bv,
})
sbc.Options = append(sbc.Options, options)
err := sbc.getError()
if err != nil {
return nil, err
@ -202,22 +208,22 @@ func (sbc *SandboxConn) Rollback(ctx context.Context, target *querypb.Target, tr
}
// BeginExecute is part of the TabletConn interface.
func (sbc *SandboxConn) BeginExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}) (*sqltypes.Result, int64, error) {
func (sbc *SandboxConn) BeginExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, int64, error) {
transactionID, err := sbc.Begin(ctx, target)
if err != nil {
return nil, 0, err
}
result, err := sbc.Execute(ctx, target, query, bindVars, transactionID)
result, err := sbc.Execute(ctx, target, query, bindVars, transactionID, options)
return result, transactionID, err
}
// BeginExecuteBatch is part of the TabletConn interface.
func (sbc *SandboxConn) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool) ([]sqltypes.Result, int64, error) {
func (sbc *SandboxConn) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, options *querypb.ExecuteOptions) ([]sqltypes.Result, int64, error) {
transactionID, err := sbc.Begin(ctx, target)
if err != nil {
return nil, 0, err
}
results, err := sbc.ExecuteBatch(ctx, target, queries, asTransaction, transactionID)
results, err := sbc.ExecuteBatch(ctx, target, queries, asTransaction, transactionID, options)
return results, transactionID, err
}

Просмотреть файл

@ -9,13 +9,14 @@ import (
"time"
log "github.com/golang/glog"
"github.com/youtube/vitess/go/sqltypes"
"golang.org/x/net/context"
"github.com/youtube/vitess/go/sqltypes"
"github.com/youtube/vitess/go/vt/tabletserver/querytypes"
querypb "github.com/youtube/vitess/go/vt/proto/query"
topodatapb "github.com/youtube/vitess/go/vt/proto/topodata"
vtrpcpb "github.com/youtube/vitess/go/vt/proto/vtrpc"
"github.com/youtube/vitess/go/vt/tabletserver/querytypes"
)
const (
@ -90,17 +91,17 @@ type TabletDialer func(tablet *topodatapb.Tablet, timeout time.Duration) (Tablet
// - context.Canceled if the query was canceled by the user.
type TabletConn interface {
// Execute executes a non-streaming query on vttablet.
Execute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, transactionID int64) (*sqltypes.Result, error)
Execute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, transactionID int64, options *querypb.ExecuteOptions) (*sqltypes.Result, error)
// ExecuteBatch executes a group of queries.
ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64) ([]sqltypes.Result, error)
ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64, options *querypb.ExecuteOptions) ([]sqltypes.Result, error)
// StreamExecute executes a streaming query on vttablet. It
// returns a sqltypes.ResultStream to get results from. If
// error is non-nil, it means that the StreamExecute failed to
// send the request. Otherwise, you can pull values from the
// ResultStream until io.EOF, or any other error.
StreamExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}) (sqltypes.ResultStream, error)
StreamExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error)
// Transaction support
Begin(ctx context.Context, target *querypb.Target) (transactionID int64, err error)
@ -110,8 +111,8 @@ type TabletConn interface {
// Combo RPC calls: they execute both a Begin and another call.
// Note even if error is set, transactionID may be returned
// and different than zero, if the Begin part worked.
BeginExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}) (result *sqltypes.Result, transactionID int64, err error)
BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool) (results []sqltypes.Result, transactionID int64, err error)
BeginExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, options *querypb.ExecuteOptions) (result *sqltypes.Result, transactionID int64, err error)
BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, options *querypb.ExecuteOptions) (results []sqltypes.Result, transactionID int64, err error)
// Close must be called for releasing resources.
Close()

Просмотреть файл

@ -8,6 +8,7 @@ import (
"golang.org/x/net/context"
"github.com/golang/protobuf/proto"
"github.com/youtube/vitess/go/sqltypes"
"github.com/youtube/vitess/go/vt/callerid"
"github.com/youtube/vitess/go/vt/tabletserver"
@ -68,6 +69,10 @@ var TestVTGateCallerID = &querypb.VTGateCallerID{
Username: "test_username",
}
var TestExecuteOptions = &querypb.ExecuteOptions{
ExcludeFieldNames: true,
}
const TestAsTransaction bool = true
func (f *FakeQueryService) checkTargetCallerID(ctx context.Context, name string, target *querypb.Target) {
@ -176,7 +181,7 @@ var ExecuteQueryResult = sqltypes.Result{
}
// Execute is part of the queryservice.QueryService interface
func (f *FakeQueryService) Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, transactionID int64) (*sqltypes.Result, error) {
func (f *FakeQueryService) Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, transactionID int64, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if f.HasError {
return nil, f.TabletError
}
@ -189,6 +194,9 @@ func (f *FakeQueryService) Execute(ctx context.Context, target *querypb.Target,
if !reflect.DeepEqual(bindVariables, ExecuteBindVars) {
f.t.Errorf("invalid Execute.BindVariables: got %v expected %v", bindVariables, ExecuteBindVars)
}
if !proto.Equal(options, TestExecuteOptions) {
f.t.Errorf("invalid Execute.ExecuteOptions: got %v expected %v", options, TestExecuteOptions)
}
f.checkTargetCallerID(ctx, "Execute", target)
if transactionID != f.ExpectedTransactionID {
f.t.Errorf("invalid Execute.TransactionId: got %v expected %v", transactionID, f.ExpectedTransactionID)
@ -229,7 +237,7 @@ var StreamExecuteQueryResult2 = sqltypes.Result{
}
// StreamExecute is part of the queryservice.QueryService interface
func (f *FakeQueryService) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sendReply func(*sqltypes.Result) error) error {
func (f *FakeQueryService) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
if f.Panics && f.StreamExecutePanicsEarly {
panic(fmt.Errorf("test-triggered panic early"))
}
@ -239,6 +247,9 @@ func (f *FakeQueryService) StreamExecute(ctx context.Context, target *querypb.Ta
if !reflect.DeepEqual(bindVariables, StreamExecuteBindVars) {
f.t.Errorf("invalid StreamExecute.BindVariables: got %v expected %v", bindVariables, StreamExecuteBindVars)
}
if !proto.Equal(options, TestExecuteOptions) {
f.t.Errorf("invalid StreamExecute.ExecuteOptions: got %v expected %v", options, TestExecuteOptions)
}
f.checkTargetCallerID(ctx, "StreamExecute", target)
if err := sendReply(&StreamExecuteQueryResult1); err != nil {
f.t.Errorf("sendReply1 failed: %v", err)
@ -318,7 +329,7 @@ var ExecuteBatchQueryResultList = []sqltypes.Result{
}
// ExecuteBatch is part of the queryservice.QueryService interface
func (f *FakeQueryService) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64) ([]sqltypes.Result, error) {
func (f *FakeQueryService) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
if f.HasError {
return nil, f.TabletError
}
@ -328,6 +339,9 @@ func (f *FakeQueryService) ExecuteBatch(ctx context.Context, target *querypb.Tar
if !reflect.DeepEqual(queries, ExecuteBatchQueries) {
f.t.Errorf("invalid ExecuteBatch.Queries: got %v expected %v", queries, ExecuteBatchQueries)
}
if !proto.Equal(options, TestExecuteOptions) {
f.t.Errorf("invalid ExecuteBatch.ExecuteOptions: got %v expected %v", options, TestExecuteOptions)
}
f.checkTargetCallerID(ctx, "ExecuteBatch", target)
if asTransaction != TestAsTransaction {
f.t.Errorf("invalid ExecuteBatch.AsTransaction: got %v expected %v", asTransaction, TestAsTransaction)
@ -386,24 +400,24 @@ var SplitQueryQueryV2SplitList = []querytypes.QuerySplit{
}
// BeginExecute combines Begin and Execute.
func (f *FakeQueryService) BeginExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}) (*sqltypes.Result, int64, error) {
func (f *FakeQueryService) BeginExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, int64, error) {
transactionID, err := f.Begin(ctx, target)
if err != nil {
return nil, 0, err
}
result, err := f.Execute(ctx, target, sql, bindVariables, transactionID)
result, err := f.Execute(ctx, target, sql, bindVariables, transactionID, options)
return result, transactionID, err
}
// BeginExecuteBatch combines Begin and ExecuteBatch.
func (f *FakeQueryService) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool) ([]sqltypes.Result, int64, error) {
func (f *FakeQueryService) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, options *querypb.ExecuteOptions) ([]sqltypes.Result, int64, error) {
transactionID, err := f.Begin(ctx, target)
if err != nil {
return nil, 0, err
}
results, err := f.ExecuteBatch(ctx, target, queries, asTransaction, transactionID)
results, err := f.ExecuteBatch(ctx, target, queries, asTransaction, transactionID, options)
return results, transactionID, err
}

Просмотреть файл

@ -174,7 +174,7 @@ func testExecute(t *testing.T, conn tabletconn.TabletConn, f *FakeQueryService)
f.ExpectedTransactionID = ExecuteTransactionID
ctx := context.Background()
ctx = callerid.NewContext(ctx, TestCallerID, TestVTGateCallerID)
qr, err := conn.Execute(ctx, TestTarget, ExecuteQuery, ExecuteBindVars, ExecuteTransactionID)
qr, err := conn.Execute(ctx, TestTarget, ExecuteQuery, ExecuteBindVars, ExecuteTransactionID, TestExecuteOptions)
if err != nil {
t.Fatalf("Execute failed: %v", err)
}
@ -187,7 +187,7 @@ func testExecuteError(t *testing.T, conn tabletconn.TabletConn, f *FakeQueryServ
t.Log("testExecuteError")
f.HasError = true
testErrorHelper(t, f, "Execute", func(ctx context.Context) error {
_, err := conn.Execute(ctx, TestTarget, ExecuteQuery, ExecuteBindVars, ExecuteTransactionID)
_, err := conn.Execute(ctx, TestTarget, ExecuteQuery, ExecuteBindVars, ExecuteTransactionID, TestExecuteOptions)
return err
})
f.HasError = false
@ -196,7 +196,7 @@ func testExecuteError(t *testing.T, conn tabletconn.TabletConn, f *FakeQueryServ
func testExecutePanics(t *testing.T, conn tabletconn.TabletConn, f *FakeQueryService) {
t.Log("testExecutePanics")
testPanicHelper(t, f, "Execute", func(ctx context.Context) error {
_, err := conn.Execute(ctx, TestTarget, ExecuteQuery, ExecuteBindVars, ExecuteTransactionID)
_, err := conn.Execute(ctx, TestTarget, ExecuteQuery, ExecuteBindVars, ExecuteTransactionID, TestExecuteOptions)
return err
})
}
@ -206,7 +206,7 @@ func testBeginExecute(t *testing.T, conn tabletconn.TabletConn, f *FakeQueryServ
f.ExpectedTransactionID = BeginTransactionID
ctx := context.Background()
ctx = callerid.NewContext(ctx, TestCallerID, TestVTGateCallerID)
qr, transactionID, err := conn.BeginExecute(ctx, TestTarget, ExecuteQuery, ExecuteBindVars)
qr, transactionID, err := conn.BeginExecute(ctx, TestTarget, ExecuteQuery, ExecuteBindVars, TestExecuteOptions)
if err != nil {
t.Fatalf("BeginExecute failed: %v", err)
}
@ -222,7 +222,7 @@ func testBeginExecuteErrorInBegin(t *testing.T, conn tabletconn.TabletConn, f *F
t.Log("testBeginExecuteErrorInBegin")
f.HasBeginError = true
testErrorHelper(t, f, "BeginExecute.Begin", func(ctx context.Context) error {
_, transactionID, err := conn.BeginExecute(ctx, TestTarget, ExecuteQuery, ExecuteBindVars)
_, transactionID, err := conn.BeginExecute(ctx, TestTarget, ExecuteQuery, ExecuteBindVars, TestExecuteOptions)
if transactionID != 0 {
t.Errorf("Unexpected transactionID from BeginExecute: got %v wanted 0", transactionID)
}
@ -236,7 +236,7 @@ func testBeginExecuteErrorInExecute(t *testing.T, conn tabletconn.TabletConn, f
f.HasError = true
testErrorHelper(t, f, "BeginExecute.Execute", func(ctx context.Context) error {
ctx = callerid.NewContext(ctx, TestCallerID, TestVTGateCallerID)
_, transactionID, err := conn.BeginExecute(ctx, TestTarget, ExecuteQuery, ExecuteBindVars)
_, transactionID, err := conn.BeginExecute(ctx, TestTarget, ExecuteQuery, ExecuteBindVars, TestExecuteOptions)
if transactionID != BeginTransactionID {
t.Errorf("Unexpected transactionID from BeginExecute: got %v wanted %v", transactionID, BeginTransactionID)
}
@ -248,7 +248,7 @@ func testBeginExecuteErrorInExecute(t *testing.T, conn tabletconn.TabletConn, f
func testBeginExecutePanics(t *testing.T, conn tabletconn.TabletConn, f *FakeQueryService) {
t.Log("testBeginExecutePanics")
testPanicHelper(t, f, "BeginExecute", func(ctx context.Context) error {
_, _, err := conn.BeginExecute(ctx, TestTarget, ExecuteQuery, ExecuteBindVars)
_, _, err := conn.BeginExecute(ctx, TestTarget, ExecuteQuery, ExecuteBindVars, TestExecuteOptions)
return err
})
}
@ -257,7 +257,7 @@ func testStreamExecute(t *testing.T, conn tabletconn.TabletConn, f *FakeQuerySer
t.Log("testStreamExecute")
ctx := context.Background()
ctx = callerid.NewContext(ctx, TestCallerID, TestVTGateCallerID)
stream, err := conn.StreamExecute(ctx, TestTarget, StreamExecuteQuery, StreamExecuteBindVars)
stream, err := conn.StreamExecute(ctx, TestTarget, StreamExecuteQuery, StreamExecuteBindVars, TestExecuteOptions)
if err != nil {
t.Fatalf("StreamExecute failed: %v", err)
}
@ -293,7 +293,7 @@ func testStreamExecuteError(t *testing.T, conn tabletconn.TabletConn, f *FakeQue
testErrorHelper(t, f, "StreamExecute", func(ctx context.Context) error {
f.ErrorWait = make(chan struct{})
ctx = callerid.NewContext(ctx, TestCallerID, TestVTGateCallerID)
stream, err := conn.StreamExecute(ctx, TestTarget, StreamExecuteQuery, StreamExecuteBindVars)
stream, err := conn.StreamExecute(ctx, TestTarget, StreamExecuteQuery, StreamExecuteBindVars, TestExecuteOptions)
if err != nil {
t.Fatalf("StreamExecute failed: %v", err)
}
@ -327,7 +327,7 @@ func testStreamExecutePanics(t *testing.T, conn tabletconn.TabletConn, f *FakeQu
f.StreamExecutePanicsEarly = true
testPanicHelper(t, f, "StreamExecute.Early", func(ctx context.Context) error {
ctx = callerid.NewContext(ctx, TestCallerID, TestVTGateCallerID)
stream, err := conn.StreamExecute(ctx, TestTarget, StreamExecuteQuery, StreamExecuteBindVars)
stream, err := conn.StreamExecute(ctx, TestTarget, StreamExecuteQuery, StreamExecuteBindVars, TestExecuteOptions)
if err != nil {
return err
}
@ -340,7 +340,7 @@ func testStreamExecutePanics(t *testing.T, conn tabletconn.TabletConn, f *FakeQu
testPanicHelper(t, f, "StreamExecute.Late", func(ctx context.Context) error {
f.PanicWait = make(chan struct{})
ctx = callerid.NewContext(ctx, TestCallerID, TestVTGateCallerID)
stream, err := conn.StreamExecute(ctx, TestTarget, StreamExecuteQuery, StreamExecuteBindVars)
stream, err := conn.StreamExecute(ctx, TestTarget, StreamExecuteQuery, StreamExecuteBindVars, TestExecuteOptions)
if err != nil {
t.Fatalf("StreamExecute failed: %v", err)
}
@ -365,7 +365,7 @@ func testExecuteBatch(t *testing.T, conn tabletconn.TabletConn, f *FakeQueryServ
f.ExpectedTransactionID = ExecuteBatchTransactionID
ctx := context.Background()
ctx = callerid.NewContext(ctx, TestCallerID, TestVTGateCallerID)
qrl, err := conn.ExecuteBatch(ctx, TestTarget, ExecuteBatchQueries, TestAsTransaction, ExecuteBatchTransactionID)
qrl, err := conn.ExecuteBatch(ctx, TestTarget, ExecuteBatchQueries, TestAsTransaction, ExecuteBatchTransactionID, TestExecuteOptions)
if err != nil {
t.Fatalf("ExecuteBatch failed: %v", err)
}
@ -378,7 +378,7 @@ func testExecuteBatchError(t *testing.T, conn tabletconn.TabletConn, f *FakeQuer
t.Log("testExecuteBatchError")
f.HasError = true
testErrorHelper(t, f, "ExecuteBatch", func(ctx context.Context) error {
_, err := conn.ExecuteBatch(ctx, TestTarget, ExecuteBatchQueries, TestAsTransaction, ExecuteBatchTransactionID)
_, err := conn.ExecuteBatch(ctx, TestTarget, ExecuteBatchQueries, TestAsTransaction, ExecuteBatchTransactionID, TestExecuteOptions)
return err
})
f.HasError = true
@ -387,7 +387,7 @@ func testExecuteBatchError(t *testing.T, conn tabletconn.TabletConn, f *FakeQuer
func testExecuteBatchPanics(t *testing.T, conn tabletconn.TabletConn, f *FakeQueryService) {
t.Log("testExecuteBatchPanics")
testPanicHelper(t, f, "ExecuteBatch", func(ctx context.Context) error {
_, err := conn.ExecuteBatch(ctx, TestTarget, ExecuteBatchQueries, TestAsTransaction, ExecuteBatchTransactionID)
_, err := conn.ExecuteBatch(ctx, TestTarget, ExecuteBatchQueries, TestAsTransaction, ExecuteBatchTransactionID, TestExecuteOptions)
return err
})
}
@ -397,7 +397,7 @@ func testBeginExecuteBatch(t *testing.T, conn tabletconn.TabletConn, f *FakeQuer
f.ExpectedTransactionID = BeginTransactionID
ctx := context.Background()
ctx = callerid.NewContext(ctx, TestCallerID, TestVTGateCallerID)
qrl, transactionID, err := conn.BeginExecuteBatch(ctx, TestTarget, ExecuteBatchQueries, true)
qrl, transactionID, err := conn.BeginExecuteBatch(ctx, TestTarget, ExecuteBatchQueries, true, TestExecuteOptions)
if err != nil {
t.Fatalf("BeginExecuteBatch failed: %v", err)
}
@ -413,7 +413,7 @@ func testBeginExecuteBatchErrorInBegin(t *testing.T, conn tabletconn.TabletConn,
t.Log("testBeginExecuteBatchErrorInBegin")
f.HasBeginError = true
testErrorHelper(t, f, "BeginExecuteBatch.Begin", func(ctx context.Context) error {
_, transactionID, err := conn.BeginExecuteBatch(ctx, TestTarget, ExecuteBatchQueries, true)
_, transactionID, err := conn.BeginExecuteBatch(ctx, TestTarget, ExecuteBatchQueries, true, TestExecuteOptions)
if transactionID != 0 {
t.Errorf("Unexpected transactionID from BeginExecuteBatch: got %v wanted 0", transactionID)
}
@ -427,7 +427,7 @@ func testBeginExecuteBatchErrorInExecuteBatch(t *testing.T, conn tabletconn.Tabl
f.HasError = true
testErrorHelper(t, f, "BeginExecute.ExecuteBatch", func(ctx context.Context) error {
ctx = callerid.NewContext(ctx, TestCallerID, TestVTGateCallerID)
_, transactionID, err := conn.BeginExecuteBatch(ctx, TestTarget, ExecuteBatchQueries, true)
_, transactionID, err := conn.BeginExecuteBatch(ctx, TestTarget, ExecuteBatchQueries, true, TestExecuteOptions)
if transactionID != BeginTransactionID {
t.Errorf("Unexpected transactionID from BeginExecuteBatch: got %v wanted %v", transactionID, BeginTransactionID)
}
@ -439,7 +439,7 @@ func testBeginExecuteBatchErrorInExecuteBatch(t *testing.T, conn tabletconn.Tabl
func testBeginExecuteBatchPanics(t *testing.T, conn tabletconn.TabletConn, f *FakeQueryService) {
t.Log("testBeginExecuteBatchPanics")
testPanicHelper(t, f, "BeginExecuteBatch", func(ctx context.Context) error {
_, _, err := conn.BeginExecuteBatch(ctx, TestTarget, ExecuteBatchQueries, true)
_, _, err := conn.BeginExecuteBatch(ctx, TestTarget, ExecuteBatchQueries, true, TestExecuteOptions)
return err
})
}

Просмотреть файл

@ -484,6 +484,7 @@ func (tsv *TabletServer) IsHealthy() error {
"select 1 from dual",
nil,
0,
nil,
)
return err
}
@ -747,7 +748,7 @@ func (tsv *TabletServer) handleExecErrorNoPanic(sql string, bindVariables map[st
}
// Execute executes the query and returns the result as response.
func (tsv *TabletServer) Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, transactionID int64) (result *sqltypes.Result, err error) {
func (tsv *TabletServer) Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, transactionID int64, options *querypb.ExecuteOptions) (result *sqltypes.Result, err error) {
logStats := newLogStats("Execute", ctx)
defer tsv.handleExecError(sql, bindVariables, &err, logStats)
@ -779,13 +780,16 @@ func (tsv *TabletServer) Execute(ctx context.Context, target *querypb.Target, sq
if err != nil {
return nil, tsv.handleExecErrorNoPanic(sql, bindVariables, err, logStats)
}
if options != nil && options.ExcludeFieldNames {
result = result.StripFieldNames()
}
return result, nil
}
// StreamExecute executes the query and streams the result.
// The first QueryResult will have Fields set (and Rows nil).
// The subsequent QueryResult will have Rows set (and Fields nil).
func (tsv *TabletServer) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sendReply func(*sqltypes.Result) error) (err error) {
func (tsv *TabletServer) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) (err error) {
logStats := newLogStats("StreamExecute", ctx)
defer tsv.handleExecError(sql, bindVariables, &err, logStats)
@ -806,7 +810,11 @@ func (tsv *TabletServer) StreamExecute(ctx context.Context, target *querypb.Targ
logStats: logStats,
qe: tsv.qe,
}
err = qre.Stream(sendReply)
excludeFieldNames := false
if options != nil && options.ExcludeFieldNames {
excludeFieldNames = true
}
err = qre.Stream(excludeFieldNames, sendReply)
if err != nil {
return tsv.handleExecErrorNoPanic(sql, bindVariables, err, logStats)
}
@ -817,7 +825,7 @@ func (tsv *TabletServer) StreamExecute(ctx context.Context, target *querypb.Targ
// ExecuteBatch can be called for an existing transaction, or it can be called with
// the AsTransaction flag which will execute all statements inside an independent
// transaction. If AsTransaction is true, TransactionId must be 0.
func (tsv *TabletServer) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64) (results []sqltypes.Result, err error) {
func (tsv *TabletServer) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64, options *querypb.ExecuteOptions) (results []sqltypes.Result, err error) {
if len(queries) == 0 {
return nil, NewTabletError(vtrpcpb.ErrorCode_BAD_INPUT, "Empty query list")
}
@ -847,7 +855,7 @@ func (tsv *TabletServer) ExecuteBatch(ctx context.Context, target *querypb.Targe
}
results = make([]sqltypes.Result, 0, len(queries))
for _, bound := range queries {
localReply, err := tsv.Execute(ctx, target, bound.Sql, bound.BindVariables, transactionID)
localReply, err := tsv.Execute(ctx, target, bound.Sql, bound.BindVariables, transactionID, options)
if err != nil {
return nil, err
}
@ -864,24 +872,24 @@ func (tsv *TabletServer) ExecuteBatch(ctx context.Context, target *querypb.Targe
}
// BeginExecute combines Begin and Execute.
func (tsv *TabletServer) BeginExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}) (*sqltypes.Result, int64, error) {
func (tsv *TabletServer) BeginExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, int64, error) {
transactionID, err := tsv.Begin(ctx, target)
if err != nil {
return nil, 0, err
}
result, err := tsv.Execute(ctx, target, sql, bindVariables, transactionID)
result, err := tsv.Execute(ctx, target, sql, bindVariables, transactionID, options)
return result, transactionID, err
}
// BeginExecuteBatch combines Begin and ExecuteBatch.
func (tsv *TabletServer) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool) ([]sqltypes.Result, int64, error) {
func (tsv *TabletServer) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, options *querypb.ExecuteOptions) ([]sqltypes.Result, int64, error) {
transactionID, err := tsv.Begin(ctx, target)
if err != nil {
return nil, 0, err
}
results, err := tsv.ExecuteBatch(ctx, target, queries, asTransaction, transactionID)
results, err := tsv.ExecuteBatch(ctx, target, queries, asTransaction, transactionID, options)
return results, transactionID, err
}

Просмотреть файл

@ -475,14 +475,14 @@ func TestTabletServerReconnect(t *testing.T) {
if err != nil {
t.Fatalf("TabletServer.StartService should success but get error: %v", err)
}
_, err = tsv.Execute(context.Background(), &target, query, nil, 0)
_, err = tsv.Execute(context.Background(), &target, query, nil, 0, nil)
if err != nil {
t.Error(err)
}
// make mysql conn fail
db.EnableConnFail()
_, err = tsv.Execute(context.Background(), &target, query, nil, 0)
_, err = tsv.Execute(context.Background(), &target, query, nil, 0, nil)
if err == nil {
t.Error("Execute: want error, got nil")
}
@ -497,7 +497,7 @@ func TestTabletServerReconnect(t *testing.T) {
if err != nil {
t.Error(err)
}
_, err = tsv.Execute(context.Background(), &target, query, nil, 0)
_, err = tsv.Execute(context.Background(), &target, query, nil, 0, nil)
if err != nil {
t.Error(err)
}
@ -523,7 +523,7 @@ func TestTabletServerTarget(t *testing.T) {
// query that works
db.AddQuery("select * from test_table limit 1000", &sqltypes.Result{})
_, err = tsv.Execute(ctx, &target1, "select * from test_table limit 1000", nil, 0)
_, err = tsv.Execute(ctx, &target1, "select * from test_table limit 1000", nil, 0, nil)
if err != nil {
t.Fatal(err)
}
@ -531,7 +531,7 @@ func TestTabletServerTarget(t *testing.T) {
// wrong tablet type
target2 := proto.Clone(&target1).(*querypb.Target)
target2.TabletType = topodatapb.TabletType_REPLICA
_, err = tsv.Execute(ctx, target2, "select * from test_table limit 1000", nil, 0)
_, err = tsv.Execute(ctx, target2, "select * from test_table limit 1000", nil, 0, nil)
want := "Invalid tablet type"
if err == nil || !strings.Contains(err.Error(), want) {
t.Errorf("err: %v, must contain %s", err, want)
@ -539,11 +539,11 @@ func TestTabletServerTarget(t *testing.T) {
// set expected target type to MASTER, but also accept REPLICA
tsv.SetServingType(topodatapb.TabletType_MASTER, true, []topodatapb.TabletType{topodatapb.TabletType_REPLICA})
_, err = tsv.Execute(ctx, &target1, "select * from test_table limit 1000", nil, 0)
_, err = tsv.Execute(ctx, &target1, "select * from test_table limit 1000", nil, 0, nil)
if err != nil {
t.Fatal(err)
}
_, err = tsv.Execute(ctx, target2, "select * from test_table limit 1000", nil, 0)
_, err = tsv.Execute(ctx, target2, "select * from test_table limit 1000", nil, 0, nil)
if err != nil {
t.Fatal(err)
}
@ -551,7 +551,7 @@ func TestTabletServerTarget(t *testing.T) {
// wrong keyspace
target2 = proto.Clone(&target1).(*querypb.Target)
target2.Keyspace = "bad"
_, err = tsv.Execute(ctx, target2, "select * from test_table limit 1000", nil, 0)
_, err = tsv.Execute(ctx, target2, "select * from test_table limit 1000", nil, 0, nil)
want = "Invalid keyspace bad"
if err == nil || !strings.Contains(err.Error(), want) {
t.Errorf("err: %v, must contain %s", err, want)
@ -560,14 +560,14 @@ func TestTabletServerTarget(t *testing.T) {
// wrong shard
target2 = proto.Clone(&target1).(*querypb.Target)
target2.Shard = "bad"
_, err = tsv.Execute(ctx, target2, "select * from test_table limit 1000", nil, 0)
_, err = tsv.Execute(ctx, target2, "select * from test_table limit 1000", nil, 0, nil)
want = "Invalid shard bad"
if err == nil || !strings.Contains(err.Error(), want) {
t.Errorf("err: %v, must contain %s", err, want)
}
// no target
_, err = tsv.Execute(ctx, nil, "select * from test_table limit 1000", nil, 0)
_, err = tsv.Execute(ctx, nil, "select * from test_table limit 1000", nil, 0, nil)
want = "No target"
if err == nil || !strings.Contains(err.Error(), want) {
t.Errorf("err: %v, must contain %s", err, want)
@ -600,7 +600,7 @@ func TestTabletServerCommitTransaciton(t *testing.T) {
if err != nil {
t.Fatalf("call TabletServer.Begin failed: %v", err)
}
if _, err := tsv.Execute(ctx, &target, executeSQL, nil, transactionID); err != nil {
if _, err := tsv.Execute(ctx, &target, executeSQL, nil, transactionID, nil); err != nil {
t.Fatalf("failed to execute query: %s: %s", executeSQL, err)
}
if err := tsv.Commit(ctx, &target, transactionID); err != nil {
@ -634,7 +634,7 @@ func TestTabletServerRollback(t *testing.T) {
if err != nil {
t.Fatalf("call TabletServer.Begin failed: %v", err)
}
if _, err := tsv.Execute(ctx, &target, executeSQL, nil, transactionID); err != nil {
if _, err := tsv.Execute(ctx, &target, executeSQL, nil, transactionID, nil); err != nil {
t.Fatalf("failed to execute query: %s: %v", executeSQL, err)
}
if err := tsv.Rollback(ctx, &target, transactionID); err != nil {
@ -666,7 +666,7 @@ func TestTabletServerStreamExecute(t *testing.T) {
defer tsv.StopService()
ctx := context.Background()
sendReply := func(*sqltypes.Result) error { return nil }
if err := tsv.StreamExecute(ctx, &target, executeSQL, nil, sendReply); err != nil {
if err := tsv.StreamExecute(ctx, &target, executeSQL, nil, nil, sendReply); err != nil {
t.Fatalf("TabletServer.StreamExecute should success: %s, but get error: %v",
executeSQL, err)
}
@ -696,7 +696,7 @@ func TestTabletServerExecuteBatch(t *testing.T) {
Sql: sql,
BindVariables: nil,
},
}, true, 0); err != nil {
}, true, 0, nil); err != nil {
t.Fatalf("TabletServer.ExecuteBatch should success: %v, but get error: %v",
sql, err)
}
@ -715,7 +715,7 @@ func TestTabletServerExecuteBatchFailEmptyQueryList(t *testing.T) {
}
defer tsv.StopService()
ctx := context.Background()
_, err = tsv.ExecuteBatch(ctx, nil, []querytypes.BoundQuery{}, false, 0)
_, err = tsv.ExecuteBatch(ctx, nil, []querytypes.BoundQuery{}, false, 0, nil)
verifyTabletError(t, err, vtrpcpb.ErrorCode_BAD_INPUT)
}
@ -737,7 +737,7 @@ func TestTabletServerExecuteBatchFailAsTransaction(t *testing.T) {
Sql: "begin",
BindVariables: nil,
},
}, true, 1)
}, true, 1, nil)
verifyTabletError(t, err, vtrpcpb.ErrorCode_BAD_INPUT)
}
@ -761,7 +761,7 @@ func TestTabletServerExecuteBatchBeginFail(t *testing.T) {
Sql: "begin",
BindVariables: nil,
},
}, false, 0); err == nil {
}, false, 0, nil); err == nil {
t.Fatalf("TabletServer.ExecuteBatch should fail")
}
}
@ -790,7 +790,7 @@ func TestTabletServerExecuteBatchCommitFail(t *testing.T) {
Sql: "commit",
BindVariables: nil,
},
}, false, 0); err == nil {
}, false, 0, nil); err == nil {
t.Fatalf("TabletServer.ExecuteBatch should fail")
}
}
@ -828,7 +828,7 @@ func TestTabletServerExecuteBatchSqlExecFailInTransaction(t *testing.T) {
Sql: sql,
BindVariables: nil,
},
}, true, 0); err == nil {
}, true, 0, nil); err == nil {
t.Fatalf("TabletServer.ExecuteBatch should fail")
}
@ -866,7 +866,7 @@ func TestTabletServerExecuteBatchSqlSucceedInTransaction(t *testing.T) {
Sql: sql,
BindVariables: nil,
},
}, false, 0); err != nil {
}, false, 0, nil); err != nil {
t.Fatalf("TabletServer.ExecuteBatch should succeed")
}
}
@ -889,7 +889,7 @@ func TestTabletServerExecuteBatchCallCommitWithoutABegin(t *testing.T) {
Sql: "commit",
BindVariables: nil,
},
}, false, 0); err == nil {
}, false, 0, nil); err == nil {
t.Fatalf("TabletServer.ExecuteBatch should fail")
}
}
@ -934,7 +934,7 @@ func TestExecuteBatchNestedTransaction(t *testing.T) {
Sql: "commit",
BindVariables: nil,
},
}, false, 0); err == nil {
}, false, 0, nil); err == nil {
t.Fatalf("TabletServer.Execute should fail because of nested transaction")
}
tsv.qe.txPool.SetTimeout(10)

Просмотреть файл

@ -312,9 +312,9 @@ func (s *stmt) Query(args []driver.Value) (driver.Rows, error) {
var stream sqltypes.ResultStream
var err error
if s.c.useExecuteShards() {
stream, err = s.c.vtgateConn.StreamExecuteShards(ctx, s.query, s.c.Keyspace, []string{s.c.Shard}, makeBindVars(args), s.c.tabletTypeProto)
stream, err = s.c.vtgateConn.StreamExecuteShards(ctx, s.query, s.c.Keyspace, []string{s.c.Shard}, makeBindVars(args), s.c.tabletTypeProto, nil)
} else {
stream, err = s.c.vtgateConn.StreamExecute(ctx, s.query, makeBindVars(args), s.c.tabletTypeProto)
stream, err = s.c.vtgateConn.StreamExecute(ctx, s.query, makeBindVars(args), s.c.tabletTypeProto, nil)
}
if err != nil {
return nil, err
@ -334,16 +334,16 @@ func (s *stmt) Query(args []driver.Value) (driver.Rows, error) {
func (s *stmt) executeVitess(ctx context.Context, args []driver.Value) (*sqltypes.Result, error) {
if s.c.tx != nil {
if s.c.useExecuteShards() {
return s.c.tx.ExecuteShards(ctx, s.query, s.c.Keyspace, []string{s.c.Shard}, makeBindVars(args), s.c.tabletTypeProto)
return s.c.tx.ExecuteShards(ctx, s.query, s.c.Keyspace, []string{s.c.Shard}, makeBindVars(args), s.c.tabletTypeProto, nil)
}
return s.c.tx.Execute(ctx, s.query, makeBindVars(args), s.c.tabletTypeProto)
return s.c.tx.Execute(ctx, s.query, makeBindVars(args), s.c.tabletTypeProto, nil)
}
// Non-transactional case.
if s.c.useExecuteShards() {
return s.c.vtgateConn.ExecuteShards(ctx, s.query, s.c.Keyspace, []string{s.c.Shard}, makeBindVars(args), s.c.tabletTypeProto)
return s.c.vtgateConn.ExecuteShards(ctx, s.query, s.c.Keyspace, []string{s.c.Shard}, makeBindVars(args), s.c.tabletTypeProto, nil)
}
return s.c.vtgateConn.Execute(ctx, s.query, makeBindVars(args), s.c.tabletTypeProto)
return s.c.vtgateConn.Execute(ctx, s.query, makeBindVars(args), s.c.tabletTypeProto, nil)
}
func makeBindVars(args []driver.Value) map[string]interface{} {

Просмотреть файл

@ -37,7 +37,7 @@ type queryExecuteSpecificShard struct {
}
// Execute is part of the VTGateService interface
func (f *fakeVTGateService) Execute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (f *fakeVTGateService) Execute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
execCase, ok := execMap[sql]
if !ok {
return nil, fmt.Errorf("no match for: %s", sql)
@ -60,7 +60,7 @@ func (f *fakeVTGateService) Execute(ctx context.Context, sql string, bindVariabl
}
// ExecuteShards is part of the VTGateService interface
func (f *fakeVTGateService) ExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (f *fakeVTGateService) ExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
execCase, ok := execSpecificShardMap[sql]
if !ok {
return nil, fmt.Errorf("no match for: %s", sql)
@ -86,32 +86,32 @@ func (f *fakeVTGateService) ExecuteShards(ctx context.Context, sql string, bindV
}
// ExecuteKeyspaceIds is part of the VTGateService interface
func (f *fakeVTGateService) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (f *fakeVTGateService) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
return nil, nil
}
// ExecuteKeyRanges is part of the VTGateService interface
func (f *fakeVTGateService) ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (f *fakeVTGateService) ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
return nil, nil
}
// ExecuteEntityIds is part of the VTGateService interface
func (f *fakeVTGateService) ExecuteEntityIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (f *fakeVTGateService) ExecuteEntityIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
return nil, nil
}
// ExecuteBatchShard is part of the VTGateService interface
func (f *fakeVTGateService) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session) ([]sqltypes.Result, error) {
func (f *fakeVTGateService) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
return nil, nil
}
// ExecuteBatchKeyspaceIds is part of the VTGateService interface
func (f *fakeVTGateService) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session) ([]sqltypes.Result, error) {
func (f *fakeVTGateService) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
return nil, nil
}
// StreamExecute is part of the VTGateService interface
func (f *fakeVTGateService) StreamExecute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (f *fakeVTGateService) StreamExecute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
execCase, ok := execMap[sql]
if !ok {
return fmt.Errorf("no match for: %s", sql)
@ -145,7 +145,7 @@ func (f *fakeVTGateService) StreamExecute(ctx context.Context, sql string, bindV
}
// StreamExecuteShards is part of the VTGateService interface
func (f *fakeVTGateService) StreamExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (f *fakeVTGateService) StreamExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
execCase, ok := execSpecificShardMap[sql]
if !ok {
return fmt.Errorf("no match for: %s", sql)
@ -182,12 +182,12 @@ func (f *fakeVTGateService) StreamExecuteShards(ctx context.Context, sql string,
}
// StreamExecuteKeyspaceIds is part of the VTGateService interface
func (f *fakeVTGateService) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (f *fakeVTGateService) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
return nil
}
// StreamExecuteKeyRanges is part of the VTGateService interface
func (f *fakeVTGateService) StreamExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (f *fakeVTGateService) StreamExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
return nil
}

Просмотреть файл

@ -14,6 +14,7 @@ import (
"strings"
"time"
"github.com/golang/protobuf/proto"
"github.com/olekukonko/tablewriter"
"github.com/youtube/vitess/go/sqltypes"
"github.com/youtube/vitess/go/vt/logutil"
@ -48,17 +49,17 @@ func init() {
addCommand(queriesGroupName, command{
"VtGateExecute",
commandVtGateExecute,
"-server <vtgate> [-bind_variables <JSON map>] [-connect_timeout <connect timeout>] [-keyspace <default keyspace>] [-tablet_type <tablet type>] [-json] <sql>",
"-server <vtgate> [-bind_variables <JSON map>] [-connect_timeout <connect timeout>] [-keyspace <default keyspace>] [-tablet_type <tablet type>] [-options <proto text options>] [-json] <sql>",
"Executes the given SQL query with the provided bound variables against the vtgate server."})
addCommand(queriesGroupName, command{
"VtGateExecuteShards",
commandVtGateExecuteShards,
"-server <vtgate> -keyspace <keyspace> -shards <shard0>,<shard1>,... [-bind_variables <JSON map>] [-connect_timeout <connect timeout>] [-tablet_type <tablet type>] [-json] <sql>",
"-server <vtgate> -keyspace <keyspace> -shards <shard0>,<shard1>,... [-bind_variables <JSON map>] [-connect_timeout <connect timeout>] [-tablet_type <tablet type>] [-options <proto text options>] [-json] <sql>",
"Executes the given SQL query with the provided bound variables against the vtgate server. It is routed to the provided shards."})
addCommand(queriesGroupName, command{
"VtGateExecuteKeyspaceIds",
commandVtGateExecuteKeyspaceIds,
"-server <vtgate> -keyspace <keyspace> -keyspace_ids <ks1 in hex>,<k2 in hex>,... [-bind_variables <JSON map>] [-connect_timeout <connect timeout>] [-tablet_type <tablet type>] [-json] <sql>",
"-server <vtgate> -keyspace <keyspace> -keyspace_ids <ks1 in hex>,<k2 in hex>,... [-bind_variables <JSON map>] [-connect_timeout <connect timeout>] [-tablet_type <tablet type>] [-options <proto text options>] [-json] <sql>",
"Executes the given SQL query with the provided bound variables against the vtgate server. It is routed to the shards that contain the provided keyspace ids."})
addCommand(queriesGroupName, command{
"VtGateSplitQuery",
@ -70,7 +71,7 @@ func init() {
addCommand(queriesGroupName, command{
"VtTabletExecute",
commandVtTabletExecute,
"[-bind_variables <JSON map>] [-connect_timeout <connect timeout>] [-transaction_id <transaction_id>] [-tablet_type <tablet_type>] [-json] -keyspace <keyspace> -shard <shard> <tablet alias> <sql>",
"[-bind_variables <JSON map>] [-connect_timeout <connect timeout>] [-transaction_id <transaction_id>] [-tablet_type <tablet_type>] [-options <proto text options>] [-json] -keyspace <keyspace> -shard <shard> <tablet alias> <sql>",
"Executes the given query on the given tablet."})
addCommand(queriesGroupName, command{
"VtTabletBegin",
@ -140,12 +141,24 @@ func newBindvars(subFlags *flag.FlagSet) *bindvars {
return &bv
}
func parseExecuteOptions(value string) (*querypb.ExecuteOptions, error) {
if value == "" {
return nil, nil
}
result := &querypb.ExecuteOptions{}
if err := proto.UnmarshalText(value, result); err != nil {
return nil, fmt.Errorf("failed to unmarshal options: %v", err)
}
return result, nil
}
func commandVtGateExecute(ctx context.Context, wr *wrangler.Wrangler, subFlags *flag.FlagSet, args []string) error {
server := subFlags.String("server", "", "VtGate server to connect to")
bindVariables := newBindvars(subFlags)
connectTimeout := subFlags.Duration("connect_timeout", 30*time.Second, "Connection timeout for vtgate client")
keyspace := subFlags.String("keyspace", "", "default keyspace to use")
tabletType := subFlags.String("tablet_type", "master", "tablet type to query")
options := subFlags.String("options", "", "execute options values as a text encoded proto of the ExecuteOptions structure")
json := subFlags.Bool("json", false, "Output JSON instead of human-readable table")
if err := subFlags.Parse(args); err != nil {
@ -158,13 +171,17 @@ func commandVtGateExecute(ctx context.Context, wr *wrangler.Wrangler, subFlags *
if err != nil {
return err
}
executeOptions, err := parseExecuteOptions(*options)
if err != nil {
return err
}
vtgateConn, err := vtgateconn.Dial(ctx, *server, *connectTimeout, *keyspace)
if err != nil {
return fmt.Errorf("error connecting to vtgate '%v': %v", *server, err)
}
defer vtgateConn.Close()
qr, err := vtgateConn.Execute(ctx, subFlags.Arg(0), *bindVariables, t)
qr, err := vtgateConn.Execute(ctx, subFlags.Arg(0), *bindVariables, t, executeOptions)
if err != nil {
return fmt.Errorf("Execute failed: %v", err)
}
@ -182,6 +199,7 @@ func commandVtGateExecuteShards(ctx context.Context, wr *wrangler.Wrangler, subF
tabletType := subFlags.String("tablet_type", "master", "tablet type to query")
keyspace := subFlags.String("keyspace", "", "keyspace to send query to")
shardsStr := subFlags.String("shards", "", "comma-separated list of shards to send query to")
options := subFlags.String("options", "", "execute options values as a text encoded proto of the ExecuteOptions structure")
json := subFlags.Bool("json", false, "Output JSON instead of human-readable table")
if err := subFlags.Parse(args); err != nil {
@ -198,13 +216,17 @@ func commandVtGateExecuteShards(ctx context.Context, wr *wrangler.Wrangler, subF
if *shardsStr != "" {
shards = strings.Split(*shardsStr, ",")
}
executeOptions, err := parseExecuteOptions(*options)
if err != nil {
return err
}
vtgateConn, err := vtgateconn.Dial(ctx, *server, *connectTimeout, "")
if err != nil {
return fmt.Errorf("error connecting to vtgate '%v': %v", *server, err)
}
defer vtgateConn.Close()
qr, err := vtgateConn.ExecuteShards(ctx, subFlags.Arg(0), *keyspace, shards, *bindVariables, t)
qr, err := vtgateConn.ExecuteShards(ctx, subFlags.Arg(0), *keyspace, shards, *bindVariables, t, executeOptions)
if err != nil {
return fmt.Errorf("Execute failed: %v", err)
}
@ -222,6 +244,7 @@ func commandVtGateExecuteKeyspaceIds(ctx context.Context, wr *wrangler.Wrangler,
tabletType := subFlags.String("tablet_type", "master", "tablet type to query")
keyspace := subFlags.String("keyspace", "", "keyspace to send query to")
keyspaceIDsStr := subFlags.String("keyspace_ids", "", "comma-separated list of keyspace ids (in hex) that will map into shards to send query to")
options := subFlags.String("options", "", "execute options values as a text encoded proto of the ExecuteOptions structure")
json := subFlags.Bool("json", false, "Output JSON instead of human-readable table")
if err := subFlags.Parse(args); err != nil {
@ -245,13 +268,17 @@ func commandVtGateExecuteKeyspaceIds(ctx context.Context, wr *wrangler.Wrangler,
}
}
}
executeOptions, err := parseExecuteOptions(*options)
if err != nil {
return err
}
vtgateConn, err := vtgateconn.Dial(ctx, *server, *connectTimeout, "")
if err != nil {
return fmt.Errorf("error connecting to vtgate '%v': %v", *server, err)
}
defer vtgateConn.Close()
qr, err := vtgateConn.ExecuteKeyspaceIds(ctx, subFlags.Arg(0), *keyspace, keyspaceIDs, *bindVariables, t)
qr, err := vtgateConn.ExecuteKeyspaceIds(ctx, subFlags.Arg(0), *keyspace, keyspaceIDs, *bindVariables, t, executeOptions)
if err != nil {
return fmt.Errorf("Execute failed: %v", err)
}
@ -292,6 +319,7 @@ func commandVtTabletExecute(ctx context.Context, wr *wrangler.Wrangler, subFlags
transactionID := subFlags.Int("transaction_id", 0, "transaction id to use, if inside a transaction.")
bindVariables := newBindvars(subFlags)
connectTimeout := subFlags.Duration("connect_timeout", 30*time.Second, "Connection timeout for vttablet client")
options := subFlags.String("options", "", "execute options values as a text encoded proto of the ExecuteOptions structure")
json := subFlags.Bool("json", false, "Output JSON instead of human-readable table")
if err := subFlags.Parse(args); err != nil {
@ -308,6 +336,10 @@ func commandVtTabletExecute(ctx context.Context, wr *wrangler.Wrangler, subFlags
if err != nil {
return err
}
executeOptions, err := parseExecuteOptions(*options)
if err != nil {
return err
}
conn, err := tabletconn.GetDialer()(tabletInfo.Tablet, *connectTimeout)
if err != nil {
@ -319,7 +351,7 @@ func commandVtTabletExecute(ctx context.Context, wr *wrangler.Wrangler, subFlags
Keyspace: tabletInfo.Tablet.Keyspace,
Shard: tabletInfo.Tablet.Shard,
TabletType: tabletInfo.Tablet.Type,
}, subFlags.Arg(1), *bindVariables, int64(*transactionID))
}, subFlags.Arg(1), *bindVariables, int64(*transactionID), executeOptions)
if err != nil {
return fmt.Errorf("Execute failed: %v", err)
}

Просмотреть файл

@ -211,7 +211,7 @@ func (conn *FakeVTGateConn) AddSplitQueryV2(
}
// Execute please see vtgateconn.Impl.Execute
func (conn *FakeVTGateConn) Execute(ctx context.Context, sql string, bindVars map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session interface{}) (*sqltypes.Result, interface{}, error) {
func (conn *FakeVTGateConn) Execute(ctx context.Context, sql string, bindVars map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, interface{}, error) {
var s *vtgatepb.Session
if session != nil {
s = session.(*vtgatepb.Session)
@ -240,7 +240,7 @@ func (conn *FakeVTGateConn) Execute(ctx context.Context, sql string, bindVars ma
}
// ExecuteShards please see vtgateconn.Impl.ExecuteShard
func (conn *FakeVTGateConn) ExecuteShards(ctx context.Context, sql string, keyspace string, shards []string, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}) (*sqltypes.Result, interface{}, error) {
func (conn *FakeVTGateConn) ExecuteShards(ctx context.Context, sql string, keyspace string, shards []string, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, interface{}, error) {
var s *vtgatepb.Session
if session != nil {
s = session.(*vtgatepb.Session)
@ -270,27 +270,27 @@ func (conn *FakeVTGateConn) ExecuteShards(ctx context.Context, sql string, keysp
}
// ExecuteKeyspaceIds please see vtgateconn.Impl.ExecuteKeyspaceIds
func (conn *FakeVTGateConn) ExecuteKeyspaceIds(ctx context.Context, query string, keyspace string, keyspaceIds [][]byte, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}) (*sqltypes.Result, interface{}, error) {
func (conn *FakeVTGateConn) ExecuteKeyspaceIds(ctx context.Context, query string, keyspace string, keyspaceIds [][]byte, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, interface{}, error) {
panic("not implemented")
}
// ExecuteKeyRanges please see vtgateconn.Impl.ExecuteKeyRanges
func (conn *FakeVTGateConn) ExecuteKeyRanges(ctx context.Context, query string, keyspace string, keyRanges []*topodatapb.KeyRange, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}) (*sqltypes.Result, interface{}, error) {
func (conn *FakeVTGateConn) ExecuteKeyRanges(ctx context.Context, query string, keyspace string, keyRanges []*topodatapb.KeyRange, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, interface{}, error) {
panic("not implemented")
}
// ExecuteEntityIds please see vtgateconn.Impl.ExecuteEntityIds
func (conn *FakeVTGateConn) ExecuteEntityIds(ctx context.Context, query string, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}) (*sqltypes.Result, interface{}, error) {
func (conn *FakeVTGateConn) ExecuteEntityIds(ctx context.Context, query string, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, interface{}, error) {
panic("not implemented")
}
// ExecuteBatchShards please see vtgateconn.Impl.ExecuteBatchShards
func (conn *FakeVTGateConn) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session interface{}) ([]sqltypes.Result, interface{}, error) {
func (conn *FakeVTGateConn) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session interface{}, options *querypb.ExecuteOptions) ([]sqltypes.Result, interface{}, error) {
panic("not implemented")
}
// ExecuteBatchKeyspaceIds please see vtgateconn.Impl.ExecuteBatchKeyspaceIds
func (conn *FakeVTGateConn) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session interface{}) ([]sqltypes.Result, interface{}, error) {
func (conn *FakeVTGateConn) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session interface{}, options *querypb.ExecuteOptions) ([]sqltypes.Result, interface{}, error) {
panic("not implemented")
}
@ -307,7 +307,7 @@ func (a *streamExecuteAdapter) Recv() (*sqltypes.Result, error) {
}
// StreamExecute please see vtgateconn.Impl.StreamExecute
func (conn *FakeVTGateConn) StreamExecute(ctx context.Context, sql string, bindVars map[string]interface{}, keyspace string, tabletType topodatapb.TabletType) (sqltypes.ResultStream, error) {
func (conn *FakeVTGateConn) StreamExecute(ctx context.Context, sql string, bindVars map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error) {
response, ok := conn.execMap[sql]
if !ok {
return nil, fmt.Errorf("no match for: %s", sql)
@ -345,17 +345,17 @@ func (conn *FakeVTGateConn) StreamExecute(ctx context.Context, sql string, bindV
}
// StreamExecuteShards please see vtgateconn.Impl.StreamExecuteShards
func (conn *FakeVTGateConn) StreamExecuteShards(ctx context.Context, query string, keyspace string, shards []string, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (sqltypes.ResultStream, error) {
func (conn *FakeVTGateConn) StreamExecuteShards(ctx context.Context, query string, keyspace string, shards []string, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error) {
panic("not implemented")
}
// StreamExecuteKeyRanges please see vtgateconn.Impl.StreamExecuteKeyRanges
func (conn *FakeVTGateConn) StreamExecuteKeyRanges(ctx context.Context, query string, keyspace string, keyRanges []*topodatapb.KeyRange, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (sqltypes.ResultStream, error) {
func (conn *FakeVTGateConn) StreamExecuteKeyRanges(ctx context.Context, query string, keyspace string, keyRanges []*topodatapb.KeyRange, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error) {
panic("not implemented")
}
// StreamExecuteKeyspaceIds please see vtgateconn.Impl.StreamExecuteKeyspaceIds
func (conn *FakeVTGateConn) StreamExecuteKeyspaceIds(ctx context.Context, query string, keyspace string, keyspaceIds [][]byte, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (sqltypes.ResultStream, error) {
func (conn *FakeVTGateConn) StreamExecuteKeyspaceIds(ctx context.Context, query string, keyspace string, keyspaceIds [][]byte, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error) {
panic("not implemented")
}

Просмотреть файл

@ -107,11 +107,11 @@ func (dg *discoveryGateway) WaitForTablets(ctx context.Context, tabletTypesToWai
}
// Execute executes the non-streaming query for the specified keyspace, shard, and tablet type.
func (dg *discoveryGateway) Execute(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, query string, bindVars map[string]interface{}, transactionID int64) (qr *sqltypes.Result, err error) {
func (dg *discoveryGateway) Execute(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, query string, bindVars map[string]interface{}, transactionID int64, options *querypb.ExecuteOptions) (qr *sqltypes.Result, err error) {
err = dg.withRetry(ctx, keyspace, shard, tabletType, func(conn tabletconn.TabletConn, target *querypb.Target) error {
var innerErr error
startTime := time.Now()
qr, innerErr = conn.Execute(ctx, target, query, bindVars, transactionID)
qr, innerErr = conn.Execute(ctx, target, query, bindVars, transactionID, options)
dg.updateStats(keyspace, shard, tabletType, startTime, innerErr)
return innerErr
}, transactionID, false)
@ -119,11 +119,11 @@ func (dg *discoveryGateway) Execute(ctx context.Context, keyspace, shard string,
}
// ExecuteBatch executes a group of queries for the specified keyspace, shard, and tablet type.
func (dg *discoveryGateway) ExecuteBatch(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64) (qrs []sqltypes.Result, err error) {
func (dg *discoveryGateway) ExecuteBatch(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64, options *querypb.ExecuteOptions) (qrs []sqltypes.Result, err error) {
err = dg.withRetry(ctx, keyspace, shard, tabletType, func(conn tabletconn.TabletConn, target *querypb.Target) error {
var innerErr error
startTime := time.Now()
qrs, innerErr = conn.ExecuteBatch(ctx, target, queries, asTransaction, transactionID)
qrs, innerErr = conn.ExecuteBatch(ctx, target, queries, asTransaction, transactionID, options)
dg.updateStats(keyspace, shard, tabletType, startTime, innerErr)
return innerErr
}, transactionID, false)
@ -131,11 +131,11 @@ func (dg *discoveryGateway) ExecuteBatch(ctx context.Context, keyspace, shard st
}
// StreamExecute executes a streaming query for the specified keyspace, shard, and tablet type.
func (dg *discoveryGateway) StreamExecute(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, query string, bindVars map[string]interface{}) (sqltypes.ResultStream, error) {
func (dg *discoveryGateway) StreamExecute(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, query string, bindVars map[string]interface{}, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error) {
var stream sqltypes.ResultStream
err := dg.withRetry(ctx, keyspace, shard, tabletType, func(conn tabletconn.TabletConn, target *querypb.Target) error {
var err error
stream, err = conn.StreamExecute(ctx, target, query, bindVars)
stream, err = conn.StreamExecute(ctx, target, query, bindVars, options)
return err
}, 0, true)
if err != nil {
@ -179,11 +179,11 @@ func (dg *discoveryGateway) Rollback(ctx context.Context, keyspace, shard string
// BeginExecute executes a begin and the non-streaming query for the
// specified keyspace, shard, and tablet type.
func (dg *discoveryGateway) BeginExecute(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, query string, bindVars map[string]interface{}) (qr *sqltypes.Result, transactionID int64, err error) {
func (dg *discoveryGateway) BeginExecute(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, query string, bindVars map[string]interface{}, options *querypb.ExecuteOptions) (qr *sqltypes.Result, transactionID int64, err error) {
err = dg.withRetry(ctx, keyspace, shard, tabletType, func(conn tabletconn.TabletConn, target *querypb.Target) error {
var innerErr error
startTime := time.Now()
qr, transactionID, innerErr = conn.BeginExecute(ctx, target, query, bindVars)
qr, transactionID, innerErr = conn.BeginExecute(ctx, target, query, bindVars, options)
dg.updateStats(keyspace, shard, tabletType, startTime, innerErr)
return innerErr
}, 0, false)
@ -192,11 +192,11 @@ func (dg *discoveryGateway) BeginExecute(ctx context.Context, keyspace, shard st
// BeginExecuteBatch executes a begin and a group of queries for the
// specified keyspace, shard, and tablet type.
func (dg *discoveryGateway) BeginExecuteBatch(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, queries []querytypes.BoundQuery, asTransaction bool) (qrs []sqltypes.Result, transactionID int64, err error) {
func (dg *discoveryGateway) BeginExecuteBatch(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, queries []querytypes.BoundQuery, asTransaction bool, options *querypb.ExecuteOptions) (qrs []sqltypes.Result, transactionID int64, err error) {
err = dg.withRetry(ctx, keyspace, shard, tabletType, func(conn tabletconn.TabletConn, target *querypb.Target) error {
var innerErr error
startTime := time.Now()
qrs, transactionID, innerErr = conn.BeginExecuteBatch(ctx, target, queries, asTransaction)
qrs, transactionID, innerErr = conn.BeginExecuteBatch(ctx, target, queries, asTransaction, options)
dg.updateStats(keyspace, shard, tabletType, startTime, innerErr)
return innerErr
}, 0, false)

Просмотреть файл

@ -18,11 +18,11 @@ import (
func TestDiscoveryGatewayExecute(t *testing.T) {
testDiscoveryGatewayGeneric(t, false, func(dg Gateway, keyspace, shard string, tabletType topodatapb.TabletType) error {
_, err := dg.Execute(context.Background(), keyspace, shard, tabletType, "query", nil, 0)
_, err := dg.Execute(context.Background(), keyspace, shard, tabletType, "query", nil, 0, nil)
return err
})
testDiscoveryGatewayTransact(t, false, func(dg Gateway, keyspace, shard string, tabletType topodatapb.TabletType) error {
_, err := dg.Execute(context.Background(), keyspace, shard, tabletType, "query", nil, 1)
_, err := dg.Execute(context.Background(), keyspace, shard, tabletType, "query", nil, 1, nil)
return err
})
}
@ -30,19 +30,19 @@ func TestDiscoveryGatewayExecute(t *testing.T) {
func TestDiscoveryGatewayExecuteBatch(t *testing.T) {
testDiscoveryGatewayGeneric(t, false, func(dg Gateway, keyspace, shard string, tabletType topodatapb.TabletType) error {
queries := []querytypes.BoundQuery{{Sql: "query", BindVariables: nil}}
_, err := dg.ExecuteBatch(context.Background(), keyspace, shard, tabletType, queries, false, 0)
_, err := dg.ExecuteBatch(context.Background(), keyspace, shard, tabletType, queries, false, 0, nil)
return err
})
testDiscoveryGatewayTransact(t, false, func(dg Gateway, keyspace, shard string, tabletType topodatapb.TabletType) error {
queries := []querytypes.BoundQuery{{Sql: "query", BindVariables: nil}}
_, err := dg.ExecuteBatch(context.Background(), keyspace, shard, tabletType, queries, false, 1)
_, err := dg.ExecuteBatch(context.Background(), keyspace, shard, tabletType, queries, false, 1, nil)
return err
})
}
func TestDiscoveryGatewayExecuteStream(t *testing.T) {
testDiscoveryGatewayGeneric(t, true, func(dg Gateway, keyspace, shard string, tabletType topodatapb.TabletType) error {
_, err := dg.StreamExecute(context.Background(), keyspace, shard, tabletType, "query", nil)
_, err := dg.StreamExecute(context.Background(), keyspace, shard, tabletType, "query", nil, nil)
return err
})
}
@ -68,7 +68,7 @@ func TestDiscoveryGatewayRollback(t *testing.T) {
func TestDiscoveryGatewayBeginExecute(t *testing.T) {
testDiscoveryGatewayGeneric(t, false, func(dg Gateway, keyspace, shard string, tabletType topodatapb.TabletType) error {
_, _, err := dg.BeginExecute(context.Background(), keyspace, shard, tabletType, "query", nil)
_, _, err := dg.BeginExecute(context.Background(), keyspace, shard, tabletType, "query", nil, nil)
return err
})
}
@ -76,7 +76,7 @@ func TestDiscoveryGatewayBeginExecute(t *testing.T) {
func TestDiscoveryGatewayBeginExecuteBatch(t *testing.T) {
testDiscoveryGatewayGeneric(t, false, func(dg Gateway, keyspace, shard string, tabletType topodatapb.TabletType) error {
queries := []querytypes.BoundQuery{{Sql: "query", BindVariables: nil}}
_, _, err := dg.BeginExecuteBatch(context.Background(), keyspace, shard, tabletType, queries, false)
_, _, err := dg.BeginExecuteBatch(context.Background(), keyspace, shard, tabletType, queries, false, nil)
return err
})
}

Просмотреть файл

@ -35,13 +35,13 @@ var (
// which is used by ScatterConn.
type Gateway interface {
// Execute executes the non-streaming query for the specified keyspace, shard, and tablet type.
Execute(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, query string, bindVars map[string]interface{}, transactionID int64) (*sqltypes.Result, error)
Execute(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, query string, bindVars map[string]interface{}, transactionID int64, options *querypb.ExecuteOptions) (*sqltypes.Result, error)
// ExecuteBatch executes a group of queries for the specified keyspace, shard, and tablet type.
ExecuteBatch(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64) ([]sqltypes.Result, error)
ExecuteBatch(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64, options *querypb.ExecuteOptions) ([]sqltypes.Result, error)
// StreamExecute executes a streaming query for the specified keyspace, shard, and tablet type.
StreamExecute(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, query string, bindVars map[string]interface{}) (sqltypes.ResultStream, error)
StreamExecute(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, query string, bindVars map[string]interface{}, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error)
// Begin starts a transaction for the specified keyspace, shard, and tablet type.
// It returns the transaction ID.
@ -55,11 +55,11 @@ type Gateway interface {
// BeginExecute executes a begin and the non-streaming query
// for the specified keyspace, shard, and tablet type.
BeginExecute(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, query string, bindVars map[string]interface{}) (*sqltypes.Result, int64, error)
BeginExecute(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, query string, bindVars map[string]interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, int64, error)
// BeginExecuteBatch executes a begin and a group of queries
// for the specified keyspace, shard, and tablet type.
BeginExecuteBatch(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, queries []querytypes.BoundQuery, asTransaction bool) ([]sqltypes.Result, int64, error)
BeginExecuteBatch(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, queries []querytypes.BoundQuery, asTransaction bool, options *querypb.ExecuteOptions) ([]sqltypes.Result, int64, error)
// SplitQuery splits a query into sub-queries for the specified keyspace, shard, and tablet type.
SplitQuery(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, sql string, bindVariables map[string]interface{}, splitColumn string, splitCount int64) ([]querytypes.QuerySplit, error)

Просмотреть файл

@ -140,11 +140,11 @@ func (lg *l2VTGateGateway) WaitForTablets(ctx context.Context, tabletTypesToWait
}
// Execute executes the non-streaming query for the specified keyspace, shard, and tablet type.
func (lg *l2VTGateGateway) Execute(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, query string, bindVars map[string]interface{}, transactionID int64) (qr *sqltypes.Result, err error) {
func (lg *l2VTGateGateway) Execute(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, query string, bindVars map[string]interface{}, transactionID int64, options *querypb.ExecuteOptions) (qr *sqltypes.Result, err error) {
err = lg.withRetry(ctx, keyspace, shard, tabletType, func(conn *l2VTGateConn, target *querypb.Target) error {
var innerErr error
startTime := time.Now()
qr, innerErr = conn.conn.Execute(ctx, target, query, bindVars, transactionID)
qr, innerErr = conn.conn.Execute(ctx, target, query, bindVars, transactionID, options)
lg.updateStats(conn, tabletType, startTime, innerErr)
return innerErr
}, transactionID, false)
@ -152,11 +152,11 @@ func (lg *l2VTGateGateway) Execute(ctx context.Context, keyspace, shard string,
}
// ExecuteBatch executes a group of queries for the specified keyspace, shard, and tablet type.
func (lg *l2VTGateGateway) ExecuteBatch(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64) (qrs []sqltypes.Result, err error) {
func (lg *l2VTGateGateway) ExecuteBatch(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64, options *querypb.ExecuteOptions) (qrs []sqltypes.Result, err error) {
err = lg.withRetry(ctx, keyspace, shard, tabletType, func(conn *l2VTGateConn, target *querypb.Target) error {
var innerErr error
startTime := time.Now()
qrs, innerErr = conn.conn.ExecuteBatch(ctx, target, queries, asTransaction, transactionID)
qrs, innerErr = conn.conn.ExecuteBatch(ctx, target, queries, asTransaction, transactionID, options)
lg.updateStats(conn, tabletType, startTime, innerErr)
return innerErr
}, transactionID, false)
@ -164,11 +164,11 @@ func (lg *l2VTGateGateway) ExecuteBatch(ctx context.Context, keyspace, shard str
}
// StreamExecute executes a streaming query for the specified keyspace, shard, and tablet type.
func (lg *l2VTGateGateway) StreamExecute(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, query string, bindVars map[string]interface{}) (sqltypes.ResultStream, error) {
func (lg *l2VTGateGateway) StreamExecute(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, query string, bindVars map[string]interface{}, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error) {
var stream sqltypes.ResultStream
err := lg.withRetry(ctx, keyspace, shard, tabletType, func(conn *l2VTGateConn, target *querypb.Target) error {
var err error
stream, err = conn.conn.StreamExecute(ctx, target, query, bindVars)
stream, err = conn.conn.StreamExecute(ctx, target, query, bindVars, options)
return err
}, 0, true)
if err != nil {
@ -212,11 +212,11 @@ func (lg *l2VTGateGateway) Rollback(ctx context.Context, keyspace, shard string,
// BeginExecute executes a begin and the non-streaming query for the
// specified keyspace, shard, and tablet type.
func (lg *l2VTGateGateway) BeginExecute(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, query string, bindVars map[string]interface{}) (qr *sqltypes.Result, transactionID int64, err error) {
func (lg *l2VTGateGateway) BeginExecute(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, query string, bindVars map[string]interface{}, options *querypb.ExecuteOptions) (qr *sqltypes.Result, transactionID int64, err error) {
err = lg.withRetry(ctx, keyspace, shard, tabletType, func(conn *l2VTGateConn, target *querypb.Target) error {
var innerErr error
startTime := time.Now()
qr, transactionID, innerErr = conn.conn.BeginExecute(ctx, target, query, bindVars)
qr, transactionID, innerErr = conn.conn.BeginExecute(ctx, target, query, bindVars, options)
lg.updateStats(conn, tabletType, startTime, innerErr)
return innerErr
}, 0, false)
@ -225,11 +225,11 @@ func (lg *l2VTGateGateway) BeginExecute(ctx context.Context, keyspace, shard str
// BeginExecuteBatch executes a begin and a group of queries for the
// specified keyspace, shard, and tablet type.
func (lg *l2VTGateGateway) BeginExecuteBatch(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, queries []querytypes.BoundQuery, asTransaction bool) (qrs []sqltypes.Result, transactionID int64, err error) {
func (lg *l2VTGateGateway) BeginExecuteBatch(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, queries []querytypes.BoundQuery, asTransaction bool, options *querypb.ExecuteOptions) (qrs []sqltypes.Result, transactionID int64, err error) {
err = lg.withRetry(ctx, keyspace, shard, tabletType, func(conn *l2VTGateConn, target *querypb.Target) error {
var innerErr error
startTime := time.Now()
qrs, transactionID, innerErr = conn.conn.BeginExecuteBatch(ctx, target, queries, asTransaction)
qrs, transactionID, innerErr = conn.conn.BeginExecuteBatch(ctx, target, queries, asTransaction, options)
lg.updateStats(conn, tabletType, startTime, innerErr)
return innerErr
}, 0, false)

Просмотреть файл

@ -33,16 +33,16 @@ type gatewayAdapter struct {
g gateway.Gateway
}
func (ga *gatewayAdapter) Execute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, transactionID int64) (*sqltypes.Result, error) {
return ga.g.Execute(ctx, target.Keyspace, target.Shard, target.TabletType, query, bindVars, transactionID)
func (ga *gatewayAdapter) Execute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, transactionID int64, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
return ga.g.Execute(ctx, target.Keyspace, target.Shard, target.TabletType, query, bindVars, transactionID, options)
}
func (ga *gatewayAdapter) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64) ([]sqltypes.Result, error) {
return ga.g.ExecuteBatch(ctx, target.Keyspace, target.Shard, target.TabletType, queries, asTransaction, transactionID)
func (ga *gatewayAdapter) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
return ga.g.ExecuteBatch(ctx, target.Keyspace, target.Shard, target.TabletType, queries, asTransaction, transactionID, options)
}
func (ga *gatewayAdapter) StreamExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}) (sqltypes.ResultStream, error) {
return ga.g.StreamExecute(ctx, target.Keyspace, target.Shard, target.TabletType, query, bindVars)
func (ga *gatewayAdapter) StreamExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error) {
return ga.g.StreamExecute(ctx, target.Keyspace, target.Shard, target.TabletType, query, bindVars, options)
}
func (ga *gatewayAdapter) Begin(ctx context.Context, target *querypb.Target) (transactionID int64, err error) {
@ -57,12 +57,12 @@ func (ga *gatewayAdapter) Rollback(ctx context.Context, target *querypb.Target,
return ga.g.Rollback(ctx, target.Keyspace, target.Shard, target.TabletType, transactionID)
}
func (ga *gatewayAdapter) BeginExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}) (result *sqltypes.Result, transactionID int64, err error) {
return ga.g.BeginExecute(ctx, target.Keyspace, target.Shard, target.TabletType, query, bindVars)
func (ga *gatewayAdapter) BeginExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]interface{}, options *querypb.ExecuteOptions) (result *sqltypes.Result, transactionID int64, err error) {
return ga.g.BeginExecute(ctx, target.Keyspace, target.Shard, target.TabletType, query, bindVars, options)
}
func (ga *gatewayAdapter) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool) (results []sqltypes.Result, transactionID int64, err error) {
return ga.g.BeginExecuteBatch(ctx, target.Keyspace, target.Shard, target.TabletType, queries, asTransaction)
func (ga *gatewayAdapter) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, options *querypb.ExecuteOptions) (results []sqltypes.Result, transactionID int64, err error) {
return ga.g.BeginExecuteBatch(ctx, target.Keyspace, target.Shard, target.TabletType, queries, asTransaction, options)
}
func (ga *gatewayAdapter) Close() {

Просмотреть файл

@ -58,7 +58,7 @@ func dial(ctx context.Context, addr string, timeout time.Duration) (vtgateconn.I
}, nil
}
func (conn *vtgateConn) Execute(ctx context.Context, query string, bindVars map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session interface{}) (*sqltypes.Result, interface{}, error) {
func (conn *vtgateConn) Execute(ctx context.Context, query string, bindVars map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, interface{}, error) {
var s *vtgatepb.Session
if session != nil {
s = session.(*vtgatepb.Session)
@ -73,6 +73,7 @@ func (conn *vtgateConn) Execute(ctx context.Context, query string, bindVars map[
Query: q,
Keyspace: keyspace,
TabletType: tabletType,
Options: options,
}
response, err := conn.c.Execute(ctx, request)
if err != nil {
@ -84,7 +85,7 @@ func (conn *vtgateConn) Execute(ctx context.Context, query string, bindVars map[
return sqltypes.Proto3ToResult(response.Result), response.Session, nil
}
func (conn *vtgateConn) ExecuteShards(ctx context.Context, query string, keyspace string, shards []string, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}) (*sqltypes.Result, interface{}, error) {
func (conn *vtgateConn) ExecuteShards(ctx context.Context, query string, keyspace string, shards []string, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, interface{}, error) {
var s *vtgatepb.Session
if session != nil {
s = session.(*vtgatepb.Session)
@ -100,6 +101,7 @@ func (conn *vtgateConn) ExecuteShards(ctx context.Context, query string, keyspac
Keyspace: keyspace,
Shards: shards,
TabletType: tabletType,
Options: options,
}
response, err := conn.c.ExecuteShards(ctx, request)
if err != nil {
@ -111,7 +113,7 @@ func (conn *vtgateConn) ExecuteShards(ctx context.Context, query string, keyspac
return sqltypes.Proto3ToResult(response.Result), response.Session, nil
}
func (conn *vtgateConn) ExecuteKeyspaceIds(ctx context.Context, query string, keyspace string, keyspaceIds [][]byte, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}) (*sqltypes.Result, interface{}, error) {
func (conn *vtgateConn) ExecuteKeyspaceIds(ctx context.Context, query string, keyspace string, keyspaceIds [][]byte, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, interface{}, error) {
var s *vtgatepb.Session
if session != nil {
s = session.(*vtgatepb.Session)
@ -127,6 +129,7 @@ func (conn *vtgateConn) ExecuteKeyspaceIds(ctx context.Context, query string, ke
Keyspace: keyspace,
KeyspaceIds: keyspaceIds,
TabletType: tabletType,
Options: options,
}
response, err := conn.c.ExecuteKeyspaceIds(ctx, request)
if err != nil {
@ -138,7 +141,7 @@ func (conn *vtgateConn) ExecuteKeyspaceIds(ctx context.Context, query string, ke
return sqltypes.Proto3ToResult(response.Result), response.Session, nil
}
func (conn *vtgateConn) ExecuteKeyRanges(ctx context.Context, query string, keyspace string, keyRanges []*topodatapb.KeyRange, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}) (*sqltypes.Result, interface{}, error) {
func (conn *vtgateConn) ExecuteKeyRanges(ctx context.Context, query string, keyspace string, keyRanges []*topodatapb.KeyRange, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, interface{}, error) {
var s *vtgatepb.Session
if session != nil {
s = session.(*vtgatepb.Session)
@ -154,6 +157,7 @@ func (conn *vtgateConn) ExecuteKeyRanges(ctx context.Context, query string, keys
Keyspace: keyspace,
KeyRanges: keyRanges,
TabletType: tabletType,
Options: options,
}
response, err := conn.c.ExecuteKeyRanges(ctx, request)
if err != nil {
@ -165,7 +169,7 @@ func (conn *vtgateConn) ExecuteKeyRanges(ctx context.Context, query string, keys
return sqltypes.Proto3ToResult(response.Result), response.Session, nil
}
func (conn *vtgateConn) ExecuteEntityIds(ctx context.Context, query string, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}) (*sqltypes.Result, interface{}, error) {
func (conn *vtgateConn) ExecuteEntityIds(ctx context.Context, query string, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, interface{}, error) {
var s *vtgatepb.Session
if session != nil {
s = session.(*vtgatepb.Session)
@ -182,6 +186,7 @@ func (conn *vtgateConn) ExecuteEntityIds(ctx context.Context, query string, keys
EntityColumnName: entityColumnName,
EntityKeyspaceIds: entityKeyspaceIDs,
TabletType: tabletType,
Options: options,
}
response, err := conn.c.ExecuteEntityIds(ctx, request)
if err != nil {
@ -193,7 +198,7 @@ func (conn *vtgateConn) ExecuteEntityIds(ctx context.Context, query string, keys
return sqltypes.Proto3ToResult(response.Result), response.Session, nil
}
func (conn *vtgateConn) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session interface{}) ([]sqltypes.Result, interface{}, error) {
func (conn *vtgateConn) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session interface{}, options *querypb.ExecuteOptions) ([]sqltypes.Result, interface{}, error) {
var s *vtgatepb.Session
if session != nil {
s = session.(*vtgatepb.Session)
@ -204,6 +209,7 @@ func (conn *vtgateConn) ExecuteBatchShards(ctx context.Context, queries []*vtgat
Queries: queries,
TabletType: tabletType,
AsTransaction: asTransaction,
Options: options,
}
response, err := conn.c.ExecuteBatchShards(ctx, request)
if err != nil {
@ -215,7 +221,7 @@ func (conn *vtgateConn) ExecuteBatchShards(ctx context.Context, queries []*vtgat
return sqltypes.Proto3ToResults(response.Results), response.Session, nil
}
func (conn *vtgateConn) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session interface{}) ([]sqltypes.Result, interface{}, error) {
func (conn *vtgateConn) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session interface{}, options *querypb.ExecuteOptions) ([]sqltypes.Result, interface{}, error) {
var s *vtgatepb.Session
if session != nil {
s = session.(*vtgatepb.Session)
@ -226,6 +232,7 @@ func (conn *vtgateConn) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*
Queries: queries,
TabletType: tabletType,
AsTransaction: asTransaction,
Options: options,
}
response, err := conn.c.ExecuteBatchKeyspaceIds(ctx, request)
if err != nil {
@ -256,7 +263,7 @@ func (a *streamExecuteAdapter) Recv() (*sqltypes.Result, error) {
return sqltypes.CustomProto3ToResult(a.fields, qr), nil
}
func (conn *vtgateConn) StreamExecute(ctx context.Context, query string, bindVars map[string]interface{}, keyspace string, tabletType topodatapb.TabletType) (sqltypes.ResultStream, error) {
func (conn *vtgateConn) StreamExecute(ctx context.Context, query string, bindVars map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error) {
q, err := querytypes.BoundQueryToProto3(query, bindVars)
if err != nil {
return nil, err
@ -266,6 +273,7 @@ func (conn *vtgateConn) StreamExecute(ctx context.Context, query string, bindVar
Query: q,
Keyspace: keyspace,
TabletType: tabletType,
Options: options,
}
stream, err := conn.c.StreamExecute(ctx, req)
if err != nil {
@ -282,7 +290,7 @@ func (conn *vtgateConn) StreamExecute(ctx context.Context, query string, bindVar
}, nil
}
func (conn *vtgateConn) StreamExecuteShards(ctx context.Context, query string, keyspace string, shards []string, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (sqltypes.ResultStream, error) {
func (conn *vtgateConn) StreamExecuteShards(ctx context.Context, query string, keyspace string, shards []string, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error) {
q, err := querytypes.BoundQueryToProto3(query, bindVars)
if err != nil {
return nil, err
@ -293,6 +301,7 @@ func (conn *vtgateConn) StreamExecuteShards(ctx context.Context, query string, k
Keyspace: keyspace,
Shards: shards,
TabletType: tabletType,
Options: options,
}
stream, err := conn.c.StreamExecuteShards(ctx, req)
if err != nil {
@ -309,7 +318,7 @@ func (conn *vtgateConn) StreamExecuteShards(ctx context.Context, query string, k
}, nil
}
func (conn *vtgateConn) StreamExecuteKeyRanges(ctx context.Context, query string, keyspace string, keyRanges []*topodatapb.KeyRange, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (sqltypes.ResultStream, error) {
func (conn *vtgateConn) StreamExecuteKeyRanges(ctx context.Context, query string, keyspace string, keyRanges []*topodatapb.KeyRange, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error) {
q, err := querytypes.BoundQueryToProto3(query, bindVars)
if err != nil {
return nil, err
@ -320,6 +329,7 @@ func (conn *vtgateConn) StreamExecuteKeyRanges(ctx context.Context, query string
Keyspace: keyspace,
KeyRanges: keyRanges,
TabletType: tabletType,
Options: options,
}
stream, err := conn.c.StreamExecuteKeyRanges(ctx, req)
if err != nil {
@ -336,7 +346,7 @@ func (conn *vtgateConn) StreamExecuteKeyRanges(ctx context.Context, query string
}, nil
}
func (conn *vtgateConn) StreamExecuteKeyspaceIds(ctx context.Context, query string, keyspace string, keyspaceIds [][]byte, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (sqltypes.ResultStream, error) {
func (conn *vtgateConn) StreamExecuteKeyspaceIds(ctx context.Context, query string, keyspace string, keyspaceIds [][]byte, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error) {
q, err := querytypes.BoundQueryToProto3(query, bindVars)
if err != nil {
return nil, err
@ -347,6 +357,7 @@ func (conn *vtgateConn) StreamExecuteKeyspaceIds(ctx context.Context, query stri
Keyspace: keyspace,
KeyspaceIds: keyspaceIds,
TabletType: tabletType,
Options: options,
}
stream, err := conn.c.StreamExecuteKeyspaceIds(ctx, req)
if err != nil {

Просмотреть файл

@ -91,7 +91,7 @@ func (vtg *VTGate) Execute(ctx context.Context, request *vtgatepb.ExecuteRequest
if err != nil {
return nil, vterrors.ToGRPCError(err)
}
result, err := vtg.server.Execute(ctx, string(request.Query.Sql), bv, request.Keyspace, request.TabletType, request.Session, request.NotInTransaction)
result, err := vtg.server.Execute(ctx, string(request.Query.Sql), bv, request.Keyspace, request.TabletType, request.Session, request.NotInTransaction, request.Options)
return &vtgatepb.ExecuteResponse{
Result: sqltypes.ResultToProto3(result),
Session: request.Session,
@ -114,7 +114,8 @@ func (vtg *VTGate) ExecuteShards(ctx context.Context, request *vtgatepb.ExecuteS
request.Shards,
request.TabletType,
request.Session,
request.NotInTransaction)
request.NotInTransaction,
request.Options)
return &vtgatepb.ExecuteShardsResponse{
Result: sqltypes.ResultToProto3(result),
Session: request.Session,
@ -137,7 +138,8 @@ func (vtg *VTGate) ExecuteKeyspaceIds(ctx context.Context, request *vtgatepb.Exe
request.KeyspaceIds,
request.TabletType,
request.Session,
request.NotInTransaction)
request.NotInTransaction,
request.Options)
return &vtgatepb.ExecuteKeyspaceIdsResponse{
Result: sqltypes.ResultToProto3(result),
Session: request.Session,
@ -160,7 +162,8 @@ func (vtg *VTGate) ExecuteKeyRanges(ctx context.Context, request *vtgatepb.Execu
request.KeyRanges,
request.TabletType,
request.Session,
request.NotInTransaction)
request.NotInTransaction,
request.Options)
return &vtgatepb.ExecuteKeyRangesResponse{
Result: sqltypes.ResultToProto3(result),
Session: request.Session,
@ -184,7 +187,8 @@ func (vtg *VTGate) ExecuteEntityIds(ctx context.Context, request *vtgatepb.Execu
request.EntityKeyspaceIds,
request.TabletType,
request.Session,
request.NotInTransaction)
request.NotInTransaction,
request.Options)
return &vtgatepb.ExecuteEntityIdsResponse{
Result: sqltypes.ResultToProto3(result),
Session: request.Session,
@ -200,7 +204,8 @@ func (vtg *VTGate) ExecuteBatchShards(ctx context.Context, request *vtgatepb.Exe
request.Queries,
request.TabletType,
request.AsTransaction,
request.Session)
request.Session,
request.Options)
return &vtgatepb.ExecuteBatchShardsResponse{
Results: sqltypes.ResultsToProto3(result),
Session: request.Session,
@ -217,7 +222,8 @@ func (vtg *VTGate) ExecuteBatchKeyspaceIds(ctx context.Context, request *vtgatep
request.Queries,
request.TabletType,
request.AsTransaction,
request.Session)
request.Session,
request.Options)
return &vtgatepb.ExecuteBatchKeyspaceIdsResponse{
Results: sqltypes.ResultsToProto3(result),
Session: request.Session,
@ -238,6 +244,7 @@ func (vtg *VTGate) StreamExecute(request *vtgatepb.StreamExecuteRequest, stream
bv,
request.Keyspace,
request.TabletType,
request.Options,
func(value *sqltypes.Result) error {
return stream.Send(&vtgatepb.StreamExecuteResponse{
Result: sqltypes.ResultToProto3(value),
@ -260,6 +267,7 @@ func (vtg *VTGate) StreamExecuteShards(request *vtgatepb.StreamExecuteShardsRequ
request.Keyspace,
request.Shards,
request.TabletType,
request.Options,
func(value *sqltypes.Result) error {
return stream.Send(&vtgatepb.StreamExecuteShardsResponse{
Result: sqltypes.ResultToProto3(value),
@ -283,6 +291,7 @@ func (vtg *VTGate) StreamExecuteKeyspaceIds(request *vtgatepb.StreamExecuteKeysp
request.Keyspace,
request.KeyspaceIds,
request.TabletType,
request.Options,
func(value *sqltypes.Result) error {
return stream.Send(&vtgatepb.StreamExecuteKeyspaceIdsResponse{
Result: sqltypes.ResultToProto3(value),
@ -306,6 +315,7 @@ func (vtg *VTGate) StreamExecuteKeyRanges(request *vtgatepb.StreamExecuteKeyRang
request.Keyspace,
request.KeyRanges,
request.TabletType,
request.Options,
func(value *sqltypes.Result) error {
return stream.Send(&vtgatepb.StreamExecuteKeyRangesResponse{
Result: sqltypes.ResultToProto3(value),

Просмотреть файл

@ -81,13 +81,13 @@ func (l *L2VTGate) Rollback(ctx context.Context, target *querypb.Target, transac
}
// Execute is part of the queryservice.QueryService interface
func (l *L2VTGate) Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, transactionID int64) (*sqltypes.Result, error) {
return l.gateway.Execute(ctx, target.Keyspace, target.Shard, target.TabletType, sql, bindVariables, transactionID)
func (l *L2VTGate) Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, transactionID int64, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
return l.gateway.Execute(ctx, target.Keyspace, target.Shard, target.TabletType, sql, bindVariables, transactionID, options)
}
// StreamExecute is part of the queryservice.QueryService interface
func (l *L2VTGate) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sendReply func(*sqltypes.Result) error) error {
stream, err := l.gateway.StreamExecute(ctx, target.Keyspace, target.Shard, target.TabletType, sql, bindVariables)
func (l *L2VTGate) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
stream, err := l.gateway.StreamExecute(ctx, target.Keyspace, target.Shard, target.TabletType, sql, bindVariables, options)
if err != nil {
return err
}
@ -106,18 +106,18 @@ func (l *L2VTGate) StreamExecute(ctx context.Context, target *querypb.Target, sq
}
// ExecuteBatch is part of the queryservice.QueryService interface
func (l *L2VTGate) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64) ([]sqltypes.Result, error) {
return l.gateway.ExecuteBatch(ctx, target.Keyspace, target.Shard, target.TabletType, queries, asTransaction, transactionID)
func (l *L2VTGate) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
return l.gateway.ExecuteBatch(ctx, target.Keyspace, target.Shard, target.TabletType, queries, asTransaction, transactionID, options)
}
// BeginExecute is part of the queryservice.QueryService interface
func (l *L2VTGate) BeginExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}) (*sqltypes.Result, int64, error) {
return l.gateway.BeginExecute(ctx, target.Keyspace, target.Shard, target.TabletType, sql, bindVariables)
func (l *L2VTGate) BeginExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, int64, error) {
return l.gateway.BeginExecute(ctx, target.Keyspace, target.Shard, target.TabletType, sql, bindVariables, options)
}
// BeginExecuteBatch is part of the queryservice.QueryService interface
func (l *L2VTGate) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool) ([]sqltypes.Result, int64, error) {
return l.gateway.BeginExecuteBatch(ctx, target.Keyspace, target.Shard, target.TabletType, queries, asTransaction)
func (l *L2VTGate) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, options *querypb.ExecuteOptions) ([]sqltypes.Result, int64, error) {
return l.gateway.BeginExecuteBatch(ctx, target.Keyspace, target.Shard, target.TabletType, queries, asTransaction, options)
}
// SplitQuery is part of the queryservice.QueryService interface

Просмотреть файл

@ -5,13 +5,15 @@
package vtgate
import (
"github.com/youtube/vitess/go/sqltypes"
"golang.org/x/net/context"
topodatapb "github.com/youtube/vitess/go/vt/proto/topodata"
vtgatepb "github.com/youtube/vitess/go/vt/proto/vtgate"
"github.com/youtube/vitess/go/sqltypes"
"github.com/youtube/vitess/go/vt/sqlparser"
"github.com/youtube/vitess/go/vt/vtgate/engine"
querypb "github.com/youtube/vitess/go/vt/proto/query"
topodatapb "github.com/youtube/vitess/go/vt/proto/topodata"
vtgatepb "github.com/youtube/vitess/go/vt/proto/vtgate"
)
type requestContext struct {
@ -22,10 +24,11 @@ type requestContext struct {
tabletType topodatapb.TabletType
session *vtgatepb.Session
notInTransaction bool
options *querypb.ExecuteOptions
router *Router
}
func newRequestContext(ctx context.Context, sql string, bindVars map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, router *Router) *requestContext {
func newRequestContext(ctx context.Context, sql string, bindVars map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions, router *Router) *requestContext {
query, comments := sqlparser.SplitTrailingComments(sql)
return &requestContext{
ctx: ctx,
@ -36,6 +39,7 @@ func newRequestContext(ctx context.Context, sql string, bindVars map[string]inte
tabletType: tabletType,
session: session,
notInTransaction: notInTransaction,
options: options,
router: router,
}
}
@ -43,7 +47,7 @@ func newRequestContext(ctx context.Context, sql string, bindVars map[string]inte
func (vc *requestContext) Execute(query string, bindvars map[string]interface{}) (*sqltypes.Result, error) {
// We have to use an empty keyspace here, becasue vindexes that call back can reference
// any table.
return vc.router.Execute(vc.ctx, query, bindvars, "", vc.tabletType, vc.session, false)
return vc.router.Execute(vc.ctx, query, bindvars, "", vc.tabletType, vc.session, false, vc.options)
}
func (vc *requestContext) ExecuteRoute(route *engine.Route, joinvars map[string]interface{}) (*sqltypes.Result, error) {

Просмотреть файл

@ -72,7 +72,7 @@ func isRetryableError(err error) bool {
// It retries query if new keyspace/shards are re-resolved after a retryable error.
// This throws an error if a dml spans multiple keyspace_ids. Resharding depends
// on being able to uniquely route a write.
func (res *Resolver) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (res *Resolver) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if sqlannotation.IsDML(sql) && len(keyspaceIds) > 1 {
return nil, vterrors.FromError(
vtrpcpb.ErrorCode_BAD_INPUT,
@ -88,12 +88,12 @@ func (res *Resolver) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVar
tabletType,
keyspaceIds)
}
return res.Execute(ctx, sql, bindVariables, keyspace, tabletType, session, mapToShards, notInTransaction)
return res.Execute(ctx, sql, bindVariables, keyspace, tabletType, session, mapToShards, notInTransaction, options)
}
// ExecuteKeyRanges executes a non-streaming query based on KeyRanges.
// It retries query if new keyspace/shards are re-resolved after a retryable error.
func (res *Resolver) ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (res *Resolver) ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
mapToShards := func(k string) (string, []string, error) {
return mapKeyRangesToShards(
ctx,
@ -103,7 +103,7 @@ func (res *Resolver) ExecuteKeyRanges(ctx context.Context, sql string, bindVaria
tabletType,
keyRanges)
}
return res.Execute(ctx, sql, bindVariables, keyspace, tabletType, session, mapToShards, notInTransaction)
return res.Execute(ctx, sql, bindVariables, keyspace, tabletType, session, mapToShards, notInTransaction, options)
}
// Execute executes a non-streaming query based on shards resolved by given func.
@ -117,6 +117,7 @@ func (res *Resolver) Execute(
session *vtgatepb.Session,
mapToShards func(string) (string, []string, error),
notInTransaction bool,
options *querypb.ExecuteOptions,
) (*sqltypes.Result, error) {
keyspace, shards, err := mapToShards(keyspace)
if err != nil {
@ -131,7 +132,8 @@ func (res *Resolver) Execute(
shards,
tabletType,
NewSafeSession(session),
notInTransaction)
notInTransaction,
options)
if isRetryableError(err) {
resharding := false
newKeyspace, newShards, err := mapToShards(keyspace)
@ -172,6 +174,7 @@ func (res *Resolver) ExecuteEntityIds(
tabletType topodatapb.TabletType,
session *vtgatepb.Session,
notInTransaction bool,
options *querypb.ExecuteOptions,
) (*sqltypes.Result, error) {
newKeyspace, shardIDMap, err := mapEntityIdsToShards(
ctx,
@ -194,7 +197,8 @@ func (res *Resolver) ExecuteEntityIds(
keyspace,
tabletType,
NewSafeSession(session),
notInTransaction)
notInTransaction,
options)
if isRetryableError(err) {
resharding := false
newKeyspace, newShardIDMap, err := mapEntityIdsToShards(
@ -234,7 +238,7 @@ func (res *Resolver) ExecuteEntityIds(
// ExecuteBatchKeyspaceIds executes a group of queries based on KeyspaceIds.
// It retries query if new keyspace/shards are re-resolved after a retryable error.
func (res *Resolver) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session) ([]sqltypes.Result, error) {
func (res *Resolver) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
buildBatchRequest := func() (*scatterBatchRequest, error) {
shardQueries, err := boundKeyspaceIDQueriesToBoundShardQueries(ctx, res.toposerv, res.cell, tabletType, queries)
if err != nil {
@ -242,7 +246,7 @@ func (res *Resolver) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtg
}
return boundShardQueriesToScatterBatchRequest(shardQueries)
}
return res.ExecuteBatch(ctx, tabletType, asTransaction, session, buildBatchRequest)
return res.ExecuteBatch(ctx, tabletType, asTransaction, session, options, buildBatchRequest)
}
// ExecuteBatch executes a group of queries based on shards resolved by given func.
@ -252,6 +256,7 @@ func (res *Resolver) ExecuteBatch(
tabletType topodatapb.TabletType,
asTransaction bool,
session *vtgatepb.Session,
options *querypb.ExecuteOptions,
buildBatchRequest func() (*scatterBatchRequest, error),
) ([]sqltypes.Result, error) {
batchRequest, err := buildBatchRequest()
@ -264,7 +269,8 @@ func (res *Resolver) ExecuteBatch(
batchRequest,
tabletType,
asTransaction,
NewSafeSession(session))
NewSafeSession(session),
options)
// Don't retry transactional requests.
if asTransaction {
return qrs, err
@ -293,7 +299,7 @@ func (res *Resolver) ExecuteBatch(
// one shard since it cannot merge-sort the results to guarantee ordering of
// response which is needed for checkpointing.
// The api supports supplying multiple KeyspaceIds to make it future proof.
func (res *Resolver) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (res *Resolver) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
mapToShards := func(k string) (string, []string, error) {
return mapKeyspaceIdsToShards(
ctx,
@ -303,7 +309,7 @@ func (res *Resolver) StreamExecuteKeyspaceIds(ctx context.Context, sql string, b
tabletType,
keyspaceIds)
}
return res.streamExecute(ctx, sql, bindVariables, keyspace, tabletType, mapToShards, sendReply)
return res.streamExecute(ctx, sql, bindVariables, keyspace, tabletType, mapToShards, options, sendReply)
}
// StreamExecuteKeyRanges executes a streaming query on the specified KeyRanges.
@ -312,7 +318,7 @@ func (res *Resolver) StreamExecuteKeyspaceIds(ctx context.Context, sql string, b
// one shard since it cannot merge-sort the results to guarantee ordering of
// response which is needed for checkpointing.
// The api supports supplying multiple keyranges to make it future proof.
func (res *Resolver) StreamExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (res *Resolver) StreamExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
mapToShards := func(k string) (string, []string, error) {
return mapKeyRangesToShards(
ctx,
@ -322,7 +328,7 @@ func (res *Resolver) StreamExecuteKeyRanges(ctx context.Context, sql string, bin
tabletType,
keyRanges)
}
return res.streamExecute(ctx, sql, bindVariables, keyspace, tabletType, mapToShards, sendReply)
return res.streamExecute(ctx, sql, bindVariables, keyspace, tabletType, mapToShards, options, sendReply)
}
// streamExecute executes a streaming query on shards resolved by given func.
@ -336,6 +342,7 @@ func (res *Resolver) streamExecute(
keyspace string,
tabletType topodatapb.TabletType,
mapToShards func(string) (string, []string, error),
options *querypb.ExecuteOptions,
sendReply func(*sqltypes.Result) error,
) error {
keyspace, shards, err := mapToShards(keyspace)
@ -349,6 +356,7 @@ func (res *Resolver) streamExecute(
keyspace,
shards,
tabletType,
options,
sendReply)
return err
}

Просмотреть файл

@ -37,7 +37,8 @@ func TestResolverExecuteKeyspaceIds(t *testing.T) {
[][]byte{{0x10}, {0x25}},
topodatapb.TabletType_MASTER,
nil,
false)
false,
nil)
})
}
@ -50,7 +51,8 @@ func TestResolverExecuteKeyRanges(t *testing.T) {
[]*topodatapb.KeyRange{{Start: []byte{0x10}, End: []byte{0x25}}},
topodatapb.TabletType_MASTER,
nil,
false)
false,
nil)
})
}
@ -75,7 +77,8 @@ func TestResolverExecuteEntityIds(t *testing.T) {
},
topodatapb.TabletType_MASTER,
nil,
false)
false,
nil)
})
}
@ -95,6 +98,7 @@ func TestResolverExecuteBatchKeyspaceIds(t *testing.T) {
}},
topodatapb.TabletType_MASTER,
false,
nil,
nil)
if err != nil {
return nil, err
@ -113,6 +117,7 @@ func TestResolverStreamExecuteKeyspaceIds(t *testing.T) {
keyspace,
[][]byte{{0x10}, {0x15}},
topodatapb.TabletType_MASTER,
nil,
func(r *sqltypes.Result) error {
appendResult(qr, r)
return nil
@ -127,6 +132,7 @@ func TestResolverStreamExecuteKeyspaceIds(t *testing.T) {
keyspace,
[][]byte{{0x10}, {0x15}, {0x25}},
topodatapb.TabletType_MASTER,
nil,
func(r *sqltypes.Result) error {
appendResult(qr, r)
return nil
@ -146,6 +152,7 @@ func TestResolverStreamExecuteKeyRanges(t *testing.T) {
keyspace,
[]*topodatapb.KeyRange{{Start: []byte{0x10}, End: []byte{0x15}}},
topodatapb.TabletType_MASTER,
nil,
func(r *sqltypes.Result) error {
appendResult(qr, r)
return nil
@ -161,6 +168,7 @@ func TestResolverStreamExecuteKeyRanges(t *testing.T) {
keyspace,
[]*topodatapb.KeyRange{{Start: []byte{0x10}, End: []byte{0x25}}},
topodatapb.TabletType_MASTER,
nil,
func(r *sqltypes.Result) error {
appendResult(qr, r)
return nil
@ -462,7 +470,8 @@ func TestResolverDmlOnMultipleKeyspaceIds(t *testing.T) {
[][]byte{{0x10}, {0x25}},
topodatapb.TabletType_MASTER,
nil,
false)
false,
nil)
if err == nil {
t.Errorf("want %v, got nil", errStr)
}
@ -491,7 +500,7 @@ func TestResolverExecBatchReresolve(t *testing.T) {
return boundShardQueriesToScatterBatchRequest(queries)
}
_, err := res.ExecuteBatch(context.Background(), topodatapb.TabletType_MASTER, false, nil, buildBatchRequest)
_, err := res.ExecuteBatch(context.Background(), topodatapb.TabletType_MASTER, false, nil, nil, buildBatchRequest)
want := "shard, host: TestResolverExecBatchReresolve.0.master, alias:<cell:\"aa\" > hostname:\"0\" port_map:<key:\"vt\" value:1 > keyspace:\"TestResolverExecBatchReresolve\" shard:\"0\" type:MASTER , retry: err"
if err == nil || err.Error() != want {
t.Errorf("want %s, got %v", want, err)
@ -528,7 +537,7 @@ func TestResolverExecBatchAsTransaction(t *testing.T) {
return boundShardQueriesToScatterBatchRequest(queries)
}
_, err := res.ExecuteBatch(context.Background(), topodatapb.TabletType_MASTER, true, nil, buildBatchRequest)
_, err := res.ExecuteBatch(context.Background(), topodatapb.TabletType_MASTER, true, nil, nil, buildBatchRequest)
want := "shard, host: TestResolverExecBatchAsTransaction.0.master, alias:<cell:\"aa\" > hostname:\"0\" port_map:<key:\"vt\" value:1 > keyspace:\"TestResolverExecBatchAsTransaction\" shard:\"0\" type:MASTER , retry: err"
if err == nil || err.Error() != want {
t.Errorf("want %v, got %v", want, err)

Просмотреть файл

@ -16,6 +16,7 @@ import (
"github.com/youtube/vitess/go/vt/vtgate/vindexes"
"golang.org/x/net/context"
querypb "github.com/youtube/vitess/go/vt/proto/query"
topodatapb "github.com/youtube/vitess/go/vt/proto/topodata"
vtgatepb "github.com/youtube/vitess/go/vt/proto/vtgate"
)
@ -56,11 +57,11 @@ func NewRouter(ctx context.Context, serv topo.SrvTopoServer, cell, statsName str
}
// Execute routes a non-streaming query.
func (rtr *Router) Execute(ctx context.Context, sql string, bindVars map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (rtr *Router) Execute(ctx context.Context, sql string, bindVars map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if bindVars == nil {
bindVars = make(map[string]interface{})
}
vcursor := newRequestContext(ctx, sql, bindVars, keyspace, tabletType, session, notInTransaction, rtr)
vcursor := newRequestContext(ctx, sql, bindVars, keyspace, tabletType, session, notInTransaction, options, rtr)
plan, err := rtr.planner.GetPlan(sql, keyspace)
if err != nil {
return nil, err
@ -69,11 +70,11 @@ func (rtr *Router) Execute(ctx context.Context, sql string, bindVars map[string]
}
// StreamExecute executes a streaming query.
func (rtr *Router) StreamExecute(ctx context.Context, sql string, bindVars map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (rtr *Router) StreamExecute(ctx context.Context, sql string, bindVars map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
if bindVars == nil {
bindVars = make(map[string]interface{})
}
vcursor := newRequestContext(ctx, sql, bindVars, keyspace, tabletType, nil, false, rtr)
vcursor := newRequestContext(ctx, sql, bindVars, keyspace, tabletType, nil, false, options, rtr)
plan, err := rtr.planner.GetPlan(sql, keyspace)
if err != nil {
return err
@ -125,6 +126,7 @@ func (rtr *Router) ExecuteRoute(vcursor *requestContext, route *engine.Route, jo
vcursor.tabletType,
NewSafeSession(vcursor.session),
vcursor.notInTransaction,
vcursor.options,
)
}
@ -157,6 +159,7 @@ func (rtr *Router) GetRouteFields(vcursor *requestContext, route *engine.Route,
vcursor.tabletType,
NewSafeSession(vcursor.session),
vcursor.notInTransaction,
vcursor.options,
)
}
@ -191,6 +194,7 @@ func (rtr *Router) StreamExecuteRoute(vcursor *requestContext, route *engine.Rou
params.ks,
params.shardVars,
vcursor.tabletType,
vcursor.options,
sendReply,
)
}
@ -284,7 +288,8 @@ func (rtr *Router) execUpdateEqual(vcursor *requestContext, route *engine.Route)
[]string{shard},
vcursor.tabletType,
NewSafeSession(vcursor.session),
vcursor.notInTransaction)
vcursor.notInTransaction,
vcursor.options)
}
func (rtr *Router) execDeleteEqual(vcursor *requestContext, route *engine.Route) (*sqltypes.Result, error) {
@ -314,7 +319,8 @@ func (rtr *Router) execDeleteEqual(vcursor *requestContext, route *engine.Route)
[]string{shard},
vcursor.tabletType,
NewSafeSession(vcursor.session),
vcursor.notInTransaction)
vcursor.notInTransaction,
vcursor.options)
}
func (rtr *Router) execInsertSharded(vcursor *requestContext, route *engine.Route) (*sqltypes.Result, error) {
@ -364,7 +370,8 @@ func (rtr *Router) execInsertSharded(vcursor *requestContext, route *engine.Rout
[]string{shard},
vcursor.tabletType,
NewSafeSession(vcursor.session),
vcursor.notInTransaction)
vcursor.notInTransaction,
vcursor.options)
if err != nil {
return nil, fmt.Errorf("execInsertSharded: %v", err)
@ -489,7 +496,8 @@ func (rtr *Router) deleteVindexEntries(vcursor *requestContext, route *engine.Ro
[]string{shard},
vcursor.tabletType,
NewSafeSession(vcursor.session),
vcursor.notInTransaction)
vcursor.notInTransaction,
vcursor.options)
if err != nil {
return err
}
@ -556,6 +564,7 @@ func (rtr *Router) handleGenerate(vcursor *requestContext, gen *engine.Generate,
vcursor.tabletType,
NewSafeSession(nil),
false,
vcursor.options,
)
if err != nil {
return 0, err

Просмотреть файл

@ -185,12 +185,13 @@ func routerExec(router *Router, sql string, bv map[string]interface{}) (*sqltype
"",
topodatapb.TabletType_MASTER,
nil,
false)
false,
nil)
}
func routerStream(router *Router, sql string) (qr *sqltypes.Result, err error) {
results := make(chan *sqltypes.Result, 10)
err = router.StreamExecute(context.Background(), sql, nil, "", topodatapb.TabletType_MASTER, func(qr *sqltypes.Result) error {
err = router.StreamExecute(context.Background(), sql, nil, "", topodatapb.TabletType_MASTER, nil, func(qr *sqltypes.Result) error {
results <- qr
return nil
})

Просмотреть файл

@ -118,6 +118,7 @@ func (stc *ScatterConn) Execute(
tabletType topodatapb.TabletType,
session *SafeSession,
notInTransaction bool,
options *querypb.ExecuteOptions,
) (*sqltypes.Result, error) {
// mu protects qr
@ -136,13 +137,13 @@ func (stc *ScatterConn) Execute(
var innerqr *sqltypes.Result
if shouldBegin {
var err error
innerqr, transactionID, err = stc.gateway.BeginExecute(ctx, keyspace, shard, tabletType, query, bindVars)
innerqr, transactionID, err = stc.gateway.BeginExecute(ctx, keyspace, shard, tabletType, query, bindVars, options)
if err != nil {
return transactionID, err
}
} else {
var err error
innerqr, err = stc.gateway.Execute(ctx, keyspace, shard, tabletType, query, bindVars, transactionID)
innerqr, err = stc.gateway.Execute(ctx, keyspace, shard, tabletType, query, bindVars, transactionID, options)
if err != nil {
return transactionID, err
}
@ -172,6 +173,7 @@ func (stc *ScatterConn) ExecuteMulti(
tabletType topodatapb.TabletType,
session *SafeSession,
notInTransaction bool,
options *querypb.ExecuteOptions,
) (*sqltypes.Result, error) {
// mu protects qr
@ -190,13 +192,13 @@ func (stc *ScatterConn) ExecuteMulti(
var innerqr *sqltypes.Result
if shouldBegin {
var err error
innerqr, transactionID, err = stc.gateway.BeginExecute(ctx, keyspace, shard, tabletType, query, shardVars[shard])
innerqr, transactionID, err = stc.gateway.BeginExecute(ctx, keyspace, shard, tabletType, query, shardVars[shard], options)
if err != nil {
return transactionID, err
}
} else {
var err error
innerqr, err = stc.gateway.Execute(ctx, keyspace, shard, tabletType, query, shardVars[shard], transactionID)
innerqr, err = stc.gateway.Execute(ctx, keyspace, shard, tabletType, query, shardVars[shard], transactionID, options)
if err != nil {
return transactionID, err
}
@ -225,6 +227,7 @@ func (stc *ScatterConn) ExecuteEntityIds(
tabletType topodatapb.TabletType,
session *SafeSession,
notInTransaction bool,
options *querypb.ExecuteOptions,
) (*sqltypes.Result, error) {
// mu protects qr
@ -246,13 +249,13 @@ func (stc *ScatterConn) ExecuteEntityIds(
if shouldBegin {
var err error
innerqr, transactionID, err = stc.gateway.BeginExecute(ctx, keyspace, shard, tabletType, sql, bindVar)
innerqr, transactionID, err = stc.gateway.BeginExecute(ctx, keyspace, shard, tabletType, sql, bindVar, options)
if err != nil {
return transactionID, err
}
} else {
var err error
innerqr, err = stc.gateway.Execute(ctx, keyspace, shard, tabletType, sql, bindVar, transactionID)
innerqr, err = stc.gateway.Execute(ctx, keyspace, shard, tabletType, sql, bindVar, transactionID, options)
if err != nil {
return transactionID, err
}
@ -293,7 +296,8 @@ func (stc *ScatterConn) ExecuteBatch(
batchRequest *scatterBatchRequest,
tabletType topodatapb.TabletType,
asTransaction bool,
session *SafeSession) (qrs []sqltypes.Result, err error) {
session *SafeSession,
options *querypb.ExecuteOptions) (qrs []sqltypes.Result, err error) {
allErrors := new(concurrency.AllErrorRecorder)
results := make([]sqltypes.Result, batchRequest.Length)
@ -312,7 +316,7 @@ func (stc *ScatterConn) ExecuteBatch(
shouldBegin, transactionID := transactionInfo(req.Keyspace, req.Shard, tabletType, session, false)
var innerqrs []sqltypes.Result
if shouldBegin {
innerqrs, transactionID, err = stc.gateway.BeginExecuteBatch(ctx, req.Keyspace, req.Shard, tabletType, req.Queries, asTransaction)
innerqrs, transactionID, err = stc.gateway.BeginExecuteBatch(ctx, req.Keyspace, req.Shard, tabletType, req.Queries, asTransaction, options)
if transactionID != 0 {
session.Append(&vtgatepb.Session_ShardSession{
Target: &querypb.Target{
@ -327,7 +331,7 @@ func (stc *ScatterConn) ExecuteBatch(
return
}
} else {
innerqrs, err = stc.gateway.ExecuteBatch(ctx, req.Keyspace, req.Shard, tabletType, req.Queries, asTransaction, transactionID)
innerqrs, err = stc.gateway.ExecuteBatch(ctx, req.Keyspace, req.Shard, tabletType, req.Queries, asTransaction, transactionID, options)
if err != nil {
return
}
@ -396,6 +400,7 @@ func (stc *ScatterConn) StreamExecute(
keyspace string,
shards []string,
tabletType topodatapb.TabletType,
options *querypb.ExecuteOptions,
sendReply func(reply *sqltypes.Result) error,
) error {
@ -411,7 +416,7 @@ func (stc *ScatterConn) StreamExecute(
shards,
tabletType,
func(shard string) error {
stream, err := stc.gateway.StreamExecute(ctx, keyspace, shard, tabletType, query, bindVars)
stream, err := stc.gateway.StreamExecute(ctx, keyspace, shard, tabletType, query, bindVars, options)
return stc.processOneStreamingResult(&mu, stream, err, &replyErr, &fieldSent, sendReply)
})
if replyErr != nil {
@ -429,6 +434,7 @@ func (stc *ScatterConn) StreamExecuteMulti(
keyspace string,
shardVars map[string]map[string]interface{},
tabletType topodatapb.TabletType,
options *querypb.ExecuteOptions,
sendReply func(reply *sqltypes.Result) error,
) error {
// mu protects fieldSent, sendReply and replyErr
@ -443,7 +449,7 @@ func (stc *ScatterConn) StreamExecuteMulti(
getShards(shardVars),
tabletType,
func(shard string) error {
stream, err := stc.gateway.StreamExecute(ctx, keyspace, shard, tabletType, query, shardVars[shard])
stream, err := stc.gateway.StreamExecute(ctx, keyspace, shard, tabletType, query, shardVars[shard], options)
return stc.processOneStreamingResult(&mu, stream, err, &replyErr, &fieldSent, sendReply)
})
if replyErr != nil {

Просмотреть файл

@ -31,7 +31,7 @@ var (
func TestScatterConnExecute(t *testing.T) {
testScatterConnGeneric(t, "TestScatterConnExecute", func(sc *ScatterConn, shards []string) (*sqltypes.Result, error) {
return sc.Execute(context.Background(), "query", nil, "TestScatterConnExecute", shards, topodatapb.TabletType_REPLICA, nil, false)
return sc.Execute(context.Background(), "query", nil, "TestScatterConnExecute", shards, topodatapb.TabletType_REPLICA, nil, false, nil)
})
}
@ -41,7 +41,7 @@ func TestScatterConnExecuteMulti(t *testing.T) {
for _, shard := range shards {
shardVars[shard] = nil
}
return sc.ExecuteMulti(context.Background(), "query", "TestScatterConnExecuteMulti", shardVars, topodatapb.TabletType_REPLICA, nil, false)
return sc.ExecuteMulti(context.Background(), "query", "TestScatterConnExecuteMulti", shardVars, topodatapb.TabletType_REPLICA, nil, false, nil)
})
}
@ -59,7 +59,7 @@ func TestScatterConnExecuteBatch(t *testing.T) {
if err != nil {
return nil, err
}
qrs, err := sc.ExecuteBatch(context.Background(), scatterRequest, topodatapb.TabletType_REPLICA, false, nil)
qrs, err := sc.ExecuteBatch(context.Background(), scatterRequest, topodatapb.TabletType_REPLICA, false, nil, nil)
if err != nil {
return nil, err
}
@ -70,7 +70,7 @@ func TestScatterConnExecuteBatch(t *testing.T) {
func TestScatterConnStreamExecute(t *testing.T) {
testScatterConnGeneric(t, "TestScatterConnStreamExecute", func(sc *ScatterConn, shards []string) (*sqltypes.Result, error) {
qr := new(sqltypes.Result)
err := sc.StreamExecute(context.Background(), "query", nil, "TestScatterConnStreamExecute", shards, topodatapb.TabletType_REPLICA, func(r *sqltypes.Result) error {
err := sc.StreamExecute(context.Background(), "query", nil, "TestScatterConnStreamExecute", shards, topodatapb.TabletType_REPLICA, nil, func(r *sqltypes.Result) error {
appendResult(qr, r)
return nil
})
@ -85,7 +85,7 @@ func TestScatterConnStreamExecuteMulti(t *testing.T) {
for _, shard := range shards {
shardVars[shard] = nil
}
err := sc.StreamExecuteMulti(context.Background(), "query", "TestScatterConnStreamExecuteMulti", shardVars, topodatapb.TabletType_REPLICA, func(r *sqltypes.Result) error {
err := sc.StreamExecuteMulti(context.Background(), "query", "TestScatterConnStreamExecuteMulti", shardVars, topodatapb.TabletType_REPLICA, nil, func(r *sqltypes.Result) error {
appendResult(qr, r)
return nil
})
@ -236,7 +236,7 @@ func TestMultiExecs(t *testing.T) {
"bv1": 1,
},
}
_, _ = sc.ExecuteMulti(context.Background(), "query", "TestMultiExecs", shardVars, topodatapb.TabletType_REPLICA, nil, false)
_, _ = sc.ExecuteMulti(context.Background(), "query", "TestMultiExecs", shardVars, topodatapb.TabletType_REPLICA, nil, false, nil)
if len(sbc0.Queries) == 0 || len(sbc1.Queries) == 0 {
t.Fatalf("didn't get expected query")
}
@ -248,7 +248,7 @@ func TestMultiExecs(t *testing.T) {
}
sbc0.Queries = nil
sbc1.Queries = nil
_ = sc.StreamExecuteMulti(context.Background(), "query", "TestMultiExecs", shardVars, topodatapb.TabletType_REPLICA, func(*sqltypes.Result) error {
_ = sc.StreamExecuteMulti(context.Background(), "query", "TestMultiExecs", shardVars, topodatapb.TabletType_REPLICA, nil, func(*sqltypes.Result) error {
return nil
})
if !reflect.DeepEqual(sbc0.Queries[0].BindVariables, shardVars["0"]) {
@ -264,7 +264,7 @@ func TestScatterConnStreamExecuteSendError(t *testing.T) {
hc := discovery.NewFakeHealthCheck()
sc := NewScatterConn(hc, topo.Server{}, new(sandboxTopo), "", "aa", retryCount, nil)
hc.AddTestTablet("aa", "0", 1, "TestScatterConnStreamExecuteSendError", "0", topodatapb.TabletType_REPLICA, true, 1, nil)
err := sc.StreamExecute(context.Background(), "query", nil, "TestScatterConnStreamExecuteSendError", []string{"0"}, topodatapb.TabletType_REPLICA, func(*sqltypes.Result) error {
err := sc.StreamExecute(context.Background(), "query", nil, "TestScatterConnStreamExecuteSendError", []string{"0"}, topodatapb.TabletType_REPLICA, nil, func(*sqltypes.Result) error {
return fmt.Errorf("send error")
})
want := "send error"
@ -304,7 +304,7 @@ func TestScatterConnCommitSuccess(t *testing.T) {
// Sequence the executes to ensure commit order
session := NewSafeSession(&vtgatepb.Session{InTransaction: true})
sc.Execute(context.Background(), "query1", nil, "TestScatterConnCommitSuccess", []string{"0"}, topodatapb.TabletType_REPLICA, session, false)
sc.Execute(context.Background(), "query1", nil, "TestScatterConnCommitSuccess", []string{"0"}, topodatapb.TabletType_REPLICA, session, false, nil)
wantSession := vtgatepb.Session{
InTransaction: true,
ShardSessions: []*vtgatepb.Session_ShardSession{{
@ -319,7 +319,7 @@ func TestScatterConnCommitSuccess(t *testing.T) {
if !reflect.DeepEqual(wantSession, *session.Session) {
t.Errorf("want\n%+v, got\n%+v", wantSession, *session.Session)
}
sc.Execute(context.Background(), "query1", nil, "TestScatterConnCommitSuccess", []string{"0", "1"}, topodatapb.TabletType_REPLICA, session, false)
sc.Execute(context.Background(), "query1", nil, "TestScatterConnCommitSuccess", []string{"0", "1"}, topodatapb.TabletType_REPLICA, session, false, nil)
wantSession = vtgatepb.Session{
InTransaction: true,
ShardSessions: []*vtgatepb.Session_ShardSession{{
@ -367,8 +367,8 @@ func TestScatterConnRollback(t *testing.T) {
// Sequence the executes to ensure commit order
session := NewSafeSession(&vtgatepb.Session{InTransaction: true})
sc.Execute(context.Background(), "query1", nil, "TestScatterConnRollback", []string{"0"}, topodatapb.TabletType_REPLICA, session, false)
sc.Execute(context.Background(), "query1", nil, "TestScatterConnRollback", []string{"0", "1"}, topodatapb.TabletType_REPLICA, session, false)
sc.Execute(context.Background(), "query1", nil, "TestScatterConnRollback", []string{"0"}, topodatapb.TabletType_REPLICA, session, false, nil)
sc.Execute(context.Background(), "query1", nil, "TestScatterConnRollback", []string{"0", "1"}, topodatapb.TabletType_REPLICA, session, false, nil)
err := sc.Rollback(context.Background(), session)
if err != nil {
t.Errorf("want nil, got %v", err)
@ -413,8 +413,8 @@ func TestScatterConnQueryNotInTransaction(t *testing.T) {
sbc0 := hc.AddTestTablet("aa", "0", 1, "TestScatterConnQueryNotInTransaction", "0", topodatapb.TabletType_REPLICA, true, 1, nil)
sbc1 := hc.AddTestTablet("aa", "1", 1, "TestScatterConnQueryNotInTransaction", "1", topodatapb.TabletType_REPLICA, true, 1, nil)
session := NewSafeSession(&vtgatepb.Session{InTransaction: true})
sc.Execute(context.Background(), "query1", nil, "TestScatterConnQueryNotInTransaction", []string{"0"}, topodatapb.TabletType_REPLICA, session, true)
sc.Execute(context.Background(), "query1", nil, "TestScatterConnQueryNotInTransaction", []string{"1"}, topodatapb.TabletType_REPLICA, session, false)
sc.Execute(context.Background(), "query1", nil, "TestScatterConnQueryNotInTransaction", []string{"0"}, topodatapb.TabletType_REPLICA, session, true, nil)
sc.Execute(context.Background(), "query1", nil, "TestScatterConnQueryNotInTransaction", []string{"1"}, topodatapb.TabletType_REPLICA, session, false, nil)
wantSession := vtgatepb.Session{
InTransaction: true,
@ -452,8 +452,8 @@ func TestScatterConnQueryNotInTransaction(t *testing.T) {
sbc0 = hc.AddTestTablet("aa", "0", 1, "TestScatterConnQueryNotInTransaction", "0", topodatapb.TabletType_REPLICA, true, 1, nil)
sbc1 = hc.AddTestTablet("aa", "1", 1, "TestScatterConnQueryNotInTransaction", "1", topodatapb.TabletType_REPLICA, true, 1, nil)
session = NewSafeSession(&vtgatepb.Session{InTransaction: true})
sc.Execute(context.Background(), "query1", nil, "TestScatterConnQueryNotInTransaction", []string{"0"}, topodatapb.TabletType_REPLICA, session, false)
sc.Execute(context.Background(), "query1", nil, "TestScatterConnQueryNotInTransaction", []string{"1"}, topodatapb.TabletType_REPLICA, session, true)
sc.Execute(context.Background(), "query1", nil, "TestScatterConnQueryNotInTransaction", []string{"0"}, topodatapb.TabletType_REPLICA, session, false, nil)
sc.Execute(context.Background(), "query1", nil, "TestScatterConnQueryNotInTransaction", []string{"1"}, topodatapb.TabletType_REPLICA, session, true, nil)
wantSession = vtgatepb.Session{
InTransaction: true,
@ -491,8 +491,8 @@ func TestScatterConnQueryNotInTransaction(t *testing.T) {
sbc0 = hc.AddTestTablet("aa", "0", 1, "TestScatterConnQueryNotInTransaction", "0", topodatapb.TabletType_REPLICA, true, 1, nil)
sbc1 = hc.AddTestTablet("aa", "1", 1, "TestScatterConnQueryNotInTransaction", "1", topodatapb.TabletType_REPLICA, true, 1, nil)
session = NewSafeSession(&vtgatepb.Session{InTransaction: true})
sc.Execute(context.Background(), "query1", nil, "TestScatterConnQueryNotInTransaction", []string{"0"}, topodatapb.TabletType_REPLICA, session, false)
sc.Execute(context.Background(), "query1", nil, "TestScatterConnQueryNotInTransaction", []string{"0", "1"}, topodatapb.TabletType_REPLICA, session, true)
sc.Execute(context.Background(), "query1", nil, "TestScatterConnQueryNotInTransaction", []string{"0"}, topodatapb.TabletType_REPLICA, session, false, nil)
sc.Execute(context.Background(), "query1", nil, "TestScatterConnQueryNotInTransaction", []string{"0", "1"}, topodatapb.TabletType_REPLICA, session, true, nil)
wantSession = vtgatepb.Session{
InTransaction: true,

Просмотреть файл

@ -159,13 +159,13 @@ func (vtg *VTGate) IsHealthy() error {
}
// Execute executes a non-streaming query by routing based on the values in the query.
func (vtg *VTGate) Execute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (vtg *VTGate) Execute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
startTime := time.Now()
ltt := topoproto.TabletTypeLString(tabletType)
statsKey := []string{"Execute", "Any", ltt}
defer vtg.timings.Record(statsKey, startTime)
qr, err := vtg.router.Execute(ctx, sql, bindVariables, keyspace, tabletType, session, notInTransaction)
qr, err := vtg.router.Execute(ctx, sql, bindVariables, keyspace, tabletType, session, notInTransaction, options)
if err == nil {
vtg.rowsReturned.Add(statsKey, int64(len(qr.Rows)))
return qr, nil
@ -178,13 +178,14 @@ func (vtg *VTGate) Execute(ctx context.Context, sql string, bindVariables map[st
"TabletType": ltt,
"Session": session,
"NotInTransaction": notInTransaction,
"Options": options,
}
handleExecuteError(err, statsKey, query, vtg.logExecute)
return nil, err
}
// ExecuteShards executes a non-streaming query on the specified shards.
func (vtg *VTGate) ExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (vtg *VTGate) ExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
startTime := time.Now()
ltt := topoproto.TabletTypeLString(tabletType)
statsKey := []string{"ExecuteShards", keyspace, ltt}
@ -203,6 +204,7 @@ func (vtg *VTGate) ExecuteShards(ctx context.Context, sql string, bindVariables
return keyspace, shards, nil
},
notInTransaction,
options,
)
if err == nil {
vtg.rowsReturned.Add(statsKey, int64(len(qr.Rows)))
@ -217,13 +219,14 @@ func (vtg *VTGate) ExecuteShards(ctx context.Context, sql string, bindVariables
"TabletType": ltt,
"Session": session,
"NotInTransaction": notInTransaction,
"Options": options,
}
handleExecuteError(err, statsKey, query, vtg.logExecuteShards)
return nil, err
}
// ExecuteKeyspaceIds executes a non-streaming query based on the specified keyspace ids.
func (vtg *VTGate) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (vtg *VTGate) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
startTime := time.Now()
ltt := topoproto.TabletTypeLString(tabletType)
statsKey := []string{"ExecuteKeyspaceIds", keyspace, ltt}
@ -231,7 +234,7 @@ func (vtg *VTGate) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVaria
sql = sqlannotation.AnnotateIfDML(sql, keyspaceIds)
qr, err := vtg.resolver.ExecuteKeyspaceIds(ctx, sql, bindVariables, keyspace, keyspaceIds, tabletType, session, notInTransaction)
qr, err := vtg.resolver.ExecuteKeyspaceIds(ctx, sql, bindVariables, keyspace, keyspaceIds, tabletType, session, notInTransaction, options)
if err == nil {
vtg.rowsReturned.Add(statsKey, int64(len(qr.Rows)))
return qr, nil
@ -245,13 +248,14 @@ func (vtg *VTGate) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVaria
"TabletType": ltt,
"Session": session,
"NotInTransaction": notInTransaction,
"Options": options,
}
handleExecuteError(err, statsKey, query, vtg.logExecuteKeyspaceIds)
return nil, err
}
// ExecuteKeyRanges executes a non-streaming query based on the specified keyranges.
func (vtg *VTGate) ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (vtg *VTGate) ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
startTime := time.Now()
ltt := topoproto.TabletTypeLString(tabletType)
statsKey := []string{"ExecuteKeyRanges", keyspace, ltt}
@ -259,7 +263,7 @@ func (vtg *VTGate) ExecuteKeyRanges(ctx context.Context, sql string, bindVariabl
sql = sqlannotation.AnnotateIfDML(sql, nil)
qr, err := vtg.resolver.ExecuteKeyRanges(ctx, sql, bindVariables, keyspace, keyRanges, tabletType, session, notInTransaction)
qr, err := vtg.resolver.ExecuteKeyRanges(ctx, sql, bindVariables, keyspace, keyRanges, tabletType, session, notInTransaction, options)
if err == nil {
vtg.rowsReturned.Add(statsKey, int64(len(qr.Rows)))
return qr, nil
@ -273,13 +277,14 @@ func (vtg *VTGate) ExecuteKeyRanges(ctx context.Context, sql string, bindVariabl
"TabletType": ltt,
"Session": session,
"NotInTransaction": notInTransaction,
"Options": options,
}
handleExecuteError(err, statsKey, query, vtg.logExecuteKeyRanges)
return nil, err
}
// ExecuteEntityIds excutes a non-streaming query based on given KeyspaceId map.
func (vtg *VTGate) ExecuteEntityIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (vtg *VTGate) ExecuteEntityIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
startTime := time.Now()
ltt := topoproto.TabletTypeLString(tabletType)
statsKey := []string{"ExecuteEntityIds", keyspace, ltt}
@ -287,7 +292,7 @@ func (vtg *VTGate) ExecuteEntityIds(ctx context.Context, sql string, bindVariabl
sql = sqlannotation.AnnotateIfDML(sql, nil)
qr, err := vtg.resolver.ExecuteEntityIds(ctx, sql, bindVariables, keyspace, entityColumnName, entityKeyspaceIDs, tabletType, session, notInTransaction)
qr, err := vtg.resolver.ExecuteEntityIds(ctx, sql, bindVariables, keyspace, entityColumnName, entityKeyspaceIDs, tabletType, session, notInTransaction, options)
if err == nil {
vtg.rowsReturned.Add(statsKey, int64(len(qr.Rows)))
return qr, nil
@ -302,13 +307,14 @@ func (vtg *VTGate) ExecuteEntityIds(ctx context.Context, sql string, bindVariabl
"TabletType": ltt,
"Session": session,
"NotInTransaction": notInTransaction,
"Options": options,
}
handleExecuteError(err, statsKey, query, vtg.logExecuteEntityIds)
return nil, err
}
// ExecuteBatchShards executes a group of queries on the specified shards.
func (vtg *VTGate) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session) ([]sqltypes.Result, error) {
func (vtg *VTGate) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
startTime := time.Now()
ltt := topoproto.TabletTypeLString(tabletType)
statsKey := []string{"ExecuteBatchShards", "", ltt}
@ -321,6 +327,7 @@ func (vtg *VTGate) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.B
tabletType,
asTransaction,
session,
options,
func() (*scatterBatchRequest, error) {
return boundShardQueriesToScatterBatchRequest(queries)
})
@ -338,13 +345,14 @@ func (vtg *VTGate) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.B
"TabletType": ltt,
"AsTransaction": asTransaction,
"Session": session,
"Options": options,
}
handleExecuteError(err, statsKey, query, vtg.logExecuteBatchShards)
return nil, err
}
// ExecuteBatchKeyspaceIds executes a group of queries based on the specified keyspace ids.
func (vtg *VTGate) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session) ([]sqltypes.Result, error) {
func (vtg *VTGate) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
startTime := time.Now()
ltt := topoproto.TabletTypeLString(tabletType)
statsKey := []string{"ExecuteBatchKeyspaceIds", "", ltt}
@ -357,7 +365,8 @@ func (vtg *VTGate) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgat
queries,
tabletType,
asTransaction,
session)
session,
options)
if err == nil {
var rowCount int64
for _, qr := range qrs {
@ -372,13 +381,14 @@ func (vtg *VTGate) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgat
"TabletType": ltt,
"AsTransaction": asTransaction,
"Session": session,
"Options": options,
}
handleExecuteError(err, statsKey, query, vtg.logExecuteBatchKeyspaceIds)
return nil, err
}
// StreamExecute executes a streaming query by routing based on the values in the query.
func (vtg *VTGate) StreamExecute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (vtg *VTGate) StreamExecute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
startTime := time.Now()
ltt := topoproto.TabletTypeLString(tabletType)
statsKey := []string{"StreamExecute", "Any", ltt}
@ -390,6 +400,7 @@ func (vtg *VTGate) StreamExecute(ctx context.Context, sql string, bindVariables
bindVariables,
keyspace,
tabletType,
options,
func(reply *sqltypes.Result) error {
vtg.rowsReturned.Add(statsKey, int64(len(reply.Rows)))
return sendReply(reply)
@ -402,6 +413,7 @@ func (vtg *VTGate) StreamExecute(ctx context.Context, sql string, bindVariables
"BindVariables": bindVariables,
"Keyspace": keyspace,
"TabletType": ltt,
"Options": options,
}
logError(err, query, vtg.logStreamExecute)
}
@ -414,7 +426,7 @@ func (vtg *VTGate) StreamExecute(ctx context.Context, sql string, bindVariables
// one shard since it cannot merge-sort the results to guarantee ordering of
// response which is needed for checkpointing.
// The api supports supplying multiple KeyspaceIds to make it future proof.
func (vtg *VTGate) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (vtg *VTGate) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
startTime := time.Now()
ltt := topoproto.TabletTypeLString(tabletType)
statsKey := []string{"StreamExecuteKeyspaceIds", keyspace, ltt}
@ -427,6 +439,7 @@ func (vtg *VTGate) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bin
keyspace,
keyspaceIds,
tabletType,
options,
func(reply *sqltypes.Result) error {
vtg.rowsReturned.Add(statsKey, int64(len(reply.Rows)))
return sendReply(reply)
@ -440,6 +453,7 @@ func (vtg *VTGate) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bin
"Keyspace": keyspace,
"KeyspaceIds": keyspaceIds,
"TabletType": ltt,
"Options": options,
}
logError(err, query, vtg.logStreamExecuteKeyspaceIds)
}
@ -452,7 +466,7 @@ func (vtg *VTGate) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bin
// one shard since it cannot merge-sort the results to guarantee ordering of
// response which is needed for checkpointing.
// The api supports supplying multiple keyranges to make it future proof.
func (vtg *VTGate) StreamExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (vtg *VTGate) StreamExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
startTime := time.Now()
ltt := topoproto.TabletTypeLString(tabletType)
statsKey := []string{"StreamExecuteKeyRanges", keyspace, ltt}
@ -465,6 +479,7 @@ func (vtg *VTGate) StreamExecuteKeyRanges(ctx context.Context, sql string, bindV
keyspace,
keyRanges,
tabletType,
options,
func(reply *sqltypes.Result) error {
vtg.rowsReturned.Add(statsKey, int64(len(reply.Rows)))
return sendReply(reply)
@ -478,6 +493,7 @@ func (vtg *VTGate) StreamExecuteKeyRanges(ctx context.Context, sql string, bindV
"Keyspace": keyspace,
"KeyRanges": keyRanges,
"TabletType": ltt,
"Options": options,
}
logError(err, query, vtg.logStreamExecuteKeyRanges)
}
@ -485,7 +501,7 @@ func (vtg *VTGate) StreamExecuteKeyRanges(ctx context.Context, sql string, bindV
}
// StreamExecuteShards executes a streaming query on the specified shards.
func (vtg *VTGate) StreamExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (vtg *VTGate) StreamExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
startTime := time.Now()
ltt := topoproto.TabletTypeLString(tabletType)
statsKey := []string{"StreamExecuteShards", keyspace, ltt}
@ -500,6 +516,7 @@ func (vtg *VTGate) StreamExecuteShards(ctx context.Context, sql string, bindVari
func(keyspace string) (string, []string, error) {
return keyspace, shards, nil
},
options,
func(reply *sqltypes.Result) error {
vtg.rowsReturned.Add(statsKey, int64(len(reply.Rows)))
return sendReply(reply)
@ -513,6 +530,7 @@ func (vtg *VTGate) StreamExecuteShards(ctx context.Context, sql string, bindVari
"Keyspace": keyspace,
"Shards": shards,
"TabletType": ltt,
"Options": options,
}
logError(err, query, vtg.logStreamExecuteShards)
}

Просмотреть файл

@ -13,6 +13,7 @@ import (
"strings"
"testing"
"github.com/golang/protobuf/proto"
"github.com/youtube/vitess/go/sqltypes"
"github.com/youtube/vitess/go/vt/discovery"
"github.com/youtube/vitess/go/vt/key"
@ -33,6 +34,10 @@ import (
var hcVTGateTest *discovery.FakeHealthCheck
var executeOptions = &querypb.ExecuteOptions{
ExcludeFieldNames: true,
}
func init() {
getSandbox(KsTestUnsharded).VSchema = `
{
@ -56,13 +61,17 @@ func TestVTGateExecute(t *testing.T) {
"",
topodatapb.TabletType_MASTER,
nil,
false)
false,
executeOptions)
if err != nil {
t.Errorf("want nil, got %v", err)
}
if !reflect.DeepEqual(sandboxconn.SingleRowResult, qr) {
t.Errorf("want \n%+v, got \n%+v", sandboxconn.SingleRowResult, qr)
}
if !proto.Equal(sbc.Options[0], executeOptions) {
t.Errorf("got ExecuteOptions \n%+v, want \n%+v", sbc.Options[0], executeOptions)
}
session, err := rpcVTGate.Begin(context.Background())
if !session.InTransaction {
@ -74,7 +83,8 @@ func TestVTGateExecute(t *testing.T) {
"",
topodatapb.TabletType_MASTER,
session,
false)
false,
nil)
wantSession := &vtgatepb.Session{
InTransaction: true,
ShardSessions: []*vtgatepb.Session_ShardSession{{
@ -102,7 +112,8 @@ func TestVTGateExecute(t *testing.T) {
"",
topodatapb.TabletType_MASTER,
session,
false)
false,
nil)
rpcVTGate.Rollback(context.Background(), session)
}
@ -116,7 +127,8 @@ func TestVTGateExecuteWithKeyspace(t *testing.T) {
KsTestUnsharded,
topodatapb.TabletType_MASTER,
nil,
false)
false,
nil)
if err != nil {
t.Errorf("want nil, got %v", err)
}
@ -129,7 +141,8 @@ func TestVTGateExecuteWithKeyspace(t *testing.T) {
"aa",
topodatapb.TabletType_MASTER,
nil,
false)
false,
nil)
want := "keyspace aa not found in vschema"
if err == nil || err.Error() != want {
t.Errorf("Execute: %v, want %s", err, want)
@ -149,13 +162,17 @@ func TestVTGateExecuteShards(t *testing.T) {
[]string{shard},
topodatapb.TabletType_REPLICA,
nil,
false)
false,
executeOptions)
if err != nil {
t.Errorf("want nil, got %v", err)
}
if !reflect.DeepEqual(sandboxconn.SingleRowResult, qr) {
t.Errorf("want \n%+v, got \n%+v", sandboxconn.SingleRowResult, qr)
}
if !proto.Equal(sbc.Options[0], executeOptions) {
t.Errorf("got ExecuteOptions \n%+v, want \n%+v", sbc.Options[0], executeOptions)
}
session, err := rpcVTGate.Begin(context.Background())
if !session.InTransaction {
@ -168,7 +185,8 @@ func TestVTGateExecuteShards(t *testing.T) {
[]string{shard},
topodatapb.TabletType_REPLICA,
session,
false)
false,
nil)
wantSession := &vtgatepb.Session{
InTransaction: true,
ShardSessions: []*vtgatepb.Session_ShardSession{{
@ -197,7 +215,8 @@ func TestVTGateExecuteShards(t *testing.T) {
[]string{shard},
topodatapb.TabletType_REPLICA,
session,
false)
false,
nil)
rpcVTGate.Rollback(context.Background(), session)
/*
// Flaky: This test should be run manually.
@ -224,7 +243,8 @@ func TestVTGateExecuteKeyspaceIds(t *testing.T) {
[][]byte{{0x10}},
topodatapb.TabletType_MASTER,
nil,
false)
false,
executeOptions)
if err != nil {
t.Errorf("want nil, got %v", err)
}
@ -234,6 +254,9 @@ func TestVTGateExecuteKeyspaceIds(t *testing.T) {
if execCount := sbc1.ExecCount.Get(); execCount != 1 {
t.Errorf("want 1, got %v\n", execCount)
}
if !proto.Equal(sbc1.Options[0], executeOptions) {
t.Errorf("got ExecuteOptions \n%+v, want \n%+v", sbc1.Options[0], executeOptions)
}
// Test for successful execution in transaction
session, err := rpcVTGate.Begin(context.Background())
if !session.InTransaction {
@ -246,7 +269,8 @@ func TestVTGateExecuteKeyspaceIds(t *testing.T) {
[][]byte{{0x10}},
topodatapb.TabletType_MASTER,
session,
false)
false,
nil)
wantSession := &vtgatepb.Session{
InTransaction: true,
ShardSessions: []*vtgatepb.Session_ShardSession{{
@ -273,7 +297,8 @@ func TestVTGateExecuteKeyspaceIds(t *testing.T) {
[][]byte{{0x10}, {0x30}},
topodatapb.TabletType_MASTER,
session,
false)
false,
nil)
if err != nil {
t.Fatalf("ExecuteKeyspaceIds failed: %v", err)
}
@ -298,7 +323,8 @@ func TestVTGateExecuteKeyRanges(t *testing.T) {
[]*topodatapb.KeyRange{{End: []byte{0x20}}},
topodatapb.TabletType_MASTER,
nil,
false)
false,
executeOptions)
if err != nil {
t.Errorf("want nil, got %v", err)
}
@ -308,6 +334,9 @@ func TestVTGateExecuteKeyRanges(t *testing.T) {
if execCount := sbc1.ExecCount.Get(); execCount != 1 {
t.Errorf("want 1, got %v\n", execCount)
}
if !proto.Equal(sbc1.Options[0], executeOptions) {
t.Errorf("got ExecuteOptions \n%+v, want \n%+v", sbc1.Options[0], executeOptions)
}
// Test for successful execution in transaction
session, err := rpcVTGate.Begin(context.Background())
if !session.InTransaction {
@ -320,7 +349,8 @@ func TestVTGateExecuteKeyRanges(t *testing.T) {
[]*topodatapb.KeyRange{{End: []byte{0x20}}},
topodatapb.TabletType_MASTER,
session,
false)
false,
nil)
if err != nil {
t.Errorf("want nil, got %v", err)
}
@ -349,7 +379,8 @@ func TestVTGateExecuteKeyRanges(t *testing.T) {
[]*topodatapb.KeyRange{{Start: []byte{0x10}, End: []byte{0x30}}},
topodatapb.TabletType_MASTER,
nil,
false)
false,
nil)
if err != nil {
t.Fatalf("ExecuteKeyRanges failed: %v", err)
}
@ -381,7 +412,8 @@ func TestVTGateExecuteEntityIds(t *testing.T) {
},
topodatapb.TabletType_MASTER,
nil,
false)
false,
executeOptions)
if err != nil {
t.Errorf("want nil, got %v", err)
}
@ -391,6 +423,9 @@ func TestVTGateExecuteEntityIds(t *testing.T) {
if execCount := sbc1.ExecCount.Get(); execCount != 1 {
t.Errorf("want 1, got %v\n", execCount)
}
if !proto.Equal(sbc1.Options[0], executeOptions) {
t.Errorf("got ExecuteOptions \n%+v, want \n%+v", sbc1.Options[0], executeOptions)
}
// Test for successful execution in transaction
session, err := rpcVTGate.Begin(context.Background())
if !session.InTransaction {
@ -410,7 +445,8 @@ func TestVTGateExecuteEntityIds(t *testing.T) {
},
topodatapb.TabletType_MASTER,
session,
false)
false,
nil)
wantSession := &vtgatepb.Session{
InTransaction: true,
ShardSessions: []*vtgatepb.Session_ShardSession{{
@ -449,7 +485,8 @@ func TestVTGateExecuteEntityIds(t *testing.T) {
},
topodatapb.TabletType_MASTER,
nil,
false)
false,
nil)
if err != nil {
t.Fatalf("ExecuteEntityIds failed: %v", err)
}
@ -464,7 +501,7 @@ func TestVTGateExecuteBatchShards(t *testing.T) {
shard1 := "-20"
shard2 := "20-40"
hcVTGateTest.Reset()
hcVTGateTest.AddTestTablet("aa", "1.1.1.1", 1001, ks, shard1, topodatapb.TabletType_MASTER, true, 1, nil)
sbc1 := hcVTGateTest.AddTestTablet("aa", "1.1.1.1", 1001, ks, shard1, topodatapb.TabletType_MASTER, true, 1, nil)
hcVTGateTest.AddTestTablet("aa", "1.1.1.1", 1002, ks, shard2, topodatapb.TabletType_MASTER, true, 1, nil)
qrl, err := rpcVTGate.ExecuteBatchShards(context.Background(),
[]*vtgatepb.BoundShardQuery{{
@ -484,7 +521,8 @@ func TestVTGateExecuteBatchShards(t *testing.T) {
}},
topodatapb.TabletType_MASTER,
false,
nil)
nil,
executeOptions)
if err != nil {
t.Fatalf("want nil, got %v", err)
}
@ -494,6 +532,9 @@ func TestVTGateExecuteBatchShards(t *testing.T) {
if qrl[0].RowsAffected != 2 {
t.Errorf("want 2, got %v", qrl[0].RowsAffected)
}
if !proto.Equal(sbc1.Options[0], executeOptions) {
t.Errorf("got ExecuteOptions \n%+v, want \n%+v", sbc1.Options[0], executeOptions)
}
session, err := rpcVTGate.Begin(context.Background())
rpcVTGate.ExecuteBatchShards(context.Background(),
@ -514,7 +555,8 @@ func TestVTGateExecuteBatchShards(t *testing.T) {
}},
topodatapb.TabletType_MASTER,
false,
session)
session,
nil)
if len(session.ShardSessions) != 2 {
t.Errorf("want 2, got %d", len(session.ShardSessions))
}
@ -526,7 +568,7 @@ func TestVTGateExecuteBatchKeyspaceIds(t *testing.T) {
shard2 := "20-40"
createSandbox(ks)
hcVTGateTest.Reset()
hcVTGateTest.AddTestTablet("aa", "1.1.1.1", 1001, ks, shard1, topodatapb.TabletType_MASTER, true, 1, nil)
sbc1 := hcVTGateTest.AddTestTablet("aa", "1.1.1.1", 1001, ks, shard1, topodatapb.TabletType_MASTER, true, 1, nil)
hcVTGateTest.AddTestTablet("aa", "1.1.1.1", 1002, ks, shard2, topodatapb.TabletType_MASTER, true, 1, nil)
kid10 := []byte{0x10}
kid30 := []byte{0x30}
@ -548,7 +590,8 @@ func TestVTGateExecuteBatchKeyspaceIds(t *testing.T) {
}},
topodatapb.TabletType_MASTER,
false,
nil)
nil,
executeOptions)
if err != nil {
t.Fatalf("want nil, got %v", err)
}
@ -558,6 +601,9 @@ func TestVTGateExecuteBatchKeyspaceIds(t *testing.T) {
if qrl[0].RowsAffected != 2 {
t.Errorf("want 2, got %v", qrl[0].RowsAffected)
}
if !proto.Equal(sbc1.Options[0], executeOptions) {
t.Errorf("got ExecuteOptions \n%+v, want \n%+v", sbc1.Options[0], executeOptions)
}
session, err := rpcVTGate.Begin(context.Background())
rpcVTGate.ExecuteBatchKeyspaceIds(context.Background(),
@ -578,7 +624,8 @@ func TestVTGateExecuteBatchKeyspaceIds(t *testing.T) {
}},
topodatapb.TabletType_MASTER,
false,
session)
session,
nil)
if len(session.ShardSessions) != 2 {
t.Errorf("want 2, got %d", len(session.ShardSessions))
}
@ -589,13 +636,14 @@ func TestVTGateStreamExecute(t *testing.T) {
shard := "0"
createSandbox(ks)
hcVTGateTest.Reset()
hcVTGateTest.AddTestTablet("aa", "1.1.1.1", 1001, ks, shard, topodatapb.TabletType_MASTER, true, 1, nil)
sbc := hcVTGateTest.AddTestTablet("aa", "1.1.1.1", 1001, ks, shard, topodatapb.TabletType_MASTER, true, 1, nil)
var qrs []*sqltypes.Result
err := rpcVTGate.StreamExecute(context.Background(),
"select id from t1",
nil,
"",
topodatapb.TabletType_MASTER,
executeOptions,
func(r *sqltypes.Result) error {
qrs = append(qrs, r)
return nil
@ -607,6 +655,9 @@ func TestVTGateStreamExecute(t *testing.T) {
if !reflect.DeepEqual(want, qrs) {
t.Errorf("want \n%+v, got \n%+v", want, qrs)
}
if !proto.Equal(sbc.Options[0], executeOptions) {
t.Errorf("got ExecuteOptions \n%+v, want \n%+v", sbc.Options[0], executeOptions)
}
}
func TestVTGateStreamExecuteKeyspaceIds(t *testing.T) {
@ -615,7 +666,7 @@ func TestVTGateStreamExecuteKeyspaceIds(t *testing.T) {
shard2 := "20-40"
createSandbox(ks)
hcVTGateTest.Reset()
hcVTGateTest.AddTestTablet("aa", "1.1.1.1", 1001, ks, shard1, topodatapb.TabletType_MASTER, true, 1, nil)
sbc1 := hcVTGateTest.AddTestTablet("aa", "1.1.1.1", 1001, ks, shard1, topodatapb.TabletType_MASTER, true, 1, nil)
hcVTGateTest.AddTestTablet("aa", "1.1.1.1", 1002, ks, shard2, topodatapb.TabletType_MASTER, true, 1, nil)
// Test for successful execution
var qrs []*sqltypes.Result
@ -625,6 +676,7 @@ func TestVTGateStreamExecuteKeyspaceIds(t *testing.T) {
ks,
[][]byte{{0x10}},
topodatapb.TabletType_MASTER,
executeOptions,
func(r *sqltypes.Result) error {
qrs = append(qrs, r)
return nil
@ -636,6 +688,9 @@ func TestVTGateStreamExecuteKeyspaceIds(t *testing.T) {
if !reflect.DeepEqual(want, qrs) {
t.Errorf("want \n%+v, got \n%+v", want, qrs)
}
if !proto.Equal(sbc1.Options[0], executeOptions) {
t.Errorf("got ExecuteOptions \n%+v, want \n%+v", sbc1.Options[0], executeOptions)
}
// Test for successful execution - multiple keyspaceids in single shard
qrs = nil
@ -645,6 +700,7 @@ func TestVTGateStreamExecuteKeyspaceIds(t *testing.T) {
ks,
[][]byte{{0x10}, {0x15}},
topodatapb.TabletType_MASTER,
nil,
func(r *sqltypes.Result) error {
qrs = append(qrs, r)
return nil
@ -663,6 +719,7 @@ func TestVTGateStreamExecuteKeyspaceIds(t *testing.T) {
ks,
[][]byte{{0x10}, {0x30}},
topodatapb.TabletType_MASTER,
nil,
func(r *sqltypes.Result) error {
qrs = append(qrs, r)
return nil
@ -678,7 +735,7 @@ func TestVTGateStreamExecuteKeyRanges(t *testing.T) {
shard2 := "20-40"
createSandbox(ks)
hcVTGateTest.Reset()
hcVTGateTest.AddTestTablet("aa", "1.1.1.1", 1001, ks, shard1, topodatapb.TabletType_MASTER, true, 1, nil)
sbc1 := hcVTGateTest.AddTestTablet("aa", "1.1.1.1", 1001, ks, shard1, topodatapb.TabletType_MASTER, true, 1, nil)
hcVTGateTest.AddTestTablet("aa", "1.1.1.1", 1002, ks, shard2, topodatapb.TabletType_MASTER, true, 1, nil)
// Test for successful execution
var qrs []*sqltypes.Result
@ -688,6 +745,7 @@ func TestVTGateStreamExecuteKeyRanges(t *testing.T) {
ks,
[]*topodatapb.KeyRange{{End: []byte{0x20}}},
topodatapb.TabletType_MASTER,
executeOptions,
func(r *sqltypes.Result) error {
qrs = append(qrs, r)
return nil
@ -699,6 +757,9 @@ func TestVTGateStreamExecuteKeyRanges(t *testing.T) {
if !reflect.DeepEqual(want, qrs) {
t.Errorf("want \n%+v, got \n%+v", want, qrs)
}
if !proto.Equal(sbc1.Options[0], executeOptions) {
t.Errorf("got ExecuteOptions \n%+v, want \n%+v", sbc1.Options[0], executeOptions)
}
// Test for successful execution - multiple shards
err = rpcVTGate.StreamExecuteKeyRanges(context.Background(),
@ -707,6 +768,7 @@ func TestVTGateStreamExecuteKeyRanges(t *testing.T) {
ks,
[]*topodatapb.KeyRange{{Start: []byte{0x10}, End: []byte{0x40}}},
topodatapb.TabletType_MASTER,
nil,
func(r *sqltypes.Result) error {
qrs = append(qrs, r)
return nil
@ -721,7 +783,7 @@ func TestVTGateStreamExecuteShards(t *testing.T) {
shard := "0"
createSandbox(ks)
hcVTGateTest.Reset()
hcVTGateTest.AddTestTablet("aa", "1.1.1.1", 1001, ks, shard, topodatapb.TabletType_MASTER, true, 1, nil)
sbc := hcVTGateTest.AddTestTablet("aa", "1.1.1.1", 1001, ks, shard, topodatapb.TabletType_MASTER, true, 1, nil)
// Test for successful execution
var qrs []*sqltypes.Result
err := rpcVTGate.StreamExecuteShards(context.Background(),
@ -730,6 +792,7 @@ func TestVTGateStreamExecuteShards(t *testing.T) {
ks,
[]string{shard},
topodatapb.TabletType_MASTER,
executeOptions,
func(r *sqltypes.Result) error {
qrs = append(qrs, r)
return nil
@ -741,6 +804,9 @@ func TestVTGateStreamExecuteShards(t *testing.T) {
if !reflect.DeepEqual(want, qrs) {
t.Errorf("want \n%+v, got \n%+v", want, qrs)
}
if !proto.Equal(sbc.Options[0], executeOptions) {
t.Errorf("got ExecuteOptions \n%+v, want \n%+v", sbc.Options[0], executeOptions)
}
}
func TestVTGateSplitQuery(t *testing.T) {
@ -1014,7 +1080,8 @@ func TestAnnotatingExecuteKeyspaceIds(t *testing.T) {
[][]byte{{0x10}},
topodatapb.TabletType_MASTER,
nil,
false)
false,
nil)
if err != nil {
t.Fatalf("want nil, got %v", err)
}
@ -1033,7 +1100,8 @@ func TestAnnotatingExecuteKeyspaceIdsMultipleIds(t *testing.T) {
[][]byte{{0x10}, {0x15}},
topodatapb.TabletType_MASTER,
nil,
false)
false,
nil)
if err == nil || !strings.Contains(err.Error(), "DML should not span multiple keyspace_ids") {
t.Fatalf("want specific error, got %v", err)
}
@ -1054,7 +1122,8 @@ func TestAnnotatingExecuteKeyRanges(t *testing.T) {
[]*topodatapb.KeyRange{{Start: []byte{0x10}, End: []byte{0x40}}},
topodatapb.TabletType_MASTER,
nil,
false)
false,
nil)
if err != nil {
t.Fatalf("want nil, got %v", err)
}
@ -1087,7 +1156,8 @@ func TestAnnotatingExecuteEntityIds(t *testing.T) {
},
topodatapb.TabletType_MASTER,
nil,
false)
false,
nil)
if err != nil {
t.Fatalf("want nil, got %v", err)
}
@ -1106,7 +1176,8 @@ func TestAnnotatingExecuteShards(t *testing.T) {
[]string{"20-40"},
topodatapb.TabletType_MASTER,
nil,
false)
false,
nil)
if err != nil {
t.Fatalf("want nil, got %v", err)
}
@ -1143,6 +1214,7 @@ func TestAnnotatingExecuteBatchKeyspaceIds(t *testing.T) {
},
topodatapb.TabletType_MASTER,
false,
nil,
nil)
if err != nil {
t.Fatalf("want nil, got %v", err)
@ -1176,6 +1248,7 @@ func TestAnnotatingExecuteBatchKeyspaceIdsMultipleIds(t *testing.T) {
},
topodatapb.TabletType_MASTER,
false,
nil,
nil)
if err != nil {
t.Fatalf("want nil, got %v", err)
@ -1224,6 +1297,7 @@ func TestAnnotatingExecuteBatchShards(t *testing.T) {
},
topodatapb.TabletType_MASTER,
false,
nil,
nil)
if err != nil {
t.Fatalf("want nil, got %v", err)

Просмотреть файл

@ -35,80 +35,80 @@ type VTGateConn struct {
// Execute executes a non-streaming query on vtgate.
// This is using v3 API.
func (conn *VTGateConn) Execute(ctx context.Context, query string, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (*sqltypes.Result, error) {
res, _, err := conn.impl.Execute(ctx, query, bindVars, conn.keyspace, tabletType, nil)
func (conn *VTGateConn) Execute(ctx context.Context, query string, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
res, _, err := conn.impl.Execute(ctx, query, bindVars, conn.keyspace, tabletType, nil, options)
return res, err
}
// ExecuteShards executes a non-streaming query for multiple shards on vtgate.
func (conn *VTGateConn) ExecuteShards(ctx context.Context, query string, keyspace string, shards []string, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (*sqltypes.Result, error) {
res, _, err := conn.impl.ExecuteShards(ctx, query, keyspace, shards, bindVars, tabletType, nil)
func (conn *VTGateConn) ExecuteShards(ctx context.Context, query string, keyspace string, shards []string, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
res, _, err := conn.impl.ExecuteShards(ctx, query, keyspace, shards, bindVars, tabletType, nil, options)
return res, err
}
// ExecuteKeyspaceIds executes a non-streaming query for multiple keyspace_ids.
func (conn *VTGateConn) ExecuteKeyspaceIds(ctx context.Context, query string, keyspace string, keyspaceIds [][]byte, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (*sqltypes.Result, error) {
res, _, err := conn.impl.ExecuteKeyspaceIds(ctx, query, keyspace, keyspaceIds, bindVars, tabletType, nil)
func (conn *VTGateConn) ExecuteKeyspaceIds(ctx context.Context, query string, keyspace string, keyspaceIds [][]byte, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
res, _, err := conn.impl.ExecuteKeyspaceIds(ctx, query, keyspace, keyspaceIds, bindVars, tabletType, nil, options)
return res, err
}
// ExecuteKeyRanges executes a non-streaming query on a key range.
func (conn *VTGateConn) ExecuteKeyRanges(ctx context.Context, query string, keyspace string, keyRanges []*topodatapb.KeyRange, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (*sqltypes.Result, error) {
res, _, err := conn.impl.ExecuteKeyRanges(ctx, query, keyspace, keyRanges, bindVars, tabletType, nil)
func (conn *VTGateConn) ExecuteKeyRanges(ctx context.Context, query string, keyspace string, keyRanges []*topodatapb.KeyRange, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
res, _, err := conn.impl.ExecuteKeyRanges(ctx, query, keyspace, keyRanges, bindVars, tabletType, nil, options)
return res, err
}
// ExecuteEntityIds executes a non-streaming query for multiple entities.
func (conn *VTGateConn) ExecuteEntityIds(ctx context.Context, query string, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (*sqltypes.Result, error) {
res, _, err := conn.impl.ExecuteEntityIds(ctx, query, keyspace, entityColumnName, entityKeyspaceIDs, bindVars, tabletType, nil)
func (conn *VTGateConn) ExecuteEntityIds(ctx context.Context, query string, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
res, _, err := conn.impl.ExecuteEntityIds(ctx, query, keyspace, entityColumnName, entityKeyspaceIDs, bindVars, tabletType, nil, options)
return res, err
}
// ExecuteBatchShards executes a set of non-streaming queries for multiple shards.
// If "asTransaction" is true, vtgate will automatically create a transaction
// (per shard) that encloses all the batch queries.
func (conn *VTGateConn) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool) ([]sqltypes.Result, error) {
res, _, err := conn.impl.ExecuteBatchShards(ctx, queries, tabletType, asTransaction, nil)
func (conn *VTGateConn) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
res, _, err := conn.impl.ExecuteBatchShards(ctx, queries, tabletType, asTransaction, nil, options)
return res, err
}
// ExecuteBatchKeyspaceIds executes a set of non-streaming queries for multiple keyspace ids.
// If "asTransaction" is true, vtgate will automatically create a transaction
// (per shard) that encloses all the batch queries.
func (conn *VTGateConn) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool) ([]sqltypes.Result, error) {
res, _, err := conn.impl.ExecuteBatchKeyspaceIds(ctx, queries, tabletType, asTransaction, nil)
func (conn *VTGateConn) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
res, _, err := conn.impl.ExecuteBatchKeyspaceIds(ctx, queries, tabletType, asTransaction, nil, options)
return res, err
}
// StreamExecute executes a streaming query on vtgate. It returns a
// ResultStream and an error. First check the error. Then you can
// pull values from the ResultStream until io.EOF, or another error.
func (conn *VTGateConn) StreamExecute(ctx context.Context, query string, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (sqltypes.ResultStream, error) {
return conn.impl.StreamExecute(ctx, query, bindVars, conn.keyspace, tabletType)
func (conn *VTGateConn) StreamExecute(ctx context.Context, query string, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error) {
return conn.impl.StreamExecute(ctx, query, bindVars, conn.keyspace, tabletType, options)
}
// StreamExecuteShards executes a streaming query on vtgate, on a set
// of shards. It returns a ResultStream and an error. First check the
// error. Then you can pull values from the ResultStream until io.EOF,
// or another error.
func (conn *VTGateConn) StreamExecuteShards(ctx context.Context, query string, keyspace string, shards []string, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (sqltypes.ResultStream, error) {
return conn.impl.StreamExecuteShards(ctx, query, keyspace, shards, bindVars, tabletType)
func (conn *VTGateConn) StreamExecuteShards(ctx context.Context, query string, keyspace string, shards []string, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error) {
return conn.impl.StreamExecuteShards(ctx, query, keyspace, shards, bindVars, tabletType, options)
}
// StreamExecuteKeyRanges executes a streaming query on vtgate, on a
// set of keyranges. It returns a ResultStream and an error. First check the
// error. Then you can pull values from the ResultStream until io.EOF,
// or another error.
func (conn *VTGateConn) StreamExecuteKeyRanges(ctx context.Context, query string, keyspace string, keyRanges []*topodatapb.KeyRange, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (sqltypes.ResultStream, error) {
return conn.impl.StreamExecuteKeyRanges(ctx, query, keyspace, keyRanges, bindVars, tabletType)
func (conn *VTGateConn) StreamExecuteKeyRanges(ctx context.Context, query string, keyspace string, keyRanges []*topodatapb.KeyRange, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error) {
return conn.impl.StreamExecuteKeyRanges(ctx, query, keyspace, keyRanges, bindVars, tabletType, options)
}
// StreamExecuteKeyspaceIds executes a streaming query on vtgate, for
// the given keyspaceIds. It returns a ResultStream and an error. First check the
// error. Then you can pull values from the ResultStream until io.EOF,
// or another error.
func (conn *VTGateConn) StreamExecuteKeyspaceIds(ctx context.Context, query string, keyspace string, keyspaceIds [][]byte, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (sqltypes.ResultStream, error) {
return conn.impl.StreamExecuteKeyspaceIds(ctx, query, keyspace, keyspaceIds, bindVars, tabletType)
func (conn *VTGateConn) StreamExecuteKeyspaceIds(ctx context.Context, query string, keyspace string, keyspaceIds [][]byte, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error) {
return conn.impl.StreamExecuteKeyspaceIds(ctx, query, keyspace, keyspaceIds, bindVars, tabletType, options)
}
// Begin starts a transaction and returns a VTGateTX.
@ -183,71 +183,71 @@ type VTGateTx struct {
}
// Execute executes a query on vtgate within the current transaction.
func (tx *VTGateTx) Execute(ctx context.Context, query string, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (*sqltypes.Result, error) {
func (tx *VTGateTx) Execute(ctx context.Context, query string, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if tx.session == nil {
return nil, fmt.Errorf("execute: not in transaction")
}
res, session, err := tx.conn.impl.Execute(ctx, query, bindVars, tx.conn.keyspace, tabletType, tx.session)
res, session, err := tx.conn.impl.Execute(ctx, query, bindVars, tx.conn.keyspace, tabletType, tx.session, options)
tx.session = session
return res, err
}
// ExecuteShards executes a query for multiple shards on vtgate within the current transaction.
func (tx *VTGateTx) ExecuteShards(ctx context.Context, query string, keyspace string, shards []string, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (*sqltypes.Result, error) {
func (tx *VTGateTx) ExecuteShards(ctx context.Context, query string, keyspace string, shards []string, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if tx.session == nil {
return nil, fmt.Errorf("executeShards: not in transaction")
}
res, session, err := tx.conn.impl.ExecuteShards(ctx, query, keyspace, shards, bindVars, tabletType, tx.session)
res, session, err := tx.conn.impl.ExecuteShards(ctx, query, keyspace, shards, bindVars, tabletType, tx.session, options)
tx.session = session
return res, err
}
// ExecuteKeyspaceIds executes a non-streaming query for multiple keyspace_ids.
func (tx *VTGateTx) ExecuteKeyspaceIds(ctx context.Context, query string, keyspace string, keyspaceIds [][]byte, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (*sqltypes.Result, error) {
func (tx *VTGateTx) ExecuteKeyspaceIds(ctx context.Context, query string, keyspace string, keyspaceIds [][]byte, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if tx.session == nil {
return nil, fmt.Errorf("executeKeyspaceIds: not in transaction")
}
res, session, err := tx.conn.impl.ExecuteKeyspaceIds(ctx, query, keyspace, keyspaceIds, bindVars, tabletType, tx.session)
res, session, err := tx.conn.impl.ExecuteKeyspaceIds(ctx, query, keyspace, keyspaceIds, bindVars, tabletType, tx.session, options)
tx.session = session
return res, err
}
// ExecuteKeyRanges executes a non-streaming query on a key range.
func (tx *VTGateTx) ExecuteKeyRanges(ctx context.Context, query string, keyspace string, keyRanges []*topodatapb.KeyRange, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (*sqltypes.Result, error) {
func (tx *VTGateTx) ExecuteKeyRanges(ctx context.Context, query string, keyspace string, keyRanges []*topodatapb.KeyRange, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if tx.session == nil {
return nil, fmt.Errorf("executeKeyRanges: not in transaction")
}
res, session, err := tx.conn.impl.ExecuteKeyRanges(ctx, query, keyspace, keyRanges, bindVars, tabletType, tx.session)
res, session, err := tx.conn.impl.ExecuteKeyRanges(ctx, query, keyspace, keyRanges, bindVars, tabletType, tx.session, options)
tx.session = session
return res, err
}
// ExecuteEntityIds executes a non-streaming query for multiple entities.
func (tx *VTGateTx) ExecuteEntityIds(ctx context.Context, query string, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (*sqltypes.Result, error) {
func (tx *VTGateTx) ExecuteEntityIds(ctx context.Context, query string, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if tx.session == nil {
return nil, fmt.Errorf("executeEntityIds: not in transaction")
}
res, session, err := tx.conn.impl.ExecuteEntityIds(ctx, query, keyspace, entityColumnName, entityKeyspaceIDs, bindVars, tabletType, tx.session)
res, session, err := tx.conn.impl.ExecuteEntityIds(ctx, query, keyspace, entityColumnName, entityKeyspaceIDs, bindVars, tabletType, tx.session, options)
tx.session = session
return res, err
}
// ExecuteBatchShards executes a set of non-streaming queries for multiple shards.
func (tx *VTGateTx) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType) ([]sqltypes.Result, error) {
func (tx *VTGateTx) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
if tx.session == nil {
return nil, fmt.Errorf("executeBatchShards: not in transaction")
}
res, session, err := tx.conn.impl.ExecuteBatchShards(ctx, queries, tabletType, false /* asTransaction */, tx.session)
res, session, err := tx.conn.impl.ExecuteBatchShards(ctx, queries, tabletType, false /* asTransaction */, tx.session, options)
tx.session = session
return res, err
}
// ExecuteBatchKeyspaceIds executes a set of non-streaming queries for multiple keyspace ids.
func (tx *VTGateTx) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType) ([]sqltypes.Result, error) {
func (tx *VTGateTx) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
if tx.session == nil {
return nil, fmt.Errorf("executeBatchKeyspaceIds: not in transaction")
}
res, session, err := tx.conn.impl.ExecuteBatchKeyspaceIds(ctx, queries, tabletType, false /* asTransaction */, tx.session)
res, session, err := tx.conn.impl.ExecuteBatchKeyspaceIds(ctx, queries, tabletType, false /* asTransaction */, tx.session, options)
tx.session = session
return res, err
}
@ -280,37 +280,37 @@ func (tx *VTGateTx) Rollback(ctx context.Context) error {
// implementation. It can be used concurrently across goroutines.
type Impl interface {
// Execute executes a non-streaming query on vtgate.
Execute(ctx context.Context, query string, bindVars map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session interface{}) (*sqltypes.Result, interface{}, error)
Execute(ctx context.Context, query string, bindVars map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, interface{}, error)
// ExecuteShards executes a non-streaming query for multiple shards on vtgate.
ExecuteShards(ctx context.Context, query string, keyspace string, shards []string, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}) (*sqltypes.Result, interface{}, error)
ExecuteShards(ctx context.Context, query string, keyspace string, shards []string, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, interface{}, error)
// ExecuteKeyspaceIds executes a non-streaming query for multiple keyspace_ids.
ExecuteKeyspaceIds(ctx context.Context, query string, keyspace string, keyspaceIds [][]byte, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}) (*sqltypes.Result, interface{}, error)
ExecuteKeyspaceIds(ctx context.Context, query string, keyspace string, keyspaceIds [][]byte, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, interface{}, error)
// ExecuteKeyRanges executes a non-streaming query on a key range.
ExecuteKeyRanges(ctx context.Context, query string, keyspace string, keyRanges []*topodatapb.KeyRange, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}) (*sqltypes.Result, interface{}, error)
ExecuteKeyRanges(ctx context.Context, query string, keyspace string, keyRanges []*topodatapb.KeyRange, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, interface{}, error)
// ExecuteEntityIds executes a non-streaming query for multiple entities.
ExecuteEntityIds(ctx context.Context, query string, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}) (*sqltypes.Result, interface{}, error)
ExecuteEntityIds(ctx context.Context, query string, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, bindVars map[string]interface{}, tabletType topodatapb.TabletType, session interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, interface{}, error)
// ExecuteBatchShards executes a set of non-streaming queries for multiple shards.
ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session interface{}) ([]sqltypes.Result, interface{}, error)
ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session interface{}, options *querypb.ExecuteOptions) ([]sqltypes.Result, interface{}, error)
// ExecuteBatchKeyspaceIds executes a set of non-streaming queries for multiple keyspace ids.
ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session interface{}) ([]sqltypes.Result, interface{}, error)
ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session interface{}, options *querypb.ExecuteOptions) ([]sqltypes.Result, interface{}, error)
// StreamExecute executes a streaming query on vtgate.
StreamExecute(ctx context.Context, query string, bindVars map[string]interface{}, keyspace string, tabletType topodatapb.TabletType) (sqltypes.ResultStream, error)
StreamExecute(ctx context.Context, query string, bindVars map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error)
// StreamExecuteShards executes a streaming query on vtgate, on a set of shards.
StreamExecuteShards(ctx context.Context, query string, keyspace string, shards []string, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (sqltypes.ResultStream, error)
StreamExecuteShards(ctx context.Context, query string, keyspace string, shards []string, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error)
// StreamExecuteKeyRanges executes a streaming query on vtgate, on a set of keyranges.
StreamExecuteKeyRanges(ctx context.Context, query string, keyspace string, keyRanges []*topodatapb.KeyRange, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (sqltypes.ResultStream, error)
StreamExecuteKeyRanges(ctx context.Context, query string, keyspace string, keyRanges []*topodatapb.KeyRange, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error)
// StreamExecuteKeyspaceIds executes a streaming query on vtgate, for the given keyspaceIds.
StreamExecuteKeyspaceIds(ctx context.Context, query string, keyspace string, keyspaceIds [][]byte, bindVars map[string]interface{}, tabletType topodatapb.TabletType) (sqltypes.ResultStream, error)
StreamExecuteKeyspaceIds(ctx context.Context, query string, keyspace string, keyspaceIds [][]byte, bindVars map[string]interface{}, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error)
// Begin starts a transaction and returns a VTGateTX.
Begin(ctx context.Context) (interface{}, error)

Просмотреть файл

@ -15,6 +15,7 @@ import (
"testing"
"time"
"github.com/golang/protobuf/proto"
"github.com/youtube/vitess/go/sqltypes"
"github.com/youtube/vitess/go/tb"
"github.com/youtube/vitess/go/vt/callerid"
@ -73,7 +74,7 @@ type queryExecute struct {
}
// Execute is part of the VTGateService interface
func (f *fakeVTGateService) Execute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (f *fakeVTGateService) Execute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if f.hasError {
return nil, errTestVtGateError
}
@ -81,6 +82,9 @@ func (f *fakeVTGateService) Execute(ctx context.Context, sql string, bindVariabl
panic(fmt.Errorf("test forced panic"))
}
f.checkCallerID(ctx, "Execute")
if !proto.Equal(options, testExecuteOptions) {
f.t.Errorf("wrong Execute options, got %+v, want %+v", options, testExecuteOptions)
}
execCase, ok := execMap[sql]
if !ok {
return nil, fmt.Errorf("no match for: %s", sql)
@ -115,7 +119,7 @@ type queryExecuteShards struct {
}
// ExecuteShards is part of the VTGateService interface
func (f *fakeVTGateService) ExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (f *fakeVTGateService) ExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if f.hasError {
return nil, errTestVtGateError
}
@ -123,6 +127,9 @@ func (f *fakeVTGateService) ExecuteShards(ctx context.Context, sql string, bindV
panic(fmt.Errorf("test forced panic"))
}
f.checkCallerID(ctx, "ExecuteShards")
if !proto.Equal(options, testExecuteOptions) {
f.t.Errorf("wrong Execute options, got %+v, want %+v", options, testExecuteOptions)
}
execCase, ok := execMap[sql]
if !ok {
return nil, fmt.Errorf("no match for: %s", sql)
@ -159,7 +166,7 @@ type queryExecuteKeyspaceIds struct {
}
// ExecuteKeyspaceIds is part of the VTGateService interface
func (f *fakeVTGateService) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (f *fakeVTGateService) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if f.hasError {
return nil, errTestVtGateError
}
@ -167,6 +174,9 @@ func (f *fakeVTGateService) ExecuteKeyspaceIds(ctx context.Context, sql string,
panic(fmt.Errorf("test forced panic"))
}
f.checkCallerID(ctx, "ExecuteKeyspaceIds")
if !proto.Equal(options, testExecuteOptions) {
f.t.Errorf("wrong Execute options, got %+v, want %+v", options, testExecuteOptions)
}
execCase, ok := execMap[sql]
if !ok {
return nil, fmt.Errorf("no match for: %s", sql)
@ -202,7 +212,7 @@ type queryExecuteKeyRanges struct {
}
// ExecuteKeyRanges is part of the VTGateService interface
func (f *fakeVTGateService) ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (f *fakeVTGateService) ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if f.hasError {
return nil, errTestVtGateError
}
@ -210,6 +220,9 @@ func (f *fakeVTGateService) ExecuteKeyRanges(ctx context.Context, sql string, bi
panic(fmt.Errorf("test forced panic"))
}
f.checkCallerID(ctx, "ExecuteKeyRanges")
if !proto.Equal(options, testExecuteOptions) {
f.t.Errorf("wrong Execute options, got %+v, want %+v", options, testExecuteOptions)
}
execCase, ok := execMap[sql]
if !ok {
return nil, fmt.Errorf("no match for: %s", sql)
@ -246,7 +259,7 @@ type queryExecuteEntityIds struct {
}
// ExecuteEntityIds is part of the VTGateService interface
func (f *fakeVTGateService) ExecuteEntityIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error) {
func (f *fakeVTGateService) ExecuteEntityIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error) {
if f.hasError {
return nil, errTestVtGateError
}
@ -254,6 +267,9 @@ func (f *fakeVTGateService) ExecuteEntityIds(ctx context.Context, sql string, bi
panic(fmt.Errorf("test forced panic"))
}
f.checkCallerID(ctx, "ExecuteEntityIds")
if !proto.Equal(options, testExecuteOptions) {
f.t.Errorf("wrong Execute options, got %+v, want %+v", options, testExecuteOptions)
}
execCase, ok := execMap[sql]
if !ok {
return nil, fmt.Errorf("no match for: %s", sql)
@ -291,7 +307,7 @@ type queryExecuteBatchShards struct {
}
// ExecuteBatchShards is part of the VTGateService interface
func (f *fakeVTGateService) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session) ([]sqltypes.Result, error) {
func (f *fakeVTGateService) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
if f.hasError {
return nil, errTestVtGateError
}
@ -299,6 +315,9 @@ func (f *fakeVTGateService) ExecuteBatchShards(ctx context.Context, queries []*v
panic(fmt.Errorf("test forced panic"))
}
f.checkCallerID(ctx, "ExecuteBatchShards")
if !proto.Equal(options, testExecuteOptions) {
f.t.Errorf("wrong Execute options, got %+v, want %+v", options, testExecuteOptions)
}
execCase, ok := execMap[queries[0].Query.Sql]
if !ok {
return nil, fmt.Errorf("no match for: %s", queries[0].Query.Sql)
@ -332,7 +351,7 @@ type queryExecuteBatchKeyspaceIds struct {
}
// ExecuteBatchKeyspaceIds is part of the VTGateService interface
func (f *fakeVTGateService) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session) ([]sqltypes.Result, error) {
func (f *fakeVTGateService) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) {
if f.hasError {
return nil, errTestVtGateError
}
@ -340,6 +359,9 @@ func (f *fakeVTGateService) ExecuteBatchKeyspaceIds(ctx context.Context, queries
panic(fmt.Errorf("test forced panic"))
}
f.checkCallerID(ctx, "ExecuteBatchKeyspaceIds")
if !proto.Equal(options, testExecuteOptions) {
f.t.Errorf("wrong Execute options, got %+v, want %+v", options, testExecuteOptions)
}
execCase, ok := execMap[queries[0].Query.Sql]
if !ok {
return nil, fmt.Errorf("no match for: %s", queries[0].Query.Sql)
@ -364,7 +386,7 @@ func (f *fakeVTGateService) ExecuteBatchKeyspaceIds(ctx context.Context, queries
}
// StreamExecute is part of the VTGateService interface
func (f *fakeVTGateService) StreamExecute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (f *fakeVTGateService) StreamExecute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
if f.panics {
panic(fmt.Errorf("test forced panic"))
}
@ -373,6 +395,9 @@ func (f *fakeVTGateService) StreamExecute(ctx context.Context, sql string, bindV
return fmt.Errorf("no match for: %s", sql)
}
f.checkCallerID(ctx, "StreamExecute")
if !proto.Equal(options, testExecuteOptions) {
f.t.Errorf("wrong Execute options, got %+v, want %+v", options, testExecuteOptions)
}
query := &queryExecute{
SQL: sql,
BindVariables: bindVariables,
@ -410,11 +435,14 @@ func (f *fakeVTGateService) StreamExecute(ctx context.Context, sql string, bindV
}
// StreamExecuteShards is part of the VTGateService interface
func (f *fakeVTGateService) StreamExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (f *fakeVTGateService) StreamExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
if f.panics {
panic(fmt.Errorf("test forced panic"))
}
f.checkCallerID(ctx, "StreamExecuteShards")
if !proto.Equal(options, testExecuteOptions) {
f.t.Errorf("wrong Execute options, got %+v, want %+v", options, testExecuteOptions)
}
execCase, ok := execMap[sql]
if !ok {
return fmt.Errorf("no match for: %s", sql)
@ -457,11 +485,14 @@ func (f *fakeVTGateService) StreamExecuteShards(ctx context.Context, sql string,
}
// StreamExecuteKeyspaceIds is part of the VTGateService interface
func (f *fakeVTGateService) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (f *fakeVTGateService) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
if f.panics {
panic(fmt.Errorf("test forced panic"))
}
f.checkCallerID(ctx, "StreamExecuteKeyspaceIds")
if !proto.Equal(options, testExecuteOptions) {
f.t.Errorf("wrong Execute options, got %+v, want %+v", options, testExecuteOptions)
}
execCase, ok := execMap[sql]
if !ok {
return fmt.Errorf("no match for: %s", sql)
@ -504,11 +535,14 @@ func (f *fakeVTGateService) StreamExecuteKeyspaceIds(ctx context.Context, sql st
}
// StreamExecuteKeyRanges is part of the VTGateService interface
func (f *fakeVTGateService) StreamExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error {
func (f *fakeVTGateService) StreamExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
if f.panics {
panic(fmt.Errorf("test forced panic"))
}
f.checkCallerID(ctx, "StreamExecuteKeyRanges")
if !proto.Equal(options, testExecuteOptions) {
f.t.Errorf("wrong Execute options, got %+v, want %+v", options, testExecuteOptions)
}
execCase, ok := execMap[sql]
if !ok {
return fmt.Errorf("no match for: %s", sql)
@ -654,7 +688,7 @@ func (f *fakeVTGateService) SplitQueryV2(
if f.panics {
panic(fmt.Errorf("test forced panic"))
}
f.checkCallerID(ctx, "SplitQuery")
f.checkCallerID(ctx, "SplitQueryV2")
query := &querySplitQueryV2{
Keyspace: keyspace,
SQL: sql,
@ -902,7 +936,7 @@ func verifyErrorString(t *testing.T, err error, method string) {
func testExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := newContext()
execCase := execMap["request1"]
qr, err := conn.Execute(ctx, execCase.execQuery.SQL, execCase.execQuery.BindVariables, execCase.execQuery.TabletType)
qr, err := conn.Execute(ctx, execCase.execQuery.SQL, execCase.execQuery.BindVariables, execCase.execQuery.TabletType, testExecuteOptions)
if err != nil {
t.Error(err)
}
@ -910,7 +944,7 @@ func testExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
t.Errorf("Unexpected result from Execute: got\n%#v want\n%#v", qr, execCase.result)
}
_, err = conn.Execute(ctx, "none", nil, topodatapb.TabletType_RDONLY)
_, err = conn.Execute(ctx, "none", nil, topodatapb.TabletType_RDONLY, testExecuteOptions)
want := "no match for: none"
if err == nil || !strings.Contains(err.Error(), want) {
t.Errorf("none request: %v, want %v", err, want)
@ -921,21 +955,21 @@ func testExecuteError(t *testing.T, conn *vtgateconn.VTGateConn, fake *fakeVTGat
ctx := newContext()
execCase := execMap["errorRequst"]
_, err := conn.Execute(ctx, execCase.execQuery.SQL, execCase.execQuery.BindVariables, execCase.execQuery.TabletType)
_, err := conn.Execute(ctx, execCase.execQuery.SQL, execCase.execQuery.BindVariables, execCase.execQuery.TabletType, testExecuteOptions)
verifyError(t, err, "Execute")
}
func testExecutePanic(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := newContext()
execCase := execMap["request1"]
_, err := conn.Execute(ctx, execCase.execQuery.SQL, execCase.execQuery.BindVariables, execCase.execQuery.TabletType)
_, err := conn.Execute(ctx, execCase.execQuery.SQL, execCase.execQuery.BindVariables, execCase.execQuery.TabletType, testExecuteOptions)
expectPanic(t, err)
}
func testExecuteShards(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := newContext()
execCase := execMap["request1"]
qr, err := conn.ExecuteShards(ctx, execCase.shardQuery.SQL, execCase.shardQuery.Keyspace, execCase.shardQuery.Shards, execCase.shardQuery.BindVariables, execCase.shardQuery.TabletType)
qr, err := conn.ExecuteShards(ctx, execCase.shardQuery.SQL, execCase.shardQuery.Keyspace, execCase.shardQuery.Shards, execCase.shardQuery.BindVariables, execCase.shardQuery.TabletType, testExecuteOptions)
if err != nil {
t.Error(err)
}
@ -943,7 +977,7 @@ func testExecuteShards(t *testing.T, conn *vtgateconn.VTGateConn) {
t.Errorf("Unexpected result from Execute: got %+v want %+v", qr, execCase.result)
}
_, err = conn.ExecuteShards(ctx, "none", "", []string{}, nil, topodatapb.TabletType_RDONLY)
_, err = conn.ExecuteShards(ctx, "none", "", []string{}, nil, topodatapb.TabletType_RDONLY, testExecuteOptions)
want := "no match for: none"
if err == nil || !strings.Contains(err.Error(), want) {
t.Errorf("none request: %v, want %v", err, want)
@ -954,21 +988,21 @@ func testExecuteShardsError(t *testing.T, conn *vtgateconn.VTGateConn, fake *fak
ctx := newContext()
execCase := execMap["errorRequst"]
_, err := conn.ExecuteShards(ctx, execCase.shardQuery.SQL, execCase.shardQuery.Keyspace, execCase.shardQuery.Shards, execCase.shardQuery.BindVariables, execCase.shardQuery.TabletType)
_, err := conn.ExecuteShards(ctx, execCase.shardQuery.SQL, execCase.shardQuery.Keyspace, execCase.shardQuery.Shards, execCase.shardQuery.BindVariables, execCase.shardQuery.TabletType, testExecuteOptions)
verifyError(t, err, "ExecuteShards")
}
func testExecuteShardsPanic(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := newContext()
execCase := execMap["request1"]
_, err := conn.ExecuteShards(ctx, execCase.execQuery.SQL, "ks", []string{"1", "2"}, execCase.execQuery.BindVariables, execCase.execQuery.TabletType)
_, err := conn.ExecuteShards(ctx, execCase.execQuery.SQL, "ks", []string{"1", "2"}, execCase.execQuery.BindVariables, execCase.execQuery.TabletType, testExecuteOptions)
expectPanic(t, err)
}
func testExecuteKeyspaceIds(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := newContext()
execCase := execMap["request1"]
qr, err := conn.ExecuteKeyspaceIds(ctx, execCase.keyspaceIDQuery.SQL, execCase.keyspaceIDQuery.Keyspace, execCase.keyspaceIDQuery.KeyspaceIds, execCase.keyspaceIDQuery.BindVariables, execCase.keyspaceIDQuery.TabletType)
qr, err := conn.ExecuteKeyspaceIds(ctx, execCase.keyspaceIDQuery.SQL, execCase.keyspaceIDQuery.Keyspace, execCase.keyspaceIDQuery.KeyspaceIds, execCase.keyspaceIDQuery.BindVariables, execCase.keyspaceIDQuery.TabletType, testExecuteOptions)
if err != nil {
t.Error(err)
}
@ -976,7 +1010,7 @@ func testExecuteKeyspaceIds(t *testing.T, conn *vtgateconn.VTGateConn) {
t.Errorf("Unexpected result from Execute: got %+v want %+v", qr, execCase.result)
}
_, err = conn.ExecuteKeyspaceIds(ctx, "none", "", [][]byte{}, nil, topodatapb.TabletType_REPLICA)
_, err = conn.ExecuteKeyspaceIds(ctx, "none", "", [][]byte{}, nil, topodatapb.TabletType_REPLICA, testExecuteOptions)
want := "no match for: none"
if err == nil || !strings.Contains(err.Error(), want) {
t.Errorf("none request: %v, want %v", err, want)
@ -987,21 +1021,21 @@ func testExecuteKeyspaceIdsError(t *testing.T, conn *vtgateconn.VTGateConn, fake
ctx := newContext()
execCase := execMap["errorRequst"]
_, err := conn.ExecuteKeyspaceIds(ctx, execCase.keyspaceIDQuery.SQL, execCase.keyspaceIDQuery.Keyspace, execCase.keyspaceIDQuery.KeyspaceIds, execCase.keyspaceIDQuery.BindVariables, execCase.keyspaceIDQuery.TabletType)
_, err := conn.ExecuteKeyspaceIds(ctx, execCase.keyspaceIDQuery.SQL, execCase.keyspaceIDQuery.Keyspace, execCase.keyspaceIDQuery.KeyspaceIds, execCase.keyspaceIDQuery.BindVariables, execCase.keyspaceIDQuery.TabletType, testExecuteOptions)
verifyError(t, err, "ExecuteKeyspaceIds")
}
func testExecuteKeyspaceIdsPanic(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := newContext()
execCase := execMap["request1"]
_, err := conn.ExecuteKeyspaceIds(ctx, execCase.keyspaceIDQuery.SQL, execCase.keyspaceIDQuery.Keyspace, execCase.keyspaceIDQuery.KeyspaceIds, execCase.keyspaceIDQuery.BindVariables, execCase.keyspaceIDQuery.TabletType)
_, err := conn.ExecuteKeyspaceIds(ctx, execCase.keyspaceIDQuery.SQL, execCase.keyspaceIDQuery.Keyspace, execCase.keyspaceIDQuery.KeyspaceIds, execCase.keyspaceIDQuery.BindVariables, execCase.keyspaceIDQuery.TabletType, testExecuteOptions)
expectPanic(t, err)
}
func testExecuteKeyRanges(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := newContext()
execCase := execMap["request1"]
qr, err := conn.ExecuteKeyRanges(ctx, execCase.keyRangeQuery.SQL, execCase.keyRangeQuery.Keyspace, execCase.keyRangeQuery.KeyRanges, execCase.keyRangeQuery.BindVariables, execCase.keyRangeQuery.TabletType)
qr, err := conn.ExecuteKeyRanges(ctx, execCase.keyRangeQuery.SQL, execCase.keyRangeQuery.Keyspace, execCase.keyRangeQuery.KeyRanges, execCase.keyRangeQuery.BindVariables, execCase.keyRangeQuery.TabletType, testExecuteOptions)
if err != nil {
t.Error(err)
}
@ -1009,7 +1043,7 @@ func testExecuteKeyRanges(t *testing.T, conn *vtgateconn.VTGateConn) {
t.Errorf("Unexpected result from Execute: got %+v want %+v", qr, execCase.result)
}
_, err = conn.ExecuteKeyRanges(ctx, "none", "", []*topodatapb.KeyRange{}, nil, topodatapb.TabletType_REPLICA)
_, err = conn.ExecuteKeyRanges(ctx, "none", "", []*topodatapb.KeyRange{}, nil, topodatapb.TabletType_REPLICA, testExecuteOptions)
want := "no match for: none"
if err == nil || !strings.Contains(err.Error(), want) {
t.Errorf("none request: %v, want %v", err, want)
@ -1020,21 +1054,21 @@ func testExecuteKeyRangesError(t *testing.T, conn *vtgateconn.VTGateConn, fake *
ctx := newContext()
execCase := execMap["errorRequst"]
_, err := conn.ExecuteKeyRanges(ctx, execCase.keyRangeQuery.SQL, execCase.keyRangeQuery.Keyspace, execCase.keyRangeQuery.KeyRanges, execCase.keyRangeQuery.BindVariables, execCase.keyRangeQuery.TabletType)
_, err := conn.ExecuteKeyRanges(ctx, execCase.keyRangeQuery.SQL, execCase.keyRangeQuery.Keyspace, execCase.keyRangeQuery.KeyRanges, execCase.keyRangeQuery.BindVariables, execCase.keyRangeQuery.TabletType, testExecuteOptions)
verifyError(t, err, "ExecuteKeyRanges")
}
func testExecuteKeyRangesPanic(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := newContext()
execCase := execMap["request1"]
_, err := conn.ExecuteKeyRanges(ctx, execCase.keyRangeQuery.SQL, execCase.keyRangeQuery.Keyspace, execCase.keyRangeQuery.KeyRanges, execCase.keyRangeQuery.BindVariables, execCase.keyRangeQuery.TabletType)
_, err := conn.ExecuteKeyRanges(ctx, execCase.keyRangeQuery.SQL, execCase.keyRangeQuery.Keyspace, execCase.keyRangeQuery.KeyRanges, execCase.keyRangeQuery.BindVariables, execCase.keyRangeQuery.TabletType, testExecuteOptions)
expectPanic(t, err)
}
func testExecuteEntityIds(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := newContext()
execCase := execMap["request1"]
qr, err := conn.ExecuteEntityIds(ctx, execCase.entityIdsQuery.SQL, execCase.entityIdsQuery.Keyspace, execCase.entityIdsQuery.EntityColumnName, execCase.entityIdsQuery.EntityKeyspaceIDs, execCase.entityIdsQuery.BindVariables, execCase.entityIdsQuery.TabletType)
qr, err := conn.ExecuteEntityIds(ctx, execCase.entityIdsQuery.SQL, execCase.entityIdsQuery.Keyspace, execCase.entityIdsQuery.EntityColumnName, execCase.entityIdsQuery.EntityKeyspaceIDs, execCase.entityIdsQuery.BindVariables, execCase.entityIdsQuery.TabletType, testExecuteOptions)
if err != nil {
t.Error(err)
}
@ -1042,7 +1076,7 @@ func testExecuteEntityIds(t *testing.T, conn *vtgateconn.VTGateConn) {
t.Errorf("Unexpected result from Execute: got %+v want %+v", qr, execCase.result)
}
_, err = conn.ExecuteEntityIds(ctx, "none", "", "", []*vtgatepb.ExecuteEntityIdsRequest_EntityId{}, nil, topodatapb.TabletType_REPLICA)
_, err = conn.ExecuteEntityIds(ctx, "none", "", "", []*vtgatepb.ExecuteEntityIdsRequest_EntityId{}, nil, topodatapb.TabletType_REPLICA, testExecuteOptions)
want := "no match for: none"
if err == nil || !strings.Contains(err.Error(), want) {
t.Errorf("none request: %v, want %v", err, want)
@ -1053,21 +1087,21 @@ func testExecuteEntityIdsError(t *testing.T, conn *vtgateconn.VTGateConn, fake *
ctx := newContext()
execCase := execMap["errorRequst"]
_, err := conn.ExecuteEntityIds(ctx, execCase.entityIdsQuery.SQL, execCase.entityIdsQuery.Keyspace, execCase.entityIdsQuery.EntityColumnName, execCase.entityIdsQuery.EntityKeyspaceIDs, execCase.entityIdsQuery.BindVariables, execCase.entityIdsQuery.TabletType)
_, err := conn.ExecuteEntityIds(ctx, execCase.entityIdsQuery.SQL, execCase.entityIdsQuery.Keyspace, execCase.entityIdsQuery.EntityColumnName, execCase.entityIdsQuery.EntityKeyspaceIDs, execCase.entityIdsQuery.BindVariables, execCase.entityIdsQuery.TabletType, testExecuteOptions)
verifyError(t, err, "ExecuteEntityIds")
}
func testExecuteEntityIdsPanic(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := newContext()
execCase := execMap["request1"]
_, err := conn.ExecuteEntityIds(ctx, execCase.entityIdsQuery.SQL, execCase.entityIdsQuery.Keyspace, execCase.entityIdsQuery.EntityColumnName, execCase.entityIdsQuery.EntityKeyspaceIDs, execCase.entityIdsQuery.BindVariables, execCase.entityIdsQuery.TabletType)
_, err := conn.ExecuteEntityIds(ctx, execCase.entityIdsQuery.SQL, execCase.entityIdsQuery.Keyspace, execCase.entityIdsQuery.EntityColumnName, execCase.entityIdsQuery.EntityKeyspaceIDs, execCase.entityIdsQuery.BindVariables, execCase.entityIdsQuery.TabletType, testExecuteOptions)
expectPanic(t, err)
}
func testExecuteBatchShards(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := newContext()
execCase := execMap["request1"]
ql, err := conn.ExecuteBatchShards(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, execCase.batchQueryShard.AsTransaction)
ql, err := conn.ExecuteBatchShards(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, execCase.batchQueryShard.AsTransaction, testExecuteOptions)
if err != nil {
t.Error(err)
}
@ -1077,7 +1111,7 @@ func testExecuteBatchShards(t *testing.T, conn *vtgateconn.VTGateConn) {
_, err = conn.ExecuteBatchShards(ctx, []*vtgatepb.BoundShardQuery{
{Query: &querypb.BoundQuery{Sql: "none"}}},
topodatapb.TabletType_REPLICA, true)
topodatapb.TabletType_REPLICA, true, testExecuteOptions)
want := "no match for: none"
if err == nil || !strings.Contains(err.Error(), want) {
t.Errorf("none request: %v, want %v", err, want)
@ -1088,21 +1122,21 @@ func testExecuteBatchShardsError(t *testing.T, conn *vtgateconn.VTGateConn, fake
ctx := newContext()
execCase := execMap["errorRequst"]
_, err := conn.ExecuteBatchShards(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, execCase.batchQueryShard.AsTransaction)
_, err := conn.ExecuteBatchShards(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, execCase.batchQueryShard.AsTransaction, testExecuteOptions)
verifyError(t, err, "ExecuteBatchShards")
}
func testExecuteBatchShardsPanic(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := newContext()
execCase := execMap["request1"]
_, err := conn.ExecuteBatchShards(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, execCase.batchQueryShard.AsTransaction)
_, err := conn.ExecuteBatchShards(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, execCase.batchQueryShard.AsTransaction, testExecuteOptions)
expectPanic(t, err)
}
func testExecuteBatchKeyspaceIds(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := newContext()
execCase := execMap["request1"]
ql, err := conn.ExecuteBatchKeyspaceIds(ctx, execCase.keyspaceIDBatchQuery.Queries, execCase.keyspaceIDBatchQuery.TabletType, execCase.batchQueryShard.AsTransaction)
ql, err := conn.ExecuteBatchKeyspaceIds(ctx, execCase.keyspaceIDBatchQuery.Queries, execCase.keyspaceIDBatchQuery.TabletType, execCase.batchQueryShard.AsTransaction, testExecuteOptions)
if err != nil {
t.Error(err)
}
@ -1112,7 +1146,7 @@ func testExecuteBatchKeyspaceIds(t *testing.T, conn *vtgateconn.VTGateConn) {
_, err = conn.ExecuteBatchKeyspaceIds(ctx, []*vtgatepb.BoundKeyspaceIdQuery{
{Query: &querypb.BoundQuery{Sql: "none"}, KeyspaceIds: [][]byte{}}},
topodatapb.TabletType_REPLICA, false)
topodatapb.TabletType_REPLICA, false, testExecuteOptions)
want := "no match for: none"
if err == nil || !strings.Contains(err.Error(), want) {
t.Errorf("none request: %v, want %v", err, want)
@ -1123,21 +1157,21 @@ func testExecuteBatchKeyspaceIdsError(t *testing.T, conn *vtgateconn.VTGateConn,
ctx := newContext()
execCase := execMap["errorRequst"]
_, err := conn.ExecuteBatchKeyspaceIds(ctx, execCase.keyspaceIDBatchQuery.Queries, execCase.keyspaceIDBatchQuery.TabletType, execCase.keyspaceIDBatchQuery.AsTransaction)
_, err := conn.ExecuteBatchKeyspaceIds(ctx, execCase.keyspaceIDBatchQuery.Queries, execCase.keyspaceIDBatchQuery.TabletType, execCase.keyspaceIDBatchQuery.AsTransaction, testExecuteOptions)
verifyError(t, err, "ExecuteBatchKeyspaceIds")
}
func testExecuteBatchKeyspaceIdsPanic(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := newContext()
execCase := execMap["request1"]
_, err := conn.ExecuteBatchKeyspaceIds(ctx, execCase.keyspaceIDBatchQuery.Queries, execCase.keyspaceIDBatchQuery.TabletType, execCase.keyspaceIDBatchQuery.AsTransaction)
_, err := conn.ExecuteBatchKeyspaceIds(ctx, execCase.keyspaceIDBatchQuery.Queries, execCase.keyspaceIDBatchQuery.TabletType, execCase.keyspaceIDBatchQuery.AsTransaction, testExecuteOptions)
expectPanic(t, err)
}
func testStreamExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := newContext()
execCase := execMap["request1"]
stream, err := conn.StreamExecute(ctx, execCase.execQuery.SQL, execCase.execQuery.BindVariables, execCase.execQuery.TabletType)
stream, err := conn.StreamExecute(ctx, execCase.execQuery.SQL, execCase.execQuery.BindVariables, execCase.execQuery.TabletType, testExecuteOptions)
if err != nil {
t.Fatal(err)
}
@ -1164,7 +1198,7 @@ func testStreamExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
t.Errorf("Unexpected result from Execute: got %+v want %+v", qr, wantResult)
}
stream, err = conn.StreamExecute(ctx, "none", nil, topodatapb.TabletType_RDONLY)
stream, err = conn.StreamExecute(ctx, "none", nil, topodatapb.TabletType_RDONLY, testExecuteOptions)
if err != nil {
t.Fatal(err)
}
@ -1178,7 +1212,7 @@ func testStreamExecute(t *testing.T, conn *vtgateconn.VTGateConn) {
func testStreamExecuteError(t *testing.T, conn *vtgateconn.VTGateConn, fake *fakeVTGateService) {
ctx := newContext()
execCase := execMap["request1"]
stream, err := conn.StreamExecute(ctx, execCase.execQuery.SQL, execCase.execQuery.BindVariables, execCase.execQuery.TabletType)
stream, err := conn.StreamExecute(ctx, execCase.execQuery.SQL, execCase.execQuery.BindVariables, execCase.execQuery.TabletType, testExecuteOptions)
if err != nil {
t.Fatalf("StreamExecute failed: %v", err)
}
@ -1203,7 +1237,7 @@ func testStreamExecuteError(t *testing.T, conn *vtgateconn.VTGateConn, fake *fak
func testStreamExecutePanic(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := newContext()
execCase := execMap["request1"]
stream, err := conn.StreamExecute(ctx, execCase.execQuery.SQL, execCase.execQuery.BindVariables, execCase.execQuery.TabletType)
stream, err := conn.StreamExecute(ctx, execCase.execQuery.SQL, execCase.execQuery.BindVariables, execCase.execQuery.TabletType, testExecuteOptions)
if err != nil {
t.Fatal(err)
}
@ -1217,7 +1251,7 @@ func testStreamExecutePanic(t *testing.T, conn *vtgateconn.VTGateConn) {
func testStreamExecuteShards(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := newContext()
execCase := execMap["request1"]
stream, err := conn.StreamExecuteShards(ctx, execCase.shardQuery.SQL, execCase.shardQuery.Keyspace, execCase.shardQuery.Shards, execCase.execQuery.BindVariables, execCase.execQuery.TabletType)
stream, err := conn.StreamExecuteShards(ctx, execCase.shardQuery.SQL, execCase.shardQuery.Keyspace, execCase.shardQuery.Shards, execCase.execQuery.BindVariables, execCase.execQuery.TabletType, testExecuteOptions)
if err != nil {
t.Fatal(err)
}
@ -1244,7 +1278,7 @@ func testStreamExecuteShards(t *testing.T, conn *vtgateconn.VTGateConn) {
t.Errorf("Unexpected result from Execute: got %+v want %+v", qr, wantResult)
}
stream, err = conn.StreamExecuteShards(ctx, "none", "", []string{}, nil, topodatapb.TabletType_REPLICA)
stream, err = conn.StreamExecuteShards(ctx, "none", "", []string{}, nil, topodatapb.TabletType_REPLICA, testExecuteOptions)
if err != nil {
t.Fatal(err)
}
@ -1258,7 +1292,7 @@ func testStreamExecuteShards(t *testing.T, conn *vtgateconn.VTGateConn) {
func testStreamExecuteShardsError(t *testing.T, conn *vtgateconn.VTGateConn, fake *fakeVTGateService) {
ctx := newContext()
execCase := execMap["request1"]
stream, err := conn.StreamExecuteShards(ctx, execCase.shardQuery.SQL, execCase.shardQuery.Keyspace, execCase.shardQuery.Shards, execCase.execQuery.BindVariables, execCase.execQuery.TabletType)
stream, err := conn.StreamExecuteShards(ctx, execCase.shardQuery.SQL, execCase.shardQuery.Keyspace, execCase.shardQuery.Shards, execCase.execQuery.BindVariables, execCase.execQuery.TabletType, testExecuteOptions)
if err != nil {
t.Fatalf("StreamExecuteShards failed: %v", err)
}
@ -1283,7 +1317,7 @@ func testStreamExecuteShardsError(t *testing.T, conn *vtgateconn.VTGateConn, fak
func testStreamExecuteShardsPanic(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := newContext()
execCase := execMap["request1"]
stream, err := conn.StreamExecuteShards(ctx, execCase.shardQuery.SQL, execCase.shardQuery.Keyspace, execCase.shardQuery.Shards, execCase.execQuery.BindVariables, execCase.execQuery.TabletType)
stream, err := conn.StreamExecuteShards(ctx, execCase.shardQuery.SQL, execCase.shardQuery.Keyspace, execCase.shardQuery.Shards, execCase.execQuery.BindVariables, execCase.execQuery.TabletType, testExecuteOptions)
if err != nil {
t.Fatal(err)
}
@ -1297,7 +1331,7 @@ func testStreamExecuteShardsPanic(t *testing.T, conn *vtgateconn.VTGateConn) {
func testStreamExecuteKeyRanges(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := newContext()
execCase := execMap["request1"]
stream, err := conn.StreamExecuteKeyRanges(ctx, execCase.keyRangeQuery.SQL, execCase.keyRangeQuery.Keyspace, execCase.keyRangeQuery.KeyRanges, execCase.keyRangeQuery.BindVariables, execCase.keyRangeQuery.TabletType)
stream, err := conn.StreamExecuteKeyRanges(ctx, execCase.keyRangeQuery.SQL, execCase.keyRangeQuery.Keyspace, execCase.keyRangeQuery.KeyRanges, execCase.keyRangeQuery.BindVariables, execCase.keyRangeQuery.TabletType, testExecuteOptions)
if err != nil {
t.Fatal(err)
}
@ -1324,7 +1358,7 @@ func testStreamExecuteKeyRanges(t *testing.T, conn *vtgateconn.VTGateConn) {
t.Errorf("Unexpected result from Execute: got %+v want %+v", qr, wantResult)
}
stream, err = conn.StreamExecuteKeyRanges(ctx, "none", "", []*topodatapb.KeyRange{}, nil, topodatapb.TabletType_REPLICA)
stream, err = conn.StreamExecuteKeyRanges(ctx, "none", "", []*topodatapb.KeyRange{}, nil, topodatapb.TabletType_REPLICA, testExecuteOptions)
if err != nil {
t.Fatal(err)
}
@ -1338,7 +1372,7 @@ func testStreamExecuteKeyRanges(t *testing.T, conn *vtgateconn.VTGateConn) {
func testStreamExecuteKeyRangesError(t *testing.T, conn *vtgateconn.VTGateConn, fake *fakeVTGateService) {
ctx := newContext()
execCase := execMap["request1"]
stream, err := conn.StreamExecuteKeyRanges(ctx, execCase.keyRangeQuery.SQL, execCase.keyRangeQuery.Keyspace, execCase.keyRangeQuery.KeyRanges, execCase.keyRangeQuery.BindVariables, execCase.keyRangeQuery.TabletType)
stream, err := conn.StreamExecuteKeyRanges(ctx, execCase.keyRangeQuery.SQL, execCase.keyRangeQuery.Keyspace, execCase.keyRangeQuery.KeyRanges, execCase.keyRangeQuery.BindVariables, execCase.keyRangeQuery.TabletType, testExecuteOptions)
if err != nil {
t.Fatalf("StreamExecuteKeyRanges failed: %v", err)
}
@ -1363,7 +1397,7 @@ func testStreamExecuteKeyRangesError(t *testing.T, conn *vtgateconn.VTGateConn,
func testStreamExecuteKeyRangesPanic(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := newContext()
execCase := execMap["request1"]
stream, err := conn.StreamExecuteKeyRanges(ctx, execCase.keyRangeQuery.SQL, execCase.keyRangeQuery.Keyspace, execCase.keyRangeQuery.KeyRanges, execCase.keyRangeQuery.BindVariables, execCase.keyRangeQuery.TabletType)
stream, err := conn.StreamExecuteKeyRanges(ctx, execCase.keyRangeQuery.SQL, execCase.keyRangeQuery.Keyspace, execCase.keyRangeQuery.KeyRanges, execCase.keyRangeQuery.BindVariables, execCase.keyRangeQuery.TabletType, testExecuteOptions)
if err != nil {
t.Fatal(err)
}
@ -1377,7 +1411,7 @@ func testStreamExecuteKeyRangesPanic(t *testing.T, conn *vtgateconn.VTGateConn)
func testStreamExecuteKeyspaceIds(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := newContext()
execCase := execMap["request1"]
stream, err := conn.StreamExecuteKeyspaceIds(ctx, execCase.keyspaceIDQuery.SQL, execCase.keyspaceIDQuery.Keyspace, execCase.keyspaceIDQuery.KeyspaceIds, execCase.keyspaceIDQuery.BindVariables, execCase.keyspaceIDQuery.TabletType)
stream, err := conn.StreamExecuteKeyspaceIds(ctx, execCase.keyspaceIDQuery.SQL, execCase.keyspaceIDQuery.Keyspace, execCase.keyspaceIDQuery.KeyspaceIds, execCase.keyspaceIDQuery.BindVariables, execCase.keyspaceIDQuery.TabletType, testExecuteOptions)
if err != nil {
t.Fatal(err)
}
@ -1404,7 +1438,7 @@ func testStreamExecuteKeyspaceIds(t *testing.T, conn *vtgateconn.VTGateConn) {
t.Errorf("Unexpected result from Execute: got %+v want %+v", qr, wantResult)
}
stream, err = conn.StreamExecuteKeyspaceIds(ctx, "none", "", [][]byte{}, nil, topodatapb.TabletType_REPLICA)
stream, err = conn.StreamExecuteKeyspaceIds(ctx, "none", "", [][]byte{}, nil, topodatapb.TabletType_REPLICA, testExecuteOptions)
if err != nil {
t.Fatal(err)
}
@ -1418,7 +1452,7 @@ func testStreamExecuteKeyspaceIds(t *testing.T, conn *vtgateconn.VTGateConn) {
func testStreamExecuteKeyspaceIdsError(t *testing.T, conn *vtgateconn.VTGateConn, fake *fakeVTGateService) {
ctx := newContext()
execCase := execMap["request1"]
stream, err := conn.StreamExecuteKeyspaceIds(ctx, execCase.keyspaceIDQuery.SQL, execCase.keyspaceIDQuery.Keyspace, execCase.keyspaceIDQuery.KeyspaceIds, execCase.keyspaceIDQuery.BindVariables, execCase.keyspaceIDQuery.TabletType)
stream, err := conn.StreamExecuteKeyspaceIds(ctx, execCase.keyspaceIDQuery.SQL, execCase.keyspaceIDQuery.Keyspace, execCase.keyspaceIDQuery.KeyspaceIds, execCase.keyspaceIDQuery.BindVariables, execCase.keyspaceIDQuery.TabletType, testExecuteOptions)
if err != nil {
t.Fatalf("StreamExecuteKeyspaceIds failed: %v", err)
}
@ -1443,7 +1477,7 @@ func testStreamExecuteKeyspaceIdsError(t *testing.T, conn *vtgateconn.VTGateConn
func testStreamExecuteKeyspaceIdsPanic(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := newContext()
execCase := execMap["request1"]
stream, err := conn.StreamExecuteKeyspaceIds(ctx, execCase.keyspaceIDQuery.SQL, execCase.keyspaceIDQuery.Keyspace, execCase.keyspaceIDQuery.KeyspaceIds, execCase.keyspaceIDQuery.BindVariables, execCase.keyspaceIDQuery.TabletType)
stream, err := conn.StreamExecuteKeyspaceIds(ctx, execCase.keyspaceIDQuery.SQL, execCase.keyspaceIDQuery.Keyspace, execCase.keyspaceIDQuery.KeyspaceIds, execCase.keyspaceIDQuery.BindVariables, execCase.keyspaceIDQuery.TabletType, testExecuteOptions)
if err != nil {
t.Fatal(err)
}
@ -1463,7 +1497,7 @@ func testTxPass(t *testing.T, conn *vtgateconn.VTGateConn) {
if err != nil {
t.Error(err)
}
_, err = tx.Execute(ctx, execCase.execQuery.SQL, execCase.execQuery.BindVariables, execCase.execQuery.TabletType)
_, err = tx.Execute(ctx, execCase.execQuery.SQL, execCase.execQuery.BindVariables, execCase.execQuery.TabletType, testExecuteOptions)
if err != nil {
t.Error(err)
}
@ -1477,7 +1511,7 @@ func testTxPass(t *testing.T, conn *vtgateconn.VTGateConn) {
if err != nil {
t.Error(err)
}
_, err = tx.ExecuteShards(ctx, execCase.shardQuery.SQL, execCase.shardQuery.Keyspace, execCase.shardQuery.Shards, execCase.shardQuery.BindVariables, execCase.shardQuery.TabletType)
_, err = tx.ExecuteShards(ctx, execCase.shardQuery.SQL, execCase.shardQuery.Keyspace, execCase.shardQuery.Shards, execCase.shardQuery.BindVariables, execCase.shardQuery.TabletType, testExecuteOptions)
if err != nil {
t.Error(err)
}
@ -1491,7 +1525,7 @@ func testTxPass(t *testing.T, conn *vtgateconn.VTGateConn) {
if err != nil {
t.Error(err)
}
_, err = tx.ExecuteKeyspaceIds(ctx, execCase.keyspaceIDQuery.SQL, execCase.keyspaceIDQuery.Keyspace, execCase.keyspaceIDQuery.KeyspaceIds, execCase.keyspaceIDQuery.BindVariables, execCase.keyspaceIDQuery.TabletType)
_, err = tx.ExecuteKeyspaceIds(ctx, execCase.keyspaceIDQuery.SQL, execCase.keyspaceIDQuery.Keyspace, execCase.keyspaceIDQuery.KeyspaceIds, execCase.keyspaceIDQuery.BindVariables, execCase.keyspaceIDQuery.TabletType, testExecuteOptions)
if err != nil {
t.Error(err)
}
@ -1505,7 +1539,7 @@ func testTxPass(t *testing.T, conn *vtgateconn.VTGateConn) {
if err != nil {
t.Error(err)
}
_, err = tx.ExecuteKeyRanges(ctx, execCase.keyRangeQuery.SQL, execCase.keyRangeQuery.Keyspace, execCase.keyRangeQuery.KeyRanges, execCase.keyRangeQuery.BindVariables, execCase.keyRangeQuery.TabletType)
_, err = tx.ExecuteKeyRanges(ctx, execCase.keyRangeQuery.SQL, execCase.keyRangeQuery.Keyspace, execCase.keyRangeQuery.KeyRanges, execCase.keyRangeQuery.BindVariables, execCase.keyRangeQuery.TabletType, testExecuteOptions)
if err != nil {
t.Error(err)
}
@ -1519,7 +1553,7 @@ func testTxPass(t *testing.T, conn *vtgateconn.VTGateConn) {
if err != nil {
t.Error(err)
}
_, err = tx.ExecuteEntityIds(ctx, execCase.entityIdsQuery.SQL, execCase.entityIdsQuery.Keyspace, execCase.entityIdsQuery.EntityColumnName, execCase.entityIdsQuery.EntityKeyspaceIDs, execCase.entityIdsQuery.BindVariables, execCase.entityIdsQuery.TabletType)
_, err = tx.ExecuteEntityIds(ctx, execCase.entityIdsQuery.SQL, execCase.entityIdsQuery.Keyspace, execCase.entityIdsQuery.EntityColumnName, execCase.entityIdsQuery.EntityKeyspaceIDs, execCase.entityIdsQuery.BindVariables, execCase.entityIdsQuery.TabletType, testExecuteOptions)
if err != nil {
t.Error(err)
}
@ -1533,7 +1567,7 @@ func testTxPass(t *testing.T, conn *vtgateconn.VTGateConn) {
if err != nil {
t.Error(err)
}
_, err = tx.ExecuteBatchShards(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType)
_, err = tx.ExecuteBatchShards(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, testExecuteOptions)
if err != nil {
t.Error(err)
}
@ -1547,7 +1581,7 @@ func testTxPass(t *testing.T, conn *vtgateconn.VTGateConn) {
if err != nil {
t.Error(err)
}
_, err = tx.ExecuteBatchKeyspaceIds(ctx, execCase.keyspaceIDBatchQuery.Queries, execCase.keyspaceIDBatchQuery.TabletType)
_, err = tx.ExecuteBatchKeyspaceIds(ctx, execCase.keyspaceIDBatchQuery.Queries, execCase.keyspaceIDBatchQuery.TabletType, testExecuteOptions)
if err != nil {
t.Error(err)
}
@ -1637,43 +1671,43 @@ func testTxFail(t *testing.T, conn *vtgateconn.VTGateConn) {
t.Errorf("Commit: %v, want %v", err, want)
}
_, err = tx.Execute(ctx, "", nil, topodatapb.TabletType_REPLICA)
_, err = tx.Execute(ctx, "", nil, topodatapb.TabletType_REPLICA, testExecuteOptions)
want = "execute: not in transaction"
if err == nil || err.Error() != want {
t.Errorf("Execute: %v, want %v", err, want)
}
_, err = tx.ExecuteShards(ctx, "", "", nil, nil, topodatapb.TabletType_REPLICA)
_, err = tx.ExecuteShards(ctx, "", "", nil, nil, topodatapb.TabletType_REPLICA, testExecuteOptions)
want = "executeShards: not in transaction"
if err == nil || err.Error() != want {
t.Errorf("ExecuteShards: %v, want %v", err, want)
}
_, err = tx.ExecuteKeyspaceIds(ctx, "", "", nil, nil, topodatapb.TabletType_REPLICA)
_, err = tx.ExecuteKeyspaceIds(ctx, "", "", nil, nil, topodatapb.TabletType_REPLICA, testExecuteOptions)
want = "executeKeyspaceIds: not in transaction"
if err == nil || err.Error() != want {
t.Errorf("ExecuteShards: %v, want %v", err, want)
}
_, err = tx.ExecuteKeyRanges(ctx, "", "", nil, nil, topodatapb.TabletType_REPLICA)
_, err = tx.ExecuteKeyRanges(ctx, "", "", nil, nil, topodatapb.TabletType_REPLICA, testExecuteOptions)
want = "executeKeyRanges: not in transaction"
if err == nil || err.Error() != want {
t.Errorf("ExecuteShards: %v, want %v", err, want)
}
_, err = tx.ExecuteEntityIds(ctx, "", "", "", nil, nil, topodatapb.TabletType_REPLICA)
_, err = tx.ExecuteEntityIds(ctx, "", "", "", nil, nil, topodatapb.TabletType_REPLICA, testExecuteOptions)
want = "executeEntityIds: not in transaction"
if err == nil || err.Error() != want {
t.Errorf("ExecuteShards: %v, want %v", err, want)
}
_, err = tx.ExecuteBatchShards(ctx, nil, topodatapb.TabletType_REPLICA)
_, err = tx.ExecuteBatchShards(ctx, nil, topodatapb.TabletType_REPLICA, testExecuteOptions)
want = "executeBatchShards: not in transaction"
if err == nil || err.Error() != want {
t.Errorf("ExecuteShards: %v, want %v", err, want)
}
_, err = tx.ExecuteBatchKeyspaceIds(ctx, nil, topodatapb.TabletType_REPLICA)
_, err = tx.ExecuteBatchKeyspaceIds(ctx, nil, topodatapb.TabletType_REPLICA, testExecuteOptions)
want = "executeBatchKeyspaceIds: not in transaction"
if err == nil || err.Error() != want {
t.Errorf("ExecuteShards: %v, want %v", err, want)
@ -1898,6 +1932,10 @@ var testCallerID = &vtrpcpb.CallerID{
Subcomponent: "test_subcomponent",
}
var testExecuteOptions = &querypb.ExecuteOptions{
ExcludeFieldNames: true,
}
var execMap = map[string]struct {
execQuery *queryExecute
shardQuery *queryExecuteShards

Просмотреть файл

@ -21,20 +21,20 @@ type VTGateService interface {
// Regular query execution.
// All these methods can change the provided session.
Execute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error)
ExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error)
ExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error)
ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error)
ExecuteEntityIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool) (*sqltypes.Result, error)
ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session) ([]sqltypes.Result, error)
ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session) ([]sqltypes.Result, error)
Execute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error)
ExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error)
ExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error)
ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error)
ExecuteEntityIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions) (*sqltypes.Result, error)
ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) ([]sqltypes.Result, error)
ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) ([]sqltypes.Result, error)
// Streaming queries
StreamExecute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error
StreamExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error
StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error
StreamExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, sendReply func(*sqltypes.Result) error) error
StreamExecute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error
StreamExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error
StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error
StreamExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodatapb.KeyRange, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions, sendReply func(*sqltypes.Result) error) error
// Transaction management

Просмотреть файл

@ -33,121 +33,121 @@ func (_m *MockVTGateService) EXPECT() *_MockVTGateServiceRecorder {
return _m.recorder
}
func (_m *MockVTGateService) Execute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodata.TabletType, session *vtgate.Session, notInTransaction bool) (*sqltypes.Result, error) {
ret := _m.ctrl.Call(_m, "Execute", ctx, sql, bindVariables, keyspace, tabletType, session, notInTransaction)
func (_m *MockVTGateService) Execute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodata.TabletType, session *vtgate.Session, notInTransaction bool, options *query.ExecuteOptions) (*sqltypes.Result, error) {
ret := _m.ctrl.Call(_m, "Execute", ctx, sql, bindVariables, keyspace, tabletType, session, notInTransaction, options)
ret0, _ := ret[0].(*sqltypes.Result)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockVTGateServiceRecorder) Execute(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "Execute", arg0, arg1, arg2, arg3, arg4, arg5, arg6)
func (_mr *_MockVTGateServiceRecorder) Execute(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "Execute", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
}
func (_m *MockVTGateService) ExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodata.TabletType, session *vtgate.Session, notInTransaction bool) (*sqltypes.Result, error) {
ret := _m.ctrl.Call(_m, "ExecuteShards", ctx, sql, bindVariables, keyspace, shards, tabletType, session, notInTransaction)
func (_m *MockVTGateService) ExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodata.TabletType, session *vtgate.Session, notInTransaction bool, options *query.ExecuteOptions) (*sqltypes.Result, error) {
ret := _m.ctrl.Call(_m, "ExecuteShards", ctx, sql, bindVariables, keyspace, shards, tabletType, session, notInTransaction, options)
ret0, _ := ret[0].(*sqltypes.Result)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockVTGateServiceRecorder) ExecuteShards(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ExecuteShards", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
func (_mr *_MockVTGateServiceRecorder) ExecuteShards(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ExecuteShards", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
}
func (_m *MockVTGateService) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodata.TabletType, session *vtgate.Session, notInTransaction bool) (*sqltypes.Result, error) {
ret := _m.ctrl.Call(_m, "ExecuteKeyspaceIds", ctx, sql, bindVariables, keyspace, keyspaceIds, tabletType, session, notInTransaction)
func (_m *MockVTGateService) ExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodata.TabletType, session *vtgate.Session, notInTransaction bool, options *query.ExecuteOptions) (*sqltypes.Result, error) {
ret := _m.ctrl.Call(_m, "ExecuteKeyspaceIds", ctx, sql, bindVariables, keyspace, keyspaceIds, tabletType, session, notInTransaction, options)
ret0, _ := ret[0].(*sqltypes.Result)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockVTGateServiceRecorder) ExecuteKeyspaceIds(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ExecuteKeyspaceIds", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
func (_mr *_MockVTGateServiceRecorder) ExecuteKeyspaceIds(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ExecuteKeyspaceIds", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
}
func (_m *MockVTGateService) ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodata.KeyRange, tabletType topodata.TabletType, session *vtgate.Session, notInTransaction bool) (*sqltypes.Result, error) {
ret := _m.ctrl.Call(_m, "ExecuteKeyRanges", ctx, sql, bindVariables, keyspace, keyRanges, tabletType, session, notInTransaction)
func (_m *MockVTGateService) ExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodata.KeyRange, tabletType topodata.TabletType, session *vtgate.Session, notInTransaction bool, options *query.ExecuteOptions) (*sqltypes.Result, error) {
ret := _m.ctrl.Call(_m, "ExecuteKeyRanges", ctx, sql, bindVariables, keyspace, keyRanges, tabletType, session, notInTransaction, options)
ret0, _ := ret[0].(*sqltypes.Result)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockVTGateServiceRecorder) ExecuteKeyRanges(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ExecuteKeyRanges", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
func (_mr *_MockVTGateServiceRecorder) ExecuteKeyRanges(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ExecuteKeyRanges", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
}
func (_m *MockVTGateService) ExecuteEntityIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgate.ExecuteEntityIdsRequest_EntityId, tabletType topodata.TabletType, session *vtgate.Session, notInTransaction bool) (*sqltypes.Result, error) {
ret := _m.ctrl.Call(_m, "ExecuteEntityIds", ctx, sql, bindVariables, keyspace, entityColumnName, entityKeyspaceIDs, tabletType, session, notInTransaction)
func (_m *MockVTGateService) ExecuteEntityIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgate.ExecuteEntityIdsRequest_EntityId, tabletType topodata.TabletType, session *vtgate.Session, notInTransaction bool, options *query.ExecuteOptions) (*sqltypes.Result, error) {
ret := _m.ctrl.Call(_m, "ExecuteEntityIds", ctx, sql, bindVariables, keyspace, entityColumnName, entityKeyspaceIDs, tabletType, session, notInTransaction, options)
ret0, _ := ret[0].(*sqltypes.Result)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockVTGateServiceRecorder) ExecuteEntityIds(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ExecuteEntityIds", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
func (_mr *_MockVTGateServiceRecorder) ExecuteEntityIds(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ExecuteEntityIds", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
}
func (_m *MockVTGateService) ExecuteBatchShards(ctx context.Context, queries []*vtgate.BoundShardQuery, tabletType topodata.TabletType, asTransaction bool, session *vtgate.Session) ([]sqltypes.Result, error) {
ret := _m.ctrl.Call(_m, "ExecuteBatchShards", ctx, queries, tabletType, asTransaction, session)
func (_m *MockVTGateService) ExecuteBatchShards(ctx context.Context, queries []*vtgate.BoundShardQuery, tabletType topodata.TabletType, asTransaction bool, session *vtgate.Session, options *query.ExecuteOptions) ([]sqltypes.Result, error) {
ret := _m.ctrl.Call(_m, "ExecuteBatchShards", ctx, queries, tabletType, asTransaction, session, options)
ret0, _ := ret[0].([]sqltypes.Result)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockVTGateServiceRecorder) ExecuteBatchShards(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ExecuteBatchShards", arg0, arg1, arg2, arg3, arg4)
func (_mr *_MockVTGateServiceRecorder) ExecuteBatchShards(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ExecuteBatchShards", arg0, arg1, arg2, arg3, arg4, arg5)
}
func (_m *MockVTGateService) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgate.BoundKeyspaceIdQuery, tabletType topodata.TabletType, asTransaction bool, session *vtgate.Session) ([]sqltypes.Result, error) {
ret := _m.ctrl.Call(_m, "ExecuteBatchKeyspaceIds", ctx, queries, tabletType, asTransaction, session)
func (_m *MockVTGateService) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgate.BoundKeyspaceIdQuery, tabletType topodata.TabletType, asTransaction bool, session *vtgate.Session, options *query.ExecuteOptions) ([]sqltypes.Result, error) {
ret := _m.ctrl.Call(_m, "ExecuteBatchKeyspaceIds", ctx, queries, tabletType, asTransaction, session, options)
ret0, _ := ret[0].([]sqltypes.Result)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockVTGateServiceRecorder) ExecuteBatchKeyspaceIds(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ExecuteBatchKeyspaceIds", arg0, arg1, arg2, arg3, arg4)
func (_mr *_MockVTGateServiceRecorder) ExecuteBatchKeyspaceIds(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ExecuteBatchKeyspaceIds", arg0, arg1, arg2, arg3, arg4, arg5)
}
func (_m *MockVTGateService) StreamExecute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodata.TabletType, sendReply func(*sqltypes.Result) error) error {
ret := _m.ctrl.Call(_m, "StreamExecute", ctx, sql, bindVariables, keyspace, tabletType, sendReply)
func (_m *MockVTGateService) StreamExecute(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, tabletType topodata.TabletType, options *query.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
ret := _m.ctrl.Call(_m, "StreamExecute", ctx, sql, bindVariables, keyspace, tabletType, options, sendReply)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockVTGateServiceRecorder) StreamExecute(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "StreamExecute", arg0, arg1, arg2, arg3, arg4, arg5)
func (_mr *_MockVTGateServiceRecorder) StreamExecute(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "StreamExecute", arg0, arg1, arg2, arg3, arg4, arg5, arg6)
}
func (_m *MockVTGateService) StreamExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodata.TabletType, sendReply func(*sqltypes.Result) error) error {
ret := _m.ctrl.Call(_m, "StreamExecuteShards", ctx, sql, bindVariables, keyspace, shards, tabletType, sendReply)
func (_m *MockVTGateService) StreamExecuteShards(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, shards []string, tabletType topodata.TabletType, options *query.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
ret := _m.ctrl.Call(_m, "StreamExecuteShards", ctx, sql, bindVariables, keyspace, shards, tabletType, options, sendReply)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockVTGateServiceRecorder) StreamExecuteShards(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "StreamExecuteShards", arg0, arg1, arg2, arg3, arg4, arg5, arg6)
func (_mr *_MockVTGateServiceRecorder) StreamExecuteShards(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "StreamExecuteShards", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
}
func (_m *MockVTGateService) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodata.TabletType, sendReply func(*sqltypes.Result) error) error {
ret := _m.ctrl.Call(_m, "StreamExecuteKeyspaceIds", ctx, sql, bindVariables, keyspace, keyspaceIds, tabletType, sendReply)
func (_m *MockVTGateService) StreamExecuteKeyspaceIds(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyspaceIds [][]byte, tabletType topodata.TabletType, options *query.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
ret := _m.ctrl.Call(_m, "StreamExecuteKeyspaceIds", ctx, sql, bindVariables, keyspace, keyspaceIds, tabletType, options, sendReply)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockVTGateServiceRecorder) StreamExecuteKeyspaceIds(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "StreamExecuteKeyspaceIds", arg0, arg1, arg2, arg3, arg4, arg5, arg6)
func (_mr *_MockVTGateServiceRecorder) StreamExecuteKeyspaceIds(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "StreamExecuteKeyspaceIds", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
}
func (_m *MockVTGateService) StreamExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodata.KeyRange, tabletType topodata.TabletType, sendReply func(*sqltypes.Result) error) error {
ret := _m.ctrl.Call(_m, "StreamExecuteKeyRanges", ctx, sql, bindVariables, keyspace, keyRanges, tabletType, sendReply)
func (_m *MockVTGateService) StreamExecuteKeyRanges(ctx context.Context, sql string, bindVariables map[string]interface{}, keyspace string, keyRanges []*topodata.KeyRange, tabletType topodata.TabletType, options *query.ExecuteOptions, sendReply func(*sqltypes.Result) error) error {
ret := _m.ctrl.Call(_m, "StreamExecuteKeyRanges", ctx, sql, bindVariables, keyspace, keyRanges, tabletType, options, sendReply)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockVTGateServiceRecorder) StreamExecuteKeyRanges(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "StreamExecuteKeyRanges", arg0, arg1, arg2, arg3, arg4, arg5, arg6)
func (_mr *_MockVTGateServiceRecorder) StreamExecuteKeyRanges(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "StreamExecuteKeyRanges", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
}
func (_m *MockVTGateService) Begin(ctx context.Context) (*vtgate.Session, error) {

Просмотреть файл

@ -64,7 +64,7 @@ func TestVitess(t *testing.T) {
t.Error(err)
return
}
_, err = conn.ExecuteShards(ctx, "select 1 from dual", "test_keyspace", []string{"0"}, nil, topodatapb.TabletType_MASTER)
_, err = conn.ExecuteShards(ctx, "select 1 from dual", "test_keyspace", []string{"0"}, nil, topodatapb.TabletType_MASTER, nil)
if err != nil {
t.Error(err)
return

Просмотреть файл

@ -58,7 +58,7 @@ func NewQueryResultReaderForTablet(ctx context.Context, ts topo.Server, tabletAl
Keyspace: tablet.Tablet.Keyspace,
Shard: tablet.Tablet.Shard,
TabletType: tablet.Tablet.Type,
}, sql, make(map[string]interface{}))
}, sql, make(map[string]interface{}), nil)
if err != nil {
return nil, err
}

Просмотреть файл

@ -231,7 +231,7 @@ type legacyTestQueryService struct {
*fakes.StreamHealthQueryService
}
func (sq *legacyTestQueryService) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sendReply func(reply *sqltypes.Result) error) error {
func (sq *legacyTestQueryService) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, options *querypb.ExecuteOptions, sendReply func(reply *sqltypes.Result) error) error {
// Custom parsing of the query we expect.
min := legacySplitCloneTestMin
max := legacySplitCloneTestMax

Просмотреть файл

@ -117,7 +117,7 @@ func (r *RestartableResultReader) startStream() (bool, error) {
Keyspace: r.tablet.Keyspace,
Shard: r.tablet.Shard,
TabletType: r.tablet.Type,
}, r.query, make(map[string]interface{}))
}, r.query, make(map[string]interface{}), nil)
if err != nil {
return true /* retryable */, fmt.Errorf("failed to call StreamExecute() for query '%v': %v", r.query, err)
}

Просмотреть файл

@ -322,7 +322,7 @@ func newTestQueryService(t *testing.T, target querypb.Target, shqs *fakes.Stream
}
}
func (sq *testQueryService) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sendReply func(reply *sqltypes.Result) error) error {
func (sq *testQueryService) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, options *querypb.ExecuteOptions, sendReply func(reply *sqltypes.Result) error) error {
// Custom parsing of the query we expect.
// Example: SELECT `id`, `msg`, `keyspace_id` FROM table1 WHERE id>=180 AND id<190 ORDER BY id
min := math.MinInt32

Просмотреть файл

@ -36,7 +36,7 @@ type destinationTabletServer struct {
excludedTable string
}
func (sq *destinationTabletServer) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sendReply func(reply *sqltypes.Result) error) error {
func (sq *destinationTabletServer) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, options *querypb.ExecuteOptions, sendReply func(reply *sqltypes.Result) error) error {
if strings.Contains(sql, sq.excludedTable) {
sq.t.Errorf("Split Diff operation on destination should skip the excluded table: %v query: %v", sq.excludedTable, sql)
}
@ -98,7 +98,7 @@ type sourceTabletServer struct {
v3 bool
}
func (sq *sourceTabletServer) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sendReply func(reply *sqltypes.Result) error) error {
func (sq *sourceTabletServer) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, options *querypb.ExecuteOptions, sendReply func(reply *sqltypes.Result) error) error {
if strings.Contains(sql, sq.excludedTable) {
sq.t.Errorf("Split Diff operation on source should skip the excluded table: %v query: %v", sq.excludedTable, sql)
}

Просмотреть файл

@ -34,7 +34,7 @@ type verticalDiffTabletServer struct {
*fakes.StreamHealthQueryService
}
func (sq *verticalDiffTabletServer) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sendReply func(reply *sqltypes.Result) error) error {
func (sq *verticalDiffTabletServer) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, options *querypb.ExecuteOptions, sendReply func(reply *sqltypes.Result) error) error {
if !strings.Contains(sql, "moving1") {
sq.t.Errorf("Vertical Split Diff operation should only operate on the 'moving1' table. query: %v", sql)
}

Просмотреть файл

@ -174,6 +174,14 @@ message BoundQuery {
map<string, BindVariable> bind_variables = 2;
}
// ExecuteOptions is passed around for all Execute calls.
message ExecuteOptions {
// If set, the resulting Field array wont have a Name, just a Type.
// This is an optimization for high-QPS queries where the client knows
// what it's getting.
bool exclude_field_names = 1;
}
// Field describes a single column returned by a query
message Field {
// name of the field as returned by mysql C API
@ -248,6 +256,7 @@ message ExecuteRequest {
Target target = 3;
BoundQuery query = 4;
int64 transaction_id = 5;
ExecuteOptions options = 6;
}
// ExecuteResponse is the returned value from Execute
@ -263,6 +272,7 @@ message ExecuteBatchRequest {
repeated BoundQuery queries = 4;
bool as_transaction = 5;
int64 transaction_id = 6;
ExecuteOptions options = 7;
}
// ExecuteBatchResponse is the returned value from ExecuteBatch
@ -276,6 +286,7 @@ message StreamExecuteRequest {
VTGateCallerID immediate_caller_id = 2;
Target target = 3;
BoundQuery query = 4;
ExecuteOptions options = 5;
}
// StreamExecuteResponse is the returned value from StreamExecute
@ -323,6 +334,7 @@ message BeginExecuteRequest {
VTGateCallerID immediate_caller_id = 2;
Target target = 3;
BoundQuery query = 4;
ExecuteOptions options = 5;
}
// BeginExecuteResponse is the returned value from BeginExecute
@ -345,6 +357,7 @@ message BeginExecuteBatchRequest {
Target target = 3;
repeated BoundQuery queries = 4;
bool as_transaction = 5;
ExecuteOptions options = 6;
}
// BeginExecuteBatchResponse is the returned value from BeginExecuteBatch

Просмотреть файл

@ -44,6 +44,9 @@ message ExecuteRequest {
// keyspace to target the query to.
string keyspace = 6;
// options
query.ExecuteOptions options = 7;
}
// ExecuteResponse is the returned value from Execute.
@ -84,6 +87,9 @@ message ExecuteShardsRequest {
// not_in_transaction is deprecated and should not be used.
bool not_in_transaction = 7;
// options
query.ExecuteOptions options = 8;
}
// ExecuteShardsResponse is the returned value from ExecuteShards.
@ -125,6 +131,9 @@ message ExecuteKeyspaceIdsRequest {
// not_in_transaction is deprecated and should not be used.
bool not_in_transaction = 7;
// options
query.ExecuteOptions options = 8;
}
// ExecuteKeyspaceIdsResponse is the returned value from ExecuteKeyspaceIds.
@ -166,6 +175,9 @@ message ExecuteKeyRangesRequest {
// not_in_transaction is deprecated and should not be used.
bool not_in_transaction = 7;
// options
query.ExecuteOptions options = 8;
}
// ExecuteKeyRangesResponse is the returned value from ExecuteKeyRanges.
@ -221,6 +233,9 @@ message ExecuteEntityIdsRequest {
// not_in_transaction is deprecated and should not be used.
bool not_in_transaction = 8;
// options
query.ExecuteOptions options = 9;
}
// ExecuteEntityIdsResponse is the returned value from ExecuteEntityIds.
@ -271,6 +286,9 @@ message ExecuteBatchShardsRequest {
// (this can be seen as adding a 'begin' before and 'commit' after the queries).
// Only makes sense if tablet_type is master. If set, the Session is ignored.
bool as_transaction = 5;
// options
query.ExecuteOptions options = 6;
}
// ExecuteBatchShardsResponse is the returned value from ExecuteBatchShards.
@ -321,6 +339,9 @@ message ExecuteBatchKeyspaceIdsRequest {
// (this can be seen as adding a 'begin' before and 'commit' after the queries).
// Only makes sense if tablet_type is master. If set, the Session is ignored.
bool as_transaction = 5;
// options
query.ExecuteOptions options = 6;
}
// ExecuteBatchKeyspaceIdsResponse is the returned value from ExecuteBatchKeyspaceId.
@ -351,6 +372,9 @@ message StreamExecuteRequest {
// keyspace to target the query to.
string keyspace = 4;
// options
query.ExecuteOptions options = 5;
}
// StreamExecuteResponse is the returned value from StreamExecute.
@ -378,6 +402,9 @@ message StreamExecuteShardsRequest {
// tablet_type is the type of tablets that this query is targeted to.
topodata.TabletType tablet_type = 5;
// options
query.ExecuteOptions options = 6;
}
// StreamExecuteShardsResponse is the returned value from StreamExecuteShards.
@ -406,6 +433,9 @@ message StreamExecuteKeyspaceIdsRequest {
// tablet_type is the type of tablets that this query is targeted to.
topodata.TabletType tablet_type = 5;
// options
query.ExecuteOptions options = 6;
}
// StreamExecuteKeyspaceIdsResponse is the returned value from StreamExecuteKeyspaceIds.
@ -434,6 +464,9 @@ message StreamExecuteKeyRangesRequest {
// tablet_type is the type of tablets that this query is targeted to.
topodata.TabletType tablet_type = 5;
// options
query.ExecuteOptions options = 6;
}
// StreamExecuteKeyRangesResponse is the returned value from StreamExecuteKeyRanges.

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -710,13 +710,15 @@ class Tablet(object):
if Tablet.tablets_running > 0:
raise utils.TestError('This test is not killing all its vttablets')
def execute(self, sql, bindvars=None, transaction_id=None, auto_log=True):
def execute(self, sql, bindvars=None, transaction_id=None,
execute_options=None, auto_log=True):
"""execute uses 'vtctl VtTabletExecute' to execute a command.
Args:
sql: the command to execute.
bindvars: a dict of bind variables.
transaction_id: the id of the transaction to use if necessary.
execute_options: proto-encoded ExecuteOptions object.
auto_log: passed to run_vtctl.
Returns:
@ -729,6 +731,8 @@ class Tablet(object):
args.extend(['-bind_variables', json.dumps(bindvars)])
if transaction_id:
args.extend(['-transaction_id', str(transaction_id)])
if execute_options:
args.extend(['-options', execute_options])
args.extend([self.tablet_alias, sql])
return utils.run_vtctl_json(args, auto_log=auto_log)

Просмотреть файл

@ -92,10 +92,20 @@ class TestTabletManager(unittest.TestCase):
tablet_62344.start_vttablet()
# make sure the query service is started right away
qr = tablet_62344.execute('select * from vt_select_test')
# make sure the query service is started right away.
qr = tablet_62344.execute('select id, msg from vt_select_test')
self.assertEqual(len(qr['rows']), 4,
'expected 4 rows in vt_select_test: %s' % str(qr))
self.assertEqual(qr['fields'][0]['name'], 'id')
self.assertEqual(qr['fields'][1]['name'], 'msg')
# test exclude_field_names to vttablet works as expected.
qr = tablet_62344.execute('select id, msg from vt_select_test',
execute_options='exclude_field_names:true ')
self.assertEqual(len(qr['rows']), 4,
'expected 4 rows in vt_select_test: %s' % str(qr))
self.assertNotIn('name', qr['fields'][0])
self.assertNotIn('name', qr['fields'][1])
# make sure direct dba queries work
query_result = utils.run_vtctl_json(

Просмотреть файл

@ -651,14 +651,27 @@ class VtGate(object):
return json.loads(out), err
return out, err
def execute(self, sql, tablet_type='master', bindvars=None):
"""Uses 'vtctl VtGateExecute' to execute a command."""
def execute(self, sql, tablet_type='master', bindvars=None,
execute_options=None):
"""Uses 'vtctl VtGateExecute' to execute a command.
Args:
sql: the command to execute.
tablet_type: the tablet_type to use.
bindvars: a dict of bind variables.
execute_options: proto-encoded ExecuteOptions object.
Returns:
the result of running vtctl command.
"""
_, addr = self.rpc_endpoint()
args = ['VtGateExecute', '-json',
'-server', addr,
'-tablet_type', tablet_type]
if bindvars:
args.extend(['-bind_variables', json.dumps(bindvars)])
if execute_options:
args.extend(['-options', execute_options])
args.append(sql)
return run_vtctl_json(args)

Просмотреть файл

@ -1031,6 +1031,17 @@ class TestVTGateFunctions(unittest.TestCase):
'select user_id, email from vt_user_extra where user_id = :user_id',
bindvars={'user_id': 11})
logging.debug('Original row: %s', str(qr))
self.assertEqual(qr['fields'][0]['name'], 'user_id')
self.assertEqual(len(qr['rows']), 1)
v = qr['rows'][0][1]
self.assertEqual(v, 'test 11')
# test using exclude_field_names works.
qr = utils.vtgate.execute(
'select user_id, email from vt_user_extra where user_id = :user_id',
bindvars={'user_id': 11}, execute_options='exclude_field_names:true ')
logging.debug('Original row: %s', str(qr))
self.assertNotIn('name', qr['fields'][0])
self.assertEqual(len(qr['rows']), 1)
v = qr['rows'][0][1]
self.assertEqual(v, 'test 11')