Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Example:
}
GlobalConfig.Parallel = min(GlobalConfig.Parallel, len(createTableDDLs))

logrus.Infof("Create %d table(s) and %d view(s), parallel: %d\n", len(createTableDDLs), len(createOtherDDLs), GlobalConfig.Parallel)
logrus.Infof("Create %d table(s) and %d view(s), parallel: %d", len(createTableDDLs), len(createOtherDDLs), GlobalConfig.Parallel)

db, err := connectDBWithoutDBName()
if err != nil {
Expand Down Expand Up @@ -174,15 +174,15 @@ func completeCreateConfig() (err error) {
fmatch := filepath.Join(ddldir, fmt.Sprintf("%s.*.table.sql", db))
tableddls, err := src.FileGlob([]string{fmatch})
if err != nil {
logrus.Errorf("Get db '%s' ddls in '%s' failed\n", db, fmatch)
logrus.Errorf("Get db '%s' ddls in '%s' failed", db, fmatch)
return err
}
createTableDDLs = append(createTableDDLs, tableddls...)

fmatch = filepath.Join(ddldir, fmt.Sprintf("%s.*view.sql", db))
viewddls, err := src.FileGlob([]string{fmatch})
if err != nil {
logrus.Errorf("Get db '%s' ddls in '%s' failed\n", db, fmatch)
logrus.Errorf("Get db '%s' ddls in '%s' failed", db, fmatch)
return err
}
createOtherDDLs = append(createOtherDDLs, viewddls...)
Expand Down
14 changes: 7 additions & 7 deletions cmd/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func diffDumpSQL(replay string) error {
client := strings.TrimSuffix(filepath.Base(path2), src.ReplayResultFileExt)
clientsqls, ok := client2sqls[client]
if !ok {
logrus.Errorf("client %s not found in original dump sql, skipping\n", client)
logrus.Errorf("client %s not found in original dump sql, skipping", client)
return nil
}

Expand All @@ -135,11 +135,11 @@ func diffDumpSQL(replay string) error {
defer f2.Close()
scan2 := bufio.NewScanner(f2)

logrus.Debugf("diffing %s:\n", path2)
logrus.Debugf("diffing %s:", path2)

id2sqls := lo.SliceToMap(clientsqls, func(s *src.ReplaySql) (string, *src.ReplaySql) { return s.QueryId, s })
if err := diff(&diffReader{id2sqls: id2sqls}, &diffReader{scan: scan2}); err != nil {
logrus.Errorf("diff %s failed, err: %v\n", path2, err)
logrus.Errorf("diff %s failed, err: %v", path2, err)
}
return nil
})
Expand Down Expand Up @@ -217,10 +217,10 @@ func diffTwoReplays(replay1, replay2 string) error {
defer f2.Close()
scan2 := bufio.NewScanner(f2)

logrus.Debugf("diffing %s and %s\n", path1, path2)
logrus.Debugf("diffing %s and %s", path1, path2)

if err := diff(&diffReader{scan: scan1}, &diffReader{scan: scan2}); err != nil {
logrus.Errorf("diff %s and %s failed, err: %v\n", path1, path2, err)
logrus.Errorf("diff %s and %s failed, err: %v", path1, path2, err)
}
return nil
})
Expand Down Expand Up @@ -248,7 +248,7 @@ func diff(scan1, scan2 *diffReader) error {

// print diff result
for id, diffmsg := range id2diff {
fmt.Printf("QueryId: %s, %s\n", color.CyanString(id), diffmsg)
fmt.Printf("QueryId: %s, %s", color.CyanString(id), diffmsg)
if len(scan1.id2sqls) > 0 {
if s, ok := scan1.id2sqls[id]; ok {
fmt.Printf("Stmt: %s", s.Stmt)
Expand Down Expand Up @@ -279,7 +279,7 @@ func (r *diffReader) get(queryId string) *src.ReplayResult {
}
result := &src.ReplayResult{}
if err := json.Unmarshal(b, result); err != nil {
logrus.Errorf("unmarshal %s failed, err: %v\n", r.scan.Text(), err)
logrus.Errorf("unmarshal %s failed, err: %v", r.scan.Text(), err)
return nil
}
return result
Expand Down
12 changes: 6 additions & 6 deletions cmd/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ or environment variables with prefix 'DORIS_', e.g.
return err
}

logrus.Infof("Found %d schema(s)\n", lo.SumBy(schemas, func(s *src.DBSchema) int { return len(s.Schemas) }))
logrus.Infof("Found %d schema(s)", lo.SumBy(schemas, func(s *src.DBSchema) int { return len(s.Schemas) }))

if err := outputSchemas(schemas); err != nil {
return err
Expand All @@ -126,7 +126,7 @@ or environment variables with prefix 'DORIS_', e.g.
return err
}

logrus.Infof("Found %d query(s)\n", count)
logrus.Infof("Found %d query(s)", count)
}

// store anonymize hash dict
Expand Down Expand Up @@ -240,7 +240,7 @@ func dumpSchemas(ctx context.Context) ([]*src.DBSchema, error) {
schemas := make([]*src.DBSchema, len(dbs))
for i, db := range dbs {
g.Go(func() error {
logrus.Infof("Dumping schemas from %s...\n", db)
logrus.Infof("Dumping schemas from %s...", db)
conn, err := connectDB(db)
if err != nil {
return err
Expand Down Expand Up @@ -382,14 +382,14 @@ func dumpQueriesFromTable(ctx context.Context, opts src.AuditLogScanOpts) (int,
return 0, err
}

logrus.Infof("Dumping queries from audit log table '%s'...\n", DumpConfig.AuditLogTable)
logrus.Infof("Dumping queries from audit log table '%s'...", DumpConfig.AuditLogTable)

w := NewQueryWriter(1, 0)
defer w.Close()

count, err := src.GetDBAuditLogs(ctx, w, db, dbname, table, opts, GlobalConfig.Parallel)
if err != nil {
logrus.Errorf("Extract queries from audit logs table failed, %v\n", err)
logrus.Errorf("Extract queries from audit logs table failed, %v", err)
return 0, err
}

Expand Down Expand Up @@ -451,7 +451,7 @@ func dumpQueriesFromFile(ctx context.Context, opts src.AuditLogScanOpts) (int, e
GlobalConfig.Parallel,
)
if err != nil {
logrus.Errorf("Extract queries from audit logs file failed, %v\n", err)
logrus.Errorf("Extract queries from audit logs file failed, %v", err)
return 0, err
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Example:
}
GlobalConfig.Parallel = min(GlobalConfig.Parallel, len(GlobalConfig.Tables))

logrus.Infof("Export data for %d table(s) to '%s', parallel: %d\n", len(GlobalConfig.Tables), ExportConfig.ToURL, GlobalConfig.Parallel)
logrus.Infof("Export data for %d table(s) to '%s', parallel: %d", len(GlobalConfig.Tables), ExportConfig.ToURL, GlobalConfig.Parallel)
if len(GlobalConfig.Tables) == 0 {
return nil
}
Expand Down
Loading