Skip to content

symbols: Fix "too many SQL variables"

Administrator requested to merge symbols-fix-too-many-sql-variables into main

Created by: chrismwendt

https://github.com/sourcegraph/sourcegraph/pull/27986 switched from deleting one path at a time to deleting all paths in one SQL query. The number of paths is unbounded, and we hit the limit on Sourcegraph.com:

t=2022-02-11T22:56:12+0000 lvl=eror msg="diskcache.Cached Fetch" error="failed to fetch missing archive cache item: databaseWriter.WriteDBFile: store.DeletePaths: too many SQL variables" count=1.000 elapsed=5.384 component=symbols

This reverts the behavior back to deleting one path at a time. Deleting 3287 paths took 197ms before this change and 204ms after.

This problem could be causing https://github.com/sourcegraph/sourcegraph/issues/28457

Test plan

Saved a SQLite DB that had paths deleted by running sqlite3 file.zip .dump from before and after this change, sorted, and compared them with diff. No difference.

Then I chunked paths by 1,000 and wrote a test.

Merge request reports

Loading