Page MenuHomePhabricator

Dry-run fixOldLogEntries for AbuseFilter
Open, Needs TriagePublic

Description

This script will fix old log entries causing T208931.
It was introduced with https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/AbuseFilter/+/483101/ and will be included in 1.34/wmf.16.
Once it reaches production, I'd like to see the result of

fixOldLogEntries.php --dry-run --verbose

on all WMF wikis, then eventually run it for real.

Details

Related Gerrit Patches:
mediawiki/extensions/AbuseFilter : masterfixOldLogEntries: don't pass empty lists to Database::makeList
mediawiki/extensions/AbuseFilter : masterfixOldLogEntries: Add missing pairs of parentheses
mediawiki/extensions/AbuseFilter : masterFix more inconsistencies in scripts for logging entries
mediawiki/extensions/AbuseFilter : masterFix silly bug in fixOldLogEntries
mediawiki/extensions/AbuseFilter : masterUpdate fixOldLogEntries
mediawiki/extensions/AbuseFilter : masterFix addMissingLogEntriesScript
mediawiki/extensions/AbuseFilter : masterfixOldLogEntries: Don't print an extra line
mediawiki/extensions/AbuseFilter : masterAesthetic changes for fixOldLogEntries script

Event Timeline

Daimona created this task.Jul 22 2019, 12:37 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 22 2019, 12:37 PM
Daimona updated the task description. (Show Details)Jul 22 2019, 12:37 PM

Do we need to run it on Beta or does it get automatically run there when updating the code? Thanks.

Do we need to run it on Beta or does it get automatically run there when updating the code? Thanks.

Yeah I guess it should be executed on Beta too. Unless it runs update.php, in which case it'll happen automatically.

It runs a full scap AIUI each ten minutes or so. I guess trying a dry-run wouldn't hurt. I can try to do it and share the results later today. I cannot do it at this moment. Sorry.

@Daimona I've ran it on deploymentwiki via mwscript. So far:

maurelio@deployment-deploy01:~$ mwscript extensions/AbuseFilter/maintenance/fixOldLogEntries.php --wiki=deploymentwiki --dry-run
FixOldLogEntries: would update 51 rows out of 51 found rows.maurelio@deployment-deploy01:~$

It looks like the script needs a line break at the end so it does not make the shell prompt to go next to the script output?

It looks like the script needs a line break at the end so it does not make the shell prompt to go next to the script output?

Done in https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/AbuseFilter/+/525058/.

51 rows seems fine, although I'm unsure what rows it found. I also see wrongly imploded stuff in 2018 logs, while the original bug only affected ~2009 entries. The script will fix them all the same, I just want to be sure it doesn't happen anymore. It seems something deploymentwiki-specific and unrelated, though.

It looks like the script needs a line break at the end so it does not make the shell prompt to go next to the script output?

Done in https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/AbuseFilter/+/525058/.

Thanks. There's that phan error now blocking the patch though. Hopefully a fix can be found soon.

51 rows seems fine, although I'm unsure what rows it found. I also see wrongly imploded stuff in 2018 logs, while the original bug only affected ~2009 entries. The script will fix them all the same, I just want to be sure it doesn't happen anymore. It seems something deploymentwiki-specific and unrelated, though.

Unless the script is modified to be more verbose and say which rows are affected I'm afraid this is what we will get running the script :-) [ or if there's any way to know which are the specific rows that are affected I am not smart enough to find out which ones ]

Thanks. There's that phan error now blocking the patch though. Hopefully a fix can be found soon.

Meh, that's an HHVM super-annoying bug.

Unless the script is modified to be more verbose and say which rows are affected I'm afraid this is what we will get running the script :-) [ or if there's any way to know which are the specific rows that are affected I am not smart enough to find out which ones ]

Yeah, let me add a --verbose option to report the IDs.

Change 525058 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Aesthetic changes for fixOldLogEntries script

https://gerrit.wikimedia.org/r/525058

Change 525058 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Aesthetic changes for fixOldLogEntries script

https://gerrit.wikimedia.org/r/525058

Daimona updated the task description. (Show Details)Jul 23 2019, 7:41 PM
maurelio@deployment-deploy01:~$ mwscript extensions/AbuseFilter/maintenance/fixOldLogEntries.php --wiki=deploymentwiki --dry-run --verbose
FixOldLogEntries: would update 51 rows out of 51 rows found.
The affected log IDs are: 15735, 15736, 15737, 15738, 15739, 15740, 15741, 15742, 15743, 15744, 15745, 15746, 15747, 15748, 15749, 15750, 15751, 23864, 23865, 23866, 23867, 23868, 23869, 23870, 23871, 23872, 23873, 23874, 23875, 23876, 23877, 23878, 23879, 23880, 23881, 23882, 23883, 23884, 23885, 23886, 23887, 23888, 23889, 23890, 23891, 23892, 23893, 23894, 23895, 23896, 23897

I'll run the same foreach and paste the results.

Mentioned in SAL (#wikimedia-releng) [2019-07-24T10:54:38Z] <hauskatze> deployment-prep Dry-running extensions/AbuseFilter/maintenance/fixOldLogEntries.php refs. T228655

Mentioned in SAL (#wikimedia-cloud) [2019-07-24T10:55:02Z] <hauskatze> Dry-running extensions/AbuseFilter/maintenance/fixOldLogEntries.php refs. T228655

Voilà:

1maurelio@deployment-deploy01:~$ foreachwiki extensions/AbuseFilter/maintenance/fixOldLogEntries.php --verbose --dry-run
2-----------------------------------------------------------------
3aawiki
4-----------------------------------------------------------------
5aawiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
6aawiki: The affected log IDs are:
7-----------------------------------------------------------------
8arwiki
9-----------------------------------------------------------------
10arwiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
11arwiki: The affected log IDs are:
12-----------------------------------------------------------------
13cawiki
14-----------------------------------------------------------------
15cawiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
16cawiki: The affected log IDs are:
17-----------------------------------------------------------------
18commonswiki
19-----------------------------------------------------------------
20commonswiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
21commonswiki: The affected log IDs are:
22-----------------------------------------------------------------
23crhwiki
24-----------------------------------------------------------------
25crhwiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
26crhwiki: The affected log IDs are:
27-----------------------------------------------------------------
28deploymentwiki
29-----------------------------------------------------------------
30deploymentwiki: FixOldLogEntries: would update 51 rows out of 51 rows found.
31deploymentwiki: The affected log IDs are: 15735, 15736, 15737, 15738, 15739, 15740, 15741, 15742, 15743, 15744, 15745, 15746, 15747, 15748, 15749, 15750, 15751, 23864, 23865, 23866, 23867, 23868, 23869, 23870, 23871, 23872, 23873, 23874, 23875, 23876, 23877, 23878, 23879, 23880, 23881, 23882, 23883, 23884, 23885, 23886, 23887, 23888, 23889, 23890, 23891, 23892, 23893, 23894, 23895, 23896, 23897
32-----------------------------------------------------------------
33dewiki
34-----------------------------------------------------------------
35dewiki: FixOldLogEntries: would update 3 rows out of 3 rows found.
36dewiki: The affected log IDs are: 17682, 17683, 17684
37-----------------------------------------------------------------
38dewiktionary
39-----------------------------------------------------------------
40dewiktionary: FixOldLogEntries: would update 0 rows out of 0 rows found.
41dewiktionary: The affected log IDs are:
42-----------------------------------------------------------------
43en_rtlwiki
44-----------------------------------------------------------------
45en_rtlwiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
46en_rtlwiki: The affected log IDs are:
47-----------------------------------------------------------------
48enwiki
49-----------------------------------------------------------------
50enwiki: FixOldLogEntries: would update 8 rows out of 8 rows found.
51enwiki: The affected log IDs are: 130871, 130872, 134816, 134817, 134818, 134819, 134820, 134821
52-----------------------------------------------------------------
53enwikibooks
54-----------------------------------------------------------------
55enwikibooks: FixOldLogEntries: would update 0 rows out of 0 rows found.
56enwikibooks: The affected log IDs are:
57-----------------------------------------------------------------
58enwikinews
59-----------------------------------------------------------------
60enwikinews: FixOldLogEntries: would update 0 rows out of 0 rows found.
61enwikinews: The affected log IDs are:
62-----------------------------------------------------------------
63enwikiquote
64-----------------------------------------------------------------
65enwikiquote: FixOldLogEntries: would update 0 rows out of 0 rows found.
66enwikiquote: The affected log IDs are:
67-----------------------------------------------------------------
68enwikisource
69-----------------------------------------------------------------
70enwikisource: FixOldLogEntries: would update 0 rows out of 0 rows found.
71enwikisource: The affected log IDs are:
72-----------------------------------------------------------------
73enwikiversity
74-----------------------------------------------------------------
75enwikiversity: FixOldLogEntries: would update 0 rows out of 0 rows found.
76enwikiversity: The affected log IDs are:
77-----------------------------------------------------------------
78enwikivoyage
79-----------------------------------------------------------------
80enwikivoyage: FixOldLogEntries: would update 0 rows out of 0 rows found.
81enwikivoyage: The affected log IDs are:
82-----------------------------------------------------------------
83enwiktionary
84-----------------------------------------------------------------
85enwiktionary: FixOldLogEntries: would update 0 rows out of 0 rows found.
86enwiktionary: The affected log IDs are:
87-----------------------------------------------------------------
88eowiki
89-----------------------------------------------------------------
90eowiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
91eowiki: The affected log IDs are:
92-----------------------------------------------------------------
93eswiki
94-----------------------------------------------------------------
95eswiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
96eswiki: The affected log IDs are:
97-----------------------------------------------------------------
98eswikibooks
99-----------------------------------------------------------------
100eswikibooks: FixOldLogEntries: would update 0 rows out of 0 rows found.
101eswikibooks: The affected log IDs are:
102-----------------------------------------------------------------
103fawiki
104-----------------------------------------------------------------
105fawiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
106fawiki: The affected log IDs are:
107-----------------------------------------------------------------
108hewiki
109-----------------------------------------------------------------
110hewiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
111hewiki: The affected log IDs are:
112-----------------------------------------------------------------
113hewiktionary
114-----------------------------------------------------------------
115hewiktionary: FixOldLogEntries: would update 0 rows out of 0 rows found.
116hewiktionary: The affected log IDs are:
117-----------------------------------------------------------------
118hiwiki
119-----------------------------------------------------------------
120hiwiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
121hiwiki: The affected log IDs are:
122-----------------------------------------------------------------
123jawiki
124-----------------------------------------------------------------
125jawiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
126jawiki: The affected log IDs are:
127-----------------------------------------------------------------
128kowiki
129-----------------------------------------------------------------
130kowiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
131kowiki: The affected log IDs are:
132-----------------------------------------------------------------
133loginwiki
134-----------------------------------------------------------------
135loginwiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
136loginwiki: The affected log IDs are:
137-----------------------------------------------------------------
138metawiki
139-----------------------------------------------------------------
140metawiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
141metawiki: The affected log IDs are:
142-----------------------------------------------------------------
143nlwiki
144-----------------------------------------------------------------
145nlwiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
146nlwiki: The affected log IDs are:
147-----------------------------------------------------------------
148ruwiki
149-----------------------------------------------------------------
150ruwiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
151ruwiki: The affected log IDs are:
152-----------------------------------------------------------------
153simplewiki
154-----------------------------------------------------------------
155simplewiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
156simplewiki: The affected log IDs are:
157-----------------------------------------------------------------
158sqwiki
159-----------------------------------------------------------------
160sqwiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
161sqwiki: The affected log IDs are:
162-----------------------------------------------------------------
163srwiki
164-----------------------------------------------------------------
165srwiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
166srwiki: The affected log IDs are:
167-----------------------------------------------------------------
168svwiki
169-----------------------------------------------------------------
170svwiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
171svwiki: The affected log IDs are:
172-----------------------------------------------------------------
173testwiki
174-----------------------------------------------------------------
175testwiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
176testwiki: The affected log IDs are:
177-----------------------------------------------------------------
178ukwiki
179-----------------------------------------------------------------
180ukwiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
181ukwiki: The affected log IDs are:
182-----------------------------------------------------------------
183wikidatawiki
184-----------------------------------------------------------------
185wikidatawiki: FixOldLogEntries: would update 0 rows out of 0 rows found.
186wikidatawiki: The affected log IDs are:
187-----------------------------------------------------------------
188zhwiki
189-----------------------------------------------------------------
190zhwiki: FixOldLogEntries: would update 35 rows out of 35 rows found.
191zhwiki: The affected log IDs are: 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 3037, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048, 3049
192-----------------------------------------------------------------
193zhwikivoyage
194-----------------------------------------------------------------
195zhwikivoyage: FixOldLogEntries: would update 0 rows out of 0 rows found.
196zhwikivoyage: The affected log IDs are:
197maurelio@deployment-deploy01:~$

@MarcoAurelio Thanks! Now I'm going to upload another patch to remove that extra "The affected log IDs are" line when there are no affected rows, to improve readability. Then I'll check the ones reported above. However, if there are other faulty rows from 2018, they should probably be handled separately by the script, as they seem to be duplicates with wrong parameters.

Change 525255 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] fixOldLogEntries: Don't print an extra line

https://gerrit.wikimedia.org/r/525255

Daimona changed the task status from Open to Stalled.Jul 24 2019, 11:39 AM

OK, so first of all, it's not so easy to see the affected rows, because it's not possible to query the logs filtering by log_id (not even with the APIs, AFAICS), and I currently cannot ssh to run the query on the DB. But I could still find most of them via API + ctrl-f. All of the affected rows on beta cluster are from 2017 or later, as I was saying above. So we have to fix them separately.

What happened is, somehow a duplicated rows was inserted with legacy parameters. For instance, this is from enwiki:

{
                "logid": 127865,
                "ns": -1,
                "title": "Special:AbuseFilter/461",
                "pageid": 0,
                "logpage": 0,
                "params": {
                    "historyId": 76,
                    "newId": "461"
                },
                "type": "abusefilter",
                "action": "modify",
                "user": "Etonkovidova",
                "timestamp": "2017-09-29T19:37:35Z",
                "comment": ""
}

And this entry is correct, see the historyId and newId params. However, right before that one we have:

{
                "logid": 130871,
                "ns": -1,
                "title": "Special:AbuseFilter/461",
                "pageid": 0,
                "logpage": 0,
                "params": {
                    "0": "76\\n461"
                },
                "type": "abusefilter",
                "action": "modify",
                "user": "Etonkovidova",
                "timestamp": "2017-09-29T19:37:34Z",
                "comment": ""
}

With params having the legacy format (single key, \n-imploded).

This bug seems now resolved, but I'm unsure about the cause. It could be internal to AF, or even withing core's logging system. I have to investigate this bug first, determine what caused it, whether it's really fixed now, and then handle it separately within the script, probably by removing the duplicated row altogether. Or at least make it use new-style params, although that will leave duplicated rows in place.

Note that the results above are not from production but from the beta cluster. I though I shall make it clearer again just in case numbers don't match. Thanks.

Note that the results above are not from production but from the beta cluster. I though I shall make it clearer again just in case numbers don't match. Thanks.

Yeah, I know. However, I believe we'll find the same bug in production. I couldn't find anything suspicious in 2017 code for AF logging, so I'll probably have to test this locally.

Change 525255 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] fixOldLogEntries: Don't print an extra line

https://gerrit.wikimedia.org/r/525255

Daimona changed the task status from Stalled to Open.Aug 11 2019, 3:37 PM

So, I did some tests. First of all, I cannot reproduce this locally. TBH, I didn't spend much time testing: I just pulled this AF version and used that with MW master, so it's not surprising. I ran the following:

