Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add mysql-shell engine as a supported engine #586

Merged
merged 7 commits into from
Sep 24, 2024

Conversation

rvrangel
Copy link
Contributor

This change is dependant on vitessio/vitess#16295 (review) as we are adding a new backup engine to Vitess. See the comment for additional context

Copy link
Member

@frouioui frouioui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CRD needs to be re-generated, this is achievable by running:

make generate && kustomize build ./deploy > build/_output/operator.yaml 

The test code must also be updated. You can take the content of build/_output/operator.yaml and copy it into ./test/endtoend/operator/operator-latest.yaml. Note that you will need to revert the changes made to lines 6889 and 6893 before commiting.

Once done, the content of operator-latest.yaml will need to be copied over to the Vitess repository into the file ./examples/operator/operator.yaml.

@frouioui
Copy link
Member

For reviewers, since the PR on vitess is not merged yet, the Docker Images containing the new backup engine are not available yet. We must build and push Docker Images of the Vitess PR to a test registry in order to test this change correctly.

@rvrangel
Copy link
Contributor Author

@frouioui I can't see the tests, but I imagine they are breaking because of the docker image? I wonder if this looks okay that we can copy the contents of the file back to vitessio/vitess#16295?

Signed-off-by: Florent Poinsard <[email protected]>
@frouioui
Copy link
Member

Some extra whitespace were introduced to operator-latest.yaml through 2e7330b, I took the liberty of fixing that by pushing 911c465.


Otherwise @rvrangel, I think once vitessio/vitess#16295 is merged, we should come back to this Pull Request and add a real E2E test that uses the new backup engine. Such a test already exists (Backup Restore Test) but it uses the xtrabackup engine:

In the meantime, copying operator-latest.yaml to the vitess repository sounds good to me as it is right now, that will unblock vitessio/vitess#16295.


I have tested this Pull Request with a custom Docker build of vitessio/vitess#16295, and here is how it looks:

  1. Build and push the lite Docker Image of adding new mysql shell backup engine vitessio/vitess#16295 to a Docker registry. I am using the branch florent-mysqlshell-backup-custom-docker-build on vitessio/vitess to push to my own registry.
$ cd vitess
$ git fetch origin && git checkout florent-mysqlshell-backup-custom-docker-build
$ make docker_lite_all
...
$ make docker_lite_push
...
$ exit
  1. Modify the vitess-operator Backup and Restore test to pull from that Docker registry and to use the new backup engine. The file ./test/endtoend/operator/101_initial_cluster_backup.yaml has to be changed:
# ./test/endtoend/operator/101_initial_cluster_backup.yaml
...
spec:
  backup:
    engine: mysqlshell
    locations:
    - volume:
        hostPath:
          path: /backup
          type: Directory
  images:
    vtctld: frouioui/lite:latest
    vtgate: frouioui/lite:latest
    vttablet: frouioui/lite:latest
    vtorc: frouioui/lite:latest
    vtbackup: frouioui/lite:latest
    mysqld:
      mysql80Compatible: mysql:8.0.30
    mysqldExporter: prom/mysqld-exporter:v0.11.0
...
  1. Run the test using the Makefile command.
$ cd vitess-operator
$ make backup-restore-test
  1. Observe the output
...
commerce/- (zone1-2548885007): time:{seconds:1724781783 nanoseconds:99078345} file:"backup.go" line:155 value:"Starting backup 2024-08-27.180303.zone1-2548885007"
commerce/- (zone1-2548885007): time:{seconds:1724781783 nanoseconds:99980137} file:"mysqlshellbackupengine.go" line:103 value:"Starting ExecuteBackup in zone1-2548885007"
commerce/- (zone1-2548885007): time:{seconds:1724781783 nanoseconds:100831220} level:ERROR file:"backup.go" line:181 value:"backup is not usable, aborting it: [MySQLShellPreCheckError: no backup location set via --mysql_shell_location\nfailed backup precheck]"
E0827 12:03:03.105541   66335 main.go:56] rpc error: code = Unknown desc = TabletManager.Backup on zone1-2548885007: failed backup precheck: MySQLShellPreCheckError: no backup location set via --mysql_shell_location
...
  1. After reviewing adding new mysql shell backup engine vitessio/vitess#16295 again, it seems like the flag --mysql-shell-backup-location is required. But we do not provide it to the container in vitess-operator. I proceeded with the following change to ./pkg/operator/vttablet/backup.go, it adds another case where we handle the mysqlshell backup engine and add the --mysql-shell-backup-location flag to vttablet, the value of the flag is set to the mount path of the backup volume.
...
// pkg/operator/vttablet/backup.go:42
func init() {
	vttabletFlags.Add(func(s lazy.Spec) vitess.Flags {
		spec := s.(*Spec)
		if spec.BackupLocation == nil || spec.Mysqld == nil {
			return nil
		}
		flags := vitess.Flags{
			"restore_from_backup":          true,
			"restore_concurrency":          restoreConcurrency,
			"wait_for_backup_interval":     waitForBackupInterval,
			"backup_engine_implementation": string(spec.BackupEngine),
		}
		switch spec.BackupEngine {
		case planetscalev2.VitessBackupEngineXtraBackup:
			// When vttablets take backups, we let them keep serving, so we
			// limit to single-threaded to reduce the impact.
			backupThreads := 1
			// When vttablets are restoring, they can't serve at the same time
			// anyway, so let the restore use all available CPUs for this Pod.
			// This is cheating a bit, since xtrabackup technically counts
			// against only the vttablet container, but we allow CPU bursting,
			// and we happen to know that our mysqld container is not using its
			// CPU request (reservation) during restore since it's stopped.
			mysqlCPU := spec.Mysqld.Resources.Requests[corev1.ResourceCPU]
			vttabletCPU := spec.Vttablet.Resources.Requests[corev1.ResourceCPU]
			restoreThreads := int(mysqlCPU.Value() + vttabletCPU.Value())
			if restoreThreads < 1 {
				restoreThreads = 1
			}
			flags.Merge(xtrabackupFlags(spec, backupThreads, restoreThreads))
		case planetscalev2.VitessBackupEngineMySQLShell:
			svm := vitessbackup.StorageVolumeMounts(spec.BackupLocation)
			flags.Merge(vitess.Flags{
				"mysql-shell-backup-location": svm[0].MountPath,
			})
		}
		clusterName := spec.Labels[planetscalev2.ClusterLabel]
		storageLocationFlags := vitessbackup.StorageFlags(spec.BackupLocation, clusterName)
		return flags.Merge(storageLocationFlags)
	})
...
  1. Run the test again. This time around, we can see in the description of the vttablet pod that the flag is correctly set.
$ make backup-restore-test
...
$ kubectl describe pod example-vttablet-zone1-0790125915-4e37d9d5
Containers:
  vttablet:
   ...
    Args:
      ...
      --mysql-shell-backup-location=/vt/backups
	  ...
  1. We are failing due to an impossible connection to mysql, I believe this is due to https://github.com/vitessio/vitess/pull/16295/files#r1725135866, since we are trying to connect to localhost.
commerce/- (zone1-2469782763): time:{seconds:1724785013 nanoseconds:814913049} file:"backup.go" line:155 value:"Starting backup 2024-08-27.185653.zone1-2469782763"
commerce/- (zone1-2469782763): time:{seconds:1724785013 nanoseconds:815813549} file:"mysqlshellbackupengine.go" line:103 value:"Starting ExecuteBackup in zone1-2469782763"
commerce/- (zone1-2469782763): time:{seconds:1724785013 nanoseconds:827818632} file:"mysqlshellbackupengine.go" line:136 value:"acquiring a global read lock before fetching the executed GTID sets"
commerce/- (zone1-2469782763): time:{seconds:1724785013 nanoseconds:836639424} file:"mysqlshellbackupengine.go" line:150 value:"running /usr/bin/mysqlsh --defaults-file=/dev/null --js -h localhost -e util.dumpInstance(\"/vt/backups/commerce/-/2024-08-27.185653.zone1-2469782763\", {\"threads\": 2})"
commerce/- (zone1-2469782763): time:{seconds:1724785019 nanoseconds:694574677} file:"backup.go" line:515 value:"mysqlshell stderr: MySQL Error 1045 (28000): Access denied for user 'vitess'@'::1' (using password: NO)"
commerce/- (zone1-2469782763): time:{seconds:1724785019 nanoseconds:870135594} level:ERROR file:"backup.go" line:181 value:"backup is not usable, aborting it: [exit status 1\nmysqlshell failed]"
E0827 12:56:59.880731   75056 main.go:56] rpc error: code = Unknown desc = TabletManager.Backup on zone1-2469782763: mysqlshell failed: exit status 1

Until we fix the hostname/socket issue this is blocked, let me know if you want me to help implementing step 5.

@rvrangel
Copy link
Contributor Author

hey @frouioui I would appreciate the help on step 5 as we don't use the vitess operator and I don't have a lot of context to make that change. Would the change you mentioned be enough (if that's the case please push it to this PR too) or do we need something else to make it work?

@frouioui
Copy link
Member

frouioui commented Aug 29, 2024

I would appreciate the help on step 5

I pushed the fix thru 4d4318c

Would the change you mentioned be enough (if that's the case please push it to this PR too) or do we need something else to make it work?

@rvrangel The change mentioned would not be enough. We will need to implement https://github.com/vitessio/vitess/pull/16295/files#r1686498163 in vitess-operator, this is what's blocking step 7 and the end of the manual test. I will work on this now and update you.

@frouioui
Copy link
Member

I fixed how we take a backup in 39d0d7f. Now I am facing issues with the restore phase. In our tests, we bring up a vitess cluster then take a backup on it and tear it down. We then re-create the vitess cluster, the data is restored from the disk and volumes, and shortly after we try to restore from backup as we found an available backup. Since the tables already exist in the destination we are left with some error like: Schema _vt already contains a table named local_metadata.

I tried excluding some tables with the load flag "excludeTables", but running the restore again just shows a bunch of other tables affected by the error, including the table created by the user. My question is, would it be safe in anyway to use --force? And also, how was that problem solved on vitess, outside of the operator?

cc @shlomi-noach @mattlord

I0829 20:51:52.350060       1 mysqlshellbackupengine.go:336] running /usr/bin/mysqlsh --defaults-file=/dev/null --no-password --js -u vt_dba -S /vt/socket/mysql.sock -e util.loadDump("/vt/backups/commerce/-/2024-08-29.205039.zone1-0790125915", {"threads": 4, "updateGtidSet": "replace", "skipBinlog": true, "progressFile": ""})
...
I0829 20:51:59.529864       1 backup.go:515] mysqlshell stderr: Opening dump...
I0829 20:51:59.548306       1 backup.go:515] mysqlshell stderr: Target is MySQL 8.0.30. Dump was produced from MySQL 8.0.30
I0829 20:51:59.581033       1 backup.go:515] mysqlshell stderr: Scanning metadata...
I0829 20:51:59.747394       1 backup.go:515] mysqlshell stderr: Scanning metadata - done
I0829 20:51:59.836035       1 backup.go:515] mysqlshell stderr: Checking for pre-existing objects...
I0829 20:51:59.843648       1 backup.go:515] mysqlshell stderr: ERROR: Schema `_vt` already contains a table named local_metadata
I0829 20:51:59.843851       1 backup.go:515] mysqlshell stderr: ERROR: Schema `_vt` already contains a table named shard_metadata
I0829 20:51:59.844203       1 backup.go:515] mysqlshell stderr: ERROR: One or more objects in the dump already exist in the destination database. You must either DROP these objects or exclude them from the load.

@rvrangel
Copy link
Contributor Author

rvrangel commented Sep 2, 2024

@frouioui could you provide a bit more of detail of how it is re-created? when you say the data is restored from disk, do you mean you restore previous snapshots of the data (so tables and schema would already exist on disk) while starting the vttablet with --restore-from-backup? if so, the main issue is in here, we only drop those databases for receiving a RestoreFromBackup() API call, not when starting with --restore-from-backup.

from the code comments, it seems if you are starting a tablet with existing data, it needs to be wiped out before you start the vttablet or you need to start the restore via an API call instead of relying on --restore-from-backup. but I am making some assumptions of how your process works, if you can describe it a bit better it would help understand where the issue is.

@shlomi-noach
Copy link
Collaborator

Let's join discussions in vitessio/vitess#16295 (comment)

@frouioui
Copy link
Member

@rvrangel, with the latest version on the vitess PR, I am still facing the same issue:

