-
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
adding new mysql shell backup engine #16295
Changes from 4 commits
1f70afb
58005ab
b74a87f
c51ee4b
6e59215
abe1d11
3ca4b3b
d26b5c3
0a5fda4
4aae34b
7116317
c2d41ac
8c6c665
0bb5631
82a288c
d9407f2
287a500
31ba57e
31c27b5
e62ae95
99f08ea
589c81b
4257ae4
e958558
2e8c441
64b52e6
75b2b76
85fba81
21f2604
47dc753
5c08cc7
e37dbbb
4418592
9243f22
4e79a02
7e77e86
1d5aaab
1fa6191
3c655a1
4e0a0e2
9218186
301e95c
ae42af7
bc2cff2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,9 +17,11 @@ limitations under the License. | |
package mysqlctl | ||
|
||
import ( | ||
"bufio" | ||
"context" | ||
"errors" | ||
"fmt" | ||
"io" | ||
"os" | ||
"path/filepath" | ||
"strings" | ||
|
@@ -29,6 +31,7 @@ import ( | |
|
||
"vitess.io/vitess/go/textutil" | ||
"vitess.io/vitess/go/vt/log" | ||
"vitess.io/vitess/go/vt/logutil" | ||
"vitess.io/vitess/go/vt/mysqlctl/backupstats" | ||
"vitess.io/vitess/go/vt/mysqlctl/backupstorage" | ||
"vitess.io/vitess/go/vt/proto/vtrpc" | ||
|
@@ -500,3 +503,20 @@ func Restore(ctx context.Context, params RestoreParams) (*BackupManifest, error) | |
params.Logger.Infof("Restore: complete") | ||
return manifest, nil | ||
} | ||
|
||
// scanLinesToLogger scans full lines from the given Reader and sends them to | ||
// the given Logger until EOF. | ||
func scanLinesToLogger(prefix string, reader io.Reader, logger logutil.Logger, doneFunc func()) { | ||
defer doneFunc() | ||
|
||
scanner := bufio.NewScanner(reader) | ||
for scanner.Scan() { | ||
line := scanner.Text() | ||
logger.Infof("%s: %s", prefix, line) | ||
} | ||
if err := scanner.Err(); err != nil { | ||
// This is usually run in a background goroutine, so there's no point | ||
// returning an error. Just log it. | ||
logger.Warningf("error scanning lines from %s: %v", prefix, err) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I notice we do not have a unit test for this function. Having moved it around, perhaps now is a good opportunity? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, I can probably add it there 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unit test added for this function |
||
} |
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.
New flags need to use dashes as separators.