summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@redhat.com>2022-10-31 17:40:01 -0400
committerFrank Ch. Eigler <fche@redhat.com>2023-04-07 11:38:41 -0400
commitba3e614b79ae18913d79e99168da414a735c7856 (patch)
tree1a78389d5d83f5467bfc9e9de41f0132870deb4d
parent0904596dd48683c95c02db54a42aff17acf173cb (diff)
downloadelfutils-users/fche/try-pr29472b.tar.gz
PR29472: debuginfod metadata query reworkusers/fche/try-pr29472b
Generalize lookup to "file" vs "glob" modes, propagate through API. Add server side timeout for metadata query ops. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
-rw-r--r--debuginfod/debuginfod.cxx14
-rw-r--r--debuginfod/libdebuginfod.map1
2 files changed, 15 insertions, 0 deletions
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;