From ba3e614b79ae18913d79e99168da414a735c7856 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Mon, 31 Oct 2022 17:40:01 -0400 Subject: PR29472: debuginfod metadata query rework Generalize lookup to "file" vs "glob" modes, propagate through API. Add server side timeout for metadata query ops. Signed-off-by: Frank Ch. Eigler --- debuginfod/debuginfod.cxx | 14 ++++++++++++++ debuginfod/libdebuginfod.map | 1 + 2 files changed, 15 insertions(+) diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx index 0be01fba..23cd9430 100644 --- a/debuginfod/debuginfod.cxx +++ b/debuginfod/debuginfod.cxx @@ -2570,6 +2570,18 @@ handle_metadata (MHD_Connection* conn, "select 0, 0, 1, q.buildid, q.artifactsrc " "from " BUILDIDS "_query_s as q " "where q.artifactsrc " + op + " ? "); + // NB: we could query source file names too, thusly: + // + // select * from " BUILDIDS "_buildids b, " BUILDIDS "_files f1, " BUILDIDS "_r_sref sr + // where b.id = sr.buildid and f1.id = sr.artifactsrc and f1.name " + op + "?" + // UNION ALL something with BUILDIDS "_f_s" + // + // But the first part of this query cannot run fast without the same index temp-created + // during "maxigroom": + // create index " BUILDIDS "_r_sref_arc on " BUILDIDS "_r_sref(artifactsrc); + // and unfortunately this index is HUGE. It's similar to the size of the _r_sref + // table, which is already the largest part of a debuginfod index. Adding that index + // would nearly double the .sqlite db size. sqlite_ps *pp = new sqlite_ps (thisdb, "mhd-query-meta-glob", sql); pp->reset(); @@ -4473,6 +4485,8 @@ main (int argc, char *argv[]) if (maxigroom) { obatched(clog) << "maxigrooming database, please wait." << endl; + // NB: this index alone can nearly double the database size! + // NB: this index would be necessary to run source-file metadata searches fast extra_ddl.push_back("create index if not exists " BUILDIDS "_r_sref_arc on " BUILDIDS "_r_sref(artifactsrc);"); extra_ddl.push_back("delete from " BUILDIDS "_r_sdef where not exists (select 1 from " BUILDIDS "_r_sref b where " BUILDIDS "_r_sdef.content = b.artifactsrc);"); extra_ddl.push_back("drop index if exists " BUILDIDS "_r_sref_arc;"); diff --git a/debuginfod/libdebuginfod.map b/debuginfod/libdebuginfod.map index 355a89fd..903efd3d 100644 --- a/debuginfod/libdebuginfod.map +++ b/debuginfod/libdebuginfod.map @@ -21,6 +21,7 @@ ELFUTILS_0.183 { ELFUTILS_0.188 { debuginfod_get_headers; debuginfod_find_section; + debuginfod_find_metadata; } ELFUTILS_0.183; ELFUTILS_0.190 { debuginfod_find_metadata; -- cgit v1.2.1