Page MenuHomeSoftware Heritage

Cassandra: Use lower consistency level in `*_missing` methods when called from `*_add`
Closed, MigratedEdits Locked

Description

When allow_overwrite is False (the default), the Cassandra storage checks if objects exist before inserting them. This is best-effort, (because other workers may write between this check and the actual write anyway), so only meant as a performance optimization.

This check is performed with the same consistency level as other queries, ie. QUORUM in production.

However, since this is already "vulnerable" to TOCTOU issues, I think we might as well lower this level to 1. This lowers the load by sending queries to fewer nodes, and lowers latency of the query itself.

Event Timeline

vlorentz created this task.
vlorentz updated the task description. (Show Details)
vlorentz updated the task description. (Show Details)