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

cli: add support for remote files in debug range-data #120776

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions pkg/cli/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,10 +478,22 @@ state like the raft HardState. With --replicated, only includes data covered by
}

func runDebugRangeData(cmd *cobra.Command, args []string) error {
ctx := context.Background()
stopper := stop.NewStopper()
defer stopper.Stop(context.Background())
defer stopper.Stop(ctx)

db, err := OpenEngine(args[0], stopper, fs.ReadOnly, storage.MustExist)
earlyBootAccessor := cloud.NewEarlyBootExternalStorageAccessor(serverCfg.Settings, serverCfg.ExternalIODirConfig)
opts := []storage.ConfigOption{storage.MustExist, storage.RemoteStorageFactory(earlyBootAccessor)}
if serverCfg.SharedStorage != "" {
es, err := cloud.ExternalStorageFromURI(ctx, serverCfg.SharedStorage,
base.ExternalIODirConfig{}, serverCfg.Settings, nil, username.RootUserName(), nil,
nil, cloud.NilMetrics)
if err != nil {
return err
}
opts = append(opts, storage.SharedStorage(es))
}
db, err := OpenEngine(args[0], stopper, fs.ReadOnly, opts...)
if err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,7 @@ func init() {
f := debugRangeDataCmd.Flags()
cliflagcfg.BoolFlag(f, &debugCtx.replicated, cliflags.Replicated)
cliflagcfg.IntFlag(f, &debugCtx.maxResults, cliflags.Limit)
cliflagcfg.StringFlag(f, &serverCfg.SharedStorage, cliflags.SharedStorage)
}
{
f := debugGossipValuesCmd.Flags()
Expand Down
Loading