cockroachdb / cockroach

CockroachDB - the open source, cloud-native distributed SQL database.
https://www.cockroachlabs.com
Other
29.51k stars 3.7k forks source link

pgcrypto: make expensive functions respect context cancellation #111073

Open steven-hubbard opened 9 months ago

steven-hubbard commented 9 months ago

Is your feature request related to a problem? Please describe. When using the crypto gen_salt function setting the iter_count to the higher end of acceptable values can take a very long time to complete. While these values aren't normally in use, if an operator does decide to use one, then this can lock the cluster into a pretty resource intensive operation until it completes or the cluster is restarted.

Describe the solution you'd like Ideally we would be able to interrupt these functions. It seems like the two possible solutions are to fork bcrypt or to wait for something like this pull request to be released in a newer version of go.

Jira issue: CRDB-31750

fqazi commented 9 months ago

We need the crypto library extended to support taking in a context, so placing this in our long term backlog.