-
Notifications
You must be signed in to change notification settings - Fork 44
refactor(1-1-restore): refactors 1-1-restore progress #4348
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
refactor(1-1-restore): refactors 1-1-restore progress #4348
Conversation
8c15d92
to
04922ec
Compare
c5bf399
to
f10f9f7
Compare
@VAveryanov8 please pull from the feature branch (or |
f10f9f7
to
d664493
Compare
ca6e046
to
c2f8135
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 39 out of 51 changed files in this pull request and generated no comments.
Files not reviewed (12)
- pkg/service/one2onerestore/testdata/1.run_table_progress.json: Language not supported
- pkg/service/one2onerestore/testdata/1.run_view_progress.json: Language not supported
- pkg/service/one2onerestore/testdata/2.run_table_progress.json: Language not supported
- pkg/service/one2onerestore/testdata/2.run_view_progress.json: Language not supported
- pkg/service/one2onerestore/testdata/3.run_table_progress.json: Language not supported
- pkg/service/one2onerestore/testdata/3.run_view_progress.json: Language not supported
- pkg/service/one2onerestore/testdata/4.run_table_progress.json: Language not supported
- pkg/service/one2onerestore/testdata/4.run_view_progress.json: Language not supported
- pkg/service/one2onerestore/testdata/5.run_table_progress.json: Language not supported
- pkg/service/one2onerestore/testdata/5.run_view_progress.json: Language not supported
- pkg/service/one2onerestore/testdata/6.run_table_progress.json: Language not supported
- pkg/service/one2onerestore/testdata/6.run_view_progress.json: Language not supported
Comments suppressed due to low confidence (3)
pkg/service/one2onerestore/progress.go:296
- The mergeProgressStatus function returns 'in_progress' when merging differing statuses (except if one is 'failed'). Please verify that this behavior is intended for cases where one progress might already be 'done'.
func mergeProgressStatus(dst, src ProgressStatus) ProgressStatus {
pkg/service/one2onerestore/model.go:75
- [nitpick] Consider renaming 'scyllaTableWithSize' to a more descriptive name such as 'tableToRestore' to clarify its role in tracking table sizes for restoration.
tablesToRestore []scyllaTableWithSize
pkg/service/one2onerestore/progress.go:9
- [nitpick] Consider renaming the alias 'stderr' for the standard errors package to something more descriptive like 'stdErrors' to avoid potential confusion.
stderr "errors"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some mostly subjective nits
type scyllaTableWithSize struct { | ||
scyllaTable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I'm a fan of shorter names (e.g. just table
or tableWithSize
), as the default table meaning in the context of SM is the Scylla table.
pkg/service/one2onerestore/model.go
Outdated
TableSize int64 | ||
Downloaded int64 | ||
VersionedDownloaded int64 | ||
IsRefreshed bool // indicates whether node tool refresh is completed for this table or not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
node tool
-> nodetool
pkg/service/one2onerestore/model.go
Outdated
KeyspaceName string | ||
TableName string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: you can use shorter names (e.g. keyspace
or table
) with db:""
tag in order to handle names reserved by CQL.
schema/v3.6.0.cql
Outdated
CREATE TABLE one2onerestore_run_view_progress ( | ||
cluster_id uuid, | ||
task_id uuid, | ||
run_id uuid, | ||
|
||
started_at timestamp, | ||
completed_at timestamp, | ||
|
||
keyspace_name text, | ||
table_name text, | ||
view_type text, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there is just table_name
, it's not 100% obvious if it is the view table name or the base table name.
Maybe it would be better to rename it to or just add view_name
?
pkg/service/one2onerestore/model.go
Outdated
var ( | ||
// ProgressStatusNotStarted indicates that 1-1-restore of table/view is not yet started. | ||
ProgressStatusNotStarted ProgressStatus = "not_started" | ||
// ProgressStatusInProgress indicates that 1-1-restore of table/view is in progress. | ||
ProgressStatusInProgress ProgressStatus = "in_progress" | ||
// ProgressStatusDone indicates that 1-1-restore of table/view is done. | ||
ProgressStatusDone ProgressStatus = "done" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be const?
if rtp.StartedAt != nil && rtp.CompletedAt == nil { | ||
return ProgressStatusInProgress | ||
} | ||
if rtp.StartedAt != nil && rtp.CompletedAt != nil && !rtp.IsRefreshed { | ||
return ProgressStatusInProgress | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we can just remove those 2 if statements
This refactors 1-1-restore progress by making following changes: - include `nodetool refresh` into table progress - only track progress of table/view restore - removes unnecessary stats (shard_count, host bandwidth, aggregation by host, keyspaces). These stats is better to keep in metrics or calculate on the client side. Refs: #4205
This introduces "failed" status for the ProgressStatus, which is used only if table/view restore ended with error.
This makes various small changes like: - use shorter names for Keyspace, Table and View (instead of KeyspaceName and etc.) - add view_name to avoid confusions with table_name - change ProgressStatus from var to const - some smaller renaming and etc.
b3bc757
to
f981e5b
Compare
This refactors 1-1-restore progress by making following changes: - include `nodetool refresh` into table progress - only track progress of table/view restore - removes unnecessary stats (shard_count, host bandwidth, aggregation by host, keyspaces). These stats is better to keep in metrics or calculate on the client side. Refs: #4205
This refactors 1-1-restore progress by making following changes: - include `nodetool refresh` into table progress - only track progress of table/view restore - removes unnecessary stats (shard_count, host bandwidth, aggregation by host, keyspaces). These stats is better to keep in metrics or calculate on the client side. Refs: #4205 fix(1-1-restore): fix 1-1-restore progress aggregation (#4429) This fixes several small issues in progress aggregation: 1. Uniqueness of views was checked by keyspace + table name 2. Progress model had the wrong json tag for ViewType
This adds progress tracking of various 1-1-restore stage. Each progress update represented by RunProgress model saved into db. w.getProgress is used to aggregate current task progress by Keyspaces, Tables and Hosts. refactor(1-1-restore): refactors 1-1-restore progress (#4348) This refactors 1-1-restore progress by making following changes: - include `nodetool refresh` into table progress - only track progress of table/view restore - removes unnecessary stats (shard_count, host bandwidth, aggregation by host, keyspaces). These stats is better to keep in metrics or calculate on the client side. Refs: #4205 fix(1-1-restore): fix 1-1-restore progress aggregation (#4429) This fixes several small issues in progress aggregation: 1. Uniqueness of views was checked by keyspace + table name 2. Progress model had the wrong json tag for ViewType
This adds progress tracking of various 1-1-restore stage. Each progress update represented by RunProgress model saved into db. w.getProgress is used to aggregate current task progress by Keyspaces, Tables and Hosts. refactor(1-1-restore): refactors 1-1-restore progress (#4348) This refactors 1-1-restore progress by making following changes: - include `nodetool refresh` into table progress - only track progress of table/view restore - removes unnecessary stats (shard_count, host bandwidth, aggregation by host, keyspaces). These stats is better to keep in metrics or calculate on the client side. Refs: #4205 fix(1-1-restore): fix 1-1-restore progress aggregation (#4429) This fixes several small issues in progress aggregation: 1. Uniqueness of views was checked by keyspace + table name 2. Progress model had the wrong json tag for ViewType
This adds progress tracking of various 1-1-restore stage. Each progress update represented by RunProgress model saved into db. w.getProgress is used to aggregate current task progress by Keyspaces, Tables and Hosts. refactor(1-1-restore): refactors 1-1-restore progress (#4348) This refactors 1-1-restore progress by making following changes: - include `nodetool refresh` into table progress - only track progress of table/view restore - removes unnecessary stats (shard_count, host bandwidth, aggregation by host, keyspaces). These stats is better to keep in metrics or calculate on the client side. Refs: #4205 fix(1-1-restore): fix 1-1-restore progress aggregation (#4429) This fixes several small issues in progress aggregation: 1. Uniqueness of views was checked by keyspace + table name 2. Progress model had the wrong json tag for ViewType (cherry picked from commit a1c4314)
This refactors 1-1-restore progress to address code review comments from #4296 by making following changes:
nodetool refresh
into table progresshost, keyspaces). These stats are better to keep in metrics or
calculate on the client side.
Now getProgress api response will have following structure:
status
field is introduced to better cover cases when we can't say if restore operation of table/view is complete just by looking atsize
andrestored
, because for tables we need to wait until nodetool refresh is complete and for views - until view rebuild operation is complete.Refs: #4205
Please make sure that: