使用并发队列安装和升级数据表/启动时自动调整MySQL变量

This commit is contained in:
GoEdgeLab
2022-09-25 20:34:19 +08:00
parent d2c925f843
commit dd48aa59b3
4 changed files with 155 additions and 53 deletions

View File

@@ -4,6 +4,7 @@ import (
"encoding/json"
"github.com/iwind/TeaGo/dbs"
"testing"
"time"
)
func TestSQLDump_Dump(t *testing.T) {
@@ -62,15 +63,20 @@ func TestSQLDump_Apply(t *testing.T) {
_ = db.Close()
}()
dump := NewSQLDump()
var dump = NewSQLDump()
result, err := dump.Dump(db)
if err != nil {
t.Fatal(err)
}
var before = time.Now()
defer func() {
t.Log("cost:", time.Since(before))
}()
db2, err := dbs.NewInstanceFromConfig(&dbs.DBConfig{
Driver: "mysql",
Dsn: "root:123456@tcp(127.0.0.1:3306)/db_edge_new?charset=utf8mb4&timeout=30s",
Dsn: "root:123456@tcp(192.168.2.60:3306)/db_edge_new?charset=utf8mb4&timeout=30s",
Prefix: "edge",
})
if err != nil {
@@ -84,9 +90,10 @@ func TestSQLDump_Apply(t *testing.T) {
t.Fatal(err)
}
t.Log("ok")
if len(ops) > 0 {
/**if len(ops) > 0 {
for _, op := range ops {
t.Log("", op)
}
}
}**/
_ = ops
}