We see the following in Clair logs:
2023-12-05T12:29:42.735270480+11:00 {"level":"info","component":"indexer/controller/Controller.Index","request_id":"06a5234b306da14a","manifest":"sha256:21aeb463f318f44327a2fcf1a7dbaba8c6a69ee1e3a8b18fe95b0243dfc6146e","time":"2023-12-05T01:29:42Z","message":"starting scan"} 2023-12-05T12:29:42.740348207+11:00 {"level":"info","component":"indexer/controller/Controller.Index","request_id":"06a5234b306da14a","manifest":"sha256:21aeb463f318f44327a2fcf1a7dbaba8c6a69ee1e3a8b18fe95b0243dfc6146e","state":"CheckManifest","time":"2023-12-05T01:29:42Z","message":"manifest to be scanned"} 2023-12-05T12:29:42.759078993+11:00 {"level":"error","component":"indexer/controller/Controller.Index","request_id":"06a5234b306da14a","manifest":"sha256:21aeb463f318f44327a2fcf1a7dbaba8c6a69ee1e3a8b18fe95b0243dfc6146e","state":"CheckManifest","error":"failed to persist manifest: failed to insert manifest -> layer link: ERROR: more than one row returned by a subquery used as an expression (SQLSTATE 21000)","time":"2023-12-05T01:29:42Z","message":"error during scan"} 2023-12-05T12:29:42.759679725+11:00 {"level":"info","component":"indexer/controller/Controller.Index","request_id":"06a5234b306da14a","manifest":"sha256:21aeb463f318f44327a2fcf1a7dbaba8c6a69ee1e3a8b18fe95b0243dfc6146e","state":"CheckManifest","error":"failed to upsert index report: ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification (SQLSTATE 42P10)","time":"2023-12-05T01:29:42Z","message":"failed persisting index report"} 2023-12-05T12:29:42.760217734+11:00 {"level":"info","manifest":"sha256:21aeb463f318f44327a2fcf1a7dbaba8c6a69ee1e3a8b18fe95b0243dfc6146e","request_id":"06a5234b306da14a","component":"libindex/Libindex.Index","time":"2023-12-05T01:29:42Z","message":"index request done"} 2023-12-05T12:29:42.760406189+11:00 {"level":"info","component":"httptransport/New","request_id":"06a5234b306da14a","remote_addr":"10.0.2.193:60926","method":"POST","request_uri":"/indexer/api/v1/index_report","status":500,"duration":26.613823,"time":"2023-12-05T01:29:42Z","message":"handled HTTP request"}
We also see a similar log for updaters:
2023-12-05T12:24:45.067848167+11:00 {"level":"error","component":"libvuln/updates/Manager.driveUpdater","updater":"RHEL8-cfme-5-including-unpatched","error":"failed to upsert successful updater status: ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification (SQLSTATE 42P10)","updater":"RHEL8-cfme-5-including-unpatched","updateTime":"2023-12-05T01:24:44Z","time":"2023-12-05T01:24:45Z","message":"error while recording updater status"} ... 2023-12-05T12:24:45.109582033+11:00 {"level":"error","component":"libvuln/updates/Manager.driveUpdater","updater":"RHEL8-openshift-4.15","error":"failed to upsert successful updater status: ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification (SQLSTATE 42P10)","updater":"RHEL8-openshift-4.15","updateTime":"2023-12-05T01:24:44Z","time":"2023-12-05T01:24:45Z","message":"error while recording updater status"}
and this seems to happen for every updater. This happens on latest Clair 3.7.x image, Clair version is 4.7.1:
# docker run --rm -it --entrypoint /usr/bin/clairctl registry.redhat.io/quay/clair-rhel8@sha256:f41decaf54d8de4bf8da7d28e041824eb9cece7feb81ab3a8c3b5245d2d20a85 --version clairctl version v4.7.1-1-g0729ad2a (user) (claircore v1.5.15)
PostgreSQL error log keeps showing the following two SQL queries as being problematic:
2023-12-06 23:40:19.183 GMT [705] ERROR: more than one row returned by a subquery used as an expression 2023-12-06 23:40:19.183 GMT [705] STATEMENT: WITH manifests AS ( SELECT id AS manifest_id FROM manifest WHERE hash = $1 ), layers AS ( SELECT id AS layer_id FROM layer WHERE hash = $2 ) INSERT INTO manifest_layer (manifest_id, layer_id, i) VALUES ((SELECT manifest_id FROM manifests), (SELECT layer_id FROM layers), $3) ON CONFLICT DO NOTHING; 2023-12-06 23:40:19.184 GMT [705] ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification 2023-12-06 23:40:19.184 GMT [705] STATEMENT: WITH manifests AS ( SELECT id AS manifest_id FROM manifest WHERE hash = $1 ) INSERT INTO indexreport (manifest_id, scan_result) VALUES ((SELECT manifest_id FROM manifests), $2) ON CONFLICT (manifest_id) DO UPDATE SET scan_result = excluded.scan_result;
Is this a problem with Clair database? What would be the remedy?
Thanks!