-
Notifications
You must be signed in to change notification settings - Fork 101
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
Add incremental backup-restore mechanism #29
Add incremental backup-restore mechanism #29
Conversation
Signed-off-by: Swapnil Mhamane <[email protected]>
25e97a2
to
1cdc1b5
Compare
1cdc1b5
to
6129c45
Compare
Signed-off-by: Swapnil Mhamane <[email protected]>
6129c45
to
55cd889
Compare
Signed-off-by: Swapnil Mhamane <[email protected]>
2417d8a
to
36145e2
Compare
Signed-off-by: Swapnil Mhamane <[email protected]>
Signed-off-by: Swapnil Mhamane <[email protected]>
b6b1531
to
66e83eb
Compare
66e83eb
to
cce3f13
Compare
Signed-off-by: Swapnil Mhamane <[email protected]>
cce3f13
to
048f7d2
Compare
@georgekuruvillak Please review and test it thoroughly. |
Signed-off-by: Swapnil Mhamane <[email protected]>
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.
Nice work! I have some queries though. Can you check it out.
cmd/restore.go
Outdated
@@ -113,3 +112,21 @@ func initialClusterFromName(name string) string { | |||
} | |||
return fmt.Sprintf("%s=http://localhost:2380", n) | |||
} | |||
|
|||
// getLatestFullSnapshotAndDeltaSnapList resturns the latest snapshot |
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.
'returns'
pkg/initializer/initializer.go
Outdated
@@ -135,3 +133,21 @@ func removeContents(dir string) error { | |||
} | |||
return nil | |||
} | |||
|
|||
// getLatestFullSnapshotAndDeltaSnapList resturns the latest snapshot | |||
func getLatestFullSnapshotAndDeltaSnapList(store snapstore.SnapStore) (*snapstore.Snapshot, snapstore.SnapList, error) { |
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.
Can we avoid the function duplication? The interface meets 'GetLatest' for snapstore, ryt?
ctx = context.TODO() | ||
) | ||
|
||
for _, e := range events { |
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.
Why do we commit on subsequent loop? Can we not fetch the ops in the same loop and commit at the end of the loop? Can we not expect events to be sequential? If that was not the case, we would lose some events because of irregular ordering, wont we?
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.
We do expect events to be sequential here. On etcd we can have transaction with multile put and delete operation. In that case, we get separate events with same key-value -modification-revision. So, if trace the logic here properly, you can see the we are collecting ops and committing it under same transaction before kv.ModRevision change. And last commit out of for-loop is just for commit the events collected in last loop iterations.
return applyEventsToEtcd(client, events[newRevisionIndex:]) | ||
} | ||
|
||
// applyDeltaSnapshot applies thw events from delta snapshot to etcd |
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.
'the' :)
return nil | ||
} | ||
|
||
// applyFirstDeltaSnapshot applies thw events from first delta snapshot to etcd |
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.
'the' :)
return e, nil | ||
} | ||
|
||
// applyDeltaSnapshot applies thw events from time sorted list of delta snapshot to etcd sequentially |
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.
'the' :)
Thank you George for reviewing it. I have addressed the changes in next PR on the way. As discussed, i I shall merge this branch now. |
Cloeses #2