MariaDB [deploymentwiki]> select * from logging where log_type = 'abusefilter' and log_params like '%\\\\n%' order by log_id desc limit 20;
+--------+-------------+------------+----------------+----------+----------------+-----------+---------------+----------------+----------+----------------+------------+-------------+
| log_id | log_type    | log_action | log_timestamp  | log_user | log_user_text  | log_actor | log_namespace | log_title      | log_page | log_comment_id | log_params | log_deleted |
+--------+-------------+------------+----------------+----------+----------------+-----------+---------------+----------------+----------+----------------+------------+-------------+
|  23897 | abusefilter | modify     | 20180909084319 |     4103 | Daimona Eaytoy |         2 |            -1 | AbuseFilter/28 |     NULL |              1 | 243\n28    |           0 |
|  23896 | abusefilter | modify     | 20180826174948 |     4103 | Daimona Eaytoy |         2 |            -1 | AbuseFilter/28 |     NULL |              1 | 242\n28    |           0 |
|  23895 | abusefilter | modify     | 20180819165232 |     4103 | Daimona Eaytoy |         2 |            -1 | AbuseFilter/28 |     NULL |              1 | 241\n28    |           0 |
|  23894 | abusefilter | modify     | 20180729140353 |     4103 | Daimona Eaytoy |         2 |            -1 | AbuseFilter/28 |     NULL |              1 | 240\n28    |           0 |
|  23893 | abusefilter | modify     | 20180728163107 |     4103 | Daimona Eaytoy |         2 |            -1 | AbuseFilter/28 |     NULL |              1 | 239\n28    |           0 |
|  23892 | abusefilter | modify     | 20180728163046 |     4103 | Daimona Eaytoy |         2 |            -1 | AbuseFilter/28 |     NULL |              1 | 238\n28    |           0 |
|  23891 | abusefilter | modify     | 20180728130620 |     4103 | Daimona Eaytoy |         2 |            -1 | AbuseFilter/28 |     NULL |              1 | 237\n28    |           0 |
|  23890 | abusefilter | modify     | 20180713021108 |     1047 | MusikAnimal    |         3 |            -1 | AbuseFilter/13 |     NULL |              1 | 236\n13    |           0 |
|  23889 | abusefilter | modify     | 20180711112610 |     4103 | Daimona Eaytoy |         2 |            -1 | AbuseFilter/28 |     NULL |              1 | 235\n28    |           0 |
|  23888 | abusefilter | modify     | 20180628201351 |     4103 | Daimona Eaytoy |         2 |            -1 | AbuseFilter/28 |     NULL |              1 | 234\n28    |           0 |
|  23887 | abusefilter | modify     | 20180609091118 |     4103 | Daimona Eaytoy |         2 |            -1 | AbuseFilter/28 |     NULL |              1 | 233\n28    |           0 |
|  23886 | abusefilter | modify     | 20180609090944 |     4103 | Daimona Eaytoy |         2 |            -1 | AbuseFilter/28 |     NULL |              1 | 232\n28    |           0 |
|  23885 | abusefilter | modify     | 20180609090842 |     4103 | Daimona Eaytoy |         2 |            -1 | AbuseFilter/28 |     NULL |              1 | 231\n28    |           0 |
|  23884 | abusefilter | modify     | 20180604162920 |     4103 | Daimona Eaytoy |         2 |            -1 | AbuseFilter/30 |     NULL |              1 | 230\n30    |           0 |
|  23883 | abusefilter | modify     | 20180527132928 |     4103 | Daimona Eaytoy |         2 |            -1 | AbuseFilter/30 |     NULL |              1 | 229\n30    |           0 |
|  23882 | abusefilter | modify     | 20180525124326 |     4103 | Daimona Eaytoy |         2 |            -1 | AbuseFilter/29 |     NULL |              1 | 228\n29    |           0 |
|  23881 | abusefilter | modify     | 20180525124219 |     4103 | Daimona Eaytoy |         2 |            -1 | AbuseFilter/29 |     NULL |              1 | 227\n29    |           0 |
|  23880 | abusefilter | modify     | 20180525124041 |     4103 | Daimona Eaytoy |         2 |            -1 | AbuseFilter/28 |     NULL |              1 | 226\n28    |           0 |
|  23879 | abusefilter | modify     | 20180525124029 |     4103 | Daimona Eaytoy |         2 |            -1 | AbuseFilter/28 |     NULL |              1 | 225\n28    |           0 |
|  23878 | abusefilter | modify     | 20180525122647 |     4103 | Daimona Eaytoy |         2 |            -1 | AbuseFilter/29 |     NULL |              1 | 224\n29    |           0 |
+--------+-------------+------------+----------------+----------+----------------+-----------+---------------+----------------+----------+----------------+------------+-------------+

Apparently, we constantly got a faulty line every time a filter was modified, until 2018-09-09. The next edit was on October 19th, so we have a ~40 days interval in which something fixed the error. It's also very weird that on production enwiki this error did not happen: entries from <2010 are the one that I meant to target with the script.


OK, so I realized what's wrong after writing the rant above (as usual). The problem lies in the addMissingLoggingEntries script (created for T54919), which adds new row using '\n' (single quotes) as separator. Depending on whether/when/where the script was executed, it's obvious that we got different results. The script also had other newline problems at its introduction, but they were fixed (although it's unclear whether any row was modified in the meanwhile).
Looking at the times I wrote in T208931#4865248, and at how I couldn't find an explanation, I now believe that the addMissingLoggingEntries script has always been the cause of this problem, for both ~2009 and ~2018 entries.

Given the amount of factors involved, some unclear points (e.g. when the script was executed and where, whether it touched any rows before newlines were fixed etc.), and the complexity of understanding something happened many years ago, I think we can avoid searching a complete explanation.
The only thing I'd like to understand is why we have 2018-08 entries on beta, since AFAICS @MarcoAurelio ran the script in February (T54919#3964726).

But anyway, given that (apparently) it's still the same problem happened in different time periods, I'm just going to write this in a comment inside the script, and then we can move on.

Oh, and of course I'm going to fix the broken script. Also, note that the script doesn't extend LoggedUpdateMaintenance, which means that it can be ran as many times as you wish.
When we switched log entries from legacy (comma-imploded numbers) to the new format (serialized array), the script stopped recognizing them, and thus it thought the rows were missing, and began to create duplicates as noted in T228655#5360754. I'm also going to fix that in the new script (removing duplicated rows).

Change 529608 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Fix addMissingLogEntriesScript

https://gerrit.wikimedia.org/r/529608

Change 529609 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Update fixOldLogEntries

https://gerrit.wikimedia.org/r/529609

Daimona changed the task status from Open to Stalled.Aug 11 2019, 4:50 PM

Back to stalled, we need both the patches above to be merged, and then I'd like to see a dry-run of the other script, so that we can add it to update.php (I'll create a separate task), and then we can resume.

The only thing I'd like to understand is why we have 2018-08 entries on beta, since AFAICS @MarcoAurelio ran the script in February (T54919#3964726).

The only possible explanation is that someone re-ran the script after that date:

MariaDB [deploymentwiki]> select * from logging where log_type = 'abusefilter' and log_params like '%243%';
+--------+-------------+------------+----------------+----------+----------------+-----------+---------------+----------------+----------+----------------+---------------------------------------------------+-------------+
| log_id | log_type    | log_action | log_timestamp  | log_user | log_user_text  | log_actor | log_namespace | log_title      | log_page | log_comment_id | log_params                                        | log_deleted |
+--------+-------------+------------+----------------+----------+----------------+-----------+---------------+----------------+----------+----------------+---------------------------------------------------+-------------+
|  23847 | abusefilter | modify     | 20180909084319 |     4103 | Daimona Eaytoy |         2 |            -1 | AbuseFilter/28 |        0 |              1 | a:2:{s:9:"historyId";i:243;s:5:"newId";s:2:"28";} |           0 |
|  23897 | abusefilter | modify     | 20180909084319 |     4103 | Daimona Eaytoy |         2 |            -1 | AbuseFilter/28 |     NULL |              1 | 243\n28                                           |           0 |
+--------+-------------+------------+----------------+----------+----------------+-----------+---------------+----------------+----------+----------------+---------------------------------------------------+-------------+

Shows that the last entry in T228655#5408181 (and probably the others, too) is a duplicate. And in fact,

MariaDB [deploymentwiki]> select log_id, log_type, log_timestamp, IF(log_type='abusefilter',log_params,'[useless]') as log_params from logging where log_id BETWEEN 23847 AND 23897;
+--------+---------------+----------------+---------------------------------------------------+
| log_id | log_type      | log_timestamp  | log_params                                        |
+--------+---------------+----------------+---------------------------------------------------+
|  23847 | abusefilter   | 20180909084319 | a:2:{s:9:"historyId";i:243;s:5:"newId";s:2:"28";} |
|  23848 | newusers      | 20180909133412 | [useless]                                         |
|  23849 | newusers      | 20180909133547 | [useless]                                         |
|  23850 | newusers      | 20180909133715 | [useless]                                         |
|  23851 | newusers      | 20180909135605 | [useless]                                         |
|  23852 | newusers      | 20180909142257 | [useless]                                         |
|  23853 | newusers      | 20180909194030 | [useless]                                         |
|  23854 | spamblacklist | 20180909195116 | [useless]                                         |
|  23855 | newusers      | 20180910145059 | [useless]                                         |
|  23856 | newusers      | 20180910192402 | [useless]                                         |
|  23857 | newusers      | 20180911022346 | [useless]                                         |
|  23858 | newusers      | 20180911073236 | [useless]                                         |
|  23859 | newusers      | 20180912044451 | [useless]                                         |
|  23860 | newusers      | 20180912101612 | [useless]                                         |
|  23861 | newusers      | 20180912185119 | [useless]                                         |
|  23862 | newusers      | 20180912195519 | [useless]                                         |
|  23863 | newusers      | 20180915043546 | [useless]                                         |
|  23864 | abusefilter   | 20180318000558 | 210\n14                                           |
|  23865 | abusefilter   | 20180330102928 | 211\n22                                           |
|  23866 | abusefilter   | 20180330102953 | 212\n22                                           |
|  23867 | abusefilter   | 20180330120433 | 213\n28                                           |
|  23868 | abusefilter   | 20180408141500 | 214\n28                                           |
|  23869 | abusefilter   | 20180424070300 | 215\n28                                           |
|  23870 | abusefilter   | 20180424070323 | 216\n28                                           |
|  23871 | abusefilter   | 20180424070349 | 217\n28                                           |
|  23872 | abusefilter   | 20180424070405 | 218\n28                                           |
|  23873 | abusefilter   | 20180427062538 | 219\n28                                           |
|  23874 | abusefilter   | 20180427062547 | 220\n28                                           |
|  23875 | abusefilter   | 20180428150250 | 221\n28                                           |
|  23876 | abusefilter   | 20180504205626 | 222\n28                                           |
|  23877 | abusefilter   | 20180504205642 | 223\n28                                           |
|  23878 | abusefilter   | 20180525122647 | 224\n29                                           |
|  23879 | abusefilter   | 20180525124029 | 225\n28                                           |
|  23880 | abusefilter   | 20180525124041 | 226\n28                                           |
|  23881 | abusefilter   | 20180525124219 | 227\n29                                           |
|  23882 | abusefilter   | 20180525124326 | 228\n29                                           |
|  23883 | abusefilter   | 20180527132928 | 229\n30                                           |
|  23884 | abusefilter   | 20180604162920 | 230\n30                                           |
|  23885 | abusefilter   | 20180609090842 | 231\n28                                           |
|  23886 | abusefilter   | 20180609090944 | 232\n28                                           |
|  23887 | abusefilter   | 20180609091118 | 233\n28                                           |
|  23888 | abusefilter   | 20180628201351 | 234\n28                                           |
|  23889 | abusefilter   | 20180711112610 | 235\n28                                           |
|  23890 | abusefilter   | 20180713021108 | 236\n13                                           |
|  23891 | abusefilter   | 20180728130620 | 237\n28                                           |
|  23892 | abusefilter   | 20180728163046 | 238\n28                                           |
|  23893 | abusefilter   | 20180728163107 | 239\n28                                           |
|  23894 | abusefilter   | 20180729140353 | 240\n28                                           |
|  23895 | abusefilter   | 20180819165232 | 241\n28                                           |
|  23896 | abusefilter   | 20180826174948 | 242\n28                                           |
|  23897 | abusefilter   | 20180909084319 | 243\n28                                           |
+--------+---------------+----------------+---------------------------------------------------+

