diff options
| author | Omar Sandoval <[email protected]> | 2024-07-23 15:35:43 -0700 |
|---|---|---|
| committer | Aaron Merey <[email protected]> | 2024-07-24 18:13:40 -0400 |
| commit | ee46d94a6fa5b6c13d494b3d6d6bd52f6a8a5d17 (patch) | |
| tree | 717f000cb98f50912cb030ebb365170825c5677e /tests | |
| parent | 7c632c5c2ed8e75c8104278ef2bcff67b5596860 (diff) | |
debuginfod: populate _r_seekable on request
Since the schema change adding _r_seekable was done in a backward
compatible way, seekable archives that were previously scanned will not
be in _r_seekable. Whenever an archive is going to be extracted to
satisfy a request, check if it is seekable. If so, populate _r_seekable
while extracting it so that future requests use the optimized path.
The next time that BUILDIDS is bumped, all archives will be checked at
scan time. At that point, checking again will be unnecessary and this
commit (including the test case modification) can be reverted.
Signed-off-by: Omar Sandoval <[email protected]>
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/run-debuginfod-seekable.sh | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/run-debuginfod-seekable.sh b/tests/run-debuginfod-seekable.sh index 4dd3b71e..52a5ab1e 100755 --- a/tests/run-debuginfod-seekable.sh +++ b/tests/run-debuginfod-seekable.sh @@ -141,4 +141,52 @@ kill $PID1 wait $PID1 PID1=0 +if type sqlite3 2>/dev/null; then + # Emulate the case of upgrading from an old server without the seekable + # optimization by dropping the _r_seekable table. + sqlite3 "$DB" 'DROP TABLE buildids10_r_seekable' + + env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../debuginfod/debuginfod $VERBOSE \ + -d $DB -p $PORT2 -t0 -g0 \ + --fdcache-mbs=100 --fdcache-mintmp=0 --fdcache-prefetch=0 \ + -R -U R D > vlog$PORT2 2>&1 & + PID2=$! + tempfiles vlog$PORT2 + errfiles vlog$PORT2 + + wait_ready $PORT2 'ready' 1 + + check_all $PORT2 + + # The first request per archive has to do a full extraction. Check + # that the rest used the seekable optimization. + curl -s http://localhost:$PORT2/metrics | awk ' +/^http_responses_total\{result="seekable xz archive"\}/ { + print + seekable = $NF +} + +/^http_responses_total\{result="(rpm|deb) archive"\}/ { + print + full = $NF +} + +END { + if (seekable == 0) { + print "error: no seekable extractions" > "/dev/stderr" + exit 1 + } + if (full > 4) { + print "error: too many (" full ") full extractions" > "/dev/stderr" + exit 1 + } +}' + + tempfiles $DB* + + kill $PID2 + wait $PID2 + PID2=0 +fi + exit 0 |
