-
Notifications
You must be signed in to change notification settings - Fork 175
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
feat: redis-restore-by-keys #8129
feat: redis-restore-by-keys #8129
Conversation
pkg/controller/plan/restore.go
Outdated
@@ -360,6 +363,9 @@ func (r *RestoreManager) initFromAnnotation(synthesizedComponent *component.Synt | |||
if doReadyRestoreAfterClusterRunning == "true" { | |||
r.doReadyRestoreAfterClusterRunning = true | |||
} | |||
if env := backupSource[constant.EnvForRestore]; env != "" { | |||
json.Unmarshal([]byte(env), &r.env) |
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.
Return the error when unmarshal fails. It should rarely happen.
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.
If a error occurs, the r.env
will be remained empty, should we still need to handle this err?
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.
If the env cannot be deserialized, we may not be able to restore the data as expected by the user (e.g., ignoring user-specified restore keys). The result of the restoration is unpredictable, so it is reasonable to fail the restoration directly.
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.
get
Please run |
@wangyelei @ldming Please take a look. |
@Chiwency Thanks for the contribution! Please issue another PR to merge the changes into the main branch. |
Resolve #8128
Support redis restore by multiply key patterns.
We can apply the key restoration by
"a*" and "b*" represent the patterns of keys we want to restore, and split by comma.
for the details of the key pattern, refer to Redis/KEYS
Implementation
DP_RESTORE_KEY_PATTERNS
.by pattern then MIGRATE the selected keys to the target redis instance.