The entry 23847 (the original one) is from 2018-09-09, the entry 23863 is from 2018-09-15 but the next one, 23864, is from 2018-03-18, i.e. 6 months before. This means that someone re-ran the script after September 15th 2018 (we could find the exact date by looking at the next entries, but I'm too lazy). Now everything is clear.

Change 529608 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Fix addMissingLogEntriesScript

https://gerrit.wikimedia.org/r/529608

Change 529609 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Update fixOldLogEntries

https://gerrit.wikimedia.org/r/529609

Daimona changed the task status from Stalled to Open.Dec 3 2019, 6:31 PM

Unstalling, the script can now be executed again, with --dry-run --verbose on a small wiki (or the beta cluster).

Change 558028 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Fix silly bug in fixOldLogEntries

https://gerrit.wikimedia.org/r/558028

Change 558028 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Fix silly bug in fixOldLogEntries

https://gerrit.wikimedia.org/r/558028

Results for beta:

1daimona@deployment-deploy01:/srv/mediawiki/php-master$ foreachwiki extensions/AbuseFilter/maintenance/fixOldLogEntries.php --verbose --dry-run
2-----------------------------------------------------------------
3aawiki
4-----------------------------------------------------------------
5aawiki: FixOldLogEntries would delete 0 rows.
6aawiki: FixOldLogEntries would update 0 rows.
7-----------------------------------------------------------------
8arwiki
9-----------------------------------------------------------------
10arwiki: FixOldLogEntries would delete 0 rows.
11arwiki: FixOldLogEntries would update 0 rows.
12-----------------------------------------------------------------
13cawiki
14-----------------------------------------------------------------
15cawiki: FixOldLogEntries would delete 0 rows.
16cawiki: FixOldLogEntries would update 0 rows.
17-----------------------------------------------------------------
18commonswiki
19-----------------------------------------------------------------
20commonswiki: FixOldLogEntries would delete 0 rows.
21commonswiki: FixOldLogEntries would update 0 rows.
22-----------------------------------------------------------------
23crhwiki
24-----------------------------------------------------------------
25crhwiki: FixOldLogEntries would delete 0 rows.
26crhwiki: FixOldLogEntries would update 0 rows.
27-----------------------------------------------------------------
28cswiki
29-----------------------------------------------------------------
30cswiki: FixOldLogEntries would delete 0 rows.
31cswiki: FixOldLogEntries would update 0 rows.
32-----------------------------------------------------------------
33deploymentwiki
34-----------------------------------------------------------------
35deploymentwiki: FixOldLogEntries would delete 51 rows.
36deploymentwiki: The affected log_id's are: 15735, 15736, 15737, 15738, 15739, 15740, 15741, 15742, 15743, 15744, 15745, 15746, 15747, 15748, 15749, 15750, 15751, 23864, 23865, 23866, 23867, 23868, 23869, 23870, 23871, 23872, 23873, 23874, 23875, 23876, 23877, 23878, 23879, 23880, 23881, 23882, 23883, 23884, 23885, 23886, 23887, 23888, 23889, 23890, 23891, 23892, 23893, 23894, 23895, 23896, 23897
37deploymentwiki: FixOldLogEntries would update 51 rows.
38deploymentwiki: The affected log_id's are: 15735, 15736, 15737, 15738, 15739, 15740, 15741, 15742, 15743, 15744, 15745, 15746, 15747, 15748, 15749, 15750, 15751, 23864, 23865, 23866, 23867, 23868, 23869, 23870, 23871, 23872, 23873, 23874, 23875, 23876, 23877, 23878, 23879, 23880, 23881, 23882, 23883, 23884, 23885, 23886, 23887, 23888, 23889, 23890, 23891, 23892, 23893, 23894, 23895, 23896, 23897
39-----------------------------------------------------------------
40dewiki
41-----------------------------------------------------------------
42dewiki: FixOldLogEntries would delete 3 rows.
43dewiki: The affected log_id's are: 17682, 17683, 17684
44dewiki: FixOldLogEntries would update 3 rows.
45dewiki: The affected log_id's are: 17682, 17683, 17684
46-----------------------------------------------------------------
47dewiktionary
48-----------------------------------------------------------------
49dewiktionary: FixOldLogEntries would delete 0 rows.
50dewiktionary: FixOldLogEntries would update 0 rows.
51-----------------------------------------------------------------
52en_rtlwiki
53-----------------------------------------------------------------
54en_rtlwiki: FixOldLogEntries would delete 0 rows.
55en_rtlwiki: FixOldLogEntries would update 0 rows.
56-----------------------------------------------------------------
57enwiki
58-----------------------------------------------------------------
59enwiki: FixOldLogEntries would delete 8 rows.
60enwiki: The affected log_id's are: 130871, 130872, 134816, 134817, 134818, 134819, 134820, 134821
61enwiki: FixOldLogEntries would update 8 rows.
62enwiki: The affected log_id's are: 130871, 130872, 134816, 134817, 134818, 134819, 134820, 134821
63-----------------------------------------------------------------
64enwikibooks
65-----------------------------------------------------------------
66enwikibooks: FixOldLogEntries would delete 0 rows.
67enwikibooks: FixOldLogEntries would update 0 rows.
68-----------------------------------------------------------------
69enwikinews
70-----------------------------------------------------------------
71enwikinews: FixOldLogEntries would delete 0 rows.
72enwikinews: FixOldLogEntries would update 0 rows.
73-----------------------------------------------------------------
74enwikiquote
75-----------------------------------------------------------------
76enwikiquote: FixOldLogEntries would delete 0 rows.
77enwikiquote: FixOldLogEntries would update 0 rows.
78-----------------------------------------------------------------
79enwikisource
80-----------------------------------------------------------------
81enwikisource: FixOldLogEntries would delete 0 rows.
82enwikisource: FixOldLogEntries would update 0 rows.
83-----------------------------------------------------------------
84enwikiversity
85-----------------------------------------------------------------
86enwikiversity: FixOldLogEntries would delete 0 rows.
87enwikiversity: FixOldLogEntries would update 0 rows.
88-----------------------------------------------------------------
89enwikivoyage
90-----------------------------------------------------------------
91enwikivoyage: FixOldLogEntries would delete 0 rows.
92enwikivoyage: FixOldLogEntries would update 0 rows.
93-----------------------------------------------------------------
94enwiktionary
95-----------------------------------------------------------------
96enwiktionary: FixOldLogEntries would delete 0 rows.
97enwiktionary: FixOldLogEntries would update 0 rows.
98-----------------------------------------------------------------
99eowiki
100-----------------------------------------------------------------
101eowiki: FixOldLogEntries would delete 0 rows.
102eowiki: FixOldLogEntries would update 0 rows.
103-----------------------------------------------------------------
104eswiki
105-----------------------------------------------------------------
106eswiki: FixOldLogEntries would delete 0 rows.
107eswiki: FixOldLogEntries would update 0 rows.
108-----------------------------------------------------------------
109eswikibooks
110-----------------------------------------------------------------
111eswikibooks: FixOldLogEntries would delete 0 rows.
112eswikibooks: FixOldLogEntries would update 0 rows.
113-----------------------------------------------------------------
114fawiki
115-----------------------------------------------------------------
116fawiki: FixOldLogEntries would delete 0 rows.
117fawiki: FixOldLogEntries would update 0 rows.
118-----------------------------------------------------------------
119hewiki
120-----------------------------------------------------------------
121hewiki: FixOldLogEntries would delete 0 rows.
122hewiki: FixOldLogEntries would update 0 rows.
123-----------------------------------------------------------------
124hewiktionary
125-----------------------------------------------------------------
126hewiktionary: FixOldLogEntries would delete 0 rows.
127hewiktionary: FixOldLogEntries would update 0 rows.
128-----------------------------------------------------------------
129hiwiki
130-----------------------------------------------------------------
131hiwiki: FixOldLogEntries would delete 0 rows.
132hiwiki: FixOldLogEntries would update 0 rows.
133-----------------------------------------------------------------
134jawiki
135-----------------------------------------------------------------
136jawiki: FixOldLogEntries would delete 0 rows.
137jawiki: FixOldLogEntries would update 0 rows.
138-----------------------------------------------------------------
139kowiki
140-----------------------------------------------------------------
141kowiki: FixOldLogEntries would delete 0 rows.
142kowiki: FixOldLogEntries would update 0 rows.
143-----------------------------------------------------------------
144loginwiki
145-----------------------------------------------------------------
146loginwiki: FixOldLogEntries would delete 0 rows.
147loginwiki: FixOldLogEntries would update 0 rows.
148-----------------------------------------------------------------
149metawiki
150-----------------------------------------------------------------
151metawiki: FixOldLogEntries would delete 0 rows.
152metawiki: FixOldLogEntries would update 0 rows.
153-----------------------------------------------------------------
154nlwiki
155-----------------------------------------------------------------
156nlwiki: FixOldLogEntries would delete 0 rows.
157nlwiki: FixOldLogEntries would update 0 rows.
158-----------------------------------------------------------------
159ruwiki
160-----------------------------------------------------------------
161ruwiki: FixOldLogEntries would delete 0 rows.
162ruwiki: FixOldLogEntries would update 0 rows.
163-----------------------------------------------------------------
164simplewiki
165-----------------------------------------------------------------
166simplewiki: FixOldLogEntries would delete 0 rows.
167simplewiki: FixOldLogEntries would update 0 rows.
168-----------------------------------------------------------------
169sqwiki
170-----------------------------------------------------------------
171sqwiki: FixOldLogEntries would delete 0 rows.
172sqwiki: FixOldLogEntries would update 0 rows.
173-----------------------------------------------------------------
174srwiki
175-----------------------------------------------------------------
176srwiki: FixOldLogEntries would delete 0 rows.
177srwiki: FixOldLogEntries would update 0 rows.
178-----------------------------------------------------------------
179svwiki
180-----------------------------------------------------------------
181svwiki: FixOldLogEntries would delete 0 rows.
182svwiki: FixOldLogEntries would update 0 rows.
183-----------------------------------------------------------------
184testwiki
185-----------------------------------------------------------------
186testwiki: FixOldLogEntries would delete 0 rows.
187testwiki: FixOldLogEntries would update 0 rows.
188-----------------------------------------------------------------
189ukwiki
190-----------------------------------------------------------------
191ukwiki: FixOldLogEntries would delete 0 rows.
192ukwiki: FixOldLogEntries would update 0 rows.
193-----------------------------------------------------------------
194wikidatawiki
195-----------------------------------------------------------------
196wikidatawiki: FixOldLogEntries would delete 0 rows.
197wikidatawiki: FixOldLogEntries would update 0 rows.
198-----------------------------------------------------------------
199zhwiki
200-----------------------------------------------------------------
201zhwiki: FixOldLogEntries would delete 35 rows.
202zhwiki: The affected log_id's are: 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 3037, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048, 3049
203zhwiki: FixOldLogEntries would update 35 rows.
204zhwiki: The affected log_id's are: 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 3037, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048, 3049
205-----------------------------------------------------------------
206zhwikivoyage
207-----------------------------------------------------------------
208zhwikivoyage: FixOldLogEntries would delete 0 rows.
209zhwikivoyage: FixOldLogEntries would update 0 rows.

Now, I'm probably going to examine the results (as I did above), then run on beta-enwiki, then the other two wikis. If everything's fine, we can move on to production.

Change 559150 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Fix more inconsistencies in scripts for logging entries

https://gerrit.wikimedia.org/r/559150

Daimona changed the task status from Open to Stalled.Dec 18 2019, 5:55 PM

And back to stalled until the patch above is merged. The result seems correct for beta enwiki, but there are other issues.

Daimona moved this task from Backlog to Under review on the User-Daimona board.

Change 559150 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Fix more inconsistencies in scripts for logging entries

https://gerrit.wikimedia.org/r/559150

Daimona changed the task status from Stalled to Open.Sat, Feb 8, 2:08 PM

The bad luck isn't ending:

daimona@deployment-deploy01:/srv/mediawiki/php-master$ mwscript extensions/AbuseFilter/maintenance/fixOldLogEntries.php --wiki=deploymentwiki --dry-run --verbose
FixOldLogEntries would delete 51 rows.
The affected log_id's are: 15735, 15736, 15737, 15738, 15739, 15740, 15741, 15742, 15743, 15744, 15745, 15746, 15747, 15748, 15749, 15750, 15751, 23864, 23865, 23866, 23867, 23868, 23869, 23870, 23871, 23872, 23873, 23874, 23875, 23876, 23877, 23878, 23879, 23880, 23881, 23882, 23883, 23884, 23885, 23886, 23887, 23888, 23889, 23890, 23891, 23892, 23893, 23894, 23895, 23896, 23897
Wikimedia\Rdbms\DBQueryError from line 1626 of /srv/mediawiki-staging/php-master/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?
Query: SELECT  log_id AS `value`  FROM `logging`    WHERE log_type = 'abusefilter' AND (log_params  LIKE '%\\n%' ESCAPE '`' ) AND (log_id >= 1) AND (log_id <= 500) AND (log_id NOT IN '15735','15736','15737','15738','15739','15740','15741','15742','15743','15744','15745','15746','15747','15748','15749','15750','15751','23864','23865','23866','23867','23868','23869','23870','23871','23872','23873','23874','23875','23876','23877','23878','23879','23880','23881','23882','23883','23884','23885','23886','23887','23888','23889','23890','23891','23892','23893','23894','23895','23896','23897')
Function: FixOldLogEntries::changeNewlineType
Error: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''15735','15736','15737','15738','15739','15740','15741','15742','15743','15744',' at line 1 (172.16.4.147:3306)

#0 /srv/mediawiki-staging/php-master/includes/libs/rdbms/database/Database.php(1610): Wikimedia\Rdbms\Database->getQueryException('You have an err...', 1064, 'SELECT  log_id ...', 'FixOldLogEntrie...')
#1 /srv/mediawiki-staging/php-master/includes/libs/rdbms/database/Database.php(1587): Wikimedia\Rdbms\Database->getQueryExceptionAndLog('You have an err...', 1064, 'SELECT  log_id ...', 'FixOldLogEntrie...')
#2 /srv/mediawiki-staging/php-master/includes/libs/rdbms/database/Database.php(1166): Wikimedia\Rdbms\Database->reportQueryError('You have an err...', 1064, 'SELECT  log_id ...', 'FixOldLogEntrie...', false)
#3 /srv/mediawiki-staging/php-master/includes/libs/rdbms/database/Database.php(1828): Wikimedia\Rdbms\Database->query('SELECT  log_id ...', 'FixOldLogEntrie...')
#4 /srv/mediawiki-staging/php-master/includes/libs/rdbms/database/Database.php(1691): Wikimedia\Rdbms\Database->select('logging', Array, Array, 'FixOldLogEntrie...', Array, Array)
#5 /srv/mediawiki-staging/php-master/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->selectFieldValues('logging', 'log_id', Array, 'FixOldLogEntrie...')
#6 /srv/mediawiki-staging/php-master/includes/libs/rdbms/database/DBConnRef.php(311): Wikimedia\Rdbms\DBConnRef->__call('selectFieldValu...', Array)
#7 /srv/mediawiki-staging/php-master/extensions/AbuseFilter/maintenance/fixOldLogEntries.php(160): Wikimedia\Rdbms\DBConnRef->selectFieldValues('logging', 'log_id', Array, 'FixOldLogEntrie...')
#8 /srv/mediawiki-staging/php-master/extensions/AbuseFilter/maintenance/fixOldLogEntries.php(260): FixOldLogEntries->changeNewlineType(Array)
#9 /srv/mediawiki-staging/php-master/maintenance/Maintenance.php(1759): FixOldLogEntries->doDBUpdates()
#10 /srv/mediawiki-staging/php-master/maintenance/doMaintenance.php(99): LoggedUpdateMaintenance->execute()
#11 /srv/mediawiki-staging/php-master/extensions/AbuseFilter/maintenance/fixOldLogEntries.php(285): require_once('/srv/mediawiki-...')
#12 /srv/mediawiki-staging/multiversion/MWScript.php(101): require_once('/srv/mediawiki-...')
#13 {main}

Easy fix coming.

Change 570997 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] fixOldLogEntries: Add missing pairs of parentheses

