scylladb / scylla-manager

The Scylla Manager
https://manager.docs.scylladb.com/stable/
Other
48 stars 33 forks source link

Use DESC SCHEMA for backup in Scylla 6.0 #3868

Closed Michal-Leszczynski closed 1 week ago

Michal-Leszczynski commented 1 month ago

Context: As the workaround described here won't work with Scylla 6.0, we need to implement a new way for schema backup/restore. It was decided to move back to the DESCRIBE SCHEMA WITH INTERNALS approach after it was changed so that it works well with restore procedure (https://github.com/scylladb/scylladb/issues/16482).

Previous approach: As SM does not always have CQL credentials to managed cluster, the first approach was to use maintenance_socket from agent (https://github.com/scylladb/scylla-manager/issues/3831). In the end it was aborted for Scylla 6.0, as it wouldn't fit the release deadline (perhaps it will be done as a part of integration with Scylla 6.1).

Chosen approach: It was decided that SM should have cluster CQL credentials when doing a backup. This is a regression when compared with the current backup which does not need the credentials to backup the schema, but this approach is better for the Scylla 6.0 release deadline.

Implementation details: DESCRIBE SCHEMA WITH INTERNALS returns 4 columns: object keyspace, object type, object name, CQL stmt. SM should just save the whole output in a file on backup. It's important to preserve the order of rows (https://github.com/scylladb/scylladb/issues/18539) and not to loose the granularity of mentioned columns (even though right now we only perform full cluster schema restore, there is a plan to support it with nicer granularity in the future). The restore would simply download mentioned file and apply all the CQL stmts in order - no cluster restart needed.