Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix(tbl-limit-size): check row count instead of table data size (#12027)
Azusaind2eda74f0ccc
diff --git a/backend/plugin/advisor/mysql/advisor_table_limit_size.go b/backend/plugin/advisor/mysql/advisor_table_limit_size.goindex 0b496fa8a4..1338acafad 100644--- a/backend/plugin/advisor/mysql/advisor_table_limit_size.go+++ b/backend/plugin/advisor/mysql/advisor_table_limit_size.go@@ -72,13 +72,13 @@ func (*MaximumTableSizeAdvisor) Check(ctx advisor.Context, _ string) ([]advisor.if ctx.DBSchema != nil && len(ctx.DBSchema.Schemas) != 0 {// Check all table size.for _, tabName := range tableSizeChecker.affectedTabNames {- dataSize := getTabSizeByName(tabName, ctx.DBSchema.Schemas[0].Tables)- if dataSize >= int64(payload.Number) {+ tableRows := getTabRowsByName(tabName, ctx.DBSchema.Schemas[0].Tables)+ if tableRows >= int64(payload.Number) {adviceList = append(adviceList, advisor.Advice{Status: status,Code: advisor.TableExceedLimitSize,Title: ctx.Rule.Type,- Content: fmt.Sprintf("Apply DDL on large table '%s' ( %d bytes ) will lock table for a long time", tabName, dataSize),+ Content: fmt.Sprintf("Apply DDL on large table '%s' ( %d rows ) will lock table for a long time", tabName, tableRows),Line: statementBaseLine + tableSizeChecker.baseLine,})}@@ -118,10 +118,10 @@ func (checker *MaximumTableSizeChecker) EnterDropTable(ctx *mysql.DropTableConte}}-func getTabSizeByName(targetTabName string, tables []*store.TableMetadata) int64 {+func getTabRowsByName(targetTabName string, tables []*store.TableMetadata) int64 {for _, table := range tables {if table.Name == targetTabName {- return table.DataSize+ return table.RowCount}}return 0diff --git a/frontend/src/locales/sql-review/en-US.json b/frontend/src/locales/sql-review/en-US.jsonindex d924e6b6b6..989d806c32 100644--- a/frontend/src/locales/sql-review/en-US.json+++ b/frontend/src/locales/sql-review/en-US.json@@ -100,11 +100,11 @@}},"table-limit-size": {- "title": "Limit DDL operations on tables with large data volumes",- "description": "Configure the maximum data size of tables for which DDL can be executed. Recommended error level: warning",+ "title": "Limit DDL operations on tables with a large number of rows",+ "description": "Configure the maximum number of rows in tables for which DDL can be executed. Recommended error level: warning","component": {"number": {- "title": "Max data size"+ "title": "Max row count"}}},diff --git a/frontend/src/locales/sql-review/es-ES.json b/frontend/src/locales/sql-review/es-ES.jsonindex 8dc67b8753..f65370fbeb 100644--- a/frontend/src/locales/sql-review/es-ES.json+++ b/frontend/src/locales/sql-review/es-ES.json@@ -100,11 +100,11 @@}},"table-limit-size": {- "title": "Limite las operaciones DDL en tablas con grandes volúmenes de datos",- "description": "Configure el tamaño máximo de datos de las tablas para las que se puede ejecutar DDL. Nivel de error recomendado: advertencia",+ "title": "Limitar operaciones DDL en tablas con gran número de filas",+ "description": "Configurar el número máximo de filas en tablas para las cuales se puede ejecutar DDL. Nivel de error recomendado: advertencia","component": {"number": {- "title": "Tamaño máximo de datos"+ "title": "Recuento máximo de filas"}}},@@ -652,4 +652,4 @@"warning": "Advertencia","disabled": "Deshabilitado"}-}\ No newline at end of file+}diff --git a/frontend/src/locales/sql-review/ja-JP.json b/frontend/src/locales/sql-review/ja-JP.jsonindex b2cd17af7f..b8a408ff92 100644--- a/frontend/src/locales/sql-review/ja-JP.json+++ b/frontend/src/locales/sql-review/ja-JP.json@@ -100,11 +100,11 @@}},"table-limit-size": {- "title": "大量のデータを含むテーブルに対する DDL 操作を制限する",- "description": "DDL を実行できるテーブルの最大データサイズを設定します。推奨エラーレベル: 警告",+ "title": "行数の多いテーブルに対するDDL操作を制限する",+ "description": "DDLが実行可能なテーブルの最大行数を設定します。推奨エラーレベル:警告","component": {"number": {- "title": "最大データサイズ"+ "title": "最大行数"}}},@@ -652,4 +652,4 @@"warning": "警告","disabled": "無効化"}-}\ No newline at end of file+}diff --git a/frontend/src/locales/sql-review/zh-CN.json b/frontend/src/locales/sql-review/zh-CN.jsonindex a729100678..450ba93b87 100644--- a/frontend/src/locales/sql-review/zh-CN.json+++ b/frontend/src/locales/sql-review/zh-CN.json@@ -100,11 +100,11 @@}},"table-limit-size": {- "title": "限制对数据量大的表执行 DDL 操作",- "description": "配置可执行 DDL 的表的最大数据量。建议错误级别:警告",+ "title": "限制对多行数表的 DDL 操作",+ "description": "配置可以执行 DDL 的表的最大行数。推荐错误级别:警告","component": {"number": {- "title": "最大数据量"+ "title": "最大行数"}}},@@ -652,4 +652,4 @@"warning": "警告","disabled": "禁用"}-}\ No newline at end of file+}