I0913 18:12:45.202496       1 query.go:81] exec SET GLOBAL super_read_only = 'OFF'
I0913 18:12:45.204092       1 mysqlshellbackupengine.go:336] running /usr/bin/mysqlsh --defaults-file=/dev/null --no-password --js -u vt_dba -S /vt/socket/mysql.sock -e util.loadDump("/vt/backups/commerce/-/2024-09-13.180948.zone1-0790125915", {"threads": 4, "updateGtidSet": "replace", "skipBinlog": true, "progressFile": ""})
W0913 18:12:49.036866       1 rpc_server.go:72] TabletManager.ReplicationStatus()(on zone1-0790125915 from ) error: context canceled
I0913 18:12:50.960489       1 backup.go:515] mysqlshell stderr: Loading DDL and Data from '/vt/backups/commerce/-/2024-09-13.180948.zone1-0790125915' using 4 threads.
I0913 18:12:50.963651       1 backup.go:515] mysqlshell stderr: Opening dump...
I0913 18:12:50.981627       1 backup.go:515] mysqlshell stderr: Target is MySQL 8.0.30. Dump was produced from MySQL 8.0.30
I0913 18:12:51.000467       1 backup.go:515] mysqlshell stderr: Scanning metadata...
I0913 18:12:51.031179       1 backup.go:515] mysqlshell stderr: Scanning metadata - done
I0913 18:12:51.033162       1 backup.go:515] mysqlshell stderr: Checking for pre-existing objects...
I0913 18:12:51.037816       1 backup.go:515] mysqlshell stderr: ERROR: Schema `_vt` already contains a table named local_metadata
I0913 18:12:51.038023       1 backup.go:515] mysqlshell stderr: ERROR: Schema `_vt` already contains a table named shard_metadata
I0913 18:12:51.038285       1 backup.go:515] mysqlshell stderr: ERROR: One or more objects in the dump already exist in the destination database. You must either DROP these objects or exclude them from the load.
I0913 18:12:51.059252       1 backup.go:515] mysqlshell stderr: Util.loadDump: While 'Scanning metadata': Duplicate objects found in destination database (MYSQLSH 53021)
I0913 18:12:51.059371       1 backup.go:515] mysqlshell stderr:  at (command line):1:6
I0913 18:12:51.059508       1 backup.go:515] mysqlshell stderr: in util.loadDump("/vt/backups/commerce/-/2024-09-13.180948.zone1-0790125915", {"threads": 4, "updateGtidSet": "replace", "skipBinlog": true, "progressFile": ""})
I0913 18:12:51.059539       1 backup.go:515] mysqlshell stderr:         ^
I0913 18:12:51.264670       1 query.go:81] exec SET GLOBAL super_read_only = 'ON'
I0913 18:12:51.265870       1 restore.go:278] Restore: got a restore manifest: <nil>, err=exit status 1
mysqlshell failed, waitForBackupInterval=0s

@rvrangel
Copy link
Contributor Author

@frouioui given the defaults have been changed in here, is it possible you were using an older version of that branch?

the restore options on the log provided are:

{"threads": 4, "updateGtidSet": "replace", "skipBinlog": true, "progressFile": ""}

All databases will be deleted by the restore process on the latest version, including _vt that shows up in your log.

@frouioui
Copy link
Member

Sorry for the oversight, I was not on the right commit.

I ran the tests again, and I am facing a different issue. Restoring from a backup fails when starting mysqld, here are the logs:

mysqld container

After starting correctly, the same snippet of log repeats itself:

...
I0917 22:46:42.997383       1 mysqld.go:417] Mysqld.Start(1726612199) stderr: 2024-09-17T22:46:42.996925Z 597 [System] [MY-010916] [Server] @@GLOBAL.GTID_PURGED was changed from '' to '213abc51-753f-11ef-9c3e-229fd19be23c:1-39'.
I0917 22:46:42.998351       1 mysqld.go:417] Mysqld.Start(1726612199) stderr: 2024-09-17T22:46:42.996992Z 597 [System] [MY-010917] [Server] @@GLOBAL.GTID_EXECUTED was changed from '' to '213abc51-753f-11ef-9c3e-229fd19be23c:1-39'.
I0917 22:46:43.167185       1 mysqld.go:365] Mysqld.Start(1726613203): No mysqld_start hook, running mysqld_safe directly
I0917 22:46:43.167421       1 mysqld.go:374] mysqld_safe not found in any of /usr/{sbin,bin,libexec,scripts}: trying to launch mysqld instead
E0917 22:46:43.168025       1 mysqld.go:492] Mysqld.Start(1726613203): not removing socket lock file: /vt/socket/mysql.sock.lock with pid 72 for "/usr/sbin/mysqld --defaults-file=/vt/vtdataroot/vt_0790125915/my.cnf --basedir=/usr "

