支持MySQL官方存储对象备份的分隔符恢复
识别DELIMITER客户端指令,保留复合语句及可执行注释,词法格式错误时拒绝执行部分备份。新增双版本官方导出对照与Scert恢复实库测试,验证触发器顺序、过程、函数、事件调度、权限失败及格式错误保护。仅覆盖本批恢复场景,自有导出对象完整性与生产验收仍未完成。
This commit is contained in:
1 parent
67070596fc
commit
e6e67197f6
5 files changed
+329
-11
No files matched your search
@@ -18,16 +18,25 @@ import (
|
||||
|
||||
// 官方工具仅连接本夹具创建的隔离实例,密码只传入子进程环境,不进入命令行或文件。
|
||||
func (f *Server) Dump(t *testing.T, cfg config.DatabaseConfig, output string) {
|
||||
f.dump(t, cfg, output, nil)
|
||||
}
|
||||
|
||||
func (f *Server) DumpStoredPrograms(t *testing.T, cfg config.DatabaseConfig, output string) {
|
||||
f.dump(t, cfg, output, []string{"--routines", "--events"})
|
||||
}
|
||||
|
||||
func (f *Server) dump(t *testing.T, cfg config.DatabaseConfig, output string, extra []string) {
|
||||
t.Helper()
|
||||
file, err := os.OpenFile(output, os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0o600)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer file.Close()
|
||||
f.runTool(t, "mysqldump", cfg, []string{
|
||||
args := []string{
|
||||
"--single-transaction", "--no-tablespaces", "--set-gtid-purged=OFF",
|
||||
"--skip-add-locks", "--hex-blob", "--complete-insert", "--skip-comments", "--skip-extended-insert",
|
||||
}, nil, file)
|
||||
}
|
||||
f.runTool(t, "mysqldump", cfg, append(args, extra...), nil, file)
|
||||
if err := file.Close(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user