Skip to content

Commit 67d01e2

Browse files
committed
Merge remote-tracking branch 'upstream/main' into cluster-watch-range
Signed-off-by: Manan Gupta <manan@planetscale.com>
2 parents c405034 + 44e46ed commit 67d01e2

File tree

94 files changed

+13513
-7547
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+13513
-7547
lines changed

.github/workflows/check_make_vtadmin_web_proto.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
6262
with:
6363
# node-version should match package.json
64-
node-version: '20.12.2'
64+
node-version: '22.13.1'
6565

6666
- name: Install npm dependencies
6767
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.proto_changes == 'true'

.github/workflows/static_checks_etc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ jobs:
230230
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
231231
with:
232232
# make proto requires newer node than the pre-installed one
233-
node-version: '20.12.2'
233+
node-version: '22.13.1'
234234

235235
- name: check_make_proto
236236
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.proto_changes == 'true'

.github/workflows/vtadmin_web_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
if: steps.skip-workflow.outputs.skip-workflow == 'false'
4545
with:
4646
# node-version should match package.json
47-
node-version: '20.12.2'
47+
node-version: '22.13.1'
4848

4949
- name: Install dependencies
5050
if: steps.skip-workflow.outputs.skip-workflow == 'false'

.github/workflows/vtadmin_web_lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
if: steps.skip-workflow.outputs.skip-workflow == 'false'
4545
with:
4646
# node-version should match package.json
47-
node-version: '20.12.2'
47+
node-version: '22.13.1'
4848

4949
- name: Install dependencies
5050
if: steps.skip-workflow.outputs.skip-workflow == 'false'

.github/workflows/vtadmin_web_unit_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
if: steps.skip-workflow.outputs.skip-workflow == 'false'
4545
with:
4646
# node-version should match package.json
47-
node-version: '20.12.2'
47+
node-version: '22.13.1'
4848

4949
- name: Install dependencies
5050
if: steps.skip-workflow.outputs.skip-workflow == 'false'

changelog/22.0/22.0.0/summary.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
- **[Minor Changes](#minor-changes)**
2121
- **[VTTablet Flags](#flags-vttablet)**
2222
- **[Topology read concurrency behaviour changes](#topo-read-concurrency-changes)**
23+
- **[VTAdmin](#vtadmin)**
24+
- [Updated to node v22.13.1](#updated-node)
2325

2426
## <a id="major-changes"/>Major Changes</a>
2527

@@ -156,3 +158,10 @@ While the flag will continue to accept float values (interpreted as seconds) for
156158
The `--topo_read_concurrency` flag was added to all components that access the topology and the provided limit is now applied separately for each global or local cell _(default `32`)_.
157159

158160
All topology read calls _(`Get`, `GetVersion`, `List` and `ListDir`)_ now respect this per-cell limit. Previous to this version a single limit was applied to all cell calls and it was not respected by many topology calls.
161+
162+
### <a id="vtadmin"/>VTAdmin
163+
164+
#### <a id="updated-node"/>vtadmin-web updated to node v22.13.1 (LTS)
165+
166+
Building `vtadmin-web` now requires node >= v22.13.0 (LTS). Breaking changes from v20 to v22 can be found at https://nodejs.org/en/blog/release/v22.13.0 -- with no known issues that apply to VTAdmin.
167+
Full details on the node v20.12.2 release can be found at https://nodejs.org/en/blog/release/v22.13.1.

doc/internal/release/how-to-release.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,8 @@ You will need administrator privileges on the vitess repository to be able to ma
364364

365365
```bash
366366
cd ./java/
367-
mvn clean deploy -P release -DskipTests
367+
# For <= v21.0, we must use -DskipTests in the mvn command below
368+
mvn clean deploy -P release
368369
cd ..
369370
```
370371

docker/binaries/vtadmin/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ARG DEBIAN_VER=bookworm-slim
1717

1818
FROM vitess/lite:${VT_BASE_VER} AS lite
1919

20-
FROM node:20-${DEBIAN_VER} as node
20+
FROM node:22-${DEBIAN_VER} as node
2121

2222
# Prepare directory structure.
2323
RUN mkdir -p /vt/web

go/cmd/vtcombo/cli/vschema_watcher.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,20 @@ func loadKeyspacesFromDir(ctx context.Context, dir string, ts *topo.Server) {
5656
log.Fatalf("Unable to read keyspace file %v: %v", ksFile, err)
5757
}
5858

59-
keyspace := &vschemapb.Keyspace{}
60-
err = json.Unmarshal(jsonData, keyspace)
59+
ksvs := &topo.KeyspaceVSchemaInfo{
60+
Name: ks.Name,
61+
Keyspace: &vschemapb.Keyspace{},
62+
}
63+
err = json.Unmarshal(jsonData, ksvs.Keyspace)
6164
if err != nil {
6265
log.Fatalf("Unable to parse keyspace file %v: %v", ksFile, err)
6366
}
6467

65-
_, err = vindexes.BuildKeyspace(keyspace, env.Parser())
68+
_, err = vindexes.BuildKeyspace(ksvs.Keyspace, env.Parser())
6669
if err != nil {
6770
log.Fatalf("Invalid keyspace definition: %v", err)
6871
}
69-
ts.SaveVSchema(ctx, ks.Name, keyspace)
72+
ts.SaveVSchema(ctx, ksvs)
7073
log.Infof("Loaded keyspace %v from %v\n", ks.Name, ksFile)
7174
}
7275
}

go/cmd/vtctldclient/command/vreplication/lookupvindex/lookupvindex.go

Lines changed: 96 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@ var (
7272

7373
externalizeOptions = struct {
7474
Keyspace string
75+
Delete bool
76+
}{}
77+
78+
internalizeOptions = struct {
79+
Keyspace string
80+
}{}
81+
82+
completeOptions = struct {
83+
Keyspace string
7584
}{}
7685

7786
parseAndValidateCreate = func(cmd *cobra.Command, args []string) error {
@@ -142,6 +151,18 @@ var (
142151
RunE: commandCancel,
143152
}
144153

154+
// complete makes a LookupVindexComplete call to a vtctld.
155+
complete = &cobra.Command{
156+
Use: "complete",
157+
Short: "Complete the LookupVindex workflow. The Vindex must have been previously externalized. If you want to delete the workflow without externalizing the Vindex then use the cancel command instead.",
158+
Example: `vtctldclient --server localhost:15999 LookupVindex --name corder_lookup_vdx --table-keyspace customer complete`,
159+
SilenceUsage: true,
160+
DisableFlagsInUseLine: true,
161+
Aliases: []string{"Complete"},
162+
Args: cobra.NoArgs,
163+
RunE: commandComplete,
164+
}
165+
145166
// create makes a LookupVindexCreate call to a vtctld.
146167
create = &cobra.Command{
147168
Use: "create",
@@ -158,7 +179,7 @@ var (
158179
// externalize makes a LookupVindexExternalize call to a vtctld.
159180
externalize = &cobra.Command{
160181
Use: "externalize",
161-
Short: "Externalize the Lookup Vindex. If the Vindex has an owner the VReplication workflow will also be deleted.",
182+
Short: "Externalize the Lookup Vindex. If the Vindex has an owner the VReplication workflow will also be stopped/deleted.",
162183
Example: `vtctldclient --server localhost:15999 LookupVindex --name corder_lookup_vdx --table-keyspace customer externalize`,
163184
SilenceUsage: true,
164185
DisableFlagsInUseLine: true,
@@ -167,6 +188,18 @@ var (
167188
RunE: commandExternalize,
168189
}
169190

191+
// internalize makes a LookupVindexInternalize call to a vtctld.
192+
internalize = &cobra.Command{
193+
Use: "internalize",
194+
Short: "Internalize the Vindex again to continue the backfill, making it unusable for queries again.",
195+
Example: `vtctldclient --server localhost:15999 LookupVindex --name corder_lookup_vdx --table-keyspace customer internalize`,
196+
SilenceUsage: true,
197+
DisableFlagsInUseLine: true,
198+
Aliases: []string{"Internalize"},
199+
Args: cobra.NoArgs,
200+
RunE: commandInternalize,
201+
}
202+
170203
// show makes a GetWorkflows call to a vtctld.
171204
show = &cobra.Command{
172205
Use: "show",
@@ -199,6 +232,30 @@ func commandCancel(cmd *cobra.Command, args []string) error {
199232
return nil
200233
}
201234

235+
func commandComplete(cmd *cobra.Command, args []string) error {
236+
if completeOptions.Keyspace == "" {
237+
completeOptions.Keyspace = baseOptions.TableKeyspace
238+
}
239+
cli.FinishedParsing(cmd)
240+
241+
_, err := common.GetClient().LookupVindexComplete(common.GetCommandCtx(), &vtctldatapb.LookupVindexCompleteRequest{
242+
Keyspace: completeOptions.Keyspace,
243+
// The name of the workflow and lookup vindex.
244+
Name: baseOptions.Name,
245+
// Where the lookup table and VReplication workflow were created.
246+
TableKeyspace: baseOptions.TableKeyspace,
247+
})
248+
249+
if err != nil {
250+
return err
251+
}
252+
253+
output := fmt.Sprintf("LookupVindex %s has been completed and the VReplication workflow has been deleted.", baseOptions.Name)
254+
fmt.Println(output)
255+
256+
return nil
257+
}
258+
202259
func commandCreate(cmd *cobra.Command, args []string) error {
203260
tsp := common.GetTabletSelectionPreference(cmd)
204261
cli.FinishedParsing(cmd)
@@ -236,21 +293,49 @@ func commandExternalize(cmd *cobra.Command, args []string) error {
236293
Name: baseOptions.Name,
237294
// Where the lookup table and VReplication workflow were created.
238295
TableKeyspace: baseOptions.TableKeyspace,
296+
// Delete the workflow after externalizing, instead of stopping.
297+
DeleteWorkflow: externalizeOptions.Delete,
239298
})
240299

241300
if err != nil {
242301
return err
243302
}
244303

245304
output := fmt.Sprintf("LookupVindex %s has been externalized", baseOptions.Name)
246-
if resp.WorkflowDeleted {
247-
output = output + fmt.Sprintf(" and the %s VReplication workflow has been deleted", baseOptions.Name)
305+
if resp.WorkflowStopped {
306+
output = output + " and the VReplication workflow has been stopped."
307+
} else if resp.WorkflowDeleted {
308+
output = output + " and the VReplication workflow has been deleted."
248309
}
249310
fmt.Println(output)
250311

251312
return nil
252313
}
253314

315+
func commandInternalize(cmd *cobra.Command, args []string) error {
316+
if internalizeOptions.Keyspace == "" {
317+
internalizeOptions.Keyspace = baseOptions.TableKeyspace
318+
}
319+
cli.FinishedParsing(cmd)
320+
321+
_, err := common.GetClient().LookupVindexInternalize(common.GetCommandCtx(), &vtctldatapb.LookupVindexInternalizeRequest{
322+
Keyspace: internalizeOptions.Keyspace,
323+
// The name of the workflow and lookup vindex.
324+
Name: baseOptions.Name,
325+
// Where the lookup table and VReplication workflow were created.
326+
TableKeyspace: baseOptions.TableKeyspace,
327+
})
328+
329+
if err != nil {
330+
return err
331+
}
332+
333+
output := fmt.Sprintf("LookupVindex %s has been internalized and the VReplication workflow has been started.", baseOptions.Name)
334+
fmt.Println(output)
335+
336+
return nil
337+
}
338+
254339
func commandShow(cmd *cobra.Command, args []string) error {
255340
cli.FinishedParsing(cmd)
256341

@@ -304,12 +389,19 @@ func registerCommands(root *cobra.Command) {
304389
// for the VReplication workflow used.
305390
base.AddCommand(show)
306391

307-
// This will also delete the VReplication workflow if the
392+
// This will also stop the VReplication workflow if the
308393
// vindex has an owner as the lookup vindex will then be
309394
// managed by VTGate.
310395
externalize.Flags().StringVar(&externalizeOptions.Keyspace, "keyspace", "", "The keyspace containing the Lookup Vindex. If no value is specified then the table-keyspace will be used.")
396+
externalize.Flags().BoolVar(&externalizeOptions.Delete, "delete", false, "Delete the VReplication workflow after externalizing the Vindex, instead of stopping (default false).")
311397
base.AddCommand(externalize)
312398

399+
internalize.Flags().StringVar(&internalizeOptions.Keyspace, "keyspace", "", "The keyspace containing the Lookup Vindex. If no value is specified then the table-keyspace will be used.")
400+
base.AddCommand(internalize)
401+
402+
complete.Flags().StringVar(&completeOptions.Keyspace, "keyspace", "", "The keyspace containing the Lookup Vindex. If no value is specified then the table-keyspace will be used.")
403+
base.AddCommand(complete)
404+
313405
// The cancel command deletes the VReplication workflow used
314406
// to backfill the lookup vindex. It ends up making a
315407
// WorkflowDelete VtctldServer call.

go/cmd/vtctldclient/command/vreplication/workflow/state.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,17 @@ func commandUpdateState(cmd *cobra.Command, args []string) error {
6060
cli.FinishedParsing(cmd)
6161

6262
var state binlogdatapb.VReplicationWorkflowState
63+
var shards []string
6364
switch strings.ToLower(cmd.Name()) {
6465
case "start":
6566
if err := common.CanRestartWorkflow(baseOptions.Keyspace, baseOptions.Workflow); err != nil {
6667
return err
6768
}
6869
state = binlogdatapb.VReplicationWorkflowState_Running
70+
shards = baseOptions.Shards
6971
case "stop":
7072
state = binlogdatapb.VReplicationWorkflowState_Stopped
73+
shards = baseOptions.Shards
7174
default:
7275
return fmt.Errorf("invalid workflow state: %s", args[0])
7376
}
@@ -80,6 +83,7 @@ func commandUpdateState(cmd *cobra.Command, args []string) error {
8083
Cells: textutil.SimulatedNullStringSlice,
8184
TabletTypes: textutil.SimulatedNullTabletTypeSlice,
8285
State: &state,
86+
Shards: shards,
8387
},
8488
}
8589

go/mysql/binlog_dump.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,13 @@ func (c *Conn) parseComBinlogDumpGTID(data []byte) (logFile string, logPos uint6
7676
if !ok {
7777
return logFile, logPos, position, readPacketErr
7878
}
79-
if gtid := string(data[pos : pos+int(dataSize)]); gtid != "" {
80-
position, err = replication.DecodePosition(gtid)
79+
if gtidBytes := data[pos : pos+int(dataSize)]; len(gtidBytes) != 0 {
80+
gtid, err := replication.NewMysql56GTIDSetFromSIDBlock(gtidBytes)
8181
if err != nil {
82-
return logFile, logPos, position, err
82+
return logFile, logPos, position, vterrors.Wrapf(err, "error parsing GTID from BinlogDumpGTID packet")
8383
}
84+
// ComBinlogDumpGTID is a MySQL specific protocol. The GTID flavor is necessarily MySQL 56
85+
position = replication.Position{GTIDSet: gtid}
8486
}
8587
if flags2&BinlogDumpNonBlock != 0 {
8688
return logFile, logPos, position, io.EOF

go/mysql/decimal/cached_size.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/mysql/flavor_mysql.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,10 @@ func (mysqlFlavor) sendBinlogDumpCommand(c *Conn, serverID uint32, binlogFilenam
218218
}
219219

220220
// Build the command.
221-
sidBlock := gtidSet.SIDBlock()
221+
var sidBlock []byte
222+
if gtidSet != nil {
223+
sidBlock = gtidSet.SIDBlock()
224+
}
222225
var flags2 uint16
223226
if binlogFilename != "" {
224227
flags2 |= BinlogThroughPosition

go/mysql/replication.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ func (c *Conn) AnalyzeSemiSyncAckRequest(buf []byte) (strippedBuf []byte, ackReq
8181
// WriteComBinlogDumpGTID writes a ComBinlogDumpGTID command.
8282
// Only works with MySQL 5.6+ (and not MariaDB).
8383
// See http://dev.mysql.com/doc/internals/en/com-binlog-dump-gtid.html for syntax.
84-
func (c *Conn) WriteComBinlogDumpGTID(serverID uint32, binlogFilename string, binlogPos uint64, flags uint16, gtidSet []byte) error {
84+
// sidBlock must be the result of a gtidSet.SIDBlock() function.
85+
func (c *Conn) WriteComBinlogDumpGTID(serverID uint32, binlogFilename string, binlogPos uint64, flags uint16, sidBlock []byte) error {
8586
c.sequence = 0
8687
length := 1 + // ComBinlogDumpGTID
8788
2 + // flags
@@ -90,16 +91,16 @@ func (c *Conn) WriteComBinlogDumpGTID(serverID uint32, binlogFilename string, bi
9091
len(binlogFilename) + // binlog-filename
9192
8 + // binlog-pos
9293
4 + // data-size
93-
len(gtidSet) // data
94+
len(sidBlock) // data
9495
data, pos := c.startEphemeralPacketWithHeader(length)
9596
pos = writeByte(data, pos, ComBinlogDumpGTID) // nolint
9697
pos = writeUint16(data, pos, flags) // nolint
9798
pos = writeUint32(data, pos, serverID) // nolint
9899
pos = writeUint32(data, pos, uint32(len(binlogFilename))) // nolint
99100
pos = writeEOFString(data, pos, binlogFilename) // nolint
100101
pos = writeUint64(data, pos, binlogPos) // nolint
101-
pos = writeUint32(data, pos, uint32(len(gtidSet))) // nolint
102-
pos += copy(data[pos:], gtidSet) // nolint
102+
pos = writeUint32(data, pos, uint32(len(sidBlock))) // nolint
103+
pos += copy(data[pos:], sidBlock) // nolint
103104
if err := c.writeEphemeralPacket(); err != nil {
104105
return sqlerror.NewSQLErrorf(sqlerror.CRServerGone, sqlerror.SSUnknownSQLState, "%v", err)
105106
}

0 commit comments

Comments
 (0)