Skip to content

Commit

Permalink
delete: generate rollback sql
Browse files Browse the repository at this point in the history
  • Loading branch information
winfredLIN committed Nov 29, 2024
1 parent e5d8ec6 commit 8e9c03a
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 57 deletions.
5 changes: 0 additions & 5 deletions sqle/driver/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,10 @@ func (inspect *MysqlDriverImpl) applyConfig(cfg *driverV2.Config) {
inspect.isOfflineAudit = cfg.DSN == nil

inspect.cnf = &Config{
DMLRollbackMaxRows: 1000,
DDLOSCMinSize: -1,
DDLGhostMinSize: -1,
}
for _, rule := range cfg.Rules {
if rule.Name == rulepkg.ConfigDMLRollbackMaxRows {
max := rule.Params.GetParam(rulepkg.DefaultSingleParamKeyName).Int()
inspect.cnf.DMLRollbackMaxRows = int64(max)
}
if rule.Name == rulepkg.ConfigDDLOSCMinSize {
min := rule.Params.GetParam(rulepkg.DefaultSingleParamKeyName).Int()
inspect.cnf.DDLOSCMinSize = int64(min)
Expand Down
1 change: 0 additions & 1 deletion sqle/driver/mysql/rule/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ const (

// inspector config code
const (
ConfigDMLRollbackMaxRows = "dml_rollback_max_rows"
ConfigDDLOSCMinSize = "ddl_osc_min_size"
ConfigDDLGhostMinSize = "ddl_ghost_min_size"
ConfigOptimizeIndexEnabled = "optimize_index_enabled"
Expand Down
19 changes: 0 additions & 19 deletions sqle/driver/mysql/rule/rule_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,6 @@ var sourceRuleHandlers = []*SourceHandler{
AllowOffline: false,
Func: notAllowInsertAutoincrement,
},
{
Rule: SourceRule{
Name: ConfigDMLRollbackMaxRows,
Desc: plocale.ConfigDMLRollbackMaxRowsDesc,
Annotation: plocale.ConfigDMLRollbackMaxRowsAnnotation,
//Value: "1000",
Level: driverV2.RuleLevelNotice,
Category: plocale.RuleTypeGlobalConfig,
Params: []*SourceParam{
{
Key: DefaultSingleParamKeyName,
Value: "1000",
Desc: plocale.ConfigDMLRollbackMaxRowsParams1,
Type: params.ParamTypeInt,
},
},
},
Func: nil,
},
{
Rule: SourceRule{
Name: ConfigDDLOSCMinSize,
Expand Down
32 changes: 0 additions & 32 deletions sqle/server/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,38 +327,6 @@ func parse(l *logrus.Entry, p driver.Plugin, sql string) (node driverV2.Node, er
return nodes[0], nil
}

// func genRollbackSQL(l *logrus.Entry, task *model.Task, p driver.Plugin) ([]*model.RollbackSQL, error) {
// rollbackSQLs := make([]*model.RollbackSQL, 0, len(task.ExecuteSQLs))
// for _, executeSQL := range task.ExecuteSQLs {
// rollbackSQL, i18nReason, err := p.GenRollbackSQL(context.TODO(), executeSQL.Content)
// if err != nil && session.IsParseShowCreateTableContentErr(err) {
// l.Errorf("gen rollback sql error, %v", err) // todo #1630 临时跳过创表语句解析错误
// return nil, nil
// } else if err != nil {
// l.Errorf("gen rollback sql error, %v", err)
// return nil, err
// }
// result := driverV2.NewAuditResults()
// for i := range executeSQL.AuditResults {
// ar := executeSQL.AuditResults[i]
// result.Add(driverV2.RuleLevel(ar.Level), ar.RuleName, model.ConvertI18NAuditResultInfoMapToI18nStr(ar.I18nAuditResultInfo))
// }
// result.Add(driverV2.RuleLevelNotice, "", i18nReason)

// executeSQL.AuditLevel = string(result.Level())
// appendExecuteSqlResults(executeSQL, result)

// rollbackSQLs = append(rollbackSQLs, &model.RollbackSQL{
// BaseSQL: model.BaseSQL{
// TaskId: executeSQL.TaskId,
// Content: rollbackSQL,
// },
// ExecuteSQLId: executeSQL.ID,
// })
// }
// return rollbackSQLs, nil
// }

func appendExecuteSqlResults(executeSQL *model.ExecuteSQL, result *driverV2.AuditResults) {
for i := range result.Results {
executeSQL.AuditResults.Append(result.Results[i])
Expand Down

0 comments on commit 8e9c03a

Please sign in to comment.