Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal-Leszczynski committed Dec 10, 2024
1 parent 63066cf commit 6d4ae23
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
2 changes: 2 additions & 0 deletions pkg/metrics/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ func (m RestoreMetrics) SetProgress(labels RestoreProgressLabels, progress float
m.progress.With(l).Set(progress)
}

// TODO: add new states for Scylla restore.

// RestoreState is the enum that defines how node is used during the restore.
type RestoreState int

Expand Down
2 changes: 2 additions & 0 deletions pkg/service/restore/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ func (t *View) UnmarshalUDT(name string, info gocql.TypeInfo, data []byte) error
return gocql.Unmarshal(info, data, f.Addr().Interface())
}

// TODO - new table and struct for scylla api progress?

// RunProgress describes progress of restoring a single batch.
type RunProgress struct {
ClusterID uuid.UUID
Expand Down
29 changes: 15 additions & 14 deletions pkg/service/restore/tablesdir_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@ func (w *tablesWorker) scyllaRestore(ctx context.Context, host string, b batch)
// TODO: resolve endpoint by either:
// - making agent return endpoint information to SM <- preferred
// - allowing for specifying endpoint instead of backed in --location flag
prefix, ok := strings.CutPrefix(b.RemoteSSTableDir, b.Location.Path)
prefix, ok := strings.CutPrefix(b.RemoteSSTableDir, b.Location.StringWithoutDC())
if !ok {
return errors.Errorf("")
return errors.Errorf("asdasd")
}
id, err := w.client.ScyllaRestore(ctx, host, "192.168.200.99", b.Location.Path, prefix, b.Keyspace, b.Table, b.TOC())
if err != nil {
Expand All @@ -313,18 +313,19 @@ func (w *tablesWorker) scyllaRestore(ctx context.Context, host string, b batch)
}

func (w *tablesWorker) scyllaWaitTask(ctx context.Context, pr *RunProgress, b batch) (err error) {
defer func() {
// On error abort task
if err != nil {
if e := w.client.ScyllaAbortTask(context.Background(), pr.Host, pr.ScyllaTaskID); e != nil {
w.logger.Error(ctx, "Failed to abort task",
"host", pr.Host,
"id", pr.ScyllaTaskID,
"error", e,
)
}
}
}()
// TODO: restore task cannot be aborted.
//defer func() {

Check failure on line 317 in pkg/service/restore/tablesdir_worker.go

View workflow job for this annotation

GitHub Actions / Various checks

commentFormatting: put a space between `//` and comment text (gocritic)
// // On error abort task
// if err != nil {
// if e := w.client.ScyllaAbortTask(context.Background(), pr.Host, pr.ScyllaTaskID); e != nil {
// w.logger.Error(ctx, "Failed to abort task",
// "host", pr.Host,
// "id", pr.ScyllaTaskID,
// "error", e,
// )
// }
// }
//}()

for {
if ctx.Err() != nil {
Expand Down

0 comments on commit 6d4ae23

Please sign in to comment.