Repository navigation
Conversation
|
Please note that the test_sanity critic failure is the |
…ges from flag_activity
… drop the backfill script
…net change per request
…the user activity stats
…vity change in the bug modal
…questee is removed
…ield and the activity by product
|
Also in this push, fixed some issues and optimized SQL request:
The PR description is updated too. |
| 'INSERT INTO flag_activity | ||
| (flag_when, type_id, flag_id, setter_id, who, requestee_id, bug_id, | ||
| attachment_id, status) | ||
| SELECT modification_date, type_id, id, setter_id, setter_id, |
There was a problem hiding this comment.
flags.modification_date is nullable but flag_activity.flag_when is NOT NULL, so a single flag with a null date makes checksetup die here, maybe use COALESCE(modification_date, creation_date)
|
|
||
| my $batch_size = 10_000; | ||
| my $added = 0; | ||
| for (my $from = 0; $from < $max_id; $from += $batch_size) { |
There was a problem hiding this comment.
this walks every flag with a NOT EXISTS probe on every checksetup run, even after the backfill is done, could it be guarded so it only runs once
| # bug's last flag change in bugs_activity. Older flag changes are read from | ||
| # bugs_activity, which has them all; flag_activity has only some of them, | ||
| # written to both tables, which must not be listed twice. | ||
| sub newer_than_bugs_activity_sql { |
There was a problem hiding this comment.
this correlated subquery is re-run for each flag_activity row and scans all of the bug's bugs_activity rows (there is no (bug_id, fieldid) index), which adds up in the user activity report and the product stats, maybe compute the cutoff once per bug or add an index
| # Flag changes are in flag_activity, not bugs_activity. | ||
| $vars->{'bugs_activity'} = $dbh->selectrow_array( | ||
| 'SELECT (SELECT COUNT(*) FROM bugs_activity WHERE who = ?) | ||
| + (SELECT COUNT(*) FROM flag_activity WHERE who = ? OR setter_id = ?)', |
There was a problem hiding this comment.
flag_activity has no index on setter_id, so this OR does a full table scan on the delete confirmation page
| AND CONVERT_TZ(fsa.flag_when, 'UTC', 'America/Los_Angeles') >= ? | ||
| AND CONVERT_TZ(fsa.flag_when, 'UTC', 'America/Los_Angeles') <= ? | ||
| AND $flag_newer | ||
| AND $flag_last |
There was a problem hiding this comment.
a request that creates and clears a flag at once shows up here as an empty change, since unlike history and bugmail this report doesn't skip rows where removed equals added
Summary
Stops writing flag changes to
bugs_activity: new ones are only recorded inflag_activity, and everything that reads flag changes now reads both tables,bugs_activityfor the older changes andflag_activityfor the newer ones.Part 2 of 1806896, whose part 1 (#2657) moved
flag_state_activityto core asflag_activityand writes every flag change to both tables.Changes
Bugzilla::BugandBugzilla::Attachmentno longer logflagtypes.nametobugs_activity; the user merge ineditusers.cgiwrites its flag changes toflag_activity.flag_activity.whocolumn: the user who made the change. It differs fromsetter_idwhen a request is redirected, which keeps the original setter. Existing rows getwho = setter_id. Indexed withflag_when.flag_activityrow (flags last changed beforeflag_activitylogged every type) a row with its current state, dated at its last change, in batches of 10,000 flags. History and bugmail don't show it, but the flag's next change gets its previous state.GetBugActivity), bugmail (_get_diffs) and the BMO user activity report read theflagtypes.namerows inbugs_activity, plus theflag_activityrows newer than the bug's last one (Bugzilla::FlagActivity->newer_than_bugs_activity_sql), so changes written to both tables are listed once. A request that changes a flag several times shows its net change, compared with the flag's last row before the request.changedbefore/changedafter/changedfrom/changedto/changedby/everchangedon flags, and the ReleaseTracking report, match either table.flag_idinflag_activity.flag_activity: the non-bot last change time, the UserProfile stats, the TagNewUsers first activity, owner idle time, andchanged*searches on any field.flag_activityrows can only be deactivated, not deleted, as its history would be deleted with it. The user deletion check ineditusers.cgicountsflag_activityrows, andscripts/remove-non-public-data.plkeepswho.t/flag-activity-history.t,-search.t,-who.t,-user-stats.t,-stream.t,-start-rows.tandt/flag-type-delete.t.The old
flagtypes.namerows stay inbugs_activity, nothing is deleted.Test plan
bugs_activitygets no newflagtypes.namerowneedinfo?" and the user activity report find both older and new changeseditusers.cgi: the reassigned requests appear in bug historyReferences