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

674 Коммитов

Автор SHA1 Сообщение Дата
Frances Thai dab32ddc55
[VTAdmin] Cherry Pick Topology Browser (#11518)
* Add web side of topology components

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add GetTopologyPath

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add protos

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add comment explaining why name is not needed at toplevel topo path

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add GetTopologyPath to vtadmin

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Modify node code for non recursive

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Update logic for GetTopologyPath

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Render correct depth for nodes

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add tests TestGetTopologyPath

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add GetTopologyPath command

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Run lint prettier fix

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Consolidate DecodeContent to vt/topo package - can't put in vt/topo/topoproto because of import cycle

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add rbac check for TopologyResource

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Update DecodeContent of zkcmd.go

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Update help text

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Run make proto again

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Run lint prettier fix

Signed-off-by: notfelineit <notfelineit@gmail.com>

Signed-off-by: notfelineit <notfelineit@gmail.com>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Co-authored-by: Florent Poinsard <florent.poinsard@outlook.fr>
2022-10-18 16:14:30 -07:00
vitess-bot[bot] bd8d5c8577
[release-15.0] [VTAdmin] `Validate`, `ValidateShard`, `ValidateVersionShard`, `GetFullStatus` (#11438) (#11452)
* Add validate

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add validate to cluster page

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Run lint prettier fix

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add UI for validate shard

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add validateShard

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Run make web proto

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Refactor validation results and implement validateShard

Signed-off-by: notfelineit <notfelineit@gmail.com>

* add http shards

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add GetFullStatus

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add keys and comment

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Run lint prettier fix

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add ValidateVersionShard to vtctldclient

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add ValidateVersionShard

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Update test for vtctldclient

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add test for ValidateVersionShard

Signed-off-by: notfelineit <notfelineit@gmail.com>

* run lint prettier fix again

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Modify during 1:1 with gomez

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Run lint prettier fix

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Address PR review comments

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Update indentation

Signed-off-by: notfelineit <notfelineit@gmail.com>

Signed-off-by: notfelineit <notfelineit@gmail.com>
Co-authored-by: notfelineit <notfelineit@gmail.com>
2022-10-12 11:47:15 +02:00
Frances Thai 201250b67d
VTAdmin: shard actions (#11328)
* Setting up page for shard actions

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add delete shard to ui

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Complete UI for delete shard

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Make deleteShard redirect to shards list

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add externally reparent

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add TabletExternallyReparented

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Disable externally reparent if no tablet selected

Signed-off-by: notfelineit <notfelineit@gmail.com>

* add all actions to rbac config when --no-rbac is configured'

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Connect up PlannedReparent

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add tablet type to select box

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Show resulting logs after planned reparent

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add emergency failover

Signed-off-by: notfelineit <notfelineit@gmail.com>

* add max height to line area

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Run linter

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Update go/vt/servenv/grpc_server.go

Co-authored-by: Iheanyi Ekechukwu <iekechukwu@gmail.com>
Signed-off-by: Frances Thai <31225471+notfelineit@users.noreply.github.com>

* Address PR comments

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Run gofmt again

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Rename master --> primary

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Run prettier

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Update go/vt/servenv/grpc_auth.go

Co-authored-by: Iheanyi Ekechukwu <iekechukwu@gmail.com>
Signed-off-by: Frances Thai <31225471+notfelineit@users.noreply.github.com>

* Update web/vtadmin/src/components/inputs/Select.tsx

Co-authored-by: Iheanyi Ekechukwu <iekechukwu@gmail.com>
Signed-off-by: Frances Thai <31225471+notfelineit@users.noreply.github.com>

* Trigger GH actions

Signed-off-by: notfelineit <notfelineit@gmail.com>

Signed-off-by: notfelineit <notfelineit@gmail.com>
Signed-off-by: Frances Thai <31225471+notfelineit@users.noreply.github.com>
Co-authored-by: Iheanyi Ekechukwu <iekechukwu@gmail.com>
2022-09-30 10:16:16 -07:00
Phani Raj bccab3777b
Allow non-SSL callers of VTGate RPC APIs to specify group information for the CallerID (#11260)
* Add Groups to vtrpc.CallerID

Signed-off-by: phanatic <phanatic@github.com>

* fix formatting

Signed-off-by: phanatic <phanatic@github.com>

* update vtadmin proto

Signed-off-by: phanatic <phanatic@github.com>

* Add end-to-end test

Signed-off-by: phanatic <phanatic@github.com>

* remove comment formatting

Signed-off-by: phanatic <phanatic@github.com>

* add release notes

Signed-off-by: phanatic <phanatic@github.com>

* fix code formatting

Signed-off-by: phanatic <phanatic@github.com>

* fix vtgate help text

Signed-off-by: phanatic <phanatic@github.com>
Signed-off-by: <phanatic@github.com>

* refactor tests

Signed-off-by: phanatic <phanatic@github.com>

* run go mod tidy

Signed-off-by: phanatic <phanatic@github.com>

* bring back comment changes

Signed-off-by: phanatic <phanatic@github.com>

* rename flag to use dashes instead of underscore

Signed-off-by: Phani Raj <phani@planetscale.com>

* undo comment formatting by make proto

Signed-off-by: Phani Raj <phani@planetscale.com>

* fix formatting

Signed-off-by: Phani Raj <phani@planetscale.com>

* fix help text fixture

Signed-off-by: Phani Raj <phani@planetscale.com>

Signed-off-by: phanatic <phanatic@github.com>
Signed-off-by: <phanatic@github.com>
Signed-off-by: Phani Raj <phani@planetscale.com>
Co-authored-by: phanatic <phanatic@github.com>
2022-09-29 14:08:45 +05:30
Frances Thai ce558fc4aa
[VTAdmin] RebuildKeyspaceGraph, RemoveKeyspaceCell, NewShard (#11249)
* Add RebuildKeyspaceGraph

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Run lint:prettier:fix

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Connect to backend

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add skeleton for RemoveKeyspaceCell

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add javascript equivalent of removeKeyspaceCell

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Connect remove keyspace cell in UI

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Run prettier

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Add skeleton of create shard

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Connect CreateShard to UI

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Use underscores and fix lint issue

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Remove unused component

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Run prettier

Signed-off-by: notfelineit <notfelineit@gmail.com>

* Restart the build

Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: notfelineit <notfelineit@gmail.com>

* Undo changes to unrelated protos

Signed-off-by: notfelineit <notfelineit@gmail.com>

Signed-off-by: notfelineit <notfelineit@gmail.com>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Co-authored-by: Florent Poinsard <florent.poinsard@outlook.fr>
2022-09-23 10:01:23 -07:00
Rohit Nayak 86e0cf822b
Partial Movetables: allow moving a table one shard at a time (#9987)
* Initial Implementation of partial movetables.  Implement cross-shard queries that obey shard routing rules.

Refactor rss updation with routed shard and add to multi col resolution. Run vtgate and reservedconn tests for both regular and with a partially moved shard.

Add ability to run tests with partial keyspaces by adding to a list in the CI generator. Implement that in test.go and cluster setup. Revert previous iteration of running partial keyspace tests in parallel. One test is failing: TestSetSystemVarAutocommitWithConnError.

Add partial vtgate misc test

Add partial keyspace tests to vtgate transaction

Add vtgate queries partial keyspace tests

Review and fix skipped tests where applicable. Refactor to allow conditional skipping of tests for partial keyspaces only so that other tests work exactly as earlier without specifying the DbName, for example

Add move shards example

Cache routing tables and minor refactor. Move move_shards example

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Add lookup index to move shards example. Comment error logs while trying to delete from missing _vt.vdiff table

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Remove move shards demo example

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Add vtgate flag to enable shard routing. Update tests to get vtparams based on partial keyspace setting, so that global routing continues to be tested as earlier without DbName being specified

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

To create subsequent partial movetables workflows we should ignore previous partial movetables (now frozen)

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Remove vdiff2 deletes since they were failing unit tests etc

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Use vtgate flag to enable shard routing rules

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Fix incorrect test setup

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Expect modified frozen query

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

set vtgate param --enable_shard_routing in partial movetables test

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Fix failing tests

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Fix flags test

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Use VTParams helper for partial keyspace tests

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Specify vtParams.DBName for partial keyspace queries

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Self-review. Remove bypass caching.

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Report partial SwitchTraffic results

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Try to address most of the upstream PR review comments

From: https://github.com/vitessio/vitess/pull/9987

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Enforce proper routing for partial migrations

Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Minor changes after self review

Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Account for local timezone in check for vdiff progress

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Update go version in workflows. Fix gofmt issue

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Fix failing CI tests

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Comment failing test for partial keyspaces

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Fix TestVtGateVtExplain by specifying dbname

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Fix leftover debug code

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Move partial keyspace tests to a single shard. Refactor test.go to use multiple config.json files

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Address review comments

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Address review comments

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Improve test skip comments

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* gofmt

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Fix failing tests

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Address review comments

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Try TestFunctionInDefault for partial keyspaces. Update skip comment.

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Delete temporary log lines

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
Co-authored-by: Matt Lord <mattalord@gmail.com>
2022-09-23 12:15:12 +02:00
Dirkjan Bussink ed9bf2427b
Add tracking session state changes for transaction start (#11061)
* Add tracking session state changes for transaction start

This logic depends on the custom option that PlanetScale as in it's
MySQL fork to get the current committed GTID at the start of a
transaction snapshot.

With this GTID, we can optimize vreplication to avoid having to lock
tables around vreplication operations.

See
9fa67ec3eb
for the change in MySQL that is published in our fork.

The change here allows getting back this value through any query
operation that might start a transaction.

Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>

* Use 'session_track_gtids = START_GTID' where possible, and avoid LOCK tables while still getting a transaction consistent GTID

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Co-authored-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
2022-08-22 14:39:34 +03:00
Manan Gupta 71cf144063
Simply Replication Status proto conversions (#10926)
* feat: simplify replication status

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: reserve the two fields on proto

Signed-off-by: Manan Gupta <manan@planetscale.com>

* test: fix typing error to use correct variable

Signed-off-by: Manan Gupta <manan@planetscale.com>

* test: remove test which is no longer required

Signed-off-by: Manan Gupta <manan@planetscale.com>
2022-08-08 19:52:38 +05:30
Manan Gupta 18fbe37346 feat: add getfullstatus rpc to vtctldserver
Signed-off-by: Manan Gupta <manan@planetscale.com>
2022-08-01 16:16:20 +05:30
Matt Lord a9a8dd7988
VDiff2: Add Stop Action (#10830)
* Minor refactoring and stop action handler scaffolding

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Initial implementation of Stop action

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Add e2e test for Stop action

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Minor changes after self review

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Remove unnecessary conditional

uuid.Parse() with an empty string returns an error.

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Don't mark a completed VDiff as stopped

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Need to use withDDL.ExecIgnore in the vdiff retry loop

to avoid potentially doing DDL during tablet state transitions
which can cause the transition to be slow or even hang.

Signed-off-by: Matt Lord <mattalord@gmail.com>
2022-07-26 17:26:17 -04:00
Matt Lord 73b4995518
VDiff2: Auto retry to continue on error (#10639)
* Don't allow resume if VDiff not completed.

An uncompleted vdiff should only be retried, not resumed.

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Record and display VDiff errors per shard

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Better align errors in text based output

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Work with underlying database errors

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Retry when appropriate on vdiff engine startup

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Address bugs in resume/retry logic after adding support for both

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Make auto-retry the default

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Ensure report is valid json before unmarshaling

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Auto retry error'd VDiffs

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Don't retry error'd VDiffs on engine start anymore

We now have a goroutine that will do this periodically

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Limit withDDL usage to entry points

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Add e2e test and fix bugs it exposed

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Ensure we always signal the retry goroutine to stop on engine.Close()

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Use vdiff engine mutex during retries

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Close retry goroutine on vde ctx cancel w/o done channel

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Open & Close of VDiff engine controls retry goroutine

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Rely on sync.Once to apply VDiff schema

And avoid withDDL usage anywhere else.

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Minor change after self review

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Tidy up vdiff retry goroutine mgmt

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Improving gorouting mgmt -- trying to eliminate flakes

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Moar safety

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Making more tweaks to exec and term more quickly

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Aye dios mio

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Go back to 30s ticker

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Make engine open more efficient to improve PRS times

Otherwise PRS was timing out too often waiting for the replicas to
catch up with the new promoted primary.

Signed-off-by: Matt Lord <mattalord@gmail.com>

* isOpen=true before initControllers to ensure proper Close

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Do lazy init in 2 entry points when doing actual work.

Check for cancelled context in the controller.run code path.

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Bug fixes and improvements

TODO: figure out how we should be tracking progress for merges where
      there's a single target shard -- and thus a single
      _vt.vdiff_table record -- but > 1 source shard.

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Final (🤞) set of bug fixes

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Add progress reporting

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Minor changes after self review

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Improved template for error handling in text format

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Bug fixes around progress calculation

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Comment improvement

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Ensure we get correct DB name from vreplication workflow.

And quickly timeout the receive attempted on the controller's
done channel when checking if it's active.

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Bug fixes and improvements to progress reporting

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Minor changes after self review

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Remove unnecessary case in select

We'll never hit that as the first one will receive immediately as
the channel was closed or we'll hit the default.

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Add unit test for progress reporting

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Be more realistic in half way unit test

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Use more descriptive var names in unit test to make logic clear

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Protect all access to vde.controllers

Add comment about safe usage of vde.addController()

Signed-off-by: Matt Lord <mattalord@gmail.com>

* De-flake ers_prs tests using state waits with timeouts

This is a test of the fix in:
  https://github.com/vitessio/vitess/pull/10720

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Minor improvement -- also to exec the test suite again

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Use simpler defer stmt

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Correct VDiff final state handling

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Improve WorkflowDiffer logging & error handling

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Use withDDL.ExecIgnore during engine startup

The VReplication engine does the same.

Signed-off-by: Matt Lord <mattalord@gmail.com>
2022-07-22 11:52:26 -04:00
Harshit Gangal 8755887a6b
Parameterize BIT types and fixes in HEX types (#10689)
* feat: add parsing for bitnums

Signed-off-by: Manan Gupta <manan@planetscale.com>

* test: add invalid cases to tests

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: normalize bitnums to bit vals too

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add normalization for bit literals

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: parameterize binary value to hex

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* test: added e2e test in vtgate and vttablet

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* fix: fix the type conversion from hexnum and hexval to binary

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* test: refactor test

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* fix: return varbinary and flaghex for hexval and hexnum in eval engine typeOf

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* test: separate expectation for mysql and vitess result

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* test: fix test expectation

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* feat: added bitnum bind variable and test

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* proto: vtadmin side update

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* test: fixed test and added more bitnum bind var test

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* added license header

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

Co-authored-by: Manan Gupta <manan@planetscale.com>
2022-07-20 11:48:14 +05:30
Matt Lord a1f1f12be8
Delete all legacy sharding related code (#10278)
* Delete all legacy sharding related code

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Move used until functions from initialsharding to cluster

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Remove vtctl commands

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Kill vtworker and SetKeyspaceServedFrom cmd

Signed-off-by: Matt Lord <mattalord@gmail.com>

* WaitForDrain related stragglers

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Legacy local straggler workflow

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Get rid of SetKeyspaceShardingInfo & wait for drain stragglers

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Remove vtworker stragglers

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Update throttlerservice protobuf

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Rename test 24, add hashicorp vault test to it (now mysql_server_vault)

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Remove last mentiones of legacy sharding in vtctl

Signed-off-by: Matt Lord <mattalord@gmail.com>

* remove binlog_use_v3_resharding_mode

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Address review comments

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Address review comments

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Correct vtgate help output

Signed-off-by: Matt Lord <mattalord@gmail.com>
2022-07-07 13:52:32 -04:00
Deepthi Sigireddi 2599788276
delete unused flags and handling of deprecated protobuf fields (#10612)
* deprecation: delete unused flags and handling of deprecated protobuf fields

Signed-off-by: deepthi <deepthi@planetscale.com>

* test: fix TestHelpOutput assertion

Signed-off-by: Manan Gupta <manan@planetscale.com>

* endtoend: fix tests that were using deleted flag enable-autocommit

Signed-off-by: deepthi <deepthi@planetscale.com>

* deprecation: reserve multiple fields on same line, found and reserved more deprecated fields

Signed-off-by: deepthi <deepthi@planetscale.com>

* deprecation: delete handling of deprecated fields from ExecuteBatch and StreamExecute RPCs

Signed-off-by: deepthi <deepthi@planetscale.com>

* java: remove deleted asTransaction field from executeBatch

Signed-off-by: deepthi <deepthi@planetscale.com>

Co-authored-by: Manan Gupta <manan@planetscale.com>
2022-07-06 10:05:45 -07:00
Shlomi Noach 3012060515
VReplication: throttling info for both source and target; Online DDL propagates said info (#10601)
* vreplication throttling information

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* using RateLimiter

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* rowstreamer reports throttling status, captured by vcopier and logged to vreplication table

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* remove magic hint, add 'throttled' field

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* propagate throttling information into schema_migrations table

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* onlineddl/vrepl endtoend test: verify propagation of throttling info

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* test vstreamer throttling

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* simplify: reuse RateLimiter

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* vtadmin_web_proto_types

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* fix EOF return path

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* expose the two new column in 'vtctl Workflow ... Show'

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* adapt test queries to change in wrangler query

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* fix test

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* proto: add Heartbeat indicator in VStreamRowsResponse

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* fix unit tests

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* RateLimiter.Stop()

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* rowstreamer now sends heartbeats, received by vcopier, and updated in _vt.vreplication

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* whoops. Removed debug Sleep()

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* make vtadmin_web_proto_types

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* skip throttled events

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* f allowed to be nil

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* fix 'now' calculation

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* remove numeric precision

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* ix typo

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* indicate Unix timestamp in field name

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* grammar

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* refactor WaitForThrottledTimestamp

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* formalize ComponentName

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* throttled app is vstreamer

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
2022-07-05 09:39:28 +03:00
Manan Gupta 0caecb84b1
Proto file lint fix and vtadmin generated file (#10563)
* lint: add a new line to proto file and generate generated file

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: fix workflow to also setup go when there are proto changes

Signed-off-by: Manan Gupta <manan@planetscale.com>
2022-06-22 18:00:17 +05:30
Shlomi Noach 5e5d91385a
vtctl GetSchema --table_schema_only (#10552)
* vtctl GetSchema --table_schema_only

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* release notes

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* no short form

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* no short form

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* updated flag comment

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* remove test; the test result is a fake, and therefore is meaningless

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* skip column introspection

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* skip column introspection

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* change to dashes

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
2022-06-22 09:43:08 +03:00
Manan Gupta 611a2601ed
Adds RPCs to vttablet that vtorc requires (#10464)
* feat: add vttablet rpc to reset replication parameters

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: added end to end testing for the rpc and fixed bug

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: fix typing error

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add basic full status rpc functionality and add test for it

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add all the fields needed in full status

Signed-off-by: Manan Gupta <manan@planetscale.com>

* test: moved the test to reparent tests and improved it

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: bug fix for no replication status and no primary status

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add version to the full status output

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add binlog information to full status

Signed-off-by: Manan Gupta <manan@planetscale.com>

* docs: fix the comment explaining the binlog information

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add semi-sync statuses to full status

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: call the correct command

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add server uuid and id to full status

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: make server_id a uint32 to accept the correct range of values

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add few more fields to the full status like version comment, semi-sync settings, binlog_row_image

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: generate vtadmin proto files

Signed-off-by: Manan Gupta <manan@planetscale.com>

* test: add assertion to check binlog row format is read correctly

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: split GTID mode in its own function because mariadb doesn't support it

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: fix parsing of empty mariadb gtid set

Signed-off-by: Manan Gupta <manan@planetscale.com>

* docs: add doucmentation for existing fields in ReplicationStatus

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add relay log file position to the replication status output

Signed-off-by: Manan Gupta <manan@planetscale.com>

* test: augmented full status test to check all the different positions stored

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add additional fields to replication status and read source user

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: read sql delay from show replica status output

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: read ssl allowed from show replica status output

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: read has replication filters from show replica status output

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: read auto position and using gtid from show replica status output

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add replication lag unknown too to replication status

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: return nils from replication and primary postiion if it is not present

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: rename FileRelayLogPosition in replication status output to RelayLogSourceBinLogEquivalentPosition and augment test to make sure rpc changes are backward compatible

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: update vtadmin proto files

Signed-off-by: Manan Gupta <manan@planetscale.com>

* refactor: rename BinLog to binlog in renamed proto field

Signed-off-by: Manan Gupta <manan@planetscale.com>
2022-06-20 10:53:04 +05:30
Harshit Gangal a595babb65
Fix: handle all cases for consistent lookup unique on single transaction mode (#10493)
* test: added failing e2e test

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* feat: proto changes for vindex_only shard session

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* session to ignore multi-db transaction error if shard session is used only for vindex query

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* test: added additional e2e tests that fails

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* feat: claim a vindex only session if other query uses it

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* refactor: addressed all review comments

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2022-06-19 14:19:42 +05:30
Arvind Murty 23727bfee1
Remove v2 resharding fields (#10409)
* cleanup: remove sharding_column_name and sharding_column_type

Signed-off-by: Arvind Murty <arvind.murty@gmail.com>

* cleanup: remove sharding_column_name and sharding_column_type

Signed-off-by: Arvind Murty <arvind.murty@gmail.com>

* cleanup: remove sharding_column_name and sharding_column_type

Signed-off-by: Arvind Murty <arvind.murty@gmail.com>

* cleanup: remove sharding_column_name and sharding_column_type

Signed-off-by: Arvind Murty <arvind.murty@gmail.com>

* generate vtadmin files

Signed-off-by: Arvind Murty <arvind.murty@gmail.com>

* cleanup: remove sharding_column_name and sharding_column_type from vtadmin

Signed-off-by: Arvind Murty <arvind.murty@gmail.com>

* Merge from main

Signed-off-by: Arvind Murty <arvind.murty@gmail.com>
2022-06-10 08:47:56 -07:00
Rohit Nayak e8c2cc088c
Vdiff2: initial release (#10382)
* VDiff2: rearchitect VDiff to run on tablets

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Improve show summary output and add 'show last'

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Improve e2e test

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* go mod tidied

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* regenerate vtadmin protos

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Minor tweaks/improvements to the e2e test

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Another round of minor tweaks

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Use UUID types directly and remove string literals

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Another round of minor tweaks

Signed-off-by: Matt Lord <mattalord@gmail.com>

* You guessed it!! More minor tweaks

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Improve handling of last and all with no results

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Remove double printing for show all output

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Return empty json array for empty show all results

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Add vdiff2 test to CI

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Trigger rebuild

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Another round of tweaks during review

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Final round of code tweaks

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Correct has_mismatch handling

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Adjust reporting for extra/mismatched row samples

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Use proto.Clone to copy VStreamRowsResponse

And use small vstream_packet_size in e2e test.

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Refactor tests. Call VDiff2 side by side with all VDiff1s. Currently failing m2m3 test workflow.

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Add doc.go to package and use a const for trunctated notation

And rename readme.md to README.md so that it is listed first
in lexicographical order.

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Correct year in header for new doc.go file 🤦

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Fix bug where we were not using in_keyrange() for filtering from source. Change logic to update table level mismatch flag to post-reconciliation of extra rows. Enhance vdiff2 test to include split/merge and full merge (working, but needs code refactoring).

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Use unbuffered channels in VDiff2 goroutine comms

TL;DR — I think it was because we were using buffered channels in the table
differ. So the order was not guaranteed and could be off by 1. I suspect the
deep copy synchronized things as a side effect.

I think it may also explain why even after the previous test correction
to return in the wait after sending true to the results channel, vtctlclient
would sometimes get another result after things were torn down. Because the
channels were buffered, where the comment says that we block, we didn’t
until there was 1+1 messages sent to the channel and the order was not
enforced between the goroutines.

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Increase vdiff timeout

Signed-off-by: Matt Lord <mattalord@gmail.com>

* VDiff2 does not support inter cluster diffs today

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Go back to using buffered chans for the vstreams

Added a comment explaining why we *want* to do the Clone here.

If we need other synchronization points in the code paths then we
can handle that independently.

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Refactor vdiff2 tests

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Minor tweaks after final review

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Correct test config after merging main branch

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Add VDiff2 to the v14 release notes summary

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Help output should not show --v2 as defaulting to true

And add note about how to use VDiff2 with example usage to the
release notes summary.

Signed-off-by: Matt Lord <mattalord@gmail.com>

Co-authored-by: Matt Lord <mattalord@gmail.com>
2022-06-07 11:54:18 +02:00
Harshit Gangal 3eded527ac
enhancement: handle advisory locks (#10186)
* feat: parse advisory lock functions

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* feat: added new tokens to keywords file

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* refactor: planner to use new locking func struct

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* feat: add locking functions provided in the select expressions to the lock engine primitive

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* feat: block mixing of locking function with other expression in dual query

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* feat: proto changes to incluse advisory lock info

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* feat: changed unsafe pooling logic based on new locking function parsing

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* feat: advisory lock implementation to track and remove the lock and close lock session when no lock held

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* feat: support only liternal string in lock name

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* feat: allow lock functions to be executed outside of reserved connections except for get_lock

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* fix: use evalengine to evaluate the name from the ast expression

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* feat: allow impossible query to execute out of reserved connection for pool unsafe queries

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* fix: getfields for lock function and name to be extracted as evalengine.Expr in plan time

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* test: added e2e test from #10130

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* feat: change endAction to endLockAction

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* refactor: for backward compatibility

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* addressed review comments

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2022-06-07 12:24:59 +05:30
Andrew Mason 846b3c5b60
[vtadmin] Rename reparent-related RPCs, endpoints, methods, RBAC actions (#10404)
* [vtadmin] Rename reparent-related RPCs, endpoints, methods, RBAC actions

- `EmergencyReparentShard` => `EmergencyFailoverShard`
- `PlannedReparentShard` => `PlannedFailoverShard`
- `ReparentTablet` => `RefreshTabletReplicationSource`
- `TabletExternallyReparented` => `TabletExternallyPromoted`

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Update vtadmin-web code that referenced old type

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* fixup! Update vtadmin-web code that referenced old type

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Remove confusing comments

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* figured out how to run the lint-fixer

Signed-off-by: Andrew Mason <andrew@planetscale.com>
2022-06-03 09:11:33 -04:00
Rohit Nayak f82d8bca76
VStream API: allow cells to be specified for picking source tablets to stream from (#10294)
* Add parameter Cells in vstream api flags, for tablet picker to look for candidates in

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Add e2e test for the new Cells vstream flag

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Self-review

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Address review comments

Signed-off-by: Rohit Nayak <rohit@planetscale.com>
2022-05-27 10:11:53 +02:00
Manan Gupta 25a7ef9324
Adds DurabilityPolicy to the KeyspaceInfo in the topo and the associated RPCs (#10221)
* feat: add durability_policy to the keyspace information in the topo server

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add durability_policy parameter to the CreateKeyspace command in vtctl and vtctld

Signed-off-by: Manan Gupta <manan@planetscale.com>

* test: add tests for durability_policy field in the keyspace information

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add a new rpc to update the durability policy in the keyspace information

Signed-off-by: Manan Gupta <manan@planetscale.com>

* test: add testing for the newly added rpc SetKeyspaceDurabilityPolicy

Signed-off-by: Manan Gupta <manan@planetscale.com>

* test: changed the e2e test to also test the vtctldclient interface

Signed-off-by: Manan Gupta <manan@planetscale.com>

* docs: add a comment explaining the test objective

Signed-off-by: Manan Gupta <manan@planetscale.com>

* test: fix vtctld api test to expect durability_policy as a new returned value in the keyspace information

Signed-off-by: Manan Gupta <manan@planetscale.com>

* docs: fix the help messages for the new command

Signed-off-by: Manan Gupta <manan@planetscale.com>

* docs: fix casing and grammar in the flag description

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: change flag to be hyphenated instead of underscored

Signed-off-by: Manan Gupta <manan@planetscale.com>

* docs: fix the year of license of new file

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: remove the vtctl command

Signed-off-by: Manan Gupta <manan@planetscale.com>

* test: remove the test for the deleted command

Signed-off-by: Manan Gupta <manan@planetscale.com>

* refactor: fix the alphabetic order of functions and rpc registrations

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: fix ordering in vtctld file too

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: improve the long help message

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: fix typing error

Signed-off-by: Manan Gupta <manan@planetscale.com>

* docs: added documentation for keyspace type

Signed-off-by: Manan Gupta <manan@planetscale.com>
2022-05-26 15:40:56 -07:00
Andrew Mason cdd4acdb84
[vtadmin] reparenting actions (#10351)
* Add protos for remaining reparent actions and run generators

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Initial reparent-actions implementations

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add pools and configs for reparent operations

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Update impls to use new pools

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* jk, TER only updates the topo

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add http wrappers

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add unit tests

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Update local rbac to allow reparents

Signed-off-by: Andrew Mason <andrew@planetscale.com>
2022-05-21 15:10:19 -04:00
Andrew Mason 330045e345
[vtadmin] tablet topopools + other cleanup (#10325) 2022-05-17 18:13:14 -04:00
Andrew Mason 2df001ab8c
[vtadmin] reload schema (#10300)
* Start adding proto messages

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Fix ordering

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* fixup! Start adding proto messages

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Implement cluster-level schema reloading

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Implement api method handler

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add http handler wrappers

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* default to "all keyspaces" when nothing else set

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add tests for reloadKeyspaceSchemas

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add tests for reloadShardSchemas

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add tests for reloadSchemaTablets

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* always forgetting about rbac

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add docs for proto sub-messages

Signed-off-by: Andrew Mason <andrew@planetscale.com>
2022-05-17 14:34:07 -04:00
doeg 846c5e2bf0
[vtadmin] Add support for 'allow_primary' when deleting a tablet (#10304)
* Add 'allow_primary' to vtadmin.proto's DeleteTabletRequest

Signed-off-by: Sara Bee <855595+doeg@users.noreply.github.com>

* Update vtadmin-api to pass through allow_primary

Signed-off-by: Sara Bee <855595+doeg@users.noreply.github.com>

* Update UI to set allow_primary=true

Signed-off-by: Sara Bee <855595+doeg@users.noreply.github.com>

* Update wording for notification on a successful DELETE request

Signed-off-by: Sara Bee <855595+doeg@users.noreply.github.com>

* Add Advanced.test.tsx + deletion tests

Signed-off-by: Sara Bee <855595+doeg@users.noreply.github.com>

* Update UI wording: allow_master -> allow_primary

Signed-off-by: Sara Bee <855595+doeg@users.noreply.github.com>

* Fix lint warnings

Signed-off-by: Sara Bee <855595+doeg@users.noreply.github.com>
2022-05-16 06:29:08 -04:00
Andrew Mason d2aceb4b6e
[vtadmin] proper alias types for tablet RPCs (#10290)
* Add Vars type

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* [vtadmin] Tablet APIs string alias -> typed alias

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Fix assertion to handle proto messages

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Cleanup redundant filtering

Signed-off-by: Andrew Mason <andrew@planetscale.com>
2022-05-13 15:45:49 -04:00
Andrew Mason d1d2c30368
[vtadmin] cell apis (#10227)
* Add protos and generate

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Implement GetCellInfos

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Implement GetCellsAliases

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add http adapters

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* simplify mutual-exclusive options check

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* add mocking infra

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add unit tests

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Remove explicit dial calls after rebase

Signed-off-by: Andrew Mason <andrew@planetscale.com>
2022-05-09 15:19:44 -04:00
Matt Lord fbf574c835
Backwards compatible replication status to state transition (#10167)
* This effectively reverts 65226ad1d77629fe29e852393a19250a9a910024

It was NOT backwards compatible.

Signed-off-by: Matt Lord <mattalord@gmail.com>

* This adds the new state fields back so that we can switch to them in v15

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Allow for safe/smooth upgrades within 14.0-SNAPSHOT

We are only appending the last io_thread_connecting field

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Avoid intermediate io_thread_connecting protobuf field

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Continue using replication states in v14 tests

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Translate SQL running status to state as well

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Use backward compat ReplicaWasRunning check

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Add backward compat SQLThreadWasRunning function

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Add comment about when backward compat can be removed

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Support older clients with new tablets

Signed-off-by: Matt Lord <mattalord@gmail.com>

* feat: remove SQLThreadWasRunning unused function

Signed-off-by: Manan Gupta <manan@planetscale.com>

* test: add an upgrade test to verify the replicationstatus is backward compatible

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: fix ReplicaWasRunning so that it doesn't have code dependent on the upgrade

Signed-off-by: Manan Gupta <manan@planetscale.com>

* refactor: rename function to reflect the output type

Signed-off-by: Manan Gupta <manan@planetscale.com>

Co-authored-by: Manan Gupta <manan@planetscale.com>
2022-04-29 10:59:24 -07:00
Rohit Nayak 39427bd41d
MoveTables: adjust datetimes when importing from non-UTC sources into UTC targets (#10102)
* Add e2e test case for source and target in different time zones

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Added source_time_zone option to MoveTables v2, pass it through to table plan builder and convert datetime columns if option is provided. e2e test demonstrates this works. VDiff needs to be modified

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Add time zone support in VDiff. Improve tests.

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Add vdiff unit test

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Add SourceTimeZone to Workflow Show

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Update workflow test for added attribute SourceTimeZone

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Support SourceTimeZone in reverse workflows, update e2e test

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Update unit tests

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Refactor vdiff timezone-related changes

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Address review comment nits

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Fix: lower col name also for time zone cols

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Use field type for type comparison instead of the string representation

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Check if current primaries have time zone loaded

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Address review comments

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Use same date for conversion and as date format

Signed-off-by: Rohit Nayak <rohit@planetscale.com>
2022-04-27 10:04:39 +02:00
Harshit Gangal 80348c6f83
refactor: removed last reserved field from vtgate session (#10140)
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2022-04-26 13:44:28 +02:00
Harshit Gangal 44fac295db fix: remove set_var session field
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2022-04-25 16:32:39 +05:30
Matt Lord b5ca7a6326
Improve Tablet Refresh Behavior in VReplication Traffic Switch Handling (#10058)
* Use lower tablet refresh timeout in vreplication traffic switching
And refresh all tablets in dry runs to alert the user to potential
issues.

* Check primary tablet health in the traffic switcher pre-check

* Add msgs about specific tablets that failed refresh to cmd output

* Keep function semantics the same but provide details if wanted
This keeps the previous behavior of ignoring partial refresh related
errors, while providing the defails of WHY we had a partial refresh
for anyone that's interested.

* Add partial refresh details to response message
This way the caller has that info and can decide what to do with
it (if anything).

* Update tests and vtadmin for updated refresh response message

* Cancel switch writes on partial tablet refresh when safe

Signed-off-by: Matt Lord <mattalord@gmail.com>
2022-04-20 15:22:16 -04:00
Deepthi Sigireddi 4cc5000c52
delete RPCs that were deprecated in 13.0 (#10099)
* delete RPCs that were deprecated in 13.0

Signed-off-by: deepthi <deepthi@planetscale.com>

* rename instead of deleting fuzzing tests

Signed-off-by: deepthi <deepthi@planetscale.com>

* rename tests instead of deleting

Signed-off-by: deepthi <deepthi@planetscale.com>

* fix imports

Signed-off-by: deepthi <deepthi@planetscale.com>
2022-04-20 11:58:29 -07:00
rsajwani ff66ce7e3b
[vtctldserver] Migrate GetPermissions PR#9903 (#10013)
* [vtctldserver] Migrate GetPermissions PR#9903

This PR migrates GetPermissions rpc to VtctldServer

Run it locally: vtctldclient --server ":15999" GetPermissions zone1-100
unit test: go test vitess.io/vitess/go/vt/vtctl/grpcvtctldserver -run TestGetPermissions

Signed-off-by: Rameez Sajwani <rameezwazirali@hotmail.com>

* [vtctldserver] Migrate GetPermissions PR#9903

This PR migrates GetPermissions rpc to VtctldServer
Run it locally: vtctldclient --server ":15999" GetPermissions zone1-100
unit test: go test vitess.io/vitess/go/vt/vtctl/grpcvtctldserver -run TestGetPermissions

Signed-off-by: Rameez Sajwani <rameezwazirali@hotmail.com>

* [vtctldserver] Migrate GetPermissions PR#9903

This PR migrates GetPermissions rpc to VtctldServer
Run it locally: vtctldclient --server ":15999" GetPermissions zone1-100
unit test: go test vitess.io/vitess/go/vt/vtctl/grpcvtctldserver -run TestGetPermissions

Signed-off-by: Rameez Sajwani <rameezwazirali@hotmail.com>

* [vtctldserver] Migrate GetPermissions PR#9903

This PR migrates GetPermissions rpc to VtctldServer
Run it locally: vtctldclient --server ":15999" GetPermissions zone1-100
unit test: go test vitess.io/vitess/go/vt/vtctl/grpcvtctldserver -run TestGetPermissiions

Signed-off-by: Rameez Sajwani <rameezwazirali@hotmail.com>
2022-04-06 17:03:03 -07:00
Shlomi Noach baf8afd0d6
add VReplicationWorkflowType
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
2022-03-23 20:49:39 +01:00
Andrew Mason 81e0853574
[vtctldserver] Migrate `ShardReplication{Add,Remove}` RPCs (#9899)
* Add ShardReplication{Add,Remove} proto definitions and generate

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Port implementations to VtctldServer

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add unit tests

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add CLI entrypoints

Signed-off-by: Andrew Mason <andrew@planetscale.com>
2022-03-17 06:34:24 -04:00
Andrew Mason 3faf6f0a54
[vtctldserver] Migrate `ShardReplicationFix` RPC (#9878)
* Add ShardReplicationFix proto definitions and run generators

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add `ShardReplicationFix` implementation

No unit tests, because `topo.FixShardReplication` is tested in isolation and we're just a passthrough

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add CLI entrypoint

Signed-off-by: Andrew Mason <andrew@planetscale.com>
2022-03-16 10:39:40 -04:00
Andrew Mason fcb6bcc61b
[vtctldserver] ExecuteFetchAs{App,DBA} (#9890) 2022-03-16 08:19:51 -04:00
Andrew Mason e6bcd5845d
[topo] ShardReplicationFix typed responses (#9876)
* Add ShardReplicationProblem protobuf message

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Update `FixShardReplication` to return problem info, update callers

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Tidy up imports

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Rename ShardReplicationProblem=>ShardReplicationError

Signed-off-by: Andrew Mason <andrew@planetscale.com>
2022-03-14 14:24:52 -04:00
Andrew Mason 6269665fa9
[vtctldserver] Migrate `SourceShard{Add,Delete}` RPCs (#9886)
* Add SourceShard{Add,Delete} rpcs and generate

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add SourceShard{Add,Delete} implementations

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Port implementation back to wrangler, preserving old error behavior

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add unit tests

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add CLI entrypoints

Signed-off-by: Andrew Mason <andrew@planetscale.com>
2022-03-14 14:08:42 -04:00
Andrew Mason a15e88ecee
[vtctldserver] Migrate `RestoreFromBackup` RPC (#9873)
* Add RestoreFromBackup proto defs and regenerate

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Port implementation from legacy vtctl command

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add CLI entrypoint

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add test cases

Signed-off-by: Andrew Mason <andrew@planetscale.com>
2022-03-12 09:50:25 -05:00
Matt Lord a8c963600f
Manage MySQL Replication Status States Properly (#9853)
* Consider repl NOT running with IO_Thread connecting and last attempt failed

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Use replication IO/SQL thread status and last IO/SQL errors in ReplicationStatus

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Minor changes & improvements after review

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Correct GroupReplication flavor unit test

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Correcting minor mistakes in func comment

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Remove unintentional behavior changes

And make function names nicer (removing double context)

And add some helper functions

Signed-off-by: Matt Lord <mattalord@gmail.com>

* One more place where we would have slightly changed behavior

Signed-off-by: Matt Lord <mattalord@gmail.com>

* One more spot that keep existing behavior

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Modify the replicationdata proto w/o breaking backwards compat

Update vtadmin web protobufs

Signed-off-by: Matt Lord <mattalord@gmail.com>
2022-03-11 09:56:40 -08:00
Andrew Mason 0002226d52
[vtctldserver] Migrate `RemoveBackup` RPC (#9865)
* Add proto definitions, run generators

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Port implementation to vtctldserver

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Update fakebackupstorage and add test cases

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add CLI entrypoint

Signed-off-by: Andrew Mason <andrew@planetscale.com>
2022-03-11 09:10:41 -05:00
Andrew Mason 5128e06fe8
[vtctldserver] Migrate `BackupShard` RPC (#9857)
* Move ShardReplicationStatuses out of wrangler for import

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Move some more functions out of wrangler that we need in grpcvtcldserver

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add BackupShard protos

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Implement BackupShard

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Refactor for shared event stream loop

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add test cases

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add CLI entrypoint

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Add missing SetReplicationSource code from wrangler version; adjust tests

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Backport new implementation to legacy vtctl commands

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Fix bad port of `SetReplicationSource`

The ignored error was deliberate here; if there is no primary in the shard,
there is no need to re-point replication on the backup tablet.

Signed-off-by: Andrew Mason <andrew@planetscale.com>
2022-03-10 10:05:29 -05:00
Andrew Mason 697436f037
[vtctldclient] Add entrypoint for `ApplySchema` (#9829)
* Add CLI entrypoint for ApplySchema

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Fix typo in --ddl_strategy help text

Signed-off-by: Andrew Mason <andrew@planetscale.com>
2022-03-08 14:20:30 -08:00
Andrew Mason 29d1af2e34
Rename ApplySchemaRequest.request_context=>migration_context (#9824)
Signed-off-by: Andrew Mason <andrew@planetscale.com>
2022-03-04 06:46:10 -05:00