From 2b5e7e546f2879121420572fdd73152eaae848f7 Mon Sep 17 00:00:00 2001 From: Jeremy Cole Date: Wed, 11 Jan 2023 16:09:21 -0800 Subject: [PATCH 1/9] Add new placement Vindex strategy Signed-off-by: Jeremy Cole Sprinkle addPadding everywhere when comparing KeyRange Start/End values Implement support for PartialVindex usage Signed-off-by: Jeremy Cole (cherry picked from commit 7424fff6d5b1069e76d1c34a26de61227772129b) (cherry picked from commit 69e6248e0691404ff6008275f3f3c0c0de12e6fa) (cherry picked from commit 8390560c27125ba62dfdfd3853e67d141bd0d268) --- go/vt/vtgate/vindexes/placement.go | 224 +++++++++++++++ go/vt/vtgate/vindexes/placement_test.go | 354 ++++++++++++++++++++++++ 2 files changed, 578 insertions(+) create mode 100644 go/vt/vtgate/vindexes/placement.go create mode 100644 go/vt/vtgate/vindexes/placement_test.go diff --git a/go/vt/vtgate/vindexes/placement.go b/go/vt/vtgate/vindexes/placement.go new file mode 100644 index 00000000000..4382bc95c83 --- /dev/null +++ b/go/vt/vtgate/vindexes/placement.go @@ -0,0 +1,224 @@ +/* +Copyright 2022 The Vitess Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +/* + +A Vindex which uses a mapping lookup table `placement_map` to set the first `placement_prefix_bytes` of the Keyspace ID +and another Vindex type `placement_sub_vindex_type` (which must support Hashing) as a sub-Vindex to set the rest. +This is suitable for regional sharding (like region_json or region_experimental) but does not require a mapping file, +and can support non-integer types for the sharding column. All parameters are prefixed with `placement_` so as to avoid +conflict, because the `params` map is passed to the sub-Vindex as well. + +*/ + +package vindexes + +import ( + "bytes" + "context" + "encoding/binary" + "fmt" + "strconv" + "strings" + + vtrpcpb "vitess.io/vitess/go/vt/proto/vtrpc" + "vitess.io/vitess/go/vt/vterrors" + + "vitess.io/vitess/go/sqltypes" + "vitess.io/vitess/go/vt/key" +) + +var ( + _ MultiColumn = (*Placement)(nil) + + PlacementRequiredParams = []string{ + "placement_map", + "placement_prefix_bytes", + "placement_sub_vindex_type", + } +) + +func init() { + Register("placement", NewPlacement) +} + +type PlacementMap map[string]uint64 + +type Placement struct { + name string + placementMap PlacementMap + subVindex Vindex + subVindexType string + subVindexName string + prefixBytes int +} + +// Parse a string containing a list of delimited string:integer key-value pairs, e.g. "foo:1,bar:2". +func parsePlacementMap(s string) (*PlacementMap, error) { + placementMap := make(PlacementMap) + for _, entry := range strings.Split(s, ",") { + if entry == "" { + continue + } + + kv := strings.Split(entry, ":") + if len(kv) != 2 { + return nil, fmt.Errorf("entry: %v; expected key:value", entry) + } + if kv[0] == "" { + return nil, fmt.Errorf("entry: %v; unexpected empty key", entry) + } + if kv[1] == "" { + return nil, fmt.Errorf("entry: %v; unexpected empty value", entry) + } + + value, err := strconv.ParseUint(kv[1], 0, 64) + if err != nil { + return nil, fmt.Errorf("entry: %v; %v", entry, err) + } + placementMap[kv[0]] = value + } + return &placementMap, nil +} + +func NewPlacement(name string, params map[string]string) (Vindex, error) { + var missingParams []string + for _, param := range PlacementRequiredParams { + if params[param] == "" { + missingParams = append(missingParams, param) + } + } + + if len(missingParams) > 0 { + return nil, fmt.Errorf("missing params: %s", strings.Join(missingParams, ", ")) + } + + placementMap, parseError := parsePlacementMap(params["placement_map"]) + if parseError != nil { + return nil, fmt.Errorf("malformed placement_map; %v", parseError) + } + + prefixBytes, prefixError := strconv.Atoi(params["placement_prefix_bytes"]) + if prefixError != nil { + return nil, prefixError + } + + if prefixBytes < 1 || prefixBytes > 7 { + return nil, fmt.Errorf("invalid placement_prefix_bytes: %v; expected integer between 1 and 7", prefixBytes) + } + + subVindexType := params["placement_sub_vindex_type"] + subVindexName := fmt.Sprintf("%s_sub_vindex", name) + subVindex, createVindexError := CreateVindex(subVindexType, subVindexName, params) + if createVindexError != nil { + return nil, fmt.Errorf("invalid placement_sub_vindex_type: %v", createVindexError) + } + + // TODO: Should we support MultiColumn Vindex? + if _, subVindexSupportsHashing := subVindex.(Hashing); !subVindexSupportsHashing { + return nil, fmt.Errorf("invalid placement_sub_vindex_type: %v; does not support the Hashing interface", createVindexError) + } + + return &Placement{ + name: name, + placementMap: *placementMap, + subVindex: subVindex, + subVindexType: subVindexType, + subVindexName: subVindexName, + prefixBytes: prefixBytes, + }, nil +} + +func (p *Placement) String() string { + return p.name +} + +func (p *Placement) Cost() int { + return 1 +} + +func (p *Placement) IsUnique() bool { + return true +} + +func (p *Placement) NeedsVCursor() bool { + return false +} + +func (p *Placement) PartialVindex() bool { + return true +} + +func makeDestinationPrefix(value uint64, prefixBytes int) []byte { + destinationPrefix := make([]byte, 8) + binary.BigEndian.PutUint64(destinationPrefix, value) + if prefixBytes < 8 { + // Shorten the prefix to the desired length. + destinationPrefix = destinationPrefix[(8 - prefixBytes):] + } + + return destinationPrefix +} + +func (p *Placement) Map(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value) ([]key.Destination, error) { + destinations := make([]key.Destination, 0, len(rowsColValues)) + + for _, row := range rowsColValues { + if len(row) != 1 && len(row) != 2 { + return nil, vterrors.Errorf(vtrpcpb.Code_INTERNAL, "wrong number of column values were passed: expected 1-2, got %d", len(row)) + } + + // Calculate the destination prefix from the placement key which will be the same whether this is a partial + // or full usage of the Vindex. + placementKey := row[0].ToString() + placementDestinationValue, placementMappingFound := p.placementMap[placementKey] + if !placementMappingFound { + destinations = append(destinations, key.DestinationNone{}) + continue + } + + placementDestinationPrefix := makeDestinationPrefix(placementDestinationValue, p.prefixBytes) + + if len(row) == 1 { // Partial Vindex usage with only the placement column provided. + destinations = append(destinations, NewKeyRangeFromPrefix(placementDestinationPrefix)) + } else if len(row) == 2 { // Full Vindex usage with the placement column and subVindex column provided. + subVindexValue, hashingError := p.subVindex.(Hashing).Hash(row[1]) + if hashingError != nil { + return nil, hashingError // TODO: Should we be less fatal here and use DestinationNone? + } + + // Concatenate and add to destinations. + rowDestination := append(placementDestinationPrefix, subVindexValue...) + destinations = append(destinations, key.DestinationKeyspaceID(rowDestination[0:8])) + } + } + + return destinations, nil +} + +func (p *Placement) Verify(ctx context.Context, vcursor VCursor, rowsColValues [][]sqltypes.Value, keyspaceIDs [][]byte) ([]bool, error) { + result := make([]bool, len(rowsColValues)) + destinations, _ := p.Map(ctx, vcursor, rowsColValues) + for i, destination := range destinations { + switch d := destination.(type) { + case key.DestinationKeyspaceID: + result[i] = bytes.Equal(d, keyspaceIDs[i]) + default: + result[i] = false + } + } + return result, nil +} diff --git a/go/vt/vtgate/vindexes/placement_test.go b/go/vt/vtgate/vindexes/placement_test.go new file mode 100644 index 00000000000..c590f1de3e8 --- /dev/null +++ b/go/vt/vtgate/vindexes/placement_test.go @@ -0,0 +1,354 @@ +/* +Copyright 2022 The Vitess Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package vindexes + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "vitess.io/vitess/go/sqltypes" + "vitess.io/vitess/go/vt/key" +) + +func createBasicPlacementVindex(t *testing.T) (Vindex, error) { + return CreateVindex("placement", "placement", map[string]string{ + "table": "t", + "from": "f1,f2", + "to": "toc", + "placement_prefix_bytes": "1", + "placement_map": "foo:1,bar:2", + "placement_sub_vindex_type": "xxhash", + }) +} + +func TestPlacementName(t *testing.T) { + vindex, err := createBasicPlacementVindex(t) + require.NoError(t, err) + assert.Equal(t, "placement", vindex.String()) +} + +func TestPlacementCost(t *testing.T) { + vindex, err := createBasicPlacementVindex(t) + require.NoError(t, err) + assert.Equal(t, 1, vindex.Cost()) +} + +func TestPlacementIsUnique(t *testing.T) { + vindex, err := createBasicPlacementVindex(t) + require.NoError(t, err) + assert.True(t, vindex.IsUnique()) +} + +func TestPlacementNeedsVCursor(t *testing.T) { + vindex, err := createBasicPlacementVindex(t) + require.NoError(t, err) + assert.False(t, vindex.NeedsVCursor()) +} + +func TestPlacementNoParams(t *testing.T) { + _, err := CreateVindex("placement", "placement", nil) + assert.EqualError(t, err, "missing params: placement_map, placement_prefix_bytes, placement_sub_vindex_type") +} + +func TestPlacementPlacementMapMissing(t *testing.T) { + _, err := CreateVindex("placement", "placement", map[string]string{ + "placement_prefix_bytes": "1", + "placement_sub_vindex_type": "hash", + }) + assert.EqualError(t, err, "missing params: placement_map") +} + +func TestPlacementPlacementMapMalformedMap(t *testing.T) { + _, err := CreateVindex("placement", "placement", map[string]string{ + "placement_map": "xyz", + "placement_prefix_bytes": "1", + "placement_sub_vindex_type": "hash", + }) + assert.EqualError(t, err, "malformed placement_map; entry: xyz; expected key:value") +} + +func TestPlacementPlacementMapMissingKey(t *testing.T) { + _, err := CreateVindex("placement", "placement", map[string]string{ + "placement_map": "abc:1,:2,ghi:3", + "placement_prefix_bytes": "1", + "placement_sub_vindex_type": "hash", + }) + assert.EqualError(t, err, "malformed placement_map; entry: :2; unexpected empty key") +} + +func TestPlacementPlacementMapMissingValue(t *testing.T) { + _, err := CreateVindex("placement", "placement", map[string]string{ + "placement_map": "abc:1,def:,ghi:3", + "placement_prefix_bytes": "1", + "placement_sub_vindex_type": "hash", + }) + assert.EqualError(t, err, "malformed placement_map; entry: def:; unexpected empty value") +} + +func TestPlacementPlacementMapMalformedValue(t *testing.T) { + _, err := CreateVindex("placement", "placement", map[string]string{ + "placement_map": "abc:xyz", + "placement_prefix_bytes": "1", + "placement_sub_vindex_type": "hash", + }) + assert.EqualError(t, err, "malformed placement_map; entry: abc:xyz; strconv.ParseUint: parsing \"xyz\": invalid syntax") +} + +func TestPlacementPrefixBytesMissing(t *testing.T) { + _, err := CreateVindex("placement", "placement", map[string]string{ + "placement_map": "foo:1,bar:2", + "placement_sub_vindex_type": "hash", + }) + assert.EqualError(t, err, "missing params: placement_prefix_bytes") +} + +func TestPlacementPrefixBytesTooLow(t *testing.T) { + _, err := CreateVindex("placement", "placement", map[string]string{ + "placement_map": "foo:1,bar:2", + "placement_prefix_bytes": "0", + "placement_sub_vindex_type": "hash", + }) + assert.EqualError(t, err, "invalid placement_prefix_bytes: 0; expected integer between 1 and 7") +} + +func TestPlacementPrefixBytesTooHigh(t *testing.T) { + _, err := CreateVindex("placement", "placement", map[string]string{ + "placement_map": "foo:1,bar:2", + "placement_prefix_bytes": "17", + "placement_sub_vindex_type": "hash", + }) + assert.EqualError(t, err, "invalid placement_prefix_bytes: 17; expected integer between 1 and 7") +} + +func TestPlacementSubVindexTypeMissing(t *testing.T) { + _, err := CreateVindex("placement", "placement", map[string]string{ + "placement_map": "foo:1,bar:2", + "placement_prefix_bytes": "1", + }) + assert.EqualError(t, err, "missing params: placement_sub_vindex_type") +} + +func TestPlacementSubVindexTypeIncorrect(t *testing.T) { + _, err := CreateVindex("placement", "placement", map[string]string{ + "placement_map": "foo:1,bar:2", + "placement_prefix_bytes": "1", + "placement_sub_vindex_type": "doesnotexist", + }) + assert.EqualError(t, err, "invalid placement_sub_vindex_type: vindexType \"doesnotexist\" not found") +} + +func TestPlacementMapSqlTypeVarChar(t *testing.T) { + vindex, err := CreateVindex("placement", "placement", map[string]string{ + "table": "t", + "from": "f1,f2", + "to": "toc", + "placement_prefix_bytes": "1", + "placement_map": "foo:1,bar:2", + "placement_sub_vindex_type": "xxhash", + }) + assert.NoError(t, err) + actualDestinations, err := vindex.(MultiColumn).Map(context.Background(), nil, [][]sqltypes.Value{{ + sqltypes.NewVarChar("foo"), sqltypes.NewVarChar("hello world"), + }, { + sqltypes.NewVarChar("bar"), sqltypes.NewVarChar("hello world"), + }, { + sqltypes.NewVarChar("xyz"), sqltypes.NewVarChar("hello world"), + }}) + assert.NoError(t, err) + + expectedDestinations := []key.Destination{ + key.DestinationKeyspaceID{0x01, 0x68, 0x69, 0x1e, 0xb2, 0x34, 0x67, 0xab}, + key.DestinationKeyspaceID{0x02, 0x68, 0x69, 0x1e, 0xb2, 0x34, 0x67, 0xab}, + key.DestinationNone{}, + } + assert.Equal(t, expectedDestinations, actualDestinations) +} + +func TestPlacementMapSqlTypeInt64(t *testing.T) { + vindex, err := CreateVindex("placement", "placement", map[string]string{ + "table": "t", + "from": "f1,f2", + "to": "toc", + "placement_prefix_bytes": "1", + "placement_map": "foo:1,bar:2", + "placement_sub_vindex_type": "xxhash", + }) + assert.NoError(t, err) + actualDestinations, err := vindex.(MultiColumn).Map(context.Background(), nil, [][]sqltypes.Value{{ + sqltypes.NewVarChar("foo"), sqltypes.NewInt64(1), + }, { + sqltypes.NewVarChar("bar"), sqltypes.NewInt64(1), + }, { + sqltypes.NewVarChar("xyz"), sqltypes.NewInt64(1), + }}) + assert.NoError(t, err) + + expectedDestinations := []key.Destination{ + key.DestinationKeyspaceID{0x01, 0xd4, 0x64, 0x05, 0x36, 0x76, 0x12, 0xb4}, + key.DestinationKeyspaceID{0x02, 0xd4, 0x64, 0x05, 0x36, 0x76, 0x12, 0xb4}, + key.DestinationNone{}, + } + assert.Equal(t, expectedDestinations, actualDestinations) +} + +func TestPlacementMapWithHexValues(t *testing.T) { + vindex, err := CreateVindex("placement", "placement", map[string]string{ + "table": "t", + "from": "f1,f2", + "to": "toc", + "placement_prefix_bytes": "1", + "placement_map": "foo:0x01,bar:0x02", + "placement_sub_vindex_type": "xxhash", + }) + assert.NoError(t, err) + actualDestinations, err := vindex.(MultiColumn).Map(context.Background(), nil, [][]sqltypes.Value{{ + sqltypes.NewVarChar("foo"), sqltypes.NewInt64(1), + }, { + sqltypes.NewVarChar("bar"), sqltypes.NewInt64(1), + }, { + sqltypes.NewVarChar("xyz"), sqltypes.NewInt64(1), + }}) + assert.NoError(t, err) + + expectedDestinations := []key.Destination{ + key.DestinationKeyspaceID{0x01, 0xd4, 0x64, 0x05, 0x36, 0x76, 0x12, 0xb4}, + key.DestinationKeyspaceID{0x02, 0xd4, 0x64, 0x05, 0x36, 0x76, 0x12, 0xb4}, + key.DestinationNone{}, + } + assert.Equal(t, expectedDestinations, actualDestinations) +} + +func TestPlacementMapMultiplePrefixBytes(t *testing.T) { + vindex, err := CreateVindex("placement", "placement", map[string]string{ + "table": "t", + "from": "f1,f2", + "to": "toc", + "placement_prefix_bytes": "4", + "placement_map": "foo:1,bar:2", + "placement_sub_vindex_type": "xxhash", + }) + assert.NoError(t, err) + actualDestinations, err := vindex.(MultiColumn).Map(context.Background(), nil, [][]sqltypes.Value{{ + sqltypes.NewVarChar("foo"), sqltypes.NewInt64(1), + }, { + sqltypes.NewVarChar("bar"), sqltypes.NewInt64(1), + }, { + sqltypes.NewVarChar("xyz"), sqltypes.NewInt64(1), + }}) + assert.NoError(t, err) + + expectedDestinations := []key.Destination{ + key.DestinationKeyspaceID{0x00, 0x00, 0x00, 0x01, 0xd4, 0x64, 0x05, 0x36}, + key.DestinationKeyspaceID{0x00, 0x00, 0x00, 0x02, 0xd4, 0x64, 0x05, 0x36}, + key.DestinationNone{}, + } + assert.Equal(t, expectedDestinations, actualDestinations) +} + +func TestPlacementSubVindexNumeric(t *testing.T) { + vindex, err := CreateVindex("placement", "placement", map[string]string{ + "table": "t", + "from": "f1,f2", + "to": "toc", + "placement_prefix_bytes": "1", + "placement_map": "foo:1,bar:2", + "placement_sub_vindex_type": "numeric", + }) + assert.NoError(t, err) + actualDestinations, err := vindex.(MultiColumn).Map(context.Background(), nil, [][]sqltypes.Value{{ + sqltypes.NewVarChar("foo"), sqltypes.NewInt64(0x01234567deadbeef), + }, { + sqltypes.NewVarChar("bar"), sqltypes.NewInt64(0x01234567deadbeef), + }, { + sqltypes.NewVarChar("xyz"), sqltypes.NewInt64(0x01234567deadbeef), + }}) + assert.NoError(t, err) + + expectedDestinations := []key.Destination{ + key.DestinationKeyspaceID{0x01, 0x01, 0x23, 0x45, 0x67, 0xde, 0xad, 0xbe}, + key.DestinationKeyspaceID{0x02, 0x01, 0x23, 0x45, 0x67, 0xde, 0xad, 0xbe}, + key.DestinationNone{}, + } + assert.Equal(t, expectedDestinations, actualDestinations) +} + +func TestPlacementMapPrefixOnly(t *testing.T) { + vindex, err := CreateVindex("placement", "placement", map[string]string{ + "table": "t", + "from": "f1,f2", + "to": "toc", + "placement_prefix_bytes": "1", + "placement_map": "foo:1,bar:2", + "placement_sub_vindex_type": "xxhash", + }) + assert.NoError(t, err) + actualDestinations, err := vindex.(MultiColumn).Map(context.Background(), nil, [][]sqltypes.Value{{ + sqltypes.NewVarChar("foo"), + }, { + sqltypes.NewVarChar("bar"), + }, { + sqltypes.NewVarChar("xyz"), + }}) + assert.NoError(t, err) + + expectedDestinations := []key.Destination{ + NewKeyRangeFromPrefix([]byte{0x01}), + NewKeyRangeFromPrefix([]byte{0x02}), + key.DestinationNone{}, + } + assert.Equal(t, expectedDestinations, actualDestinations) +} + +func TestPlacementMapTooManyColumns(t *testing.T) { + vindex, err := CreateVindex("placement", "placement", map[string]string{ + "table": "t", + "from": "f1,f2", + "to": "toc", + "placement_prefix_bytes": "1", + "placement_map": "foo:1,bar:2", + "placement_sub_vindex_type": "xxhash", + }) + assert.NoError(t, err) + actualDestinations, err := vindex.(MultiColumn).Map(context.Background(), nil, [][]sqltypes.Value{{ + // Too many columns; expecting two, providing three. + sqltypes.NewVarChar("a"), sqltypes.NewVarChar("b"), sqltypes.NewVarChar("c"), + }}) + assert.EqualError(t, err, "wrong number of column values were passed: expected 1-2, got 3") + + assert.Nil(t, actualDestinations) +} + +func TestPlacementMapNoColumns(t *testing.T) { + vindex, err := CreateVindex("placement", "placement", map[string]string{ + "table": "t", + "from": "f1,f2", + "to": "toc", + "placement_prefix_bytes": "1", + "placement_map": "foo:1,bar:2", + "placement_sub_vindex_type": "xxhash", + }) + assert.NoError(t, err) + actualDestinations, err := vindex.(MultiColumn).Map(context.Background(), nil, [][]sqltypes.Value{{ + // Empty column list. + }}) + assert.EqualError(t, err, "wrong number of column values were passed: expected 1-2, got 0") + + assert.Nil(t, actualDestinations) +} From 2a8d3fd5b6f6c308936a02b8308f5db6fdb4fec3 Mon Sep 17 00:00:00 2001 From: Brendan Dougherty Date: Thu, 15 Jun 2023 17:09:28 -0400 Subject: [PATCH 2/9] Merge pull request #102 from Shopify/generate-cachedsize-for-placement-vindex Generate CachedSize function for Placement vindex (cherry picked from commit 986ffc65eb603ea4bafd539f740628c1c47e793c) (cherry picked from commit 1fe7126a122320a1a76f4d83e6624fc064d24fa6) (cherry picked from commit 62a60b22f515d61d7f7d90fff87b4505e8d4f081) --- go/vt/vtgate/vindexes/cached_size.go | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/go/vt/vtgate/vindexes/cached_size.go b/go/vt/vtgate/vindexes/cached_size.go index 55bbd44ea2d..5752daed4da 100644 --- a/go/vt/vtgate/vindexes/cached_size.go +++ b/go/vt/vtgate/vindexes/cached_size.go @@ -346,6 +346,42 @@ func (cached *NumericStaticMap) CachedSize(alloc bool) int64 { } return size } + +//go:nocheckptr +func (cached *Placement) CachedSize(alloc bool) int64 { + if cached == nil { + return int64(0) + } + size := int64(0) + if alloc { + size += int64(80) + } + // field name string + size += hack.RuntimeAllocSize(int64(len(cached.name))) + // field placementMap vitess.io/vitess/go/vt/vtgate/vindexes.PlacementMap + if cached.placementMap != nil { + size += int64(48) + hmap := reflect.ValueOf(cached.placementMap) + numBuckets := int(math.Pow(2, float64((*(*uint8)(unsafe.Pointer(hmap.Pointer() + uintptr(9))))))) + numOldBuckets := (*(*uint16)(unsafe.Pointer(hmap.Pointer() + uintptr(10)))) + size += hack.RuntimeAllocSize(int64(numOldBuckets * 208)) + if len(cached.placementMap) > 0 || numBuckets > 1 { + size += hack.RuntimeAllocSize(int64(numBuckets * 208)) + } + for k := range cached.placementMap { + size += hack.RuntimeAllocSize(int64(len(k))) + } + } + // field subVindex vitess.io/vitess/go/vt/vtgate/vindexes.Vindex + if cc, ok := cached.subVindex.(cachedObject); ok { + size += cc.CachedSize(true) + } + // field subVindexType string + size += hack.RuntimeAllocSize(int64(len(cached.subVindexType))) + // field subVindexName string + size += hack.RuntimeAllocSize(int64(len(cached.subVindexName))) + return size +} func (cached *RegionExperimental) CachedSize(alloc bool) int64 { if cached == nil { return int64(0) From 8d31457d27e375b0785b9454a25b606e04a0a4c8 Mon Sep 17 00:00:00 2001 From: Austen Lacy Date: Wed, 5 Jul 2023 14:29:40 -0400 Subject: [PATCH 3/9] `vttestserver`: persist vschema changes in `--persistent_mode` (#13065) (#107) Co-authored-by: Hormoz Kheradmand (cherry picked from commit 508442ddb1c9b0906ea697ef74e7053423de0e49) (cherry picked from commit 21ef27109f81fb4d0c8c8d2499167cf283ad2c34) (cherry picked from commit bde24ca9123999a8afb5af94b874b2cdb0f74a28) --- go/cmd/vtcombo/main.go | 12 ++- go/cmd/vtcombo/vschema_watcher.go | 111 +++++++++++++++++++++++ go/cmd/vttestserver/main.go | 6 +- go/cmd/vttestserver/vttestserver_test.go | 14 ++- go/flags/endtoend/vttestserver.txt | 2 +- go/vt/vttest/local_cluster.go | 34 ++++--- go/vt/vttest/vtprocess.go | 4 + 7 files changed, 157 insertions(+), 26 deletions(-) create mode 100644 go/cmd/vtcombo/vschema_watcher.go diff --git a/go/cmd/vtcombo/main.go b/go/cmd/vtcombo/main.go index affbf0520e7..8557d5575e8 100644 --- a/go/cmd/vtcombo/main.go +++ b/go/cmd/vtcombo/main.go @@ -61,7 +61,13 @@ var ( mysqlPort = flags.Int("mysql_port", 3306, "mysql port") externalTopoServer = flags.Bool("external_topo_server", false, "Should vtcombo use an external topology server instead of starting its own in-memory topology server. "+ "If true, vtcombo will use the flags defined in topo/server.go to open topo server") - plannerName = flags.String("planner-version", "", "Sets the default planner to use when the session has not changed it. Valid values are: V3, V3Insert, Gen4, Gen4Greedy and Gen4Fallback. Gen4Fallback tries the gen4 planner and falls back to the V3 planner if the gen4 fails.") + plannerName = flags.String("planner-version", "", "Sets the default planner to use when the session has not changed it. Valid values are: V3, V3Insert, Gen4, Gen4Greedy and Gen4Fallback. Gen4Fallback tries the gen4 planner and falls back to the V3 planner if the gen4 fails.") + vschemaPersistenceDir = flags.String("vschema-persistence-dir", "", "If set, per-keyspace vschema will be persisted in this directory "+ + "and reloaded into the in-memory topology server across restarts. Bookkeeping is performed using a simple watcher goroutine. "+ + "This is useful when running vtcombo as an application development container (e.g. vttestserver) where you want to keep the same "+ + "vschema even if developer's machine reboots. This works in tandem with vttestserver's --persistent_mode flag. Needless to say, "+ + "this is neither a perfect nor a production solution for vschema persistence. Consider using the --external_topo_server flag if "+ + "you require a more complete solution. This flag is ignored if --external_topo_server is set.") tpb vttestpb.VTTestTopology ts *topo.Server @@ -292,6 +298,10 @@ func main() { exit.Return(1) } + if *vschemaPersistenceDir != "" && !*externalTopoServer { + startVschemaWatcher(*vschemaPersistenceDir, tpb.Keyspaces, ts) + } + servenv.OnRun(func() { addStatusParts(vtg) }) diff --git a/go/cmd/vtcombo/vschema_watcher.go b/go/cmd/vtcombo/vschema_watcher.go new file mode 100644 index 00000000000..9194f61e774 --- /dev/null +++ b/go/cmd/vtcombo/vschema_watcher.go @@ -0,0 +1,111 @@ +/* +Copyright 2023 The Vitess Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "encoding/json" + "os" + "path" + + "vitess.io/vitess/go/vt/log" + vschemapb "vitess.io/vitess/go/vt/proto/vschema" + vttestpb "vitess.io/vitess/go/vt/proto/vttest" + "vitess.io/vitess/go/vt/topo" +) + +func startVschemaWatcher(vschemaPersistenceDir string, keyspaces []*vttestpb.Keyspace, ts *topo.Server) { + // Create the directory if it doesn't exist. + if err := createDirectoryIfNotExists(vschemaPersistenceDir); err != nil { + log.Fatalf("Unable to create vschema persistence directory %v: %v", vschemaPersistenceDir, err) + } + + // If there are keyspace files, load them. + loadKeyspacesFromDir(vschemaPersistenceDir, keyspaces, ts) + + // Rebuild the SrvVSchema object in case we loaded vschema from file + if err := ts.RebuildSrvVSchema(context.Background(), tpb.Cells); err != nil { + log.Fatalf("RebuildSrvVSchema failed: %v", err) + } + + // Now watch for changes in the SrvVSchema object and persist them to disk. + go watchSrvVSchema(context.Background(), ts, tpb.Cells[0]) +} + +func loadKeyspacesFromDir(dir string, keyspaces []*vttestpb.Keyspace, ts *topo.Server) { + for _, ks := range tpb.Keyspaces { + ksFile := path.Join(dir, ks.Name+".json") + if _, err := os.Stat(ksFile); err == nil { + jsonData, err := os.ReadFile(ksFile) + if err != nil { + log.Fatalf("Unable to read keyspace file %v: %v", ksFile, err) + } + + keyspace := &vschemapb.Keyspace{} + err = json.Unmarshal(jsonData, keyspace) + if err != nil { + log.Fatalf("Unable to parse keyspace file %v: %v", ksFile, err) + } + + ts.SaveVSchema(context.Background(), ks.Name, keyspace) + log.Infof("Loaded keyspace %v from %v\n", ks.Name, ksFile) + } + } +} + +func watchSrvVSchema(ctx context.Context, ts *topo.Server, cell string) { + data, ch, err := ts.WatchSrvVSchema(context.Background(), tpb.Cells[0]) + if err != nil { + log.Fatalf("WatchSrvVSchema failed: %v", err) + } + + if data.Err != nil { + log.Fatalf("WatchSrvVSchema could not retrieve initial vschema: %v", data.Err) + } + persistNewSrvVSchema(data.Value) + + for update := range ch { + if update.Err != nil { + log.Errorf("WatchSrvVSchema returned an error: %v", update.Err) + } else { + persistNewSrvVSchema(update.Value) + } + } +} + +func persistNewSrvVSchema(srvVSchema *vschemapb.SrvVSchema) { + for ksName, ks := range srvVSchema.Keyspaces { + jsonBytes, err := json.MarshalIndent(ks, "", " ") + if err != nil { + log.Errorf("Error marshaling keyspace: %v", err) + continue + } + + err = os.WriteFile(path.Join(*vschemaPersistenceDir, ksName+".json"), jsonBytes, 0644) + if err != nil { + log.Errorf("Error writing keyspace file: %v", err) + } + log.Infof("Persisted keyspace %v to %v", ksName, *vschemaPersistenceDir) + } +} + +func createDirectoryIfNotExists(dir string) error { + if _, err := os.Stat(dir); os.IsNotExist(err) { + return os.Mkdir(dir, 0755) + } + return nil +} diff --git a/go/cmd/vttestserver/main.go b/go/cmd/vttestserver/main.go index d15d26c2894..af0e6d162e3 100644 --- a/go/cmd/vttestserver/main.go +++ b/go/cmd/vttestserver/main.go @@ -93,9 +93,9 @@ func registerFlags(fs *pflag.FlagSet) { " vttestserver as a database container in local developer environments. Note"+ " that db migration files (--schema_dir option) and seeding of"+ " random data (--initialize_with_random_data option) will only run during"+ - " cluster startup if the data directory does not already exist. vschema"+ - " migrations are run every time the cluster starts, since persistence"+ - " for the topology server has not been implemented yet") + " cluster startup if the data directory does not already exist. "+ + " Changes to VSchema are persisted across cluster restarts using a simple"+ + " watcher if the --data_dir argument is specified.") fs.BoolVar(&doSeed, "initialize_with_random_data", false, "If this flag is each table-shard will be initialized"+ diff --git a/go/cmd/vttestserver/vttestserver_test.go b/go/cmd/vttestserver/vttestserver_test.go index 0665d5f9c46..9313182d9b8 100644 --- a/go/cmd/vttestserver/vttestserver_test.go +++ b/go/cmd/vttestserver/vttestserver_test.go @@ -81,8 +81,14 @@ func TestPersistentMode(t *testing.T) { cluster, err := startPersistentCluster(dir) assert.NoError(t, err) - // basic sanity checks similar to TestRunsVschemaMigrations + // Add a new "ad-hoc" vindex via vtgate once the cluster is up, to later make sure it is persisted across teardowns + err = addColumnVindex(cluster, "test_keyspace", "alter vschema on persistence_test add vindex my_vdx(id)") + assert.NoError(t, err) + + // Basic sanity checks similar to TestRunsVschemaMigrations + // See go/cmd/vttestserver/data/schema/app_customer/* and go/cmd/vttestserver/data/schema/test_keyspace/* assertColumnVindex(t, cluster, columnVindex{keyspace: "test_keyspace", table: "test_table", vindex: "my_vdx", vindexType: "hash", column: "id"}) + assertColumnVindex(t, cluster, columnVindex{keyspace: "test_keyspace", table: "persistence_test", vindex: "my_vdx", vindexType: "hash", column: "id"}) assertColumnVindex(t, cluster, columnVindex{keyspace: "app_customer", table: "customers", vindex: "hash", vindexType: "hash", column: "id"}) // insert some data to ensure persistence across teardowns @@ -111,8 +117,9 @@ func TestPersistentMode(t *testing.T) { defer cluster.TearDown() assert.NoError(t, err) - // rerun our sanity checks to make sure vschema migrations are run during every startup + // rerun our sanity checks to make sure vschema is persisted correctly assertColumnVindex(t, cluster, columnVindex{keyspace: "test_keyspace", table: "test_table", vindex: "my_vdx", vindexType: "hash", column: "id"}) + assertColumnVindex(t, cluster, columnVindex{keyspace: "test_keyspace", table: "persistence_test", vindex: "my_vdx", vindexType: "hash", column: "id"}) assertColumnVindex(t, cluster, columnVindex{keyspace: "app_customer", table: "customers", vindex: "hash", vindexType: "hash", column: "id"}) // ensure previous data was successfully persisted @@ -316,7 +323,8 @@ func startCluster(flags ...string) (vttest.LocalCluster, error) { keyspaceArg := "--keyspaces=" + strings.Join(clusterKeyspaces, ",") numShardsArg := "--num_shards=2,2" vschemaDDLAuthorizedUsers := "--vschema_ddl_authorized_users=%" - os.Args = append(os.Args, []string{schemaDirArg, keyspaceArg, numShardsArg, tabletHostname, vschemaDDLAuthorizedUsers}...) + alsoLogToStderr := "--alsologtostderr" // better debugging + os.Args = append(os.Args, []string{schemaDirArg, keyspaceArg, numShardsArg, tabletHostname, vschemaDDLAuthorizedUsers, alsoLogToStderr}...) os.Args = append(os.Args, flags...) return runCluster() } diff --git a/go/flags/endtoend/vttestserver.txt b/go/flags/endtoend/vttestserver.txt index 668e31f1656..b4e6bb30711 100644 --- a/go/flags/endtoend/vttestserver.txt +++ b/go/flags/endtoend/vttestserver.txt @@ -89,7 +89,7 @@ Usage of vttestserver: --num_shards strings Comma separated shard count (one per keyspace) (default [2]) --onclose_timeout duration wait no more than this for OnClose handlers before stopping (default 10s) --onterm_timeout duration wait no more than this for OnTermSync handlers before stopping (default 10s) - --persistent_mode If this flag is set, the MySQL data directory is not cleaned up when LocalCluster.TearDown() is called. This is useful for running vttestserver as a database container in local developer environments. Note that db migration files (--schema_dir option) and seeding of random data (--initialize_with_random_data option) will only run during cluster startup if the data directory does not already exist. vschema migrations are run every time the cluster starts, since persistence for the topology server has not been implemented yet + --persistent_mode If this flag is set, the MySQL data directory is not cleaned up when LocalCluster.TearDown() is called. This is useful for running vttestserver as a database container in local developer environments. Note that db migration files (--schema_dir option) and seeding of random data (--initialize_with_random_data option) will only run during cluster startup if the data directory does not already exist. Changes to VSchema are persisted across cluster restarts using a simple watcher if the --data_dir argument is specified. --pid_file string If set, the process will write its pid to the named file, and delete it on graceful shutdown. --planner-version string Sets the default planner to use when the session has not changed it. Valid values are: V3, V3Insert, Gen4, Gen4Greedy and Gen4Fallback. Gen4Fallback tries the new gen4 planner and falls back to the V3 planner if the gen4 fails. --pool_hostname_resolve_interval duration if set force an update to all hostnames and reconnect if changed, defaults to 0 (disabled) diff --git a/go/vt/vttest/local_cluster.go b/go/vt/vttest/local_cluster.go index 3a095eb8b2d..726726e2615 100644 --- a/go/vt/vttest/local_cluster.go +++ b/go/vt/vttest/local_cluster.go @@ -491,28 +491,26 @@ func (db *LocalCluster) loadSchema(shouldRunDatabaseMigrations bool) error { } } - glob, _ := filepath.Glob(path.Join(schemaDir, "*.sql")) - for _, filepath := range glob { - cmds, err := LoadSQLFile(filepath, schemaDir) - if err != nil { - return err - } - - // One single vschema migration per file - if !db.OnlyMySQL && len(cmds) == 1 && strings.HasPrefix(strings.ToUpper(cmds[0]), "ALTER VSCHEMA") { - if err = db.applyVschema(keyspace, cmds[0]); err != nil { + if shouldRunDatabaseMigrations { + glob, _ := filepath.Glob(path.Join(schemaDir, "*.sql")) + for _, filepath := range glob { + cmds, err := LoadSQLFile(filepath, schemaDir) + if err != nil { return err } - continue - } - if !shouldRunDatabaseMigrations { - continue - } + // One single vschema migration per file + if !db.OnlyMySQL && len(cmds) == 1 && strings.HasPrefix(strings.ToUpper(cmds[0]), "ALTER VSCHEMA") { + if err = db.applyVschema(keyspace, cmds[0]); err != nil { + return err + } + continue + } - for _, dbname := range db.shardNames(kpb) { - if err := db.Execute(cmds, dbname); err != nil { - return err + for _, dbname := range db.shardNames(kpb) { + if err := db.Execute(cmds, dbname); err != nil { + return err + } } } } diff --git a/go/vt/vttest/vtprocess.go b/go/vt/vttest/vtprocess.go index 37582542c02..a6c03176f1b 100644 --- a/go/vt/vttest/vtprocess.go +++ b/go/vt/vttest/vtprocess.go @@ -23,6 +23,7 @@ import ( "net/http" "os" "os/exec" + "path" "strings" "syscall" "time" @@ -242,6 +243,9 @@ func VtcomboProcess(environment Environment, args *Config, mysql MySQLManager) ( if args.SchemaDir != "" { vt.ExtraArgs = append(vt.ExtraArgs, []string{"--schema_dir", args.SchemaDir}...) } + if args.PersistentMode && args.DataDir != "" { + vt.ExtraArgs = append(vt.ExtraArgs, []string{"--vschema-persistence-dir", path.Join(args.DataDir, "vschema_data")}...) + } if args.TransactionMode != "" { vt.ExtraArgs = append(vt.ExtraArgs, []string{"--transaction_mode", args.TransactionMode}...) } From 0db5860242cda5c710e1e010e8b8ec2f590c98fb Mon Sep 17 00:00:00 2001 From: Austen Lacy Date: Tue, 19 Sep 2023 13:11:25 -0400 Subject: [PATCH 4/9] [BACK-PORT] Properly support ignore_nulls in CreateLookupVindex (#13913) (#122) * Properly support ignore_nulls in CreateLookupVindex (#13913) Signed-off-by: Matt Lord * remove new vreplication tests that dont work with v15 Signed-off-by: Austen Lacy --------- Signed-off-by: Matt Lord Signed-off-by: Austen Lacy Co-authored-by: Matt Lord Co-authored-by: Austen Lacy (cherry picked from commit ebde3109eac62ebf61bf3302c2374394c53479d1) (cherry picked from commit 07c6f4a9444ab5a8dc524c59bbebde0c354bfaa0) (cherry picked from commit 428d1bdce466e47c0c4959a11773c7404ec45747) --- go/test/endtoend/vreplication/config_test.go | 27 ++++ .../tabletserver/vstreamer/planbuilder.go | 25 ++++ go/vt/wrangler/materializer.go | 48 +++++-- go/vt/wrangler/materializer_test.go | 119 ++++++++++++++++++ 4 files changed, 207 insertions(+), 12 deletions(-) diff --git a/go/test/endtoend/vreplication/config_test.go b/go/test/endtoend/vreplication/config_test.go index b8684b04c71..4d2043f2908 100644 --- a/go/test/endtoend/vreplication/config_test.go +++ b/go/test/endtoend/vreplication/config_test.go @@ -98,6 +98,33 @@ create table reftable (id int, val1 varchar(20), primary key(id), key(val1)); } } ` + + createLookupVindexVSchema = ` +{ + "sharded": true, + "vindexes": { + "customer_name_keyspace_id": { + "type": "consistent_lookup", + "params": { + "table": "product.customer_name_keyspace_id", + "from": "name,cid", + "to": "keyspace_id", + "ignore_nulls": "true" + }, + "owner": "customer" + } + }, + "tables": { + "customer": { + "column_vindexes": [{ + "columns": ["name", "cid"], + "name": "customer_name_keyspace_id" + }] + } + } +} +` + customerSchema = "" customerVSchema = ` { diff --git a/go/vt/vttablet/tabletserver/vstreamer/planbuilder.go b/go/vt/vttablet/tabletserver/vstreamer/planbuilder.go index 7741ef51bfa..ed910189be9 100644 --- a/go/vt/vttablet/tabletserver/vstreamer/planbuilder.go +++ b/go/vt/vttablet/tabletserver/vstreamer/planbuilder.go @@ -79,6 +79,8 @@ const ( GreaterThanEqual // NotEqual is used to filter a comparable column if != specific value NotEqual + // IsNotNull is used to filter a column if it is NULL + IsNotNull ) // Filter contains opcodes for filtering. @@ -224,6 +226,10 @@ func (plan *Plan) filter(values, result []sqltypes.Value, charsets []collations. if !key.KeyRangeContains(filter.KeyRange, ksid) { return false, nil } + case IsNotNull: + if values[filter.ColNum].IsNull() { + return false, nil + } default: match, err := compare(filter.Opcode, values[filter.ColNum], filter.Value, charsets[filter.ColNum]) if err != nil { @@ -550,6 +556,25 @@ func (plan *Plan) analyzeWhere(vschema *localVSchema, where *sqlparser.Where) er if err := plan.analyzeInKeyRange(vschema, expr.Exprs); err != nil { return err } + case *sqlparser.IsExpr: // Needed for CreateLookupVindex with ignore_nulls + if expr.Right != sqlparser.IsNotNullOp { + return fmt.Errorf("unsupported constraint: %v", sqlparser.String(expr)) + } + qualifiedName, ok := expr.Left.(*sqlparser.ColName) + if !ok { + return fmt.Errorf("unexpected: %v", sqlparser.String(expr)) + } + if !qualifiedName.Qualifier.IsEmpty() { + return fmt.Errorf("unsupported qualifier for column: %v", sqlparser.String(qualifiedName)) + } + colnum, err := findColumn(plan.Table, qualifiedName.Name) + if err != nil { + return err + } + plan.Filters = append(plan.Filters, Filter{ + Opcode: IsNotNull, + ColNum: colnum, + }) default: return fmt.Errorf("unsupported constraint: %v", sqlparser.String(expr)) } diff --git a/go/vt/wrangler/materializer.go b/go/vt/wrangler/materializer.go index 6dea5d3b9f1..086ff93816e 100644 --- a/go/vt/wrangler/materializer.go +++ b/go/vt/wrangler/materializer.go @@ -54,6 +54,7 @@ import ( tabletmanagerdatapb "vitess.io/vitess/go/vt/proto/tabletmanagerdata" vschemapb "vitess.io/vitess/go/vt/proto/vschema" vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata" + vtrpcpb "vitess.io/vitess/go/vt/proto/vtrpc" ) type materializer struct { @@ -449,12 +450,13 @@ func (wr *Wrangler) prepareCreateLookup(ctx context.Context, keyspace string, sp // Important variables are pulled out here. var ( // lookup vindex info - vindexName string - vindex *vschemapb.Vindex - targetKeyspace string - targetTableName string - vindexFromCols []string - vindexToCol string + vindexName string + vindex *vschemapb.Vindex + targetKeyspace string + targetTableName string + vindexFromCols []string + vindexToCol string + vindexIgnoreNulls bool // source table info sourceTableName string @@ -505,6 +507,18 @@ func (wr *Wrangler) prepareCreateLookup(ctx context.Context, keyspace string, sp if _, err := vindexes.CreateVindex(vindex.Type, vindexName, vindex.Params); err != nil { return nil, nil, nil, err } + if ignoreNullsStr, ok := vindex.Params["ignore_nulls"]; ok { + // This mirrors the behavior of vindexes.boolFromMap(). + switch ignoreNullsStr { + case "true": + vindexIgnoreNulls = true + case "false": + vindexIgnoreNulls = false + default: + return nil, nil, nil, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "ignore_nulls value must be 'true' or 'false': '%s'", + ignoreNullsStr) + } + } // Validate input table if len(specs.Tables) != 1 { @@ -641,21 +655,31 @@ func (wr *Wrangler) prepareCreateLookup(ctx context.Context, keyspace string, sp buf = sqlparser.NewTrackedBuffer(nil) buf.Myprintf("select ") for i := range vindexFromCols { - buf.Myprintf("%v as %v, ", sqlparser.NewIdentifierCI(sourceVindexColumns[i]), sqlparser.NewIdentifierCI(vindexFromCols[i])) + buf.Myprintf("%s as %s, ", sqlparser.String(sqlparser.NewIdentifierCI(sourceVindexColumns[i])), sqlparser.String(sqlparser.NewIdentifierCI(vindexFromCols[i]))) } if strings.EqualFold(vindexToCol, "keyspace_id") || strings.EqualFold(vindex.Type, "consistent_lookup_unique") || strings.EqualFold(vindex.Type, "consistent_lookup") { - buf.Myprintf("keyspace_id() as %v ", sqlparser.NewIdentifierCI(vindexToCol)) + buf.Myprintf("keyspace_id() as %s ", sqlparser.String(sqlparser.NewIdentifierCI(vindexToCol))) } else { - buf.Myprintf("%v as %v ", sqlparser.NewIdentifierCI(vindexToCol), sqlparser.NewIdentifierCI(vindexToCol)) + buf.Myprintf("%s as %s ", sqlparser.String(sqlparser.NewIdentifierCI(vindexToCol)), sqlparser.String(sqlparser.NewIdentifierCI(vindexToCol))) + } + buf.Myprintf("from %s", sqlparser.String(sqlparser.NewIdentifierCS(sourceTableName))) + if vindexIgnoreNulls { + buf.Myprintf(" where ") + lastValIdx := len(vindexFromCols) - 1 + for i := range vindexFromCols { + buf.Myprintf("%s is not null", sqlparser.String(sqlparser.NewIdentifierCI(vindexFromCols[i]))) + if i != lastValIdx { + buf.Myprintf(" and ") + } + } } - buf.Myprintf("from %v", sqlparser.NewIdentifierCS(sourceTableName)) if vindex.Owner != "" { // Only backfill buf.Myprintf(" group by ") for i := range vindexFromCols { - buf.Myprintf("%v, ", sqlparser.NewIdentifierCI(vindexFromCols[i])) + buf.Myprintf("%s, ", sqlparser.String(sqlparser.NewIdentifierCI(vindexFromCols[i]))) } - buf.Myprintf("%v", sqlparser.NewIdentifierCI(vindexToCol)) + buf.Myprintf("%s", sqlparser.String(sqlparser.NewIdentifierCI(vindexToCol))) } materializeQuery = buf.String() diff --git a/go/vt/wrangler/materializer_test.go b/go/vt/wrangler/materializer_test.go index 8f92a814f06..83ed5b26504 100644 --- a/go/vt/wrangler/materializer_test.go +++ b/go/vt/wrangler/materializer_test.go @@ -1279,6 +1279,125 @@ func TestCreateCustomizedVindex(t *testing.T) { } } +func TestCreateLookupVindexIgnoreNulls(t *testing.T) { + ms := &vtctldatapb.MaterializeSettings{ + SourceKeyspace: "ks", + TargetKeyspace: "ks", + } + + env := newTestMaterializerEnv(t, ms, []string{"0"}, []string{"0"}) + defer env.close() + + specs := &vschemapb.Keyspace{ + Vindexes: map[string]*vschemapb.Vindex{ + "v": { + Type: "consistent_lookup", + Params: map[string]string{ + "table": "ks.lkp", + "from": "col2,col1", + "to": "keyspace_id", + "ignore_nulls": "true", + }, + Owner: "t1", + }, + }, + Tables: map[string]*vschemapb.Table{ + "t1": { + ColumnVindexes: []*vschemapb.ColumnVindex{{ + Name: "v", + Columns: []string{"col2", "col1"}, + }}, + }, + }, + } + // Dummy sourceSchema + sourceSchema := "CREATE TABLE `t1` (\n" + + " `col1` int(11) NOT NULL AUTO_INCREMENT,\n" + + " `col2` int(11) DEFAULT NULL,\n" + + " PRIMARY KEY (`id`)\n" + + ") ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1" + + vschema := &vschemapb.Keyspace{ + Sharded: true, + Vindexes: map[string]*vschemapb.Vindex{ + "hash": { + Type: "hash", + }, + }, + Tables: map[string]*vschemapb.Table{ + "t1": { + ColumnVindexes: []*vschemapb.ColumnVindex{{ + Name: "hash", + Column: "col1", + }}, + }, + }, + } + + wantKs := &vschemapb.Keyspace{ + Sharded: true, + Vindexes: map[string]*vschemapb.Vindex{ + "hash": { + Type: "hash", + }, + "v": { + Type: "consistent_lookup", + Params: map[string]string{ + "table": "ks.lkp", + "from": "col2,col1", + "to": "keyspace_id", + "write_only": "true", + "ignore_nulls": "true", + }, + Owner: "t1", + }, + }, + Tables: map[string]*vschemapb.Table{ + "t1": { + ColumnVindexes: []*vschemapb.ColumnVindex{{ + Name: "hash", + Column: "col1", + }, { + Name: "v", + Columns: []string{"col2", "col1"}, + }}, + }, + "lkp": { + ColumnVindexes: []*vschemapb.ColumnVindex{{ + Column: "col2", + Name: "hash", + }}, + }, + }, + } + wantQuery := "select col2 as col2, col1 as col1, keyspace_id() as keyspace_id from t1 where col2 is not null and col1 is not null group by col2, col1, keyspace_id" + + env.tmc.schema[ms.SourceKeyspace+".t1"] = &tabletmanagerdatapb.SchemaDefinition{ + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{{ + Fields: []*querypb.Field{{ + Name: "col1", + Type: querypb.Type_INT64, + }, { + Name: "col2", + Type: querypb.Type_INT64, + }}, + Schema: sourceSchema, + }}, + } + if err := env.topoServ.SaveVSchema(context.Background(), ms.SourceKeyspace, vschema); err != nil { + t.Fatal(err) + } + + ms, ks, _, err := env.wr.prepareCreateLookup(context.Background(), ms.SourceKeyspace, specs, false) + require.NoError(t, err) + if !proto.Equal(wantKs, ks) { + t.Errorf("unexpected keyspace value: got:\n%v, want\n%v", ks, wantKs) + } + require.NotNil(t, ms) + require.GreaterOrEqual(t, len(ms.TableSettings), 1) + require.Equal(t, wantQuery, ms.TableSettings[0].SourceExpression, "unexpected query") +} + func TestStopAfterCopyFlag(t *testing.T) { ms := &vtctldatapb.MaterializeSettings{ SourceKeyspace: "ks", From 9ed3bbe6e3da7fc2d6c9d25b14d0337c93278cbf Mon Sep 17 00:00:00 2001 From: Austen Lacy Date: Mon, 6 Nov 2023 11:24:22 -0500 Subject: [PATCH 5/9] Bug fix: Use target tablet from health stats cache when checking replication status (#14436) (#128) Signed-off-by: Austen Lacy Co-authored-by: Austen Lacy (cherry picked from commit f757ff28f0e5aaa35b79f436c5b994e346d6221c) (cherry picked from commit 7fabb2df0a87ce757583e6c12c76fe9511f54e3e) (cherry picked from commit a5cc3960224739e5a905725cd86dc5cbefa65f70) --- go/test/endtoend/cluster/cluster_process.go | 5 ++++ go/test/endtoend/tabletgateway/vtgate_test.go | 29 +++++++++++++++++++ go/vt/vtgate/executor.go | 4 +-- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/go/test/endtoend/cluster/cluster_process.go b/go/test/endtoend/cluster/cluster_process.go index 075bec7c868..694081a9e01 100644 --- a/go/test/endtoend/cluster/cluster_process.go +++ b/go/test/endtoend/cluster/cluster_process.go @@ -982,6 +982,11 @@ func (cluster *LocalProcessCluster) VtctlclientGetTablet(tablet *Vttablet) (*top return &ti, nil } +func (cluster *LocalProcessCluster) VtctlclientChangeTabletType(tablet *Vttablet, tabletType topodatapb.TabletType) error { + _, err := cluster.VtctlclientProcess.ExecuteCommandWithOutput("ChangeTabletType", "--", tablet.Alias, tabletType.String()) + return err +} + // Teardown brings down the cluster by invoking teardown for individual processes func (cluster *LocalProcessCluster) Teardown() { PanicHandler(nil) diff --git a/go/test/endtoend/tabletgateway/vtgate_test.go b/go/test/endtoend/tabletgateway/vtgate_test.go index 9a26888647a..06a590cfb1f 100644 --- a/go/test/endtoend/tabletgateway/vtgate_test.go +++ b/go/test/endtoend/tabletgateway/vtgate_test.go @@ -35,6 +35,7 @@ import ( "vitess.io/vitess/go/test/endtoend/cluster" "vitess.io/vitess/go/test/endtoend/utils" vtorcutils "vitess.io/vitess/go/test/endtoend/vtorc/utils" + "vitess.io/vitess/go/vt/proto/topodata" ) func TestVtgateHealthCheck(t *testing.T) { @@ -100,6 +101,34 @@ func TestVtgateReplicationStatusCheck(t *testing.T) { assert.True(t, rawLag.IsNull() || lagInt > 0, "replication lag should be NULL or greater than 0 but was: %s", rawLag.ToString()) } +func TestVtgateReplicationStatusCheckWithTabletTypeChange(t *testing.T) { + defer cluster.PanicHandler(t) + // Healthcheck interval on tablet is set to 1s, so sleep for 2s + time.Sleep(2 * time.Second) + verifyVtgateVariables(t, clusterInstance.VtgateProcess.VerifyURL) + ctx := context.Background() + conn, err := mysql.Connect(ctx, &vtParams) + require.NoError(t, err) + defer conn.Close() + + // Only returns rows for REPLICA and RDONLY tablets -- so should be 2 of them + qr := utils.Exec(t, conn, "show vitess_replication_status like '%'") + expectNumRows := 2 + numRows := len(qr.Rows) + assert.Equal(t, expectNumRows, numRows, fmt.Sprintf("wrong number of results from show vitess_replication_status. Expected %d, got %d", expectNumRows, numRows)) + + // change the RDONLY tablet to SPARE + rdOnlyTablet := clusterInstance.Keyspaces[0].Shards[0].Rdonly() + err = clusterInstance.VtctlclientChangeTabletType(rdOnlyTablet, topodata.TabletType_SPARE) + require.NoError(t, err) + + // Only returns rows for REPLICA and RDONLY tablets -- so should be 1 of them since we updated 1 to spare + qr = utils.Exec(t, conn, "show vitess_replication_status like '%'") + expectNumRows = 1 + numRows = len(qr.Rows) + assert.Equal(t, expectNumRows, numRows, fmt.Sprintf("wrong number of results from show vitess_replication_status. Expected %d, got %d", expectNumRows, numRows)) +} + func verifyVtgateVariables(t *testing.T, url string) { resp, err := http.Get(url) require.NoError(t, err) diff --git a/go/vt/vtgate/executor.go b/go/vt/vtgate/executor.go index 4de224802ca..aeddd61be27 100644 --- a/go/vt/vtgate/executor.go +++ b/go/vt/vtgate/executor.go @@ -852,14 +852,14 @@ func (e *Executor) showVitessReplicationStatus(ctx context.Context, filter *sqlp for _, s := range status { for _, ts := range s.TabletsStats { // We only want to show REPLICA and RDONLY tablets - if ts.Tablet.Type != topodatapb.TabletType_REPLICA && ts.Tablet.Type != topodatapb.TabletType_RDONLY { + if ts.Target.TabletType != topodatapb.TabletType_REPLICA && ts.Target.TabletType != topodatapb.TabletType_RDONLY { continue } // Allow people to filter by Keyspace and Shard using a LIKE clause if filter != nil { ksFilterRegex := sqlparser.LikeToRegexp(filter.Like) - keyspaceShardStr := fmt.Sprintf("%s/%s", ts.Tablet.Keyspace, ts.Tablet.Shard) + keyspaceShardStr := fmt.Sprintf("%s/%s", ts.Target.Keyspace, ts.Target.Shard) if !ksFilterRegex.MatchString(keyspaceShardStr) { continue } From 140a0c9f6cf274f9c426f172ad2e567760210de0 Mon Sep 17 00:00:00 2001 From: shanth96 Date: Thu, 14 Mar 2024 14:37:04 -0400 Subject: [PATCH 6/9] Merge pull request #148 from Shopify/fix-tests Run all relevant tests on all PRs (cherry picked from commit b55dd2675c57dd03d1d4e683e3ccd31beb730ff8) (cherry picked from commit 8feee142931d3a3ebca03c0ba6ee83a5b0e78360) (cherry picked from commit 6bc3c088c815e910550f62dbb91bc529c49d023b) --- .../check_make_vtadmin_authz_testgen.yml | 2 +- .../check_make_vtadmin_web_proto.yml | 2 +- .github/workflows/cluster_endtoend_12.yml | 2 +- .github/workflows/cluster_endtoend_13.yml | 2 +- .github/workflows/cluster_endtoend_15.yml | 2 +- .github/workflows/cluster_endtoend_18.yml | 2 +- .github/workflows/cluster_endtoend_21.yml | 2 +- .github/workflows/cluster_endtoend_22.yml | 2 +- .../cluster_endtoend_backup_pitr.yml | 2 +- .../cluster_endtoend_backup_pitr_mysql57.yml | 2 +- ...ter_endtoend_ers_prs_newfeatures_heavy.yml | 2 +- .../workflows/cluster_endtoend_mysql80.yml | 2 +- .../cluster_endtoend_mysql_server_vault.yml | 2 +- .../cluster_endtoend_onlineddl_ghost.yml | 2 +- ...uster_endtoend_onlineddl_ghost_mysql57.yml | 2 +- .../cluster_endtoend_onlineddl_revert.yml | 2 +- ...ster_endtoend_onlineddl_revert_mysql57.yml | 2 +- .../cluster_endtoend_onlineddl_scheduler.yml | 2 +- ...r_endtoend_onlineddl_scheduler_mysql57.yml | 2 +- .../cluster_endtoend_onlineddl_vrepl.yml | 2 +- ...uster_endtoend_onlineddl_vrepl_mysql57.yml | 2 +- ...luster_endtoend_onlineddl_vrepl_stress.yml | 2 +- ...ndtoend_onlineddl_vrepl_stress_mysql57.yml | 2 +- ..._endtoend_onlineddl_vrepl_stress_suite.yml | 2 +- ...d_onlineddl_vrepl_stress_suite_mysql57.yml | 2 +- ...cluster_endtoend_onlineddl_vrepl_suite.yml | 2 +- ...endtoend_onlineddl_vrepl_suite_mysql57.yml | 2 +- .../cluster_endtoend_schemadiff_vrepl.yml | 2 +- ...ster_endtoend_schemadiff_vrepl_mysql57.yml | 2 +- .../cluster_endtoend_tabletmanager_consul.yml | 2 +- ...cluster_endtoend_tabletmanager_tablegc.yml | 2 +- ...endtoend_tabletmanager_tablegc_mysql57.yml | 2 +- ...uster_endtoend_tabletmanager_throttler.yml | 2 +- ..._tabletmanager_throttler_custom_config.yml | 2 +- ..._endtoend_tabletmanager_throttler_topo.yml | 2 +- ...cluster_endtoend_topo_connection_cache.yml | 2 +- ...dtoend_vreplication_across_db_versions.yml | 2 +- .../cluster_endtoend_vreplication_basic.yml | 2 +- ...luster_endtoend_vreplication_cellalias.yml | 2 +- ...vreplication_migrate_vdiff2_convert_tz.yml | 2 +- ...luster_endtoend_vreplication_multicell.yml | 2 +- .../cluster_endtoend_vreplication_v2.yml | 2 +- .../cluster_endtoend_vstream_failover.yml | 2 +- ...r_endtoend_vstream_stoponreshard_false.yml | 2 +- ...er_endtoend_vstream_stoponreshard_true.yml | 2 +- ...dtoend_vstream_with_keyspaces_to_watch.yml | 2 +- .../workflows/cluster_endtoend_vtbackup.yml | 2 +- ..._vtctlbackup_sharded_clustertest_heavy.yml | 2 +- .../cluster_endtoend_vtgate_concurrentdml.yml | 2 +- .../cluster_endtoend_vtgate_gen4.yml | 2 +- .../cluster_endtoend_vtgate_general_heavy.yml | 2 +- .../cluster_endtoend_vtgate_godriver.yml | 2 +- ...uster_endtoend_vtgate_partial_keyspace.yml | 2 +- .../cluster_endtoend_vtgate_queries.yml | 2 +- ...cluster_endtoend_vtgate_readafterwrite.yml | 2 +- .../cluster_endtoend_vtgate_reservedconn.yml | 2 +- .../cluster_endtoend_vtgate_schema.yml | 2 +- ...cluster_endtoend_vtgate_schema_tracker.yml | 2 +- ...dtoend_vtgate_tablet_healthcheck_cache.yml | 2 +- .../cluster_endtoend_vtgate_topo.yml | 2 +- .../cluster_endtoend_vtgate_topo_consul.yml | 2 +- .../cluster_endtoend_vtgate_topo_etcd.yml | 2 +- .../cluster_endtoend_vtgate_transaction.yml | 2 +- .../cluster_endtoend_vtgate_unsharded.yml | 2 +- .../cluster_endtoend_vtgate_vindex_heavy.yml | 2 +- .../cluster_endtoend_vtgate_vschema.yml | 2 +- .github/workflows/cluster_endtoend_vtorc.yml | 2 +- .../cluster_endtoend_vtorc_mysql57.yml | 2 +- .../cluster_endtoend_vttablet_prscomplex.yml | 2 +- .../workflows/cluster_endtoend_xb_backup.yml | 2 +- .../cluster_endtoend_xb_backup_mysql57.yml | 2 +- .../cluster_endtoend_xb_recovery.yml | 2 +- .../cluster_endtoend_xb_recovery_mysql57.yml | 2 +- .github/workflows/docker_test_cluster_10.yml | 2 +- .github/workflows/docker_test_cluster_25.yml | 2 +- .github/workflows/e2e_race.yml | 4 +- .github/workflows/endtoend.yml | 2 +- .github/workflows/local_example.yml | 4 +- .github/workflows/region_example.yml | 2 +- .github/workflows/static_checks_etc.yml | 4 +- .github/workflows/unit_race.yml | 2 +- .github/workflows/unit_test_mysql57.yml | 4 +- .github/workflows/unit_test_mysql80.yml | 4 +- .../upgrade_downgrade_test_backups_e2e.yml | 4 +- ...owngrade_test_backups_e2e_next_release.yml | 5 +-- .../upgrade_downgrade_test_backups_manual.yml | 5 +-- ...grade_test_backups_manual_next_release.yml | 5 +-- ...e_downgrade_test_query_serving_queries.yml | 5 +-- ...est_query_serving_queries_next_release.yml | 5 +-- ...de_downgrade_test_query_serving_schema.yml | 5 +-- ...test_query_serving_schema_next_release.yml | 5 +-- ...rade_downgrade_test_reparent_new_vtctl.yml | 5 +-- ...e_downgrade_test_reparent_new_vttablet.yml | 5 +-- ...rade_downgrade_test_reparent_old_vtctl.yml | 5 +-- ...e_downgrade_test_reparent_old_vttablet.yml | 5 +-- .github/workflows/vtadmin_web_build.yml | 6 +-- .github/workflows/vtadmin_web_lint.yml | 14 +++---- .github/workflows/vtadmin_web_unit_tests.yml | 8 ++-- test/templates/cluster_endtoend_test.tpl | 2 +- .../cluster_endtoend_test_docker.tpl | 2 +- .../cluster_endtoend_test_mysql57.tpl | 2 +- .../cluster_endtoend_test_self_hosted.tpl | 2 +- test/templates/unit_test.tpl | 4 +- test/templates/unit_test_self_hosted.tpl | 2 +- tools/get_next_release_shopify.sh | 38 +++++++++++++++++++ tools/get_previous_release_shopify.sh | 33 ++++++++++++++++ 106 files changed, 204 insertions(+), 144 deletions(-) create mode 100755 tools/get_next_release_shopify.sh create mode 100755 tools/get_previous_release_shopify.sh diff --git a/.github/workflows/check_make_vtadmin_authz_testgen.yml b/.github/workflows/check_make_vtadmin_authz_testgen.yml index c4d70111e25..e46e2761109 100644 --- a/.github/workflows/check_make_vtadmin_authz_testgen.yml +++ b/.github/workflows/check_make_vtadmin_authz_testgen.yml @@ -19,7 +19,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/check_make_vtadmin_web_proto.yml b/.github/workflows/check_make_vtadmin_web_proto.yml index 0e25a527a76..61f0bc42d3a 100644 --- a/.github/workflows/check_make_vtadmin_web_proto.yml +++ b/.github/workflows/check_make_vtadmin_web_proto.yml @@ -19,7 +19,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_12.yml b/.github/workflows/cluster_endtoend_12.yml index fc1f6c82d70..7519df2054b 100644 --- a/.github/workflows/cluster_endtoend_12.yml +++ b/.github/workflows/cluster_endtoend_12.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_13.yml b/.github/workflows/cluster_endtoend_13.yml index 1b372b03b5c..7366afdd61d 100644 --- a/.github/workflows/cluster_endtoend_13.yml +++ b/.github/workflows/cluster_endtoend_13.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_15.yml b/.github/workflows/cluster_endtoend_15.yml index 01e07d2573a..a0ded4cc206 100644 --- a/.github/workflows/cluster_endtoend_15.yml +++ b/.github/workflows/cluster_endtoend_15.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_18.yml b/.github/workflows/cluster_endtoend_18.yml index cba15f0527c..7a1df03c701 100644 --- a/.github/workflows/cluster_endtoend_18.yml +++ b/.github/workflows/cluster_endtoend_18.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_21.yml b/.github/workflows/cluster_endtoend_21.yml index ff44d3ed308..2812fbd93dd 100644 --- a/.github/workflows/cluster_endtoend_21.yml +++ b/.github/workflows/cluster_endtoend_21.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_22.yml b/.github/workflows/cluster_endtoend_22.yml index 3af8c3bd997..907a3c665ee 100644 --- a/.github/workflows/cluster_endtoend_22.yml +++ b/.github/workflows/cluster_endtoend_22.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_backup_pitr.yml b/.github/workflows/cluster_endtoend_backup_pitr.yml index 6e1de9b5742..aa22a65f4e0 100644 --- a/.github/workflows/cluster_endtoend_backup_pitr.yml +++ b/.github/workflows/cluster_endtoend_backup_pitr.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_backup_pitr_mysql57.yml b/.github/workflows/cluster_endtoend_backup_pitr_mysql57.yml index be938c48c27..2dcc3b55910 100644 --- a/.github/workflows/cluster_endtoend_backup_pitr_mysql57.yml +++ b/.github/workflows/cluster_endtoend_backup_pitr_mysql57.yml @@ -34,7 +34,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_ers_prs_newfeatures_heavy.yml b/.github/workflows/cluster_endtoend_ers_prs_newfeatures_heavy.yml index f2e4fd3068b..22dd229c66a 100644 --- a/.github/workflows/cluster_endtoend_ers_prs_newfeatures_heavy.yml +++ b/.github/workflows/cluster_endtoend_ers_prs_newfeatures_heavy.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_mysql80.yml b/.github/workflows/cluster_endtoend_mysql80.yml index b507b7c8da6..8f9809d7689 100644 --- a/.github/workflows/cluster_endtoend_mysql80.yml +++ b/.github/workflows/cluster_endtoend_mysql80.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_mysql_server_vault.yml b/.github/workflows/cluster_endtoend_mysql_server_vault.yml index c6de7d4be1d..d8a0ddb8789 100644 --- a/.github/workflows/cluster_endtoend_mysql_server_vault.yml +++ b/.github/workflows/cluster_endtoend_mysql_server_vault.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_onlineddl_ghost.yml b/.github/workflows/cluster_endtoend_onlineddl_ghost.yml index d236ed4220c..74f2794ceca 100644 --- a/.github/workflows/cluster_endtoend_onlineddl_ghost.yml +++ b/.github/workflows/cluster_endtoend_onlineddl_ghost.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_onlineddl_ghost_mysql57.yml b/.github/workflows/cluster_endtoend_onlineddl_ghost_mysql57.yml index b4fcdfe89dd..3ccbe284e85 100644 --- a/.github/workflows/cluster_endtoend_onlineddl_ghost_mysql57.yml +++ b/.github/workflows/cluster_endtoend_onlineddl_ghost_mysql57.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_onlineddl_revert.yml b/.github/workflows/cluster_endtoend_onlineddl_revert.yml index 7505c1e347a..64874d7c40c 100644 --- a/.github/workflows/cluster_endtoend_onlineddl_revert.yml +++ b/.github/workflows/cluster_endtoend_onlineddl_revert.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_onlineddl_revert_mysql57.yml b/.github/workflows/cluster_endtoend_onlineddl_revert_mysql57.yml index 6da91d92109..ed0ed8a5167 100644 --- a/.github/workflows/cluster_endtoend_onlineddl_revert_mysql57.yml +++ b/.github/workflows/cluster_endtoend_onlineddl_revert_mysql57.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_onlineddl_scheduler.yml b/.github/workflows/cluster_endtoend_onlineddl_scheduler.yml index 843c8080d26..7917bb6a5ca 100644 --- a/.github/workflows/cluster_endtoend_onlineddl_scheduler.yml +++ b/.github/workflows/cluster_endtoend_onlineddl_scheduler.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_onlineddl_scheduler_mysql57.yml b/.github/workflows/cluster_endtoend_onlineddl_scheduler_mysql57.yml index f793a082d7d..57ab5b592f0 100644 --- a/.github/workflows/cluster_endtoend_onlineddl_scheduler_mysql57.yml +++ b/.github/workflows/cluster_endtoend_onlineddl_scheduler_mysql57.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_onlineddl_vrepl.yml b/.github/workflows/cluster_endtoend_onlineddl_vrepl.yml index 8e0717bdff9..910deecd861 100644 --- a/.github/workflows/cluster_endtoend_onlineddl_vrepl.yml +++ b/.github/workflows/cluster_endtoend_onlineddl_vrepl.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_onlineddl_vrepl_mysql57.yml b/.github/workflows/cluster_endtoend_onlineddl_vrepl_mysql57.yml index 997a8fb18c9..da55a3ef81b 100644 --- a/.github/workflows/cluster_endtoend_onlineddl_vrepl_mysql57.yml +++ b/.github/workflows/cluster_endtoend_onlineddl_vrepl_mysql57.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_onlineddl_vrepl_stress.yml b/.github/workflows/cluster_endtoend_onlineddl_vrepl_stress.yml index 9b1e6bf1ada..0cd900d36aa 100644 --- a/.github/workflows/cluster_endtoend_onlineddl_vrepl_stress.yml +++ b/.github/workflows/cluster_endtoend_onlineddl_vrepl_stress.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_onlineddl_vrepl_stress_mysql57.yml b/.github/workflows/cluster_endtoend_onlineddl_vrepl_stress_mysql57.yml index dbefd0475e7..05d928d8955 100644 --- a/.github/workflows/cluster_endtoend_onlineddl_vrepl_stress_mysql57.yml +++ b/.github/workflows/cluster_endtoend_onlineddl_vrepl_stress_mysql57.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_onlineddl_vrepl_stress_suite.yml b/.github/workflows/cluster_endtoend_onlineddl_vrepl_stress_suite.yml index 299a6c72c0f..b92ace77601 100644 --- a/.github/workflows/cluster_endtoend_onlineddl_vrepl_stress_suite.yml +++ b/.github/workflows/cluster_endtoend_onlineddl_vrepl_stress_suite.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_onlineddl_vrepl_stress_suite_mysql57.yml b/.github/workflows/cluster_endtoend_onlineddl_vrepl_stress_suite_mysql57.yml index 5ede1e5c3ed..7fed08843c9 100644 --- a/.github/workflows/cluster_endtoend_onlineddl_vrepl_stress_suite_mysql57.yml +++ b/.github/workflows/cluster_endtoend_onlineddl_vrepl_stress_suite_mysql57.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_onlineddl_vrepl_suite.yml b/.github/workflows/cluster_endtoend_onlineddl_vrepl_suite.yml index bf59e11ffc3..3ecc8cd1677 100644 --- a/.github/workflows/cluster_endtoend_onlineddl_vrepl_suite.yml +++ b/.github/workflows/cluster_endtoend_onlineddl_vrepl_suite.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_onlineddl_vrepl_suite_mysql57.yml b/.github/workflows/cluster_endtoend_onlineddl_vrepl_suite_mysql57.yml index b2b3df85102..45cfe7a3c58 100644 --- a/.github/workflows/cluster_endtoend_onlineddl_vrepl_suite_mysql57.yml +++ b/.github/workflows/cluster_endtoend_onlineddl_vrepl_suite_mysql57.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_schemadiff_vrepl.yml b/.github/workflows/cluster_endtoend_schemadiff_vrepl.yml index cefe3c07f39..f482477c843 100644 --- a/.github/workflows/cluster_endtoend_schemadiff_vrepl.yml +++ b/.github/workflows/cluster_endtoend_schemadiff_vrepl.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_schemadiff_vrepl_mysql57.yml b/.github/workflows/cluster_endtoend_schemadiff_vrepl_mysql57.yml index 8e982eb38f6..ca2f45d472f 100644 --- a/.github/workflows/cluster_endtoend_schemadiff_vrepl_mysql57.yml +++ b/.github/workflows/cluster_endtoend_schemadiff_vrepl_mysql57.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_tabletmanager_consul.yml b/.github/workflows/cluster_endtoend_tabletmanager_consul.yml index f749b443b69..af8b7d8c620 100644 --- a/.github/workflows/cluster_endtoend_tabletmanager_consul.yml +++ b/.github/workflows/cluster_endtoend_tabletmanager_consul.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_tabletmanager_tablegc.yml b/.github/workflows/cluster_endtoend_tabletmanager_tablegc.yml index 46c4335e2e1..2aa6328ec44 100644 --- a/.github/workflows/cluster_endtoend_tabletmanager_tablegc.yml +++ b/.github/workflows/cluster_endtoend_tabletmanager_tablegc.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_tabletmanager_tablegc_mysql57.yml b/.github/workflows/cluster_endtoend_tabletmanager_tablegc_mysql57.yml index 66e80f20b8a..c405050fdfa 100644 --- a/.github/workflows/cluster_endtoend_tabletmanager_tablegc_mysql57.yml +++ b/.github/workflows/cluster_endtoend_tabletmanager_tablegc_mysql57.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_tabletmanager_throttler.yml b/.github/workflows/cluster_endtoend_tabletmanager_throttler.yml index fdee23f23ea..1d12311baef 100644 --- a/.github/workflows/cluster_endtoend_tabletmanager_throttler.yml +++ b/.github/workflows/cluster_endtoend_tabletmanager_throttler.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_tabletmanager_throttler_custom_config.yml b/.github/workflows/cluster_endtoend_tabletmanager_throttler_custom_config.yml index a6b017e6bb7..5f18e9475d5 100644 --- a/.github/workflows/cluster_endtoend_tabletmanager_throttler_custom_config.yml +++ b/.github/workflows/cluster_endtoend_tabletmanager_throttler_custom_config.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_tabletmanager_throttler_topo.yml b/.github/workflows/cluster_endtoend_tabletmanager_throttler_topo.yml index 563c24923a6..0c102209625 100644 --- a/.github/workflows/cluster_endtoend_tabletmanager_throttler_topo.yml +++ b/.github/workflows/cluster_endtoend_tabletmanager_throttler_topo.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_topo_connection_cache.yml b/.github/workflows/cluster_endtoend_topo_connection_cache.yml index b3d94c592dd..a0359aaf6fc 100644 --- a/.github/workflows/cluster_endtoend_topo_connection_cache.yml +++ b/.github/workflows/cluster_endtoend_topo_connection_cache.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vreplication_across_db_versions.yml b/.github/workflows/cluster_endtoend_vreplication_across_db_versions.yml index d477623dccf..9ac83091c74 100644 --- a/.github/workflows/cluster_endtoend_vreplication_across_db_versions.yml +++ b/.github/workflows/cluster_endtoend_vreplication_across_db_versions.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vreplication_basic.yml b/.github/workflows/cluster_endtoend_vreplication_basic.yml index 6e1dbaf5100..eabb980fd1c 100644 --- a/.github/workflows/cluster_endtoend_vreplication_basic.yml +++ b/.github/workflows/cluster_endtoend_vreplication_basic.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vreplication_cellalias.yml b/.github/workflows/cluster_endtoend_vreplication_cellalias.yml index d64da405590..8a5283a245f 100644 --- a/.github/workflows/cluster_endtoend_vreplication_cellalias.yml +++ b/.github/workflows/cluster_endtoend_vreplication_cellalias.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vreplication_migrate_vdiff2_convert_tz.yml b/.github/workflows/cluster_endtoend_vreplication_migrate_vdiff2_convert_tz.yml index ebb73b70148..94ab52d647a 100644 --- a/.github/workflows/cluster_endtoend_vreplication_migrate_vdiff2_convert_tz.yml +++ b/.github/workflows/cluster_endtoend_vreplication_migrate_vdiff2_convert_tz.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vreplication_multicell.yml b/.github/workflows/cluster_endtoend_vreplication_multicell.yml index 2778c4315e2..f1bb2ddef95 100644 --- a/.github/workflows/cluster_endtoend_vreplication_multicell.yml +++ b/.github/workflows/cluster_endtoend_vreplication_multicell.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vreplication_v2.yml b/.github/workflows/cluster_endtoend_vreplication_v2.yml index fa3b755a545..dd82b187dbe 100644 --- a/.github/workflows/cluster_endtoend_vreplication_v2.yml +++ b/.github/workflows/cluster_endtoend_vreplication_v2.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vstream_failover.yml b/.github/workflows/cluster_endtoend_vstream_failover.yml index 0d17b3ef0c7..af52d7f90a8 100644 --- a/.github/workflows/cluster_endtoend_vstream_failover.yml +++ b/.github/workflows/cluster_endtoend_vstream_failover.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vstream_stoponreshard_false.yml b/.github/workflows/cluster_endtoend_vstream_stoponreshard_false.yml index 0c9f7993d70..a309ea0e6d4 100644 --- a/.github/workflows/cluster_endtoend_vstream_stoponreshard_false.yml +++ b/.github/workflows/cluster_endtoend_vstream_stoponreshard_false.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vstream_stoponreshard_true.yml b/.github/workflows/cluster_endtoend_vstream_stoponreshard_true.yml index e345c94b783..7523debdbdf 100644 --- a/.github/workflows/cluster_endtoend_vstream_stoponreshard_true.yml +++ b/.github/workflows/cluster_endtoend_vstream_stoponreshard_true.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vstream_with_keyspaces_to_watch.yml b/.github/workflows/cluster_endtoend_vstream_with_keyspaces_to_watch.yml index 7eed654dd50..657a4284e44 100644 --- a/.github/workflows/cluster_endtoend_vstream_with_keyspaces_to_watch.yml +++ b/.github/workflows/cluster_endtoend_vstream_with_keyspaces_to_watch.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vtbackup.yml b/.github/workflows/cluster_endtoend_vtbackup.yml index 8dc0a042e9a..9ec75224a27 100644 --- a/.github/workflows/cluster_endtoend_vtbackup.yml +++ b/.github/workflows/cluster_endtoend_vtbackup.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vtctlbackup_sharded_clustertest_heavy.yml b/.github/workflows/cluster_endtoend_vtctlbackup_sharded_clustertest_heavy.yml index 7f0b6599a9d..f1d33ff3ac0 100644 --- a/.github/workflows/cluster_endtoend_vtctlbackup_sharded_clustertest_heavy.yml +++ b/.github/workflows/cluster_endtoend_vtctlbackup_sharded_clustertest_heavy.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vtgate_concurrentdml.yml b/.github/workflows/cluster_endtoend_vtgate_concurrentdml.yml index 577a01a5903..967e6595486 100644 --- a/.github/workflows/cluster_endtoend_vtgate_concurrentdml.yml +++ b/.github/workflows/cluster_endtoend_vtgate_concurrentdml.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vtgate_gen4.yml b/.github/workflows/cluster_endtoend_vtgate_gen4.yml index da3ba5039b2..bf1ddced804 100644 --- a/.github/workflows/cluster_endtoend_vtgate_gen4.yml +++ b/.github/workflows/cluster_endtoend_vtgate_gen4.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vtgate_general_heavy.yml b/.github/workflows/cluster_endtoend_vtgate_general_heavy.yml index 1083b02023e..c8d0d6f3ff0 100644 --- a/.github/workflows/cluster_endtoend_vtgate_general_heavy.yml +++ b/.github/workflows/cluster_endtoend_vtgate_general_heavy.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vtgate_godriver.yml b/.github/workflows/cluster_endtoend_vtgate_godriver.yml index 46701a64bdc..2c1f5126b41 100644 --- a/.github/workflows/cluster_endtoend_vtgate_godriver.yml +++ b/.github/workflows/cluster_endtoend_vtgate_godriver.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vtgate_partial_keyspace.yml b/.github/workflows/cluster_endtoend_vtgate_partial_keyspace.yml index 080f0262ddb..d11e58b80cf 100644 --- a/.github/workflows/cluster_endtoend_vtgate_partial_keyspace.yml +++ b/.github/workflows/cluster_endtoend_vtgate_partial_keyspace.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vtgate_queries.yml b/.github/workflows/cluster_endtoend_vtgate_queries.yml index 454cb906983..98df94455a4 100644 --- a/.github/workflows/cluster_endtoend_vtgate_queries.yml +++ b/.github/workflows/cluster_endtoend_vtgate_queries.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vtgate_readafterwrite.yml b/.github/workflows/cluster_endtoend_vtgate_readafterwrite.yml index ac49c0c60a7..252a69e2a52 100644 --- a/.github/workflows/cluster_endtoend_vtgate_readafterwrite.yml +++ b/.github/workflows/cluster_endtoend_vtgate_readafterwrite.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vtgate_reservedconn.yml b/.github/workflows/cluster_endtoend_vtgate_reservedconn.yml index 0d66781b405..3e8baaa0985 100644 --- a/.github/workflows/cluster_endtoend_vtgate_reservedconn.yml +++ b/.github/workflows/cluster_endtoend_vtgate_reservedconn.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vtgate_schema.yml b/.github/workflows/cluster_endtoend_vtgate_schema.yml index f3aae736e1d..45415ec13e6 100644 --- a/.github/workflows/cluster_endtoend_vtgate_schema.yml +++ b/.github/workflows/cluster_endtoend_vtgate_schema.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vtgate_schema_tracker.yml b/.github/workflows/cluster_endtoend_vtgate_schema_tracker.yml index 3e560e99382..b5cc840e673 100644 --- a/.github/workflows/cluster_endtoend_vtgate_schema_tracker.yml +++ b/.github/workflows/cluster_endtoend_vtgate_schema_tracker.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vtgate_tablet_healthcheck_cache.yml b/.github/workflows/cluster_endtoend_vtgate_tablet_healthcheck_cache.yml index b80a19bb28d..7d714bc0eed 100644 --- a/.github/workflows/cluster_endtoend_vtgate_tablet_healthcheck_cache.yml +++ b/.github/workflows/cluster_endtoend_vtgate_tablet_healthcheck_cache.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vtgate_topo.yml b/.github/workflows/cluster_endtoend_vtgate_topo.yml index 4b5bfd192e4..5d91bbaf1e7 100644 --- a/.github/workflows/cluster_endtoend_vtgate_topo.yml +++ b/.github/workflows/cluster_endtoend_vtgate_topo.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vtgate_topo_consul.yml b/.github/workflows/cluster_endtoend_vtgate_topo_consul.yml index b95068f1beb..cc2bcf5fd57 100644 --- a/.github/workflows/cluster_endtoend_vtgate_topo_consul.yml +++ b/.github/workflows/cluster_endtoend_vtgate_topo_consul.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vtgate_topo_etcd.yml b/.github/workflows/cluster_endtoend_vtgate_topo_etcd.yml index 275a9eb3915..c51fc9dca02 100644 --- a/.github/workflows/cluster_endtoend_vtgate_topo_etcd.yml +++ b/.github/workflows/cluster_endtoend_vtgate_topo_etcd.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vtgate_transaction.yml b/.github/workflows/cluster_endtoend_vtgate_transaction.yml index 34314036761..f26ff3f35a2 100644 --- a/.github/workflows/cluster_endtoend_vtgate_transaction.yml +++ b/.github/workflows/cluster_endtoend_vtgate_transaction.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vtgate_unsharded.yml b/.github/workflows/cluster_endtoend_vtgate_unsharded.yml index 9b828a67233..9bb1036eded 100644 --- a/.github/workflows/cluster_endtoend_vtgate_unsharded.yml +++ b/.github/workflows/cluster_endtoend_vtgate_unsharded.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vtgate_vindex_heavy.yml b/.github/workflows/cluster_endtoend_vtgate_vindex_heavy.yml index 2aaae45f611..1696c51801a 100644 --- a/.github/workflows/cluster_endtoend_vtgate_vindex_heavy.yml +++ b/.github/workflows/cluster_endtoend_vtgate_vindex_heavy.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vtgate_vschema.yml b/.github/workflows/cluster_endtoend_vtgate_vschema.yml index 962ab9dbdef..95748b9470b 100644 --- a/.github/workflows/cluster_endtoend_vtgate_vschema.yml +++ b/.github/workflows/cluster_endtoend_vtgate_vschema.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vtorc.yml b/.github/workflows/cluster_endtoend_vtorc.yml index 369581c465e..32f41b5fb32 100644 --- a/.github/workflows/cluster_endtoend_vtorc.yml +++ b/.github/workflows/cluster_endtoend_vtorc.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vtorc_mysql57.yml b/.github/workflows/cluster_endtoend_vtorc_mysql57.yml index d4e1319f40d..6f93d06cd5d 100644 --- a/.github/workflows/cluster_endtoend_vtorc_mysql57.yml +++ b/.github/workflows/cluster_endtoend_vtorc_mysql57.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_vttablet_prscomplex.yml b/.github/workflows/cluster_endtoend_vttablet_prscomplex.yml index 49cdaa24f7b..5e55addb77d 100644 --- a/.github/workflows/cluster_endtoend_vttablet_prscomplex.yml +++ b/.github/workflows/cluster_endtoend_vttablet_prscomplex.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_xb_backup.yml b/.github/workflows/cluster_endtoend_xb_backup.yml index f98735805b2..7f16beedcf8 100644 --- a/.github/workflows/cluster_endtoend_xb_backup.yml +++ b/.github/workflows/cluster_endtoend_xb_backup.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_xb_backup_mysql57.yml b/.github/workflows/cluster_endtoend_xb_backup_mysql57.yml index 7be9706c0db..dc8971a2ccb 100644 --- a/.github/workflows/cluster_endtoend_xb_backup_mysql57.yml +++ b/.github/workflows/cluster_endtoend_xb_backup_mysql57.yml @@ -34,7 +34,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_xb_recovery.yml b/.github/workflows/cluster_endtoend_xb_recovery.yml index b244912e88a..9428fb24c4e 100644 --- a/.github/workflows/cluster_endtoend_xb_recovery.yml +++ b/.github/workflows/cluster_endtoend_xb_recovery.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/cluster_endtoend_xb_recovery_mysql57.yml b/.github/workflows/cluster_endtoend_xb_recovery_mysql57.yml index f94cf471946..a8f90b44ae0 100644 --- a/.github/workflows/cluster_endtoend_xb_recovery_mysql57.yml +++ b/.github/workflows/cluster_endtoend_xb_recovery_mysql57.yml @@ -34,7 +34,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/docker_test_cluster_10.yml b/.github/workflows/docker_test_cluster_10.yml index 293aae1400b..c3400479a1c 100644 --- a/.github/workflows/docker_test_cluster_10.yml +++ b/.github/workflows/docker_test_cluster_10.yml @@ -19,7 +19,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip $skip diff --git a/.github/workflows/docker_test_cluster_25.yml b/.github/workflows/docker_test_cluster_25.yml index a002c3fda99..dbc4940e84f 100644 --- a/.github/workflows/docker_test_cluster_25.yml +++ b/.github/workflows/docker_test_cluster_25.yml @@ -19,7 +19,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/e2e_race.yml b/.github/workflows/e2e_race.yml index 77efa5babbf..8651bb3696f 100644 --- a/.github/workflows/e2e_race.yml +++ b/.github/workflows/e2e_race.yml @@ -18,7 +18,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} @@ -69,7 +69,7 @@ jobs: echo mysql-apt-config mysql-apt-config/select-server select mysql-8.0 | sudo debconf-set-selections sudo DEBIAN_FRONTEND="noninteractive" dpkg -i mysql-apt-config* sudo apt-get update - + # Install everything else we need, and configure sudo apt-get install -y mysql-server mysql-client make unzip g++ etcd curl git wget eatmydata xz-utils sudo service mysql stop diff --git a/.github/workflows/endtoend.yml b/.github/workflows/endtoend.yml index 008fa3c6041..4bdb60d39fd 100644 --- a/.github/workflows/endtoend.yml +++ b/.github/workflows/endtoend.yml @@ -18,7 +18,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/local_example.yml b/.github/workflows/local_example.yml index 654435e66a5..1b5de801440 100644 --- a/.github/workflows/local_example.yml +++ b/.github/workflows/local_example.yml @@ -23,7 +23,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} @@ -76,7 +76,7 @@ jobs: echo mysql-apt-config mysql-apt-config/select-server select mysql-8.0 | sudo debconf-set-selections sudo DEBIAN_FRONTEND="noninteractive" dpkg -i mysql-apt-config* sudo apt-get update - + # Install everything else we need, and configure sudo apt-get install -y mysql-server mysql-client make unzip g++ etcd curl git wget eatmydata sudo service mysql stop diff --git a/.github/workflows/region_example.yml b/.github/workflows/region_example.yml index 9e36f8bc4b6..3e8fafaac49 100644 --- a/.github/workflows/region_example.yml +++ b/.github/workflows/region_example.yml @@ -23,7 +23,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/static_checks_etc.yml b/.github/workflows/static_checks_etc.yml index fa0c8ea156b..aefdc254fae 100644 --- a/.github/workflows/static_checks_etc.yml +++ b/.github/workflows/static_checks_etc.yml @@ -23,11 +23,11 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} - echo "skip-workflow=${skip}" >> $GITHUB_OUTPUT + echo "skip-workflow=${skip}" >> $GITHUB_OUTPUT - name: Checkout code if: steps.skip-workflow.outputs.skip-workflow == 'false' diff --git a/.github/workflows/unit_race.yml b/.github/workflows/unit_race.yml index 52b4d76cad6..fe50c0c29e9 100644 --- a/.github/workflows/unit_race.yml +++ b/.github/workflows/unit_race.yml @@ -23,7 +23,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/unit_test_mysql57.yml b/.github/workflows/unit_test_mysql57.yml index 7258477f5ed..41c540209d3 100644 --- a/.github/workflows/unit_test_mysql57.yml +++ b/.github/workflows/unit_test_mysql57.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} @@ -118,7 +118,7 @@ jobs: go mod download go install golang.org/x/tools/cmd/goimports@latest - + # install JUnit report formatter go install github.com/vitessio/go-junit-report@HEAD diff --git a/.github/workflows/unit_test_mysql80.yml b/.github/workflows/unit_test_mysql80.yml index a04a1fcbcfb..d710cad2f7e 100644 --- a/.github/workflows/unit_test_mysql80.yml +++ b/.github/workflows/unit_test_mysql80.yml @@ -30,7 +30,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} @@ -115,7 +115,7 @@ jobs: go mod download go install golang.org/x/tools/cmd/goimports@latest - + # install JUnit report formatter go install github.com/vitessio/go-junit-report@HEAD diff --git a/.github/workflows/upgrade_downgrade_test_backups_e2e.yml b/.github/workflows/upgrade_downgrade_test_backups_e2e.yml index a744f53cb1a..2c945aefb85 100644 --- a/.github/workflows/upgrade_downgrade_test_backups_e2e.yml +++ b/.github/workflows/upgrade_downgrade_test_backups_e2e.yml @@ -26,7 +26,7 @@ jobs: - name: Set output with latest release branch id: output-previous-release-ref run: | - previous_release_ref=$(./tools/get_previous_release.sh ${{github.base_ref}} ${{github.ref}}) + previous_release_ref=$(./tools/get_previous_release_shopify.sh) echo $previous_release_ref echo "previous_release_ref=${previous_release_ref}" >> $GITHUB_OUTPUT @@ -47,7 +47,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/.github/workflows/upgrade_downgrade_test_backups_e2e_next_release.yml b/.github/workflows/upgrade_downgrade_test_backups_e2e_next_release.yml index 8303c4017d7..9ff7e983570 100644 --- a/.github/workflows/upgrade_downgrade_test_backups_e2e_next_release.yml +++ b/.github/workflows/upgrade_downgrade_test_backups_e2e_next_release.yml @@ -10,7 +10,6 @@ concurrency: permissions: read-all jobs: - upgrade_downgrade_test_e2e: timeout-minutes: 60 name: Run Upgrade Downgrade Test - Backups - E2E - Next Release @@ -32,7 +31,7 @@ jobs: - name: Set output with latest release branch id: output-next-release-ref run: | - next_release_ref=$(./tools/get_next_release.sh ${{github.base_ref}} ${{github.ref}}) + next_release_ref=$(./tools/get_next_release_shopify.sh) echo $next_release_ref echo "next_release_ref=${next_release_ref}" >> $GITHUB_OUTPUT @@ -40,7 +39,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi if [[ "${{steps.output-next-release-ref.outputs.next_release_ref}}" == "" ]]; then diff --git a/.github/workflows/upgrade_downgrade_test_backups_manual.yml b/.github/workflows/upgrade_downgrade_test_backups_manual.yml index 715676e95a6..9c738c5e357 100644 --- a/.github/workflows/upgrade_downgrade_test_backups_manual.yml +++ b/.github/workflows/upgrade_downgrade_test_backups_manual.yml @@ -10,7 +10,6 @@ concurrency: permissions: read-all jobs: - # This job usually execute in ± 20 minutes upgrade_downgrade_test_manual: timeout-minutes: 40 @@ -29,7 +28,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} @@ -46,7 +45,7 @@ jobs: id: output-previous-release-ref if: steps.skip-workflow.outputs.skip-workflow == 'false' run: | - previous_release_ref=$(./tools/get_previous_release.sh ${{github.base_ref}} ${{github.ref}}) + previous_release_ref=$(./tools/get_previous_release_shopify.sh) echo $previous_release_ref echo "previous_release_ref=${previous_release_ref}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/upgrade_downgrade_test_backups_manual_next_release.yml b/.github/workflows/upgrade_downgrade_test_backups_manual_next_release.yml index 95f32487fbc..6406c82c28e 100644 --- a/.github/workflows/upgrade_downgrade_test_backups_manual_next_release.yml +++ b/.github/workflows/upgrade_downgrade_test_backups_manual_next_release.yml @@ -10,7 +10,6 @@ concurrency: permissions: read-all jobs: - # This job usually execute in ± 20 minutes upgrade_downgrade_test_manual: timeout-minutes: 40 @@ -34,7 +33,7 @@ jobs: - name: Set output with latest release branch id: output-next-release-ref run: | - next_release_ref=$(./tools/get_next_release.sh ${{github.base_ref}} ${{github.ref}}) + next_release_ref=$(./tools/get_next_release_shopify.sh) echo $next_release_ref echo "next_release_ref=${next_release_ref}" >> $GITHUB_OUTPUT @@ -42,7 +41,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi if [[ "${{steps.output-next-release-ref.outputs.next_release_ref}}" == "" ]]; then diff --git a/.github/workflows/upgrade_downgrade_test_query_serving_queries.yml b/.github/workflows/upgrade_downgrade_test_query_serving_queries.yml index 1765b758157..f6dcb402b41 100644 --- a/.github/workflows/upgrade_downgrade_test_query_serving_queries.yml +++ b/.github/workflows/upgrade_downgrade_test_query_serving_queries.yml @@ -13,7 +13,6 @@ permissions: read-all # (vtgate, vttablet, etc) built on different versions. jobs: - upgrade_downgrade_test: name: Run Upgrade Downgrade Test - Query Serving (Queries) runs-on: ubuntu-22.04 @@ -30,7 +29,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} @@ -46,7 +45,7 @@ jobs: id: output-previous-release-ref if: steps.skip-workflow.outputs.skip-workflow == 'false' run: | - previous_release_ref=$(./tools/get_previous_release.sh ${{github.base_ref}} ${{github.ref}}) + previous_release_ref=$(./tools/get_previous_release_shopify.sh) echo $previous_release_ref echo "previous_release_ref=${previous_release_ref}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/upgrade_downgrade_test_query_serving_queries_next_release.yml b/.github/workflows/upgrade_downgrade_test_query_serving_queries_next_release.yml index 3a6b60cf6b4..994688de07e 100644 --- a/.github/workflows/upgrade_downgrade_test_query_serving_queries_next_release.yml +++ b/.github/workflows/upgrade_downgrade_test_query_serving_queries_next_release.yml @@ -13,7 +13,6 @@ permissions: read-all # (vtgate, vttablet, etc) built on different versions. jobs: - upgrade_downgrade_test: name: Run Upgrade Downgrade Test - Query Serving (Queries) Next Release runs-on: ubuntu-22.04 @@ -34,7 +33,7 @@ jobs: - name: Set output with latest release branch id: output-next-release-ref run: | - next_release_ref=$(./tools/get_next_release.sh ${{github.base_ref}} ${{github.ref}}) + next_release_ref=$(./tools/get_next_release_shopify.sh) echo $next_release_ref echo "next_release_ref=${next_release_ref}" >> $GITHUB_OUTPUT @@ -42,7 +41,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi if [[ "${{steps.output-next-release-ref.outputs.next_release_ref}}" == "" ]]; then diff --git a/.github/workflows/upgrade_downgrade_test_query_serving_schema.yml b/.github/workflows/upgrade_downgrade_test_query_serving_schema.yml index 572c17dbeaf..59c73875a9f 100644 --- a/.github/workflows/upgrade_downgrade_test_query_serving_schema.yml +++ b/.github/workflows/upgrade_downgrade_test_query_serving_schema.yml @@ -13,7 +13,6 @@ permissions: read-all # (vtgate, vttablet, etc) built on different versions. jobs: - upgrade_downgrade_test: name: Run Upgrade Downgrade Test - Query Serving (Schema) runs-on: ubuntu-22.04 @@ -30,7 +29,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} @@ -46,7 +45,7 @@ jobs: id: output-previous-release-ref if: steps.skip-workflow.outputs.skip-workflow == 'false' run: | - previous_release_ref=$(./tools/get_previous_release.sh ${{github.base_ref}} ${{github.ref}}) + previous_release_ref=$(./tools/get_previous_release_shopify.sh) echo $previous_release_ref echo "previous_release_ref=${previous_release_ref}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/upgrade_downgrade_test_query_serving_schema_next_release.yml b/.github/workflows/upgrade_downgrade_test_query_serving_schema_next_release.yml index 5036c55c11b..6754fa3c07f 100644 --- a/.github/workflows/upgrade_downgrade_test_query_serving_schema_next_release.yml +++ b/.github/workflows/upgrade_downgrade_test_query_serving_schema_next_release.yml @@ -13,7 +13,6 @@ permissions: read-all # (vtgate, vttablet, etc) built on different versions. jobs: - upgrade_downgrade_test: name: Run Upgrade Downgrade Test - Query Serving (Schema) Next Release runs-on: ubuntu-22.04 @@ -34,7 +33,7 @@ jobs: - name: Set output with latest release branch id: output-next-release-ref run: | - next_release_ref=$(./tools/get_next_release.sh ${{github.base_ref}} ${{github.ref}}) + next_release_ref=$(./tools/get_next_release_shopify.sh ${{github.base_ref}} ${{github.ref}}) echo $next_release_ref echo "next_release_ref=${next_release_ref}" >> $GITHUB_OUTPUT @@ -42,7 +41,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi if [[ "${{steps.output-next-release-ref.outputs.next_release_ref}}" == "" ]]; then diff --git a/.github/workflows/upgrade_downgrade_test_reparent_new_vtctl.yml b/.github/workflows/upgrade_downgrade_test_reparent_new_vtctl.yml index 7ae979791db..9bcedbb9290 100644 --- a/.github/workflows/upgrade_downgrade_test_reparent_new_vtctl.yml +++ b/.github/workflows/upgrade_downgrade_test_reparent_new_vtctl.yml @@ -13,7 +13,6 @@ permissions: read-all # (vtctl, vttablet, etc) built on different versions. jobs: - upgrade_downgrade_test: name: Run Upgrade Downgrade Test - Reparent New Vtctl runs-on: ubuntu-22.04 @@ -34,7 +33,7 @@ jobs: - name: Set output with latest release branch id: output-next-release-ref run: | - next_release_ref=$(./tools/get_next_release.sh ${{github.base_ref}} ${{github.ref}}) + next_release_ref=$(./tools/get_next_release_shopify.sh ${{github.base_ref}} ${{github.ref}}) echo $next_release_ref echo "next_release_ref=${next_release_ref}" >> $GITHUB_OUTPUT @@ -42,7 +41,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi if [[ "${{steps.output-next-release-ref.outputs.next_release_ref}}" == "" ]]; then diff --git a/.github/workflows/upgrade_downgrade_test_reparent_new_vttablet.yml b/.github/workflows/upgrade_downgrade_test_reparent_new_vttablet.yml index 05df2967fe3..dfb64252a02 100644 --- a/.github/workflows/upgrade_downgrade_test_reparent_new_vttablet.yml +++ b/.github/workflows/upgrade_downgrade_test_reparent_new_vttablet.yml @@ -13,7 +13,6 @@ permissions: read-all # (vtctl, vttablet, etc) built on different versions. jobs: - upgrade_downgrade_test: name: Run Upgrade Downgrade Test - Reparent New VTTablet runs-on: ubuntu-22.04 @@ -34,7 +33,7 @@ jobs: - name: Set output with latest release branch id: output-next-release-ref run: | - next_release_ref=$(./tools/get_next_release.sh ${{github.base_ref}} ${{github.ref}}) + next_release_ref=$(./tools/get_next_release_shopify.sh ${{github.base_ref}} ${{github.ref}}) echo $next_release_ref echo "next_release_ref=${next_release_ref}" >> $GITHUB_OUTPUT @@ -42,7 +41,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi if [[ "${{steps.output-next-release-ref.outputs.next_release_ref}}" == "" ]]; then diff --git a/.github/workflows/upgrade_downgrade_test_reparent_old_vtctl.yml b/.github/workflows/upgrade_downgrade_test_reparent_old_vtctl.yml index 53eb24a3f75..5f43d50b2dc 100644 --- a/.github/workflows/upgrade_downgrade_test_reparent_old_vtctl.yml +++ b/.github/workflows/upgrade_downgrade_test_reparent_old_vtctl.yml @@ -13,7 +13,6 @@ permissions: read-all # (vtctl, vttablet, etc) built on different versions. jobs: - upgrade_downgrade_test: name: Run Upgrade Downgrade Test - Reparent Old Vtctl runs-on: ubuntu-22.04 @@ -30,7 +29,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} @@ -46,7 +45,7 @@ jobs: id: output-previous-release-ref if: steps.skip-workflow.outputs.skip-workflow == 'false' run: | - previous_release_ref=$(./tools/get_previous_release.sh ${{github.base_ref}} ${{github.ref}}) + previous_release_ref=$(./tools/get_previous_release_shopify.sh) echo $previous_release_ref echo "previous_release_ref=${previous_release_ref}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/upgrade_downgrade_test_reparent_old_vttablet.yml b/.github/workflows/upgrade_downgrade_test_reparent_old_vttablet.yml index d9f1d85fa24..51688d50b14 100644 --- a/.github/workflows/upgrade_downgrade_test_reparent_old_vttablet.yml +++ b/.github/workflows/upgrade_downgrade_test_reparent_old_vttablet.yml @@ -13,7 +13,6 @@ permissions: read-all # (vtctl, vttablet, etc) built on different versions. jobs: - upgrade_downgrade_test: name: Run Upgrade Downgrade Test - Reparent Old VTTablet runs-on: ubuntu-22.04 @@ -30,7 +29,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} @@ -46,7 +45,7 @@ jobs: id: output-previous-release-ref if: steps.skip-workflow.outputs.skip-workflow == 'false' run: | - previous_release_ref=$(./tools/get_previous_release.sh ${{github.base_ref}} ${{github.ref}}) + previous_release_ref=$(./tools/get_previous_release_shopify.sh ${{github.base_ref}} ${{github.ref}}) echo $previous_release_ref echo "previous_release_ref=${previous_release_ref}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/vtadmin_web_build.yml b/.github/workflows/vtadmin_web_build.yml index d09c37493f8..59dd0d6de0d 100644 --- a/.github/workflows/vtadmin_web_build.yml +++ b/.github/workflows/vtadmin_web_build.yml @@ -1,6 +1,6 @@ name: vtadmin-web build -# In specifying the 'paths' property, we need to include the path to this workflow .yml file. +# In specifying the 'paths' property, we need to include the path to this workflow .yml file. # See https://github.community/t/trigger-a-workflow-on-change-to-the-yml-file-itself/17792/4) on: push: @@ -29,7 +29,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} @@ -53,6 +53,6 @@ jobs: run: cd ./web/vtadmin && npm run build # Cancel pending and in-progress runs of this workflow if a newer ref is pushed to CI. - concurrency: + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/vtadmin_web_lint.yml b/.github/workflows/vtadmin_web_lint.yml index 1d23a8459e7..040a04bb2f9 100644 --- a/.github/workflows/vtadmin_web_lint.yml +++ b/.github/workflows/vtadmin_web_lint.yml @@ -1,6 +1,6 @@ name: vtadmin-web linting + formatting -# In specifying the 'paths' property, we need to include the path to this workflow .yml file. +# In specifying the 'paths' property, we need to include the path to this workflow .yml file. # See https://github.community/t/trigger-a-workflow-on-change-to-the-yml-file-itself/17792/4) on: push: @@ -29,7 +29,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} @@ -49,13 +49,13 @@ jobs: run: cd ./web/vtadmin && npm ci # Using "if: always()" means each step will run, even if a previous - # step fails. This is nice because, for example, we want stylelint and - # prettier to run even if eslint fails. + # step fails. This is nice because, for example, we want stylelint and + # prettier to run even if eslint fails. # # An undesirable secondary effect of this is these steps # will run even if the install, etc. steps fail, which is... weird. # A nice enhancement is to parallelize these steps into jobs, with the - # trade-off of more complexity around sharing npm install artifacts. + # trade-off of more complexity around sharing npm install artifacts. - name: Run eslint if: steps.skip-workflow.outputs.skip-workflow == 'false' && always() run: cd ./web/vtadmin && npm run lint:eslint @@ -63,12 +63,12 @@ jobs: - name: Run stylelint if: steps.skip-workflow.outputs.skip-workflow == 'false' && always() run: cd ./web/vtadmin && npm run lint:stylelint -- -f verbose - + - name: Run prettier if: steps.skip-workflow.outputs.skip-workflow == 'false' && always() run: cd ./web/vtadmin && npm run lint:prettier # Cancel pending and in-progress runs of this workflow if a newer ref is pushed to CI. - concurrency: + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/vtadmin_web_unit_tests.yml b/.github/workflows/vtadmin_web_unit_tests.yml index 948f59f4249..234889e0332 100644 --- a/.github/workflows/vtadmin_web_unit_tests.yml +++ b/.github/workflows/vtadmin_web_unit_tests.yml @@ -1,6 +1,6 @@ name: vtadmin-web unit tests -# In specifying the 'paths' property, we need to include the path to this workflow .yml file. +# In specifying the 'paths' property, we need to include the path to this workflow .yml file. # See https://github.community/t/trigger-a-workflow-on-change-to-the-yml-file-itself/17792/4) on: push: @@ -29,7 +29,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then + if [[ "${{github.event.pull_request}}" == "" ]]; then skip='true' fi echo Skip ${skip} @@ -51,8 +51,8 @@ jobs: - name: Run unit tests if: steps.skip-workflow.outputs.skip-workflow == 'false' run: cd ./web/vtadmin && CI=true npm run test - + # Cancel pending and in-progress runs of this workflow if a newer ref is pushed to CI. - concurrency: + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/test/templates/cluster_endtoend_test.tpl b/test/templates/cluster_endtoend_test.tpl index 28c22da7c72..b76fa20c93d 100644 --- a/test/templates/cluster_endtoend_test.tpl +++ b/test/templates/cluster_endtoend_test.tpl @@ -28,7 +28,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "{{"${{github.event.pull_request}}"}}" == "" ]] && [[ "{{"${{github.ref}}"}}" != "refs/heads/main" ]] && [[ ! "{{"${{github.ref}}"}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "{{"${{github.ref}}"}}" =~ "refs/tags/.*" ]]; then + if [[ "{{"${{github.event.pull_request}}"}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/test/templates/cluster_endtoend_test_docker.tpl b/test/templates/cluster_endtoend_test_docker.tpl index a12deb7dd32..f0c895a2abb 100644 --- a/test/templates/cluster_endtoend_test_docker.tpl +++ b/test/templates/cluster_endtoend_test_docker.tpl @@ -20,7 +20,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "{{"${{github.event.pull_request}}"}}" == "" ]] && [[ "{{"${{github.ref}}"}}" != "refs/heads/main" ]] && [[ ! "{{"${{github.ref}}"}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "{{"${{github.ref}}"}}" =~ "refs/tags/.*" ]]; then + if [[ "{{"${{github.event.pull_request}}"}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/test/templates/cluster_endtoend_test_mysql57.tpl b/test/templates/cluster_endtoend_test_mysql57.tpl index 3837de1c133..8135405c743 100644 --- a/test/templates/cluster_endtoend_test_mysql57.tpl +++ b/test/templates/cluster_endtoend_test_mysql57.tpl @@ -33,7 +33,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "{{"${{github.event.pull_request}}"}}" == "" ]] && [[ "{{"${{github.ref}}"}}" != "refs/heads/main" ]] && [[ ! "{{"${{github.ref}}"}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "{{"${{github.ref}}"}}" =~ "refs/tags/.*" ]]; then + if [[ "{{"${{github.event.pull_request}}"}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/test/templates/cluster_endtoend_test_self_hosted.tpl b/test/templates/cluster_endtoend_test_self_hosted.tpl index d31978d3f34..e76219070f1 100644 --- a/test/templates/cluster_endtoend_test_self_hosted.tpl +++ b/test/templates/cluster_endtoend_test_self_hosted.tpl @@ -23,7 +23,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "{{"${{github.event.pull_request}}"}}" == "" ]] && [[ "{{"${{github.ref}}"}}" != "refs/heads/main" ]] && [[ ! "{{"${{github.ref}}"}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "{{"${{github.ref}}"}}" =~ "refs/tags/.*" ]]; then + if [[ "{{"${{github.event.pull_request}}"}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/test/templates/unit_test.tpl b/test/templates/unit_test.tpl index dff1ef9133e..ef10345ab15 100644 --- a/test/templates/unit_test.tpl +++ b/test/templates/unit_test.tpl @@ -28,7 +28,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "{{"${{github.event.pull_request}}"}}" == "" ]] && [[ "{{"${{github.ref}}"}}" != "refs/heads/main" ]] && [[ ! "{{"${{github.ref}}"}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "{{"${{github.ref}}"}}" =~ "refs/tags/.*" ]]; then + if [[ "{{"${{github.event.pull_request}}"}}" == "" ]]; then skip='true' fi echo Skip ${skip} @@ -132,7 +132,7 @@ jobs: go mod download go install golang.org/x/tools/cmd/goimports@latest - + # install JUnit report formatter go install github.com/vitessio/go-junit-report@HEAD diff --git a/test/templates/unit_test_self_hosted.tpl b/test/templates/unit_test_self_hosted.tpl index 1bb28a07399..bb57b50e041 100644 --- a/test/templates/unit_test_self_hosted.tpl +++ b/test/templates/unit_test_self_hosted.tpl @@ -22,7 +22,7 @@ jobs: id: skip-workflow run: | skip='false' - if [[ "{{"${{github.event.pull_request}}"}}" == "" ]] && [[ "{{"${{github.ref}}"}}" != "refs/heads/main" ]] && [[ ! "{{"${{github.ref}}"}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "{{"${{github.ref}}"}}" =~ "refs/tags/.*" ]]; then + if [[ "{{"${{github.event.pull_request}}"}}" == "" ]]; then skip='true' fi echo Skip ${skip} diff --git a/tools/get_next_release_shopify.sh b/tools/get_next_release_shopify.sh new file mode 100755 index 00000000000..38cc78784a0 --- /dev/null +++ b/tools/get_next_release_shopify.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# Copyright 2022 The Vitess Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# github.base_ref $1 +git fetch --tags origin + +target_release="" + +latest_major_release=$(git show-ref --tags | grep -E 'refs/tags/v[0-9]*\.[0-9]*\.[0-9]*$' | sed 's/[a-z0-9]* refs\/tags\/v//' | awk -v FS=. '{print $1}' | sort -Vr | head -n1) +major_release=$(cat ./go/vt/servenv/version.go| grep versionName | awk -v 'FS= ' '{print $4}' | tr -d '"' | sed 's/\..*//') +target_major_release=$((major_release+1)) + +# Try to get the latest shopify release +target_release_number=$(git show-ref | grep -E 'refs/remotes/origin/v[0-9]*\.[0-9]*\.[0-9]*-shopify-[0-9]*$' | sed 's/[a-z0-9]* refs\/remotes\/origin\/v//' | awk -v FS=. -v RELEASE="$target_major_release" '{if ($1 == RELEASE) print; }' | sort -Vr | head -n1) +if [ -z "$target_release_number" ]; then + # Fallback to upstream release if shopify release doesn't exist + target_release_number=$(git show-ref --tags | grep -E 'refs/tags/v[0-9]*\.[0-9]*\.[0-9]*$' | sed 's/[a-z0-9]* refs\/tags\/v//' | awk -v FS=. -v RELEASE="$target_major_release" '{if ($1 == RELEASE) print; }' | sort -Vr | head -n1) +fi +target_release="v$target_release_number" + +if [ "$major_release" == "$latest_major_release" ]; then + target_release="main" +fi + +echo "$target_release" diff --git a/tools/get_previous_release_shopify.sh b/tools/get_previous_release_shopify.sh new file mode 100755 index 00000000000..74ad558648b --- /dev/null +++ b/tools/get_previous_release_shopify.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Copyright 2022 The Vitess Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This script is used to build and copy the Angular 2 based vtctld UI +# into the release folder (app) for checkin. Prior to running this script, +# bootstrap.sh and bootstrap_web.sh should already have been run. + +# github.base_ref $1 + +target_release="" + +major_release=$(cat ./go/vt/servenv/version.go| grep versionName | awk -v 'FS= ' '{print $4}' | tr -d '"' | sed 's/\..*//') +target_major_release=$((major_release-1)) +target_release_number=$(git show-ref | grep -E 'refs/remotes/origin/v[0-9]*.[0-9]*.[0-9]*-shopify-[0-9]*$' | sed 's/[a-z0-9]* refs\/remotes\/origin\/v//' | awk -v FS=. -v RELEASE="$target_major_release" '{if ($1 == RELEASE) print; }' | sort -Vr | head -n1) +if [ ! -z "$target_release_number" ] +then + target_release="v$target_release_number" +fi + +echo "$target_release" From bca1b632b292ec8d92c182461798879d138a9a68 Mon Sep 17 00:00:00 2001 From: shanth96 Date: Thu, 4 Apr 2024 10:45:39 -0400 Subject: [PATCH 7/9] Merge pull request #153 from Shopify/fix-build-issue Fix build issues (cherry picked from commit 2815e0e43606984b555905735caa9c9dd0e21920) (cherry picked from commit fdefd713889f090d2a6e4fa0593fc4c8421403ba) --- docker/lite/Dockerfile.mysql57 | 8 +++--- docker/lite/Dockerfile.mysql80 | 8 +++--- docker/lite/Dockerfile.percona57 | 8 +++--- docker/lite/Dockerfile.percona80 | 8 +++--- docker/lite/Dockerfile.testing | 2 +- docker/lite/install_dependencies.sh | 44 +++++++++++++++-------------- 6 files changed, 40 insertions(+), 38 deletions(-) diff --git a/docker/lite/Dockerfile.mysql57 b/docker/lite/Dockerfile.mysql57 index 390e9d6d7da..42a13f642eb 100644 --- a/docker/lite/Dockerfile.mysql57 +++ b/docker/lite/Dockerfile.mysql57 @@ -1,11 +1,11 @@ # Copyright 2019 The Vitess Authors. -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,7 +33,7 @@ USER vitess RUN make install PREFIX=/vt/install # Start over and build the final image. -FROM debian:buster-slim +FROM debian:bullseye-slim # Install dependencies COPY docker/lite/install_dependencies.sh /vt/dist/install_dependencies.sh diff --git a/docker/lite/Dockerfile.mysql80 b/docker/lite/Dockerfile.mysql80 index 51d63a3df44..dc929b84684 100644 --- a/docker/lite/Dockerfile.mysql80 +++ b/docker/lite/Dockerfile.mysql80 @@ -1,11 +1,11 @@ # Copyright 2019 The Vitess Authors. -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,7 +33,7 @@ USER vitess RUN make install PREFIX=/vt/install # Start over and build the final image. -FROM debian:buster-slim +FROM debian:bullseye-slim # Install dependencies COPY docker/lite/install_dependencies.sh /vt/dist/install_dependencies.sh diff --git a/docker/lite/Dockerfile.percona57 b/docker/lite/Dockerfile.percona57 index 95780d0bf75..2b32dae6322 100644 --- a/docker/lite/Dockerfile.percona57 +++ b/docker/lite/Dockerfile.percona57 @@ -1,11 +1,11 @@ # Copyright 2019 The Vitess Authors. -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,7 +33,7 @@ USER vitess RUN make install PREFIX=/vt/install # Start over and build the final image. -FROM debian:buster-slim +FROM debian:bullseye-slim # Install dependencies COPY docker/lite/install_dependencies.sh /vt/dist/install_dependencies.sh diff --git a/docker/lite/Dockerfile.percona80 b/docker/lite/Dockerfile.percona80 index 20b9ce1b131..96fd1137c00 100644 --- a/docker/lite/Dockerfile.percona80 +++ b/docker/lite/Dockerfile.percona80 @@ -1,11 +1,11 @@ # Copyright 2019 The Vitess Authors. -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,7 +33,7 @@ USER vitess RUN make install PREFIX=/vt/install # Start over and build the final image. -FROM debian:buster-slim +FROM debian:bullseye-slim # Install dependencies COPY docker/lite/install_dependencies.sh /vt/dist/install_dependencies.sh diff --git a/docker/lite/Dockerfile.testing b/docker/lite/Dockerfile.testing index d47c45ef0df..924aee0e226 100644 --- a/docker/lite/Dockerfile.testing +++ b/docker/lite/Dockerfile.testing @@ -33,7 +33,7 @@ USER vitess RUN make install-testing PREFIX=/vt/install # Start over and build the final image. -FROM debian:buster-slim +FROM debian:bullseye-slim # Install dependencies COPY docker/lite/install_dependencies.sh /vt/dist/install_dependencies.sh diff --git a/docker/lite/install_dependencies.sh b/docker/lite/install_dependencies.sh index f2adfb85df9..2fe86ca5287 100755 --- a/docker/lite/install_dependencies.sh +++ b/docker/lite/install_dependencies.sh @@ -84,23 +84,25 @@ mysql57) ;; mysql80) mysql8_version=8.0.30 - do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/libmysqlclient21_${mysql8_version}-1debian10_amd64.deb /tmp/libmysqlclient21_${mysql8_version}-1debian10_amd64.deb - do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-community-client-core_${mysql8_version}-1debian10_amd64.deb /tmp/mysql-community-client-core_${mysql8_version}-1debian10_amd64.deb - do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-community-client-plugins_${mysql8_version}-1debian10_amd64.deb /tmp/mysql-community-client-plugins_${mysql8_version}-1debian10_amd64.deb - do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-community-client_${mysql8_version}-1debian10_amd64.deb /tmp/mysql-community-client_${mysql8_version}-1debian10_amd64.deb - do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-client_${mysql8_version}-1debian10_amd64.deb /tmp/mysql-client_${mysql8_version}-1debian10_amd64.deb - do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-community-server-core_${mysql8_version}-1debian10_amd64.deb /tmp/mysql-community-server-core_${mysql8_version}-1debian10_amd64.deb - do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-community-server_${mysql8_version}-1debian10_amd64.deb /tmp/mysql-community-server_${mysql8_version}-1debian10_amd64.deb - do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-server_${mysql8_version}-1debian10_amd64.deb /tmp/mysql-server_${mysql8_version}-1debian10_amd64.deb + do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-common_${mysql8_version}-1debian11_amd64.deb /tmp/mysql-common_${mysql8_version}-1debian11_amd64.deb + do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/libmysqlclient21_${mysql8_version}-1debian11_amd64.deb /tmp/libmysqlclient21_${mysql8_version}-1debian11_amd64.deb + do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-community-client-core_${mysql8_version}-1debian11_amd64.deb /tmp/mysql-community-client-core_${mysql8_version}-1debian11_amd64.deb + do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-community-client-plugins_${mysql8_version}-1debian11_amd64.deb /tmp/mysql-community-client-plugins_${mysql8_version}-1debian11_amd64.deb + do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-community-client_${mysql8_version}-1debian11_amd64.deb /tmp/mysql-community-client_${mysql8_version}-1debian11_amd64.deb + do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-client_${mysql8_version}-1debian11_amd64.deb /tmp/mysql-client_${mysql8_version}-1debian11_amd64.deb + do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-community-server-core_${mysql8_version}-1debian11_amd64.deb /tmp/mysql-community-server-core_${mysql8_version}-1debian11_amd64.deb + do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-community-server_${mysql8_version}-1debian11_amd64.deb /tmp/mysql-community-server_${mysql8_version}-1debian11_amd64.deb + do_fetch https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community/mysql-server_${mysql8_version}-1debian11_amd64.deb /tmp/mysql-server_${mysql8_version}-1debian11_amd64.deb PACKAGES=( - /tmp/libmysqlclient21_${mysql8_version}-1debian10_amd64.deb - /tmp/mysql-community-client-core_${mysql8_version}-1debian10_amd64.deb - /tmp/mysql-community-client-plugins_${mysql8_version}-1debian10_amd64.deb - /tmp/mysql-community-client_${mysql8_version}-1debian10_amd64.deb - /tmp/mysql-client_${mysql8_version}-1debian10_amd64.deb - /tmp/mysql-community-server-core_${mysql8_version}-1debian10_amd64.deb - /tmp/mysql-community-server_${mysql8_version}-1debian10_amd64.deb - /tmp/mysql-server_${mysql8_version}-1debian10_amd64.deb + /tmp/mysql-common_${mysql8_version}-1debian11_amd64.deb + /tmp/libmysqlclient21_${mysql8_version}-1debian11_amd64.deb + /tmp/mysql-community-client-core_${mysql8_version}-1debian11_amd64.deb + /tmp/mysql-community-client-plugins_${mysql8_version}-1debian11_amd64.deb + /tmp/mysql-community-client_${mysql8_version}-1debian11_amd64.deb + /tmp/mysql-client_${mysql8_version}-1debian11_amd64.deb + /tmp/mysql-community-server-core_${mysql8_version}-1debian11_amd64.deb + /tmp/mysql-community-server_${mysql8_version}-1debian11_amd64.deb + /tmp/mysql-server_${mysql8_version}-1debian11_amd64.deb percona-xtrabackup-80 ) ;; @@ -143,21 +145,21 @@ add_apt_key 9334A25F8507EFA5 # Add extra apt repositories for MySQL. case "${FLAVOR}" in mysql57) - echo 'deb http://repo.mysql.com/apt/debian/ buster mysql-5.7' > /etc/apt/sources.list.d/mysql.list + echo 'deb http://repo.mysql.com/apt/debian/ bullseye mysql-5.7' > /etc/apt/sources.list.d/mysql.list ;; mysql80) - echo 'deb http://repo.mysql.com/apt/debian/ buster mysql-8.0' > /etc/apt/sources.list.d/mysql.list + echo 'deb http://repo.mysql.com/apt/debian/ bullseye mysql-8.0' > /etc/apt/sources.list.d/mysql.list ;; esac # Add extra apt repositories for Percona Server and/or Percona XtraBackup. case "${FLAVOR}" in mysql57|mysql80|percona57) - echo 'deb http://repo.percona.com/apt buster main' > /etc/apt/sources.list.d/percona.list + echo 'deb http://repo.percona.com/apt bullseye main' > /etc/apt/sources.list.d/percona.list ;; percona80) - echo 'deb http://repo.percona.com/apt buster main' > /etc/apt/sources.list.d/percona.list - echo 'deb http://repo.percona.com/ps-80/apt buster main' > /etc/apt/sources.list.d/percona80.list + echo 'deb http://repo.percona.com/apt bullseye main' > /etc/apt/sources.list.d/percona.list + echo 'deb http://repo.percona.com/ps-80/apt bullseye main' > /etc/apt/sources.list.d/percona80.list ;; esac From e05a8149aae28aae6d7dffac06d85f80524a676c Mon Sep 17 00:00:00 2001 From: Pawan Dubey <2499863+pawandubey@users.noreply.github.com> Date: Tue, 9 Apr 2024 15:58:36 -0400 Subject: [PATCH 8/9] Merge pull request #155 from Shopify/candidate-v15.0.3-shopify-11 Backport: set vreplication net read and net write timeout session vars to high values (cherry picked from commit 84ea974575014d7d40182c19c5c093b34671cee0) (cherry picked from commit 5cc2dfcb138ba33e0536f50957a1000900b028f7) (cherry picked from commit dde12107e0b1c5e4d1804b77ac538fad108fbd30) --- go/flags/endtoend/vttablet.txt | 2 ++ go/vt/vttablet/flags.go | 7 +++++++ go/vt/vttablet/tabletmanager/vreplication/controller.go | 8 ++++++++ go/vt/vttablet/tabletserver/vstreamer/rowstreamer.go | 8 ++++++++ 4 files changed, 25 insertions(+) diff --git a/go/flags/endtoend/vttablet.txt b/go/flags/endtoend/vttablet.txt index f4319799061..6d12d638bcf 100644 --- a/go/flags/endtoend/vttablet.txt +++ b/go/flags/endtoend/vttablet.txt @@ -376,6 +376,8 @@ Usage of vttablet: --vreplication_healthcheck_topology_refresh duration refresh interval for re-reading the topology (default 30s) --vreplication_heartbeat_update_interval int Frequency (in seconds, default 1, max 60) at which the time_updated column of a vreplication stream when idling (default 1) --vreplication_max_time_to_retry_on_error duration stop automatically retrying when we've had consecutive failures with the same error for this long after the first occurrence + --vreplication_net_read_timeout int Session value of net_read_timeout for vreplication, in seconds (default 300) + --vreplication_net_write_timeout int Session value of net_write_timeout for vreplication, in seconds (default 600) --vreplication_replica_lag_tolerance duration Replica lag threshold duration: once lag is below this we switch from copy phase to the replication (streaming) phase (default 1m0s) --vreplication_retry_delay duration delay before retrying a failed workflow event in the replication phase (default 5s) --vreplication_store_compressed_gtid Store compressed gtids in the pos column of the sidecar database's vreplication table diff --git a/go/vt/vttablet/flags.go b/go/vt/vttablet/flags.go index 460a5427358..7f00aa8bc66 100644 --- a/go/vt/vttablet/flags.go +++ b/go/vt/vttablet/flags.go @@ -29,6 +29,11 @@ const ( var VReplicationExperimentalFlags = VReplicationExperimentalFlagOptimizeInserts | VReplicationExperimentalFlagAllowNoBlobBinlogRowImage +var ( + VReplicationNetReadTimeout = 300 + VReplicationNetWriteTimeout = 600 +) + func init() { servenv.OnParseFor("vttablet", registerFlags) } @@ -36,4 +41,6 @@ func init() { func registerFlags(fs *pflag.FlagSet) { fs.Int64Var(&VReplicationExperimentalFlags, "vreplication_experimental_flags", VReplicationExperimentalFlags, "(Bitmask) of experimental features in vreplication to enable") + fs.IntVar(&VReplicationNetReadTimeout, "vreplication_net_read_timeout", VReplicationNetReadTimeout, "Session value of net_read_timeout for vreplication, in seconds") + fs.IntVar(&VReplicationNetWriteTimeout, "vreplication_net_write_timeout", VReplicationNetWriteTimeout, "Session value of net_write_timeout for vreplication, in seconds") } diff --git a/go/vt/vttablet/tabletmanager/vreplication/controller.go b/go/vt/vttablet/tabletmanager/vreplication/controller.go index 8f9974a5424..ea1026cdf54 100644 --- a/go/vt/vttablet/tabletmanager/vreplication/controller.go +++ b/go/vt/vttablet/tabletmanager/vreplication/controller.go @@ -24,6 +24,8 @@ import ( "sync/atomic" "time" + "vitess.io/vitess/go/vt/vttablet" + "google.golang.org/protobuf/encoding/prototext" "vitess.io/vitess/go/vt/discovery" @@ -243,6 +245,12 @@ func (ct *controller) runBlp(ctx context.Context) (err error) { if _, err := dbClient.ExecuteFetch("set names 'binary'", 10000); err != nil { return err } + if _, err := dbClient.ExecuteFetch(fmt.Sprintf("set @@session.net_read_timeout = %v", vttablet.VReplicationNetReadTimeout), 10000); err != nil { + return err + } + if _, err := dbClient.ExecuteFetch(fmt.Sprintf("set @@session.net_write_timeout = %v", vttablet.VReplicationNetWriteTimeout), 10000); err != nil { + return err + } // We must apply AUTO_INCREMENT values precisely as we got them. This include the 0 value, which is not recommended in AUTO_INCREMENT, and yet is valid. if _, err := dbClient.ExecuteFetch("set @@session.sql_mode = CONCAT(@@session.sql_mode, ',NO_AUTO_VALUE_ON_ZERO')", 10000); err != nil { return err diff --git a/go/vt/vttablet/tabletserver/vstreamer/rowstreamer.go b/go/vt/vttablet/tabletserver/vstreamer/rowstreamer.go index 31e13427af3..5c083ea746d 100644 --- a/go/vt/vttablet/tabletserver/vstreamer/rowstreamer.go +++ b/go/vt/vttablet/tabletserver/vstreamer/rowstreamer.go @@ -23,6 +23,8 @@ import ( "time" "vitess.io/vitess/go/mysql" + "vitess.io/vitess/go/vt/vttablet" + "vitess.io/vitess/go/mysql/collations" "vitess.io/vitess/go/sqltypes" "vitess.io/vitess/go/textutil" @@ -119,6 +121,12 @@ func (rs *rowStreamer) Stream() error { if _, err := conn.ExecuteFetch("set names 'binary'", 1, false); err != nil { return err } + if _, err := conn.ExecuteFetch(fmt.Sprintf("set @@session.net_read_timeout = %v", vttablet.VReplicationNetReadTimeout), 1, false); err != nil { + return err + } + if _, err := conn.ExecuteFetch(fmt.Sprintf("set @@session.net_write_timeout = %v", vttablet.VReplicationNetWriteTimeout), 1, false); err != nil { + return err + } return rs.streamQuery(conn, rs.send) } From f7ab69538645bb47d70c2e0a38ed54ffc594cd77 Mon Sep 17 00:00:00 2001 From: Shiv Nagarajan Date: Thu, 9 May 2024 11:25:44 -0400 Subject: [PATCH 9/9] Merge pull request #161 from Shopify/fix_e2e_test_v17 fix for e2e test issue on v17 (cherry picked from commit 6a86fc9d6c258c5f03b69830c0aad286cc9fe4d1) --- .github/workflows/upgrade_downgrade_test_backups_e2e.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/upgrade_downgrade_test_backups_e2e.yml b/.github/workflows/upgrade_downgrade_test_backups_e2e.yml index 2c945aefb85..6701e6e722b 100644 --- a/.github/workflows/upgrade_downgrade_test_backups_e2e.yml +++ b/.github/workflows/upgrade_downgrade_test_backups_e2e.yml @@ -63,7 +63,7 @@ jobs: if: steps.skip-workflow.outputs.skip-workflow == 'false' id: output-previous-release-ref run: | - previous_release_ref=$(./tools/get_previous_release.sh ${{github.base_ref}} ${{github.ref}}) + previous_release_ref=$(./tools/get_previous_release_shopify.sh) echo $previous_release_ref echo "previous_release_ref=${previous_release_ref}" >> $GITHUB_OUTPUT