Off by Math.random()
-
var actual = {}; db.objects.aggregate([{ $match: { _key: { $regex: /^tid:[0-9]+:posts$/ } } }, { $group: { _id: '$_key', count: { $sum: 1 } } }]).forEach(function(t) { actual[/^tid:([0-9]+):posts$/.exec(t._id)[1]] = t.count; }); db.objects.find({ _key: /^topic:[0-9]+$/ }, { _id: 0, tid: 1, postcount: 1 }).map(function(t) { t.actual = (actual[t.tid] || 0) + 1; return t; }).filter(function(t) { return t.postcount !== t.actual; }).sort(function(a, b) { return a.tid - b.tid; });
Gonna leave this running (on the staging server) while I go for a walk.
-
@ben_lubar said in Off by Math.random():
var actual = {}; db.objects.aggregate([{ $match: { _key: { $regex: /^tid:[0-9]+:posts$/ } } }, { $group: { _id: '$_key', count: { $sum: 1 } } }]).forEach(function(t) { actual[/^tid:([0-9]+):posts$/.exec(t._id)[1]] = t.count; }); db.objects.find({ _key: /^topic:[0-9]+$/ }, { _id: 0, tid: 1, postcount: 1 }).map(function(t) { t.actual = (actual[t.tid] || 0) + 1; return t; }).filter(function(t) { return t.postcount !== t.actual; }).sort(function(a, b) { return a.tid - b.tid; });
Gonna leave this running (on the staging server) while I go for a walk.
Remind me never to use Node and Mongo for anything ever.
-
Oh wow, it finished a lot faster than I thought it would:
[ { "tid" : 11465, "postcount" : 11621, "actual" : 11623 }, { "tid" : 12236, "postcount" : 56041, "actual" : 56040 }, { "tid" : 17361, "postcount" : 19405, "actual" : 19404 }, { "tid" : 18653, "postcount" : 2783, "actual" : 2782 }, { "tid" : 19232, "postcount" : 2365, "actual" : 2366 }, { "tid" : 19233, "postcount" : 2488, "actual" : 2489 }, { "tid" : 19234, "postcount" : 1670, "actual" : 1671 }, { "tid" : 19235, "postcount" : 373, "actual" : 374 }, { "tid" : 19236, "postcount" : 386, "actual" : 387 }, { "tid" : 19237, "postcount" : 21, "actual" : 22 }, { "tid" : 19238, "postcount" : 209, "actual" : 210 }, { "tid" : 19239, "postcount" : 2987, "actual" : 2988 }, { "tid" : 19240, "postcount" : 960, "actual" : 961 }, { "tid" : 19713, "postcount" : 459, "actual" : 458 }, { "tid" : 19786, "postcount" : 85, "actual" : 84 }, { "tid" : 19861, "postcount" : 750, "actual" : 749 }, { "tid" : 20387, "postcount" : 0, "actual" : 1 }, { "tid" : 20389, "postcount" : 0, "actual" : 1 }, { "tid" : 20532, "postcount" : 0, "actual" : 1 }, { "tid" : 20533, "postcount" : 0, "actual" : 1 }, { "tid" : 20534, "postcount" : 0, "actual" : 1 }, { "tid" : 20535, "postcount" : 0, "actual" : 1 }, { "tid" : 20805, "postcount" : 0, "actual" : 1 }, { "tid" : 20878, "postcount" : 0, "actual" : 1 }, { "tid" : 20879, "postcount" : 0, "actual" : 1 }, { "tid" : 20880, "postcount" : 0, "actual" : 1 }, { "tid" : 20881, "postcount" : 0, "actual" : 1 }, { "tid" : 20884, "postcount" : 1367, "actual" : 1366 }, { "tid" : 20936, "postcount" : 397, "actual" : 396 }, { "tid" : 21016, "postcount" : 27, "actual" : 26 }, { "tid" : 21042, "postcount" : 1687, "actual" : 1686 }, { "tid" : 21055, "postcount" : 2, "actual" : 3 }, { "tid" : 21056, "postcount" : 0, "actual" : 1 }, { "tid" : 21065, "postcount" : 0, "actual" : 1 }, { "tid" : 21066, "postcount" : 0, "actual" : 1 }, { "tid" : 21067, "postcount" : 0, "actual" : 1 }, { "tid" : 21068, "postcount" : 0, "actual" : 1 }, { "tid" : 21069, "postcount" : 0, "actual" : 1 } ]
-
@ben_lubar so
- threads off by 2: 1
- threads off by 1: 27
- threads off by -1: 10
That's a total of 29 in the one direction, and 10 in the other. I would've thought, if jeffing was the cause of it, that the sum of all those would be 0. But it's not...
-
@anotherusername Let's look at the individual threads.
🙅 THE BAD IDEAS THEAD off by -2
The Official Status Thread off by -1
🔥 Computer says no guacamole off by +1
🔥 Everything is racist off by +1
[redacted] off by -1[from PM]
[redacted] off by -1[from PM]
[redacted] off by -1 [from PM]
[redacted] off by -1 [from PM]
[redacted] off by -1 [from PM]
[redacted] off by -1 [from PM]
[redacted] off by -1 [from PM]
[redacted] off by -1 [from PM]
[redacted] off by -1 [from PM]
Mafia VI - Rooftop Bear Garden hosting a convention of Club Ded off by +1
[lounge topic] off by +1
More Windows 10 auto-update auto-reboot nonsense off by +1
GitKraken [no main post or replies]
Elevator Action [no main post or replies]
Elevator Action - now in glorious 3-color mode! [no main post or replies]
elevator action - now with slightly less than 2 bits of color [no main post or replies]
elevator action - now with slightly less than 2 bits of color space [no main post or replies]
🔥 Recognizing microracism and rapes [no main post or replies]
Fortune Telling [no main post or replies]
Fortune Telling [no main post or replies]
Fortune Telling [no main post or replies]
Page 65 [no main post or replies]
Putting the world on hyper-welfare off by +1
[redacted] off by +1
[staff topic] off by +1
Trigger warning: Dem bones, dem bones, dem dry bones... off by +1
Micro and Macro in purple off by -1
Micro and Macro in purple off by -1 [same main post as previous]
Aspie Quiz [no main post or replies]
Aspie Quiz [no main post or replies]
Aspie Quiz [no main post or replies]
Aspie Quiz [no main post or replies]
Aspie Quiz [no main post or replies]
-
@secret-PM-club I have fixed the topics in the above list that are labeled "[from PM]"
-
@ben_lubar Wow, is that every fucking thread in our forum? lol.
I think the discourse -> nodeBB transition did this somehow
And clearly there's a second repro path: somehow making a thread with 0 posts.
Wonder what the rest of it is?
-
@ben_lubar said in Off by Math.random():
@anotherusername Let's look at the individual threads.
🙅 THE BAD IDEAS THEAD off by -2
The Official Status Thread off by -1
🔥 Computer says no guacamole off by +1
🔥 Everything is racist off by +1
Mafia VI - Rooftop Bear Garden hosting a convention of Club Ded off by +1
[lounge topic] off by +1
More Windows 10 auto-update auto-reboot nonsense off by +1
Putting the world on hyper-welfare off by +1
[redacted] off by +1
[staff topic] off by +1
Trigger warning: Dem bones, dem bones, dem dry bones... off by +1
Micro and Macro in purple off by -1
Micro and Macro in purple off by -1 [same main post as previous]Ok, so counting only the ones that I didn't directly cause and that aren't miscounted by my algorithm (my query in the OP assumes every topic has an OP):
- Bad Ideas is off by -2
- Status Thread is off by -1
- several topics that are forks are off by +1
- The last two are just flat out broken, and I think they're also forked topics.
-
Alright, everything except the failed forks should have the correct post count now.
-
@Yamikuronue said in Off by Math.random():
@ben_lubar Wow, is that every fucking thread in our forum? lol.
Depending on your definition of "our", yes.
-
@ben_lubar "our" as in @secret-PM-club
-
-
@ben_lubar said in Off by Math.random():
var actual = {}; db.objects.aggregate([{ $match: { _key: { $regex: /^tid:[0-9]+:posts$/ } } }, { $group: { _id: '$_key', count: { $sum: 1 } } }]).forEach(function(t) { actual[/^tid:([0-9]+):posts$/.exec(t._id)[1]] = t.count; }); db.objects.find({ _key: /^topic:[0-9]+$/ }, { _id: 0, tid: 1, postcount: 1 }).map(function(t) { t.actual = (actual[t.tid] || 0) + 1; return t; }).filter(function(t) { return t.postcount !== t.actual; }).sort(function(a, b) { return a.tid - b.tid; });
Gonna leave this running (on the staging server) while I go for a walk.
Well at least it's much more readable and programmer-friendly than SQL, right?
-
@ben_lubar I used the opposite +/- notation (
actual - postcount
), so our signs are opposite.@Yamikuronue said in Off by Math.random():
I think the discourse -> nodeBB transition did this somehow
I don't. Some of those threads are newer. The bones thread is definitely more recent than Discourse; it's only 11 days old.
-
@anotherusername Sure. I count three sources: the import script (specifically the part that moved PMs to real threads), fucked up forks, and something else that did the bones thread.
-
@Yamikuronue said in Off by Math.random():
specifically the part that moved PMs to real threads
That wasn't the importer, that was me writing MongoDB queries directly.
-
@ben_lubar But you WERE the importer, @ben_lubar!
Filed Under: The best kind of importer, too!
-
actual[/^tid:([0-9]+):posts$/.exec(t._id)[1]] = t.count;
oh, never mind. for a sec I thought I saw a
exec()
in there, but it's just running the regex. :D