vttablet container

It seems like restoring from the backup with the new engine works correctly, until we try to start mysqld (Restore: starting mysqld for mysql_upgrade).

I0917 22:46:43.159145       1 mysqlshellbackupengine.go:364] mysqlsh completed successfully
I0917 22:46:43.159544       1 query.go:81] exec SET GLOBAL LOCAL_INFILE=0
I0917 22:46:43.159824       1 mysqlshellbackupengine.go:371] set local_infile=0
I0917 22:46:43.159895       1 mysqlshellbackupengine.go:373] Restore completed
I0917 22:46:43.160117       1 query.go:81] exec SET GLOBAL super_read_only = 'ON'
I0917 22:46:43.160462       1 backup.go:457] Restore: starting mysqld for mysql_upgrade
I0917 22:46:43.160630       1 mysqld.go:337] executing Mysqld.Start() remotely via mysqlctld server: /vt/socket/mysqlctl.sock
I0917 22:46:43.172336       1 restore.go:278] Restore: got a restore manifest: <nil>, err=rpc error: code = Unknown desc = process 72 is still running, waitForBackupInterval=0s
I0917 22:46:43.172629       1 tm_state.go:186] Changing Tablet Type: REPLICA for cell:"zone1" uid:790125915
I0917 22:46:43.172862       1 tm_state.go:382] Publishing state: alias:{cell:"zone1" uid:790125915} hostname:"10.244.0.119" port_map:{key:"grpc" value:15999} port_map:{key:"vt" value:15000} keyspace:"commerce" shard:"-" key_range:{} type:REPLICA db_name_override:"vt_commerce" mysql_hostname:"10.244.0.119" mysql_port:3306 default_conn_collation:255
I0917 22:46:43.179742       1 syslogger.go:133] commerce/-/zone1-0790125915 [tablet] updated
I0917 22:46:43.180004       1 shard_sync.go:79] Change to tablet state
I0917 22:46:43.181152       1 restore.go:170] No vttablet_restore_done hook.
F0917 22:46:43.180685       1 tm_init.go:847] RestoreFromBackup failed: rpc error: code = Unknown desc = process 72 is still running
Can't restore backup

It seems like we cannot clean up the stale lock file, because it is not stale and still used by, in this case, process 72. We attempt to do this here and end up failing there.

Have you encountered that issue outside of the vitess-operator before?

@rvrangel
Copy link
Contributor Author

ah, I believe we did in fact, but we do have a custom mysqld_start hook when testing on live tablets, so we could address it there. since there were so many changes I have been relying mostly on the endtoend tests to avoid having to backport every change to our current version and re-testing them, so I didn't encounter this as perhaps the start works differently when it is called from the tests.

the problem when testing on live tables was that Vitess always assumes it needs to start mysqld after a restore, which is not true for mysqlshell. I have made a change in vitessio/vitess@9243f22 so that mysqlshell doesn't start it, could you test if that solves that issue for you?

@frouioui
Copy link
Member

@rvrangel, i will test with the new commit today and come back to you with the results.

@frouioui
Copy link
Member

frouioui commented Sep 18, 2024

@rvrangel with the latest commit on the Vitess PR, I am able to take a backup and restore from that backup correctly.

The exact same test passes with both the xtrabackup and mysqlsh backup> engine. Outside of the issue explained below, everything looks good to me on the vitess-operator side.


In my test, before and after the restore phase I make sure of certain parameters in the database, to do so I connect to the database using the root user. However, it seems like the root user is not added back to the database during the restore. Meaning we can no longer connect as root to the database. Note that this is working fine before restoring, also connecting with other users such as vt_dba works fine.

Failed connection using -u root

Does not fail with vt_dba, but does with root.

$ kubectl exec "example-vttablet-zone1-2548885007-46a852d0" -c mysqld -it -- mysql -S "/vt/socket/mysql.sock" -u vt_dba
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 454
Server version: 8.0.30 MySQL Community Server - GPL

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
$ kubectl exec "example-vttablet-zone1-2548885007-46a852d0" -c mysqld -it -- mysql -S "/vt/socket/mysql.sock" -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
command terminated with exit code 1

vttablet container logs

$ kubectl logs example-vttablet-zone1-2548885007-46a852d0
...
I0918 20:01:43.315869       1 mysqlshellbackupengine.go:571] Dropping User "vt_repl@%"
I0918 20:01:43.316276       1 query.go:81] exec DROP USER 'vt_repl'@'%'
I0918 20:01:43.320393       1 mysqlshellbackupengine.go:571] Dropping User "root@localhost"
I0918 20:01:43.320669       1 query.go:81] exec DROP USER 'root'@'localhost'
I0918 20:01:43.323349       1 mysqlshellbackupengine.go:571] Dropping User "vt_allprivs@localhost"
I0918 20:01:43.323631       1 query.go:81] exec DROP USER 'vt_allprivs'@'localhost'
I0918 20:01:43.325298       1 mysqlshellbackupengine.go:571] Dropping User "vt_app@localhost"
I0918 20:01:43.325447       1 query.go:81] exec DROP USER 'vt_app'@'localhost'
I0918 20:01:43.328609       1 mysqlshellbackupengine.go:571] Dropping User "vt_appdebug@localhost"
I0918 20:01:43.328881       1 query.go:81] exec DROP USER 'vt_appdebug'@'localhost'
I0918 20:01:43.330711       1 mysqlshellbackupengine.go:571] Dropping User "vt_filtered@localhost"
I0918 20:01:43.330996       1 query.go:81] exec DROP USER 'vt_filtered'@'localhost'
...
I0918 20:01:49.845319       1 backup.go:517] mysqlshell stderr: NOTE: Skipping CREATE/ALTER USER statements for user 'root'@'localhost'
I0918 20:01:49.845843       1 backup.go:517] mysqlshell stderr: NOTE: Skipping CREATE/ALTER USER statements for user 'vt_dba'@'localhost'
I0918 20:01:49.846019       1 backup.go:517] mysqlshell stderr: NOTE: Skipping GRANT/REVOKE statements for user 'root'@'localhost'
I0918 20:01:49.846126       1 backup.go:517] mysqlshell stderr: NOTE: Skipping GRANT/REVOKE statements for user 'vt_dba'@'localhost'
...

It seems like we are dropping all the known users and the root user is not added back. Would it be possible to maybe not drop the root user and add it to the reservedUsers slice we have in mysqlshellbackupengine.go?

@deepthi
Copy link
Collaborator

deepthi commented Sep 18, 2024

Standard vitess config leaves root@localhost alone, so it makes sense that a restore should bring it back to that same state. Ref: https://github.com/vitessio/vitess/blob/main/config/init_db.sql#L18-L19
I'm curious, how do all those dropped users get added back? Ultimately users like vt_dba have to be present for things to work.

@rvrangel
Copy link
Contributor Author

Great to hear that @frouioui !!

@deepthi those users are added back by mysqlsh as we pass "loadUsers": true by default after having discussed this approach with @shlomi-noach. To add some colour, the way it works is that during the dump process mysqlsh will store the users in a separate file and can load them in the DB, but they must:

  1. not exist, else it fails
  2. not one of the internal users
  3. not be the current user
  4. we must the permissions to add a new users with its original permissions

I mentioned this briefly on this comment, the main problem is that vt_dba has the rights to DROP USER 'root'@'localhost', but it doesn't have all the grants to create it again, missing at least GRANT PROXY when running endtoend tests. So I added a flag where users can decide which users are excluded and can adapt it to their environment.

After the restore process is completed, we should have most users in the same state they were when the backup started, with the exception of the vt_dba user (used for the restore, so mysqlsh won't update it as it is the current connection) and any excluded users (root@localhost by default, but this can be disabled by changing the flag if a user requires it)

@frouioui
Copy link
Member

frouioui commented Sep 20, 2024

I took the liberty of pushing another commit to this branch. 134463b adds the grant to the vt_dba user where needed.

I am not longer seeing any issue with my tests after using the latest version of the Vitess branch, and the fixed I just pushed.

@rvrangel
Copy link
Contributor Author

awesome, thanks @frouioui . I see some tests are failing, but I can't see them, are those expected because we haven't merged the other PR yet?

Copy link
Member

@frouioui frouioui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@frouioui
Copy link
Member

awesome, thanks @frouioui . I see some tests are failing, but I can't see them, are those expected because we haven't merged the other PR yet?

The failures seemed unrelated to this PR, I restarted the workflows.

@frouioui frouioui merged commit bff6251 into planetscale:main Sep 24, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants