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

Validate if there are any tablet based keyspaces #4254

Open
karol-kokoszka opened this issue Feb 13, 2025 · 4 comments
Open

Validate if there are any tablet based keyspaces #4254

karol-kokoszka opened this issue Feb 13, 2025 · 4 comments
Milestone

Comments

@karol-kokoszka
Copy link
Collaborator

... and fail the process if there are any, and they are not filtered out by the "--keyspaces" flag.

@karol-kokoszka karol-kokoszka added this to the 1-1 Restore milestone Feb 13, 2025
@VAveryanov8
Copy link
Collaborator

VAveryanov8 commented Feb 20, 2025

The way I see how we can check if keyspace is tablet based or not is following:

  1. Check the value of scylla.yaml enable_tablets. https://opensource.docs.scylladb.com/stable/reference#confval-enable_tablets
  2. If it is false - then there is not way to create tablet based keyspace - we good to go with 1-1-restore.
  3. if it's set to true, every keyspace by default is tablet based, but there is an option to opt out - CREATE KEYSPACE .... WITH tablets = {'enabled': false} , so we need to see how the keyspace was created. Unfortunately system_schema.keyspace and scylladb/gocql doesn't expose this option, so the only way I found is to check (parse) the output of DESCRIBE SCHEMA WITH INTERNALS.

@Michal-Leszczynski @karol-kokoszka what do you think? Maybe you know a better way of checking if keyspace is tablet based or not?

@Michal-Leszczynski
Copy link
Collaborator

When running the 1-1-restore we already have the required schema in the cluster, so we can just query Scylla API for the information about table replication type:

// KeyspaceReplication describes keyspace replication.
type KeyspaceReplication string
// KeyspaceReplication enum.
const (
ReplicationAll KeyspaceReplication = "all"
ReplicationVnode KeyspaceReplication = "vnodes"
ReplicationTablet KeyspaceReplication = "tablets"
)
// KeyspaceType describes keyspace type.
type KeyspaceType string
// KeyspaceType enum.
const (
KeyspaceTypeAll KeyspaceType = "all"
KeyspaceTypeUser KeyspaceType = "user"
KeyspaceTypeNonLocal KeyspaceType = "non_local_strategy"
)
// AllKeyspaceTypes contains all possible KeyspaceType.
var AllKeyspaceTypes = []KeyspaceType{
KeyspaceTypeAll,
KeyspaceTypeUser,
KeyspaceTypeNonLocal,
}
// FilteredKeyspaces return a list of keyspaces with given replication.
func (c *Client) FilteredKeyspaces(ctx context.Context, ksType KeyspaceType, replication KeyspaceReplication) ([]string, error) {
resp, err := c.scyllaOps.StorageServiceKeyspacesGet(&operations.StorageServiceKeyspacesGetParams{
Context: ctx,
Type: pointer.StringPtr(string(ksType)),
Replication: pointer.StringPtr(string(replication)),
})
if err != nil {
return nil, err
}
return resp.Payload, nil
}

@Michal-Leszczynski
Copy link
Collaborator

But in general we have a problem with recreating keyspace replication type from DESCRIBE SCHEMA WITH INTERNALS.
See scylladb/scylladb#22866 for more info.
This issue could happen only when we use different tablet configuration in scylla.yaml in the backup and restore destination cluster.

@VAveryanov8
Copy link
Collaborator

When running the 1-1-restore we already have the required schema in the cluster, so we can just query Scylla API for the information about table replication type:

Thanks, that's exactly what i was searching for! :)

But in general we have a problem with recreating keyspace replication type from DESCRIBE SCHEMA WITH INTERNALS.
See scylladb/scylladb#22866 for more info.
This issue could happen only when we use different tablet configuration in scylla.yaml in the backup and restore destination cluster.

good finding!

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

No branches or pull requests

3 participants