Skip to content

Commit

Permalink
MODIFY action runtime returned result exceeds 20MiB.
Browse files Browse the repository at this point in the history
  • Loading branch information
karminski committed Feb 26, 2024
1 parent 762b1c1 commit 1f4ced1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/actionruntime/common/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
)

const DEFAULT_QUERY_AND_EXEC_TIMEOUT = 30 * time.Second
const SQL_RESULT_MEMORY_LIMIT = 209715200 // 200 * 1024 * 1024 bytes
const SQL_RESULT_MEMORY_LIMIT = 20971520 // 20 * 1024 * 1024 bytes
const SQL_RESULT_MEMORY_CHECK_SAMPLE = 100 // check 100 item bytes and calculate max item capacity

func RetrieveToMap(rows *sql.Rows) ([]map[string]interface{}, error) {
Expand Down Expand Up @@ -100,8 +100,8 @@ func RetrieveToMap(rows *sql.Rows) ([]map[string]interface{}, error) {
tableDataCapacity = (SQL_RESULT_MEMORY_LIMIT / tableDataSizeBySample) * SQL_RESULT_MEMORY_CHECK_SAMPLE
}
if iteratorNums > tableDataCapacity {
log.Printf("[ERROR] RetrieveToMap result exceeds 200MiB by iteratorNums: %d, size: %d", iteratorNums, size.Of(mapData))
return nil, errors.New("returned result exceeds 200MiB, please adjust the query limit to reduce the number of results")
log.Printf("[ERROR] RetrieveToMap result exceeds 20MiB by iteratorNums: %d, size: %d", iteratorNums, size.Of(mapData))
return nil, errors.New("returned result exceeds 20MiB, please adjust the query limit to reduce the number of results")
}
}

Expand Down Expand Up @@ -167,8 +167,8 @@ func RetrieveToMapByDriverRows(rows driver.Rows) ([]map[string]interface{}, erro
tableDataCapacity = (SQL_RESULT_MEMORY_LIMIT / tableDataSizeBySample) * SQL_RESULT_MEMORY_CHECK_SAMPLE
}
if iteratorNums > tableDataCapacity {
log.Printf("[ERROR] RetrieveToMap result exceeds 200MiB by iteratorNums: %d, size: %d", iteratorNums, size.Of(mapData))
return nil, errors.New("returned result exceeds 200MiB, please adjust the query limit to reduce the number of results")
log.Printf("[ERROR] RetrieveToMap result exceeds 20MiB by iteratorNums: %d, size: %d", iteratorNums, size.Of(mapData))
return nil, errors.New("returned result exceeds 20MiB, please adjust the query limit to reduce the number of results")
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/actionruntime/postgresql/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ func RetrieveToMap(rows pgx.Rows) ([]map[string]interface{}, error) {
tableDataCapacity = (common.SQL_RESULT_MEMORY_LIMIT / tableDataSizeBySample) * common.SQL_RESULT_MEMORY_CHECK_SAMPLE
}
if iteratorNums > tableDataCapacity {
log.Printf("[ERROR] RetrieveToMap result exceeds 200MiB by iteratorNums: %d, size: %d", iteratorNums, size.Of(tableData))
return nil, errors.New("returned result exceeds 200MiB, please adjust the query limit to reduce the number of results")
log.Printf("[ERROR] RetrieveToMap result exceeds 20MiB by iteratorNums: %d, size: %d", iteratorNums, size.Of(tableData))
return nil, errors.New("returned result exceeds 20MiB, please adjust the query limit to reduce the number of results")
}
}

Expand Down

0 comments on commit 1f4ced1

Please sign in to comment.