https://gerrit.wikimedia.org/r/570997

Change 570997 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] fixOldLogEntries: Add missing pairs of parentheses

https://gerrit.wikimedia.org/r/570997

Aye!

1daimona@deployment-deploy01:/srv/mediawiki/php-master$ foreachwiki extensions/AbuseFilter/maintenance/fixOldLogEntries.php --dry-run --verbose
2-----------------------------------------------------------------
3aawiki
4-----------------------------------------------------------------
5aawiki: FixOldLogEntries would delete 0 rows.
6aawiki: FixOldLogEntries would update newlines for 0 rows.
7aawiki: FixOldLogEntries would update fields for 0 rows.
8-----------------------------------------------------------------
9arwiki
10-----------------------------------------------------------------
11arwiki: FixOldLogEntries would delete 0 rows.
12arwiki: FixOldLogEntries would update newlines for 0 rows.
13arwiki: FixOldLogEntries would update fields for 0 rows.
14-----------------------------------------------------------------
15cawiki
16-----------------------------------------------------------------
17cawiki: FixOldLogEntries would delete 0 rows.
18cawiki: FixOldLogEntries would update newlines for 0 rows.
19cawiki: FixOldLogEntries would update fields for 0 rows.
20-----------------------------------------------------------------
21commonswiki
22-----------------------------------------------------------------
23commonswiki: FixOldLogEntries would delete 0 rows.
24commonswiki: FixOldLogEntries would update newlines for 0 rows.
25commonswiki: FixOldLogEntries would update fields for 0 rows.
26-----------------------------------------------------------------
27crhwiki
28-----------------------------------------------------------------
29crhwiki: FixOldLogEntries would delete 0 rows.
30crhwiki: FixOldLogEntries would update newlines for 0 rows.
31crhwiki: FixOldLogEntries would update fields for 0 rows.
32-----------------------------------------------------------------
33cswiki
34-----------------------------------------------------------------
35cswiki: FixOldLogEntries would delete 0 rows.
36cswiki: FixOldLogEntries would update newlines for 0 rows.
37cswiki: FixOldLogEntries would update fields for 0 rows.
38-----------------------------------------------------------------
39deploymentwiki
40-----------------------------------------------------------------
41deploymentwiki: FixOldLogEntries would delete 51 rows.
42deploymentwiki: The affected log_id's are: 15735, 15736, 15737, 15738, 15739, 15740, 15741, 15742, 15743, 15744, 15745, 15746, 15747, 15748, 15749, 15750, 15751, 23864, 23865, 23866, 23867, 23868, 23869, 23870, 23871, 23872, 23873, 23874, 23875, 23876, 23877, 23878, 23879, 23880, 23881, 23882, 23883, 23884, 23885, 23886, 23887, 23888, 23889, 23890, 23891, 23892, 23893, 23894, 23895, 23896, 23897
43deploymentwiki: FixOldLogEntries would update newlines for 0 rows.
44deploymentwiki: FixOldLogEntries would update fields for 0 rows.
45-----------------------------------------------------------------
46dewiki
47-----------------------------------------------------------------
48dewiki: FixOldLogEntries would delete 3 rows.
49dewiki: The affected log_id's are: 17682, 17683, 17684
50dewiki: FixOldLogEntries would update newlines for 0 rows.
51dewiki: FixOldLogEntries would update fields for 0 rows.
52-----------------------------------------------------------------
53dewiktionary
54-----------------------------------------------------------------
55dewiktionary: FixOldLogEntries would delete 0 rows.
56dewiktionary: FixOldLogEntries would update newlines for 0 rows.
57dewiktionary: FixOldLogEntries would update fields for 0 rows.
58-----------------------------------------------------------------
59en_rtlwiki
60-----------------------------------------------------------------
61en_rtlwiki: FixOldLogEntries would delete 0 rows.
62en_rtlwiki: FixOldLogEntries would update newlines for 0 rows.
63en_rtlwiki: FixOldLogEntries would update fields for 0 rows.
64-----------------------------------------------------------------
65enwiki
66-----------------------------------------------------------------
67enwiki: FixOldLogEntries would delete 8 rows.
68enwiki: The affected log_id's are: 130871, 130872, 134816, 134817, 134818, 134819, 134820, 134821
69enwiki: FixOldLogEntries would update newlines for 0 rows.
70enwiki: FixOldLogEntries would update fields for 0 rows.
71-----------------------------------------------------------------
72enwikibooks
73-----------------------------------------------------------------
74enwikibooks: FixOldLogEntries would delete 0 rows.
75enwikibooks: FixOldLogEntries would update newlines for 0 rows.
76enwikibooks: FixOldLogEntries would update fields for 0 rows.
77-----------------------------------------------------------------
78enwikinews
79-----------------------------------------------------------------
80enwikinews: FixOldLogEntries would delete 0 rows.
81enwikinews: FixOldLogEntries would update newlines for 0 rows.
82enwikinews: FixOldLogEntries would update fields for 0 rows.
83-----------------------------------------------------------------
84enwikiquote
85-----------------------------------------------------------------
86enwikiquote: FixOldLogEntries would delete 0 rows.
87enwikiquote: FixOldLogEntries would update newlines for 0 rows.
88enwikiquote: FixOldLogEntries would update fields for 0 rows.
89-----------------------------------------------------------------
90enwikisource
91-----------------------------------------------------------------
92enwikisource: FixOldLogEntries would delete 0 rows.
93enwikisource: FixOldLogEntries would update newlines for 0 rows.
94enwikisource: FixOldLogEntries would update fields for 0 rows.
95-----------------------------------------------------------------
96enwikiversity
97-----------------------------------------------------------------
98enwikiversity: FixOldLogEntries would delete 0 rows.
99enwikiversity: FixOldLogEntries would update newlines for 0 rows.
100enwikiversity: FixOldLogEntries would update fields for 0 rows.
101-----------------------------------------------------------------
102enwikivoyage
103-----------------------------------------------------------------
104enwikivoyage: FixOldLogEntries would delete 0 rows.
105enwikivoyage: FixOldLogEntries would update newlines for 0 rows.
106enwikivoyage: FixOldLogEntries would update fields for 0 rows.
107-----------------------------------------------------------------
108enwiktionary
109-----------------------------------------------------------------
110enwiktionary: FixOldLogEntries would delete 0 rows.
111enwiktionary: FixOldLogEntries would update newlines for 0 rows.
112enwiktionary: FixOldLogEntries would update fields for 0 rows.
113-----------------------------------------------------------------
114eowiki
115-----------------------------------------------------------------
116eowiki: FixOldLogEntries would delete 0 rows.
117eowiki: FixOldLogEntries would update newlines for 0 rows.
118eowiki: FixOldLogEntries would update fields for 0 rows.
119-----------------------------------------------------------------
120eswiki
121-----------------------------------------------------------------
122eswiki: FixOldLogEntries would delete 0 rows.
123eswiki: FixOldLogEntries would update newlines for 0 rows.
124eswiki: FixOldLogEntries would update fields for 0 rows.
125-----------------------------------------------------------------
126eswikibooks
127-----------------------------------------------------------------
128eswikibooks: FixOldLogEntries would delete 0 rows.
129eswikibooks: FixOldLogEntries would update newlines for 0 rows.
130eswikibooks: FixOldLogEntries would update fields for 0 rows.
131-----------------------------------------------------------------
132fawiki
133-----------------------------------------------------------------
134fawiki: FixOldLogEntries would delete 0 rows.
135fawiki: FixOldLogEntries would update newlines for 0 rows.
136fawiki: FixOldLogEntries would update fields for 0 rows.
137-----------------------------------------------------------------
138hewiki
139-----------------------------------------------------------------
140hewiki: FixOldLogEntries would delete 0 rows.
141hewiki: FixOldLogEntries would update newlines for 0 rows.
142hewiki: FixOldLogEntries would update fields for 0 rows.
143-----------------------------------------------------------------
144hewiktionary
145-----------------------------------------------------------------
146hewiktionary: FixOldLogEntries would delete 0 rows.
147hewiktionary: FixOldLogEntries would update newlines for 0 rows.
148hewiktionary: FixOldLogEntries would update fields for 0 rows.
149-----------------------------------------------------------------
150hiwiki
151-----------------------------------------------------------------
152hiwiki: FixOldLogEntries would delete 0 rows.
153hiwiki: FixOldLogEntries would update newlines for 0 rows.
154hiwiki: FixOldLogEntries would update fields for 0 rows.
155-----------------------------------------------------------------
156jawiki
157-----------------------------------------------------------------
158jawiki: FixOldLogEntries would delete 0 rows.
159jawiki: FixOldLogEntries would update newlines for 0 rows.
160jawiki: FixOldLogEntries would update fields for 0 rows.
161-----------------------------------------------------------------
162kowiki
163-----------------------------------------------------------------
164kowiki: FixOldLogEntries would delete 0 rows.
165kowiki: FixOldLogEntries would update newlines for 0 rows.
166kowiki: FixOldLogEntries would update fields for 0 rows.
167-----------------------------------------------------------------
168loginwiki
169-----------------------------------------------------------------
170loginwiki: FixOldLogEntries would delete 0 rows.
171loginwiki: FixOldLogEntries would update newlines for 0 rows.
172loginwiki: FixOldLogEntries would update fields for 0 rows.
173-----------------------------------------------------------------
174metawiki
175-----------------------------------------------------------------
176metawiki: FixOldLogEntries would delete 0 rows.
177metawiki: FixOldLogEntries would update newlines for 0 rows.
178metawiki: FixOldLogEntries would update fields for 0 rows.
179-----------------------------------------------------------------
180nlwiki
181-----------------------------------------------------------------
182nlwiki: FixOldLogEntries would delete 0 rows.
183nlwiki: FixOldLogEntries would update newlines for 0 rows.
184nlwiki: FixOldLogEntries would update fields for 0 rows.
185-----------------------------------------------------------------
186ruwiki
187-----------------------------------------------------------------
188ruwiki: FixOldLogEntries would delete 0 rows.
189ruwiki: FixOldLogEntries would update newlines for 0 rows.
190ruwiki: FixOldLogEntries would update fields for 0 rows.
191-----------------------------------------------------------------
192simplewiki
193-----------------------------------------------------------------
194simplewiki: FixOldLogEntries would delete 0 rows.
195simplewiki: FixOldLogEntries would update newlines for 0 rows.
196simplewiki: FixOldLogEntries would update fields for 0 rows.
197-----------------------------------------------------------------
198sqwiki
199-----------------------------------------------------------------
200sqwiki: FixOldLogEntries would delete 0 rows.
201sqwiki: FixOldLogEntries would update newlines for 0 rows.
202sqwiki: FixOldLogEntries would update fields for 0 rows.
203-----------------------------------------------------------------
204srwiki
205-----------------------------------------------------------------
206srwiki: FixOldLogEntries would delete 0 rows.
207srwiki: FixOldLogEntries would update newlines for 0 rows.
208srwiki: FixOldLogEntries would update fields for 0 rows.
209-----------------------------------------------------------------
210svwiki
211-----------------------------------------------------------------
212svwiki: FixOldLogEntries would delete 0 rows.
213svwiki: FixOldLogEntries would update newlines for 0 rows.
214svwiki: FixOldLogEntries would update fields for 0 rows.
215-----------------------------------------------------------------
216testwiki
217-----------------------------------------------------------------
218testwiki: FixOldLogEntries would delete 0 rows.
219testwiki: FixOldLogEntries would update newlines for 0 rows.
220testwiki: FixOldLogEntries would update fields for 0 rows.
221-----------------------------------------------------------------
222ukwiki
223-----------------------------------------------------------------
224ukwiki: FixOldLogEntries would delete 0 rows.
225ukwiki: FixOldLogEntries would update newlines for 0 rows.
226ukwiki: FixOldLogEntries would update fields for 0 rows.
227-----------------------------------------------------------------
228wikidatawiki
229-----------------------------------------------------------------
230wikidatawiki: FixOldLogEntries would delete 0 rows.
231wikidatawiki: FixOldLogEntries would update newlines for 0 rows.
232wikidatawiki: FixOldLogEntries would update fields for 0 rows.
233-----------------------------------------------------------------
234zhwiki
235-----------------------------------------------------------------
236zhwiki: FixOldLogEntries would delete 35 rows.
237zhwiki: The affected log_id's are: 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 3037, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048, 3049
238zhwiki: FixOldLogEntries would update newlines for 0 rows.
239zhwiki: FixOldLogEntries would update fields for 0 rows.
240-----------------------------------------------------------------
241zhwikivoyage
242-----------------------------------------------------------------
243zhwikivoyage: FixOldLogEntries would delete 0 rows.
244zhwikivoyage: FixOldLogEntries would update newlines for 0 rows.
245zhwikivoyage: FixOldLogEntries would update fields for 0 rows.

Will run on the BC next week, to see if we're prod-ready.

Cleaned paste:

1-----------------------------------------------------------------
2deploymentwiki
3-----------------------------------------------------------------
4deploymentwiki: FixOldLogEntries would delete 51 rows.
5deploymentwiki: The affected log_id's are: 15735, 15736, 15737, 15738, 15739, 15740, 15741, 15742, 15743, 15744, 15745, 15746, 15747, 15748, 15749, 15750, 15751, 23864, 23865, 23866, 23867, 23868, 23869, 23870, 23871, 23872, 23873, 23874, 23875, 23876, 23877, 23878, 23879, 23880, 23881, 23882, 23883, 23884, 23885, 23886, 23887, 23888, 23889, 23890, 23891, 23892, 23893, 23894, 23895, 23896, 23897
6deploymentwiki: FixOldLogEntries would update newlines for 0 rows.
7deploymentwiki: FixOldLogEntries would update fields for 0 rows.
8-----------------------------------------------------------------
9dewiki
10-----------------------------------------------------------------
11dewiki: FixOldLogEntries would delete 3 rows.
12dewiki: The affected log_id's are: 17682, 17683, 17684
13dewiki: FixOldLogEntries would update newlines for 0 rows.
14dewiki: FixOldLogEntries would update fields for 0 rows.
15-----------------------------------------------------------------
16enwiki
17-----------------------------------------------------------------
18enwiki: FixOldLogEntries would delete 8 rows.
19enwiki: The affected log_id's are: 130871, 130872, 134816, 134817, 134818, 134819, 134820, 134821
20enwiki: FixOldLogEntries would update newlines for 0 rows.
21enwiki: FixOldLogEntries would update fields for 0 rows.
22-----------------------------------------------------------------
23zhwiki
24-----------------------------------------------------------------
25zhwiki: FixOldLogEntries would delete 35 rows.
26zhwiki: The affected log_id's are: 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 3037, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048, 3049
27zhwiki: FixOldLogEntries would update newlines for 0 rows.
28zhwiki: FixOldLogEntries would update fields for 0 rows.

I'm now going to examine it again, and run the script on the Beta Cluster if everything's OK.

Mentioned in SAL (#wikimedia-releng) [2020-02-10T16:20:27Z] <Daimona> mwscript extensions/AbuseFilter/maintenance/fixOldLogEntries.php --wiki=dewiki | T228655

Meh

daimona@deployment-deploy01:/srv/mediawiki/php-master$ mwscript extensions/AbuseFilter/maintenance/fixOldLogEntries.php --wiki=dewiki
FixOldLogEntries deleted 3 rows.
InvalidArgumentException from line 2257 of /srv/mediawiki-staging/php-master/includes/libs/rdbms/database/Database.php: Wikimedia\Rdbms\Database::makeList: empty input for field log_id
#0 /srv/mediawiki-staging/php-master/includes/libs/rdbms/database/Database.php(2218): Wikimedia\Rdbms\Database->makeList(Array, 1)
#1 /srv/mediawiki-staging/php-master/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->update('`logging`', Array, Array, 'FixOldLogEntrie...')
#2 /srv/mediawiki-staging/php-master/includes/libs/rdbms/database/DBConnRef.php(380): Wikimedia\Rdbms\DBConnRef->__call('update', Array)
#3 /srv/mediawiki-staging/php-master/extensions/AbuseFilter/maintenance/fixOldLogEntries.php(171): Wikimedia\Rdbms\DBConnRef->update('logging', Array, Array, 'FixOldLogEntrie...')
#4 /srv/mediawiki-staging/php-master/extensions/AbuseFilter/maintenance/fixOldLogEntries.php(260): FixOldLogEntries->changeNewlineType(Array)
#5 /srv/mediawiki-staging/php-master/maintenance/Maintenance.php(1759): FixOldLogEntries->doDBUpdates()
#6 /srv/mediawiki-staging/php-master/maintenance/doMaintenance.php(99): LoggedUpdateMaintenance->execute()
#7 /srv/mediawiki-staging/php-master/extensions/AbuseFilter/maintenance/fixOldLogEntries.php(285): require_once('/srv/mediawiki-...')
#8 /srv/mediawiki-staging/multiversion/MWScript.php(101): require_once('/srv/mediawiki-...')
#9 {main}

The script worked correctly, and the faulty rows were deleted. The failure happened at a later stage and didn't cause any harm. Nonetheless, this bug should be fixed before moving on.

Change 571317 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] fixOldLogEntries: don't pass empty lists to Database::makeList

https://gerrit.wikimedia.org/r/571317

Change 571317 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] fixOldLogEntries: don't pass empty lists to Database::makeList

https://gerrit.wikimedia.org/r/571317

Mentioned in SAL (#wikimedia-releng) [2020-02-11T09:43:54Z] <Daimona> mwscript extensions/AbuseFilter/maintenance/fixOldLogEntries.php --wiki=enwiki | T228655

Mentioned in SAL (#wikimedia-releng) [2020-02-11T09:46:08Z] <Daimona> foreachwiki extensions/AbuseFilter/maintenance/fixOldLogEntries.php | T228655

Beta Cluster is done, and this is now ready for production as soon as https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/AbuseFilter/+/571317/ lands (with wmf.19, at the end of this week).

Anyone feel free to dry-run it (foreachwiki extensions/AbuseFilter/maintenance/fixOldLogEntries.php --dry-run --verbose), but please coordinate with me before running it without --dry-run.