Closed Bug 1592410 Opened 5 years ago Closed 4 years ago

different bug count with and without count_only=1 parameter

Categories

(bugzilla.mozilla.org :: Search, defect)

Production
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: aryx, Assigned: glob)

Details

Attachments

(1 file)

46 bytes, text/x-github-pull-request
Details | Review

https://bugzilla.mozilla.org/rest/bug?include_fields=id&bug_type=defect&bug_severity=blocker&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&resolution=---&resolution=FIXED&resolution=INACTIVE&resolution=INCOMPLETE&resolution=SUPPORT&resolution=EXPIRED&resolution=MOVED&chfield=cf_last_resolved&count_only=1&chfieldfrom=-14ws&chfieldto=-1ws&product=Core&product=DevTools&product=External%20Software%20Affecting%20Firefox&product=Firefox&product=Firefox%20Build%20System&product=Firefox%20for%20Android&product=Firefox%20for%20iOS&product=GeckoView&product=NSPR&product=NSS&product=Toolkit&product=WebExtensions
uses count_only=1 and returns 19 as bug count for me.

https://bugzilla.mozilla.org/rest/bug?include_fields=id&bug_type=defect&bug_severity=blocker&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&resolution=---&resolution=FIXED&resolution=INACTIVE&resolution=INCOMPLETE&resolution=SUPPORT&resolution=EXPIRED&resolution=MOVED&chfield=cf_last_resolved&chfieldfrom=-14ws&chfieldto=-1ws&product=Core&product=DevTools&product=External%20Software%20Affecting%20Firefox&product=Firefox&product=Firefox%20Build%20System&product=Firefox%20for%20Android&product=Firefox%20for%20iOS&product=GeckoView&product=NSPR&product=NSS&product=Toolkit&product=WebExtensions
is the same without count_only and returns 17 bugs.

https://bugzilla.mozilla.org/buglist.cgi?bug_type=defect&bug_severity=blocker&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&resolution=---&resolution=FIXED&resolution=INACTIVE&resolution=INCOMPLETE&resolution=SUPPORT&resolution=EXPIRED&resolution=MOVED&chfield=cf_last_resolved&chfieldfrom=-14ws&chfieldto=-1ws&product=Core&product=DevTools&product=External%20Software%20Affecting%20Firefox&product=Firefox&product=Firefox%20Build%20System&product=Firefox%20for%20Android&product=Firefox%20for%20iOS&product=GeckoView&product=NSPR&product=NSS&product=Toolkit&product=WebExtensions&list_id=14965778
is the second query in the browser and lists 18 bugs here, one of those is a restricted one.

The second and third bug count make sense because the second query lacks the restricted bug due to missing authentication.

But the first and second query should return the same count of bugs.

Also reproducible with https://bugzilla.mozilla.org/rest/bug?keywords=intermittent-failure&keywords_type=nowords&f1=status_whiteboard&o1=notsubstring&emailtype1=exact&emailassigned_to1=1&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=nobody%40mozilla.org&priority=--&component=Canvas%3A%202D&component=Canvas%3A%20WebGL&component=GFX%3A%20Color%20Management&component=Graphics&component=Graphics%3A%20Layers&component=Graphics%3A%20Text&component=Graphics%3A%20WebRender&component=Image%20Blocking&component=ImageLib&product=Core&n2=1&n7=1&o2=changedafter&o4=changedafter&j3=OR&v2=2020-01-10&v4=2020-01-04&f10=CP&o7=changedafter&v6=2020-01-04&f8=CP&j5=AND_G&o6=changedafter&v7=2020-01-10&f4=component&f3=OP&f2=component&f5=OP&f6=creation_ts&f7=creation_ts

Looks like what's happening is the standard query uses GROUP BY bugs.bug_id to remove duplicates, while count_only does not.

Using the above query, right now without the GROUP BY 3 rows are returned:

1606946 	2020-01-07 21:45:37 	UNCONFIRMED 	-- 	nobody@mozilla.org
1607059 	2020-01-07 17:41:26 	UNCONFIRMED 	-- 	nobody@mozilla.org
1607059 	2020-01-07 17:41:26 	UNCONFIRMED 	-- 	nobody@mozilla.org

Note 1607059 is returned twice.

We probably want to use COUNT(DISTINCT bugs.bug_id) AS count instead of COUNT(*) AS count for count_only queries.

Component: API → Search
Version: Staging → Production
Attached file GitHub Pull Request
Assignee: nobody → glob
Status: NEW → ASSIGNED

Merged to master.

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: