cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
30.12k stars 3.81k forks source link

sql: move txn contention event memory account into RPC handler #79526

Open Azhng opened 2 years ago

Azhng commented 2 years ago

Currently, the memory accounting for txn contention event happens in the virtual table handler. This happens after the RPC result has been allocated. This is bad since the memory monitor does not have the opportunity to deny the allocation if the limit has been exceeded.

We should incrementally call .Grow() as we receive RPC response back from iterate{Nodes, Pods}

Jira issue: CRDB-15948

knz commented 2 years ago

NB: any new accounting here should be careful to ensure the bytes are released if the result is pushed to a HTTP client instead of being consumed locally.

github-actions[bot] commented 8 months ago

We have marked this issue as stale because it has been inactive for 18 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to CockroachDB!