Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
Signed-off-by: yisaer <[email protected]>
  • Loading branch information
Yisaer committed Nov 8, 2022
1 parent 2a3c459 commit 386f9ab
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions domain/plan_replayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (p *dumpFileGcChecker) gcDumpFilesByPath(path string, t time.Duration) {
continue
}
logutil.BgLogger().Info("dumpFileGcChecker successful", zap.String("filename", fileName))
if isPlanReplayer {
if isPlanReplayer && p.planReplayerHandle != nil {
p.planReplayerHandle.deletePlanReplayerStatus(context.Background(), fileName)
}
}
Expand Down Expand Up @@ -159,7 +159,7 @@ func (h *planReplayerHandle) insertExternalPlanReplayerErrorStatusRecord(ctx con
exec := h.sctx.(sqlexec.SQLExecutor)
_, err := exec.ExecuteInternal(ctx, fmt.Sprintf(
"insert into mysql.plan_replayer_status (origin_sql, fail_reason, instance) values ('%s','%s','%s')",
record.OriginSql, record.FailedReason, instance))
record.OriginSQL, record.FailedReason, instance))
if err != nil {
logutil.BgLogger().Warn("insert mysql.plan_replayer_status record failed",
zap.Error(err))
Expand All @@ -172,7 +172,7 @@ func (h *planReplayerHandle) insertExternalPlanReplayerSuccessStatusRecord(ctx c
exec := h.sctx.(sqlexec.SQLExecutor)
_, err := exec.ExecuteInternal(ctx, fmt.Sprintf(
"insert into mysql.plan_replayer_status (origin_sql, token, instance) values ('%s','%s','%s')",
record.OriginSql, record.Token, instance))
record.OriginSQL, record.Token, instance))
if err != nil {
logutil.BgLogger().Warn("insert mysql.plan_replayer_status record failed",
zap.Error(err))
Expand All @@ -182,7 +182,7 @@ func (h *planReplayerHandle) insertExternalPlanReplayerSuccessStatusRecord(ctx c
// PlanReplayerStatusRecord indicates record in mysql.plan_replayer_status
type PlanReplayerStatusRecord struct {
Internal bool
OriginSql string
OriginSQL string
Token string
FailedReason string
}
2 changes: 1 addition & 1 deletion executor/infoschema_cluster_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ func TestTableStorageStats(t *testing.T) {
"test 2",
))
rows := tk.MustQuery("select TABLE_NAME from information_schema.TABLE_STORAGE_STATS where TABLE_SCHEMA = 'mysql';").Rows()
result := 37
result := 38
require.Len(t, rows, result)

// More tests about the privileges.
Expand Down
2 changes: 1 addition & 1 deletion executor/plan_replayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ func generateRecords(task *PlanReplayerDumpTask) []domain.PlanReplayerStatusReco
if len(task.ExecStmts) > 0 {
for _, execStmt := range task.ExecStmts {
records = append(records, domain.PlanReplayerStatusRecord{
OriginSql: execStmt.Text(),
OriginSQL: execStmt.Text(),
Token: task.FileName,
Internal: false,
})
Expand Down

0 comments on commit 386f9ab

Please sign in to comment.