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: exp check proto size (#12192)
Danny Xua192825a9bee
diff --git a/backend/plugin/db/bigquery/bigquery.go b/backend/plugin/db/bigquery/bigquery.goindex f2c740d474..e7d6b4143b 100644--- a/backend/plugin/db/bigquery/bigquery.go+++ b/backend/plugin/db/bigquery/bigquery.go@@ -245,8 +245,8 @@ func (d *Driver) querySingleSQL(ctx context.Context, statement string) (*v1pb.Qurow.Values = append(row.Values, convertValue(v, fieldTypes[i]))}result.Rows = append(result.Rows, row)-- if proto.Size(result) > common.MaximumSQLResultSize {+ n := len(result.Rows)+ if (n&(n-1) == 0) && proto.Size(result) > common.MaximumSQLResultSize {result.Error = common.MaximumSQLResultSizeExceededresult.Latency = durationpb.New(time.Since(startTime))return result, nildiff --git a/backend/plugin/db/clickhouse/clickhouse.go b/backend/plugin/db/clickhouse/clickhouse.goindex 12b125cce1..9849b52170 100644--- a/backend/plugin/db/clickhouse/clickhouse.go+++ b/backend/plugin/db/clickhouse/clickhouse.go@@ -508,7 +508,8 @@ func readRowsForClickhouse(result *v1pb.QueryResult, rows *sql.Rows, columnTypes}result.Rows = append(result.Rows, &rowData)- if proto.Size(result) > common.MaximumSQLResultSize {+ n := len(result.Rows)+ if (n&(n-1) == 0) && proto.Size(result) > common.MaximumSQLResultSize {result.Error = common.MaximumSQLResultSizeExceededreturn nil}diff --git a/backend/plugin/db/hive/hive.go b/backend/plugin/db/hive/hive.goindex b8d9603aca..ac21d109b2 100644--- a/backend/plugin/db/hive/hive.go+++ b/backend/plugin/db/hive/hive.go@@ -240,7 +240,8 @@ func runSingleStatement(ctx context.Context, conn *gohive.Connection, statement// Rows.result.Rows = append(result.Rows, &queryRow)- if proto.Size(result) > common.MaximumSQLResultSize {+ n := len(result.Rows)+ if (n&(n-1) == 0) && proto.Size(result) > common.MaximumSQLResultSize {result.Error = common.MaximumSQLResultSizeExceededresult.Latency = durationpb.New(time.Since(startTime))return result, nildiff --git a/backend/plugin/db/redis/redis.go b/backend/plugin/db/redis/redis.goindex 8f223dd5c6..4d84779ce9 100644--- a/backend/plugin/db/redis/redis.go+++ b/backend/plugin/db/redis/redis.go@@ -259,7 +259,8 @@ func setQueryResultRows(result *v1pb.QueryResult, cmd *redis.Cmd) {if ok {for i, v := range l {result.Rows = append(result.Rows, getResultRow(i+1, v))- if proto.Size(result) > common.MaximumSQLResultSize {+ n := len(result.Rows)+ if (n&(n-1) == 0) && proto.Size(result) > common.MaximumSQLResultSize {result.Error = common.MaximumSQLResultSizeExceededreturn}diff --git a/backend/plugin/db/spanner/spanner.go b/backend/plugin/db/spanner/spanner.goindex 2f7fd4c728..d7b2cb6cc2 100644--- a/backend/plugin/db/spanner/spanner.go+++ b/backend/plugin/db/spanner/spanner.go@@ -320,7 +320,8 @@ func (d *Driver) querySingleSQL(ctx context.Context, statement string) (*v1pb.Qureturn nil, err}result.Rows = append(result.Rows, rowData)- if proto.Size(result) > common.MaximumSQLResultSize {+ n := len(result.Rows)+ if (n&(n-1) == 0) && proto.Size(result) > common.MaximumSQLResultSize {result.Error = common.MaximumSQLResultSizeExceededresult.Latency = durationpb.New(time.Since(startTime))return result, nildiff --git a/backend/plugin/db/util/driverutil.go b/backend/plugin/db/util/driverutil.goindex b855b9c91c..2d53fbbcac 100644--- a/backend/plugin/db/util/driverutil.go+++ b/backend/plugin/db/util/driverutil.go@@ -226,7 +226,8 @@ func readRows(result *v1pb.QueryResult, dbType storepb.Engine, rows *sql.Rows, c}result.Rows = append(result.Rows, &rowData)- if proto.Size(result) > common.MaximumSQLResultSize {+ n := len(result.Rows)+ if (n&(n-1) == 0) && proto.Size(result) > common.MaximumSQLResultSize {result.Error = common.MaximumSQLResultSizeExceededreturn nil}