-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Backup improvements. #2263
Backup improvements. #2263
Conversation
This is ready for review. I will squash everything before merge, but maybe for review individual commits are better. @michael-berlin you're the primary review, @enisoc this is a FYI, feel free to review. |
filterOrTee = tee | ||
} | ||
|
||
// Create the gzip compression filter |
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.
Now that it's possible to plug in their own filter, users may want the option to disable built-in gzip compression. For example, maybe they want to use the filter hook to use a different compression algorithm, or their filter produces encrypted output that will only get bigger if sent through gzip.
Overall the change looks good. I left several comments around naming the feature and how to enable it via a flag. Reviewed 1 of 1 files at r1, 1 of 1 files at r2, 2 of 2 files at r3, 3 of 3 files at r4, 3 of 3 files at r5, 8 of 8 files at r6. bootstrap.sh, line 138 at r6 (raw file):
Can you please include the word "test" in the filename? Otherwise it's misleading and people would think that this file is the default backup filter. go/vt/hook/hook.go, line 145 at r3 (raw file):
typo: exit go/vt/hook/hook.go, line 164 at r3 (raw file):
Optional: You could also define this as function type. go/vt/hook/hook.go, line 165 at r3 (raw file):
I prefer "cmd.Wait()" to avoid confusing it with the previous "wait()" mentioning. go/vt/hook/hook.go, line 175 at r3 (raw file):
This probably stands for "WriteCloser". What about naming this and the writer "in" and "out" to better describe the data flow? go/vt/hook/hook.go, line 161 at r4 (raw file):
I think "filter" is the wrong word and we should name it differently (throughout the codebase). At no point data is getting filtered i.e. no backup data is getting omitted. Instead, it gets transformed or processed e.g. compressed or encrypted. go/vt/mysqlctl/backup.go, line 200 at r1 (raw file):
Is this new error handling covered by any test? It would be nice to have? go/vt/mysqlctl/backup.go, line 222 at r1 (raw file):
nit: s/useable/usable/ to be consistent go/vt/mysqlctl/backup.go, line 327 at r1 (raw file):
nit: Can you please capitalize the "b" in "backup"? go/vt/mysqlctl/backup.go, line 423 at r4 (raw file):
Same comment as in the other file. I think his variable name is not intuitive. Hook Write Closer? This is more the transformed output. go/vt/mysqlctl/backup.go, line 423 at r4 (raw file):
"close" in the variable name is confusing. I would expect "wait" here instead e.g. "hwait"? go/vt/mysqlctl/backup.go, line 424 at r4 (raw file):
Do you need to preserve the original value of Why not just override it?
go/vt/mysqlctl/backup.go, line 62 at r5 (raw file):
I'm not in favor of this flag. Instead, I think we should provide a flag where the user can specify the backup transformation/processing hook which should be used. If somebody wants to run Vitess with two different hooks (like you do in this test), they would do so at the hook level. We don't need the "--filter" flag in that case. Note that in the future we could provide multiple default implementations for transformation e.g. one for gzip. Users could then select which one they want to use by specifying the flag. When we have such a hook flag, you could also the bogus value "-backup_storage_filter=enabled" in the test below. go/vt/mysqlctl/backup.go, line 438 at r5 (raw file):
I would prefer if we don't hardcode this and instead provide a flag for that. go/vt/mysqlctl/backupstorage/interface.go, line 73 at r6 (raw file):
"stored" ? test/vthook-backup_filter, line 13 at r4 (raw file):
Please move "do" on the same line: while [[ $# -gt 1 ]]; do test/vthook-backup_filter, line 15 at r4 (raw file):
Please indent the while block by two spaces. Comments from Reviewable |
Review status: 0 of 13 files reviewed at latest revision, 18 unresolved discussions. bootstrap.sh, line 138 at r6 (raw file):
|
Review status: 0 of 14 files reviewed at latest revision, 18 unresolved discussions. go/vt/mysqlctl/backup.go, line 449 at r6 (raw file):
|
OK all comments addressed, much better. @michael-berlin @enisoc ready for review. |
Thank you for addressing all comments. Reviewed 13 of 14 files at r7, 1 of 1 files at r8, 2 of 2 files at r9, 3 of 4 files at r10, 3 of 4 files at r11, 8 of 8 files at r12, 8 of 8 files at r13, 3 of 3 files at r14. Comments from Reviewable |
- better backup error handling: When the backup fails, we now try to restore mysqld state anyway. That way the tablet becomes usable again. - Refactoring backup / restore code: So individual file backup / restore are each in their own function, instead of being two blocks deep. - Adding support for piping data through hooks. Also streamlining the hook creation, which changes the HookResult details a bit. All errors now are in Stderr. - Now supporting backup filters (optional, command-line driven). And adding one to backup test. - Add flag to disable backup compression (in case filter compresses). And add a test to make sure no backup is left-over upon backup failure. - Adding context to backupstorage API. The only current user is the GCS one, but it's way cleaner.
…ardized viper framework for vitess configuration parameters (vitessio#2407) * backport of 2263 * resolve conflicts Signed-off-by: Andrew Mason <andrew@planetscale.com> --------- Signed-off-by: Andrew Mason <andrew@planetscale.com> Co-authored-by: Andrew Mason <andrew@planetscale.com>
…tess configuration parameters (vitessio#2263) * cherry pick of 11456 * resolve go.mod Signed-off-by: Andrew Mason <andrew@planetscale.com> * resolve flagdata conflicts Signed-off-by: Andrew Mason <andrew@planetscale.com> --------- Signed-off-by: Andrew Mason <andrew@planetscale.com> Co-authored-by: Andrew Mason <andrew@planetscale.com>
Supports new features: