Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions changelog/23.0/23.0.0/summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,25 @@

### Table of Contents
- **[Minor Changes](#minor-changes)**
- **[Deletions](#deletions)**
- [Metrics](#deleted-metrics)
- **[VTTablet](#minor-changes-vttablet)**
- [CLI Flags](#flags-vttablet)
- [Managed MySQL configuration defaults to caching-sha2-password](#mysql-caching-sha2-password)

## <a id="minor-changes"/>Minor Changes</a>

### <a id="deletions"/>Deletions</a>

#### <a id="deleted-metrics"/>Metrics</a>

| Component | Metric Name | Was Deprecated In | Deprecation PR |
|:---------:|:-------------------------:|:-----------------:|:-------------------------------------------------------:|
| `vtgate` | `QueriesProcessed` | `v22.0.0` | [#17727](https://github.com/vitessio/vitess/pull/17727) |
| `vtgate` | `QueriesRouted` | `v22.0.0` | [#17727](https://github.com/vitessio/vitess/pull/17727) |
| `vtgate` | `QueriesProcessedByTable` | `v22.0.0` | [#17727](https://github.com/vitessio/vitess/pull/17727) |
| `vtgate` | `QueriesRoutedByTable` | `v22.0.0` | [#17727](https://github.com/vitessio/vitess/pull/17727) |

### <a id="minor-changes-vttablet"/>VTTablet</a>

#### <a id="flags-vttablet"/>CLI Flags</a>
Expand Down
34 changes: 34 additions & 0 deletions go/test/endtoend/vtgate/queries/misc/join_output1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"OperatorType": "Join",
"Variant": "Join",
"JoinColumnIndexes": "L:0,L:1,R:0",
"JoinVars": {
"tbl_nonunq_col": 1
},
"Inputs": [
{
"OperatorType": "Route",
"Variant": "Scatter",
"Keyspace": {
"Name": "ks_misc",
"Sharded": true
},
"FieldQuery": "select tbl.unq_col, tbl.nonunq_col from tbl where 1 != 1",
"Query": "select tbl.unq_col, tbl.nonunq_col from tbl"
},
{
"OperatorType": "Route",
"Variant": "EqualUnique",
"Keyspace": {
"Name": "ks_misc",
"Sharded": true
},
"FieldQuery": "select t1.id2 from t1 where 1 != 1",
"Query": "select t1.id2 from t1 where t1.id1 = :tbl_nonunq_col /* INT64 */",
"Values": [
":tbl_nonunq_col"
],
"Vindex": "hash"
}
]
}
58 changes: 58 additions & 0 deletions go/test/endtoend/vtgate/queries/misc/join_output2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"OperatorType": "Join",
"Variant": "Join",
"JoinColumnIndexes": "R:0,R:1,L:0",
"JoinVars": {
"t1_id1": 1
},
"Inputs": [
{
"OperatorType": "Route",
"Variant": "Scatter",
"Keyspace": {
"Name": "ks_misc",
"Sharded": true
},
"FieldQuery": "select t1.id2, t1.id1 from t1 where 1 != 1",
"Query": "select t1.id2, t1.id1 from t1"
},
{
"OperatorType": "VindexLookup",
"Variant": "Equal",
"Keyspace": {
"Name": "ks_misc",
"Sharded": true
},
"Values": [
":t1_id1"
],
"Vindex": "nonunq_vdx",
"Inputs": [
{
"OperatorType": "Route",
"Variant": "IN",
"Keyspace": {
"Name": "ks_misc",
"Sharded": true
},
"FieldQuery": "select nonunq_col, keyspace_id from nonunq_idx where 1 != 1",
"Query": "select nonunq_col, keyspace_id from nonunq_idx where nonunq_col in ::__vals",
"Values": [
"::nonunq_col"
],
"Vindex": "hash"
},
{
"OperatorType": "Route",
"Variant": "ByDestination",
"Keyspace": {
"Name": "ks_misc",
"Sharded": true
},
"FieldQuery": "select tbl.unq_col, tbl.nonunq_col from tbl where 1 != 1",
"Query": "select tbl.unq_col, tbl.nonunq_col from tbl where tbl.nonunq_col = :t1_id1 /* INT64 */"
}
]
}
]
}
13 changes: 11 additions & 2 deletions go/test/endtoend/vtgate/queries/misc/misc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package misc
import (
"context"
"database/sql"
_ "embed"
"fmt"
"strings"
"testing"
Expand Down Expand Up @@ -645,6 +646,12 @@ func TestAlterTableWithView(t *testing.T) {
mcmp.AssertMatches("select * from v1", `[[INT64(1) INT64(1)]]`)
}

//go:embed join_output1.json
var expJoinOutput1 string

//go:embed join_output2.json
var expJoinOutput2 string

// TestStraightJoin tests that Vitess respects the ordering of join in a STRAIGHT JOIN query.
func TestStraightJoin(t *testing.T) {
mcmp, closer := start(t)
Expand All @@ -659,7 +666,8 @@ func TestStraightJoin(t *testing.T) {
// Verify that in a normal join query, vitess joins tbl with t1.
res, err := mcmp.VtConn.ExecuteFetch("vexplain plan select tbl.unq_col, tbl.nonunq_col, t1.id2 from t1 join tbl where t1.id1 = tbl.nonunq_col", 100, false)
require.NoError(t, err)
require.Contains(t, fmt.Sprintf("%v", res.Rows), "tbl_t1")
require.Len(t, res.Rows, 1)
require.JSONEq(t, expJoinOutput1, res.Rows[0][0].ToString())

// Test the same query with a straight join
mcmp.AssertMatchesNoOrder("select tbl.unq_col, tbl.nonunq_col, t1.id2 from t1 straight_join tbl where t1.id1 = tbl.nonunq_col",
Expand All @@ -668,7 +676,8 @@ func TestStraightJoin(t *testing.T) {
// Verify that in a straight join query, vitess joins t1 with tbl.
res, err = mcmp.VtConn.ExecuteFetch("vexplain plan select tbl.unq_col, tbl.nonunq_col, t1.id2 from t1 straight_join tbl where t1.id1 = tbl.nonunq_col", 100, false)
require.NoError(t, err)
require.Contains(t, fmt.Sprintf("%v", res.Rows), "t1_tbl")
require.Len(t, res.Rows, 1)
require.JSONEq(t, expJoinOutput2, res.Rows[0][0].ToString())
}

func TestFailingOuterJoinInOLAP(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/endtoend/vstream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ recvLoop:
// The last response, when the vstream copy completes, does not
// typically contain ROW events.
if beginEventSeen || commitEventSeen {
require.True(t, (beginEventSeen && commitEventSeen), "did not receive both BEGIN and COMMIT events in the final ROW event set")
require.True(t, beginEventSeen && commitEventSeen, "did not receive both BEGIN and COMMIT events in the final ROW event set")
}
}

Expand Down
4 changes: 1 addition & 3 deletions go/vt/vtgate/engine/cached_size.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 1 addition & 31 deletions go/vt/vtgate/engine/concatenate.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,36 +56,6 @@ func NewConcatenate(Sources []Primitive, ignoreCols []int) *Concatenate {
}
}

// RouteType returns a description of the query routing type used by the primitive
func (c *Concatenate) RouteType() string {
return "Concatenate"
}

// GetKeyspaceName specifies the Keyspace that this primitive routes to
func (c *Concatenate) GetKeyspaceName() string {
res := c.Sources[0].GetKeyspaceName()
for i := 1; i < len(c.Sources); i++ {
res = formatTwoOptionsNicely(res, c.Sources[i].GetKeyspaceName())
}
return res
}

// GetTableName specifies the table that this primitive routes to.
func (c *Concatenate) GetTableName() string {
res := c.Sources[0].GetTableName()
for i := 1; i < len(c.Sources); i++ {
res = formatTwoOptionsNicely(res, c.Sources[i].GetTableName())
}
return res
}

func formatTwoOptionsNicely(a, b string) string {
if a == b {
return a
}
return a + "_" + b
}

// errWrongNumberOfColumnsInSelect is an error
var errWrongNumberOfColumnsInSelect = vterrors.NewErrorf(vtrpcpb.Code_FAILED_PRECONDITION, vterrors.WrongNumberOfColumnsInSelect, "The used SELECT statements have a different number of columns")

Expand Down Expand Up @@ -480,5 +450,5 @@ func (c *Concatenate) Inputs() ([]Primitive, []map[string]any) {
}

func (c *Concatenate) description() PrimitiveDescription {
return PrimitiveDescription{OperatorType: c.RouteType()}
return PrimitiveDescription{OperatorType: "Concatenate"}
}
15 changes: 2 additions & 13 deletions go/vt/vtgate/engine/dbddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,24 +78,13 @@ func NewDBDDL(dbName string, create bool, timeout int) *DBDDL {
}
}

// RouteType implements the Primitive interface
func (c *DBDDL) RouteType() string {
func (c *DBDDL) routeType() string {
if c.create {
return "CreateDB"
}
return "DropDB"
}

// GetKeyspaceName implements the Primitive interface
func (c *DBDDL) GetKeyspaceName() string {
return c.name
}

// GetTableName implements the Primitive interface
func (c *DBDDL) GetTableName() string {
return ""
}

// TryExecute implements the Primitive interface
func (c *DBDDL) TryExecute(ctx context.Context, vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
name := vcursor.GetDBDDLPluginName()
Expand Down Expand Up @@ -199,7 +188,7 @@ func (c *DBDDL) GetFields(context.Context, VCursor, map[string]*querypb.BindVari
// description implements the Primitive interface
func (c *DBDDL) description() PrimitiveDescription {
return PrimitiveDescription{
OperatorType: strings.ToUpper(c.RouteType()),
OperatorType: strings.ToUpper(c.routeType()),
Keyspace: &vindexes.Keyspace{Name: c.name},
}
}
15 changes: 0 additions & 15 deletions go/vt/vtgate/engine/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,6 @@ func (ddl *DDL) description() PrimitiveDescription {
}
}

// RouteType implements the Primitive interface
func (ddl *DDL) RouteType() string {
return "DDL"
}

// GetKeyspaceName implements the Primitive interface
func (ddl *DDL) GetKeyspaceName() string {
return ddl.Keyspace.Name
}

// GetTableName implements the Primitive interface
func (ddl *DDL) GetTableName() string {
return ddl.DDL.GetTable().Name.String()
}

// IsOnlineSchemaDDL returns true if the query is an online schema change DDL
func (ddl *DDL) isOnlineSchemaDDL() bool {
switch ddl.DDL.GetAction() {
Expand Down
1 change: 0 additions & 1 deletion go/vt/vtgate/engine/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ func (del *Delete) isVindexModified() bool {
func (del *Delete) description() PrimitiveDescription {
other := map[string]any{
"Query": del.Query,
"Table": del.GetTableName(),
"OwnedVindexQuery": del.OwnedVindexQuery,
"MultiShardAutocommit": del.MultiShardAutocommit,
"QueryTimeout": del.QueryTimeout,
Expand Down
15 changes: 0 additions & 15 deletions go/vt/vtgate/engine/distinct.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,6 @@ func (d *Distinct) TryStreamExecute(ctx context.Context, vcursor VCursor, bindVa
return err
}

// RouteType implements the Primitive interface
func (d *Distinct) RouteType() string {
return d.Source.RouteType()
}

// GetKeyspaceName implements the Primitive interface
func (d *Distinct) GetKeyspaceName() string {
return d.Source.GetKeyspaceName()
}

// GetTableName implements the Primitive interface
func (d *Distinct) GetTableName() string {
return d.Source.GetTableName()
}

// GetFields implements the Primitive interface
func (d *Distinct) GetFields(ctx context.Context, vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error) {
return d.Source.GetFields(ctx, vcursor, bindVars)
Expand Down
26 changes: 0 additions & 26 deletions go/vt/vtgate/engine/dml.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ package engine
import (
"context"
"fmt"
"sort"
"strings"

"vitess.io/vitess/go/sqltypes"
"vitess.io/vitess/go/vt/key"
Expand Down Expand Up @@ -99,30 +97,6 @@ func (dml *DML) execMultiDestination(ctx context.Context, primitive Primitive, v
return dml.execMultiShard(ctx, primitive, vcursor, rss, queries)
}

// RouteType returns a description of the query routing type used by the primitive
func (dml *DML) RouteType() string {
return dml.Opcode.String()
}

// GetKeyspaceName specifies the Keyspace that this primitive routes to.
func (dml *DML) GetKeyspaceName() string {
return dml.Keyspace.Name
}

// GetTableName specifies the table that this primitive routes to.
func (dml *DML) GetTableName() string {
sort.Strings(dml.TableNames)
var tableNames []string
var previousTbl string
for _, name := range dml.TableNames {
if name != previousTbl {
tableNames = append(tableNames, name)
previousTbl = name
}
}
return strings.Join(tableNames, ", ")
}

func allowOnlyPrimary(rss ...*srvtopo.ResolvedShard) error {
for _, rs := range rss {
if rs != nil && rs.Target.TabletType != topodatapb.TabletType_PRIMARY {
Expand Down
12 changes: 0 additions & 12 deletions go/vt/vtgate/engine/dml_with_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,6 @@ type DMLWithInput struct {
BVList []map[string]int
}

func (dml *DMLWithInput) RouteType() string {
return "DMLWithInput"
}

func (dml *DMLWithInput) GetKeyspaceName() string {
return dml.Input.GetKeyspaceName()
}

func (dml *DMLWithInput) GetTableName() string {
return dml.Input.GetTableName()
}

func (dml *DMLWithInput) Inputs() ([]Primitive, []map[string]any) {
return append([]Primitive{dml.Input}, dml.DMLs...), nil
}
Expand Down
Loading
Loading