Closed (fixed)
Project:
Project
Version:
5.x-1.x-dev
Component:
Usage statistics
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Sep 2007 at 23:13 UTC
Updated:
28 Sep 2007 at 20:52 UTC
Jump to comment: Most recent file
Comments
Comment #1
drewish commentedhere it is with an update (well two actually, splitting them up avoided timeouts).
Comment #2
dwwAll looks reasonable, but I have no time to test this now. Have you already tried all of this on test data? Thanks.
Comment #3
drewish commentedI did test it but after your prompting I added a little debugging code and re-ran it on a clean copy of the d.o database to double check. In the process realized that I'd swapped the rounding code for days and weeks. I reversed that and added some code to extend the script time limit because the updates were timing out on my machine.
Once I got that straight, I put another clean copy of the d.o db on and re-ran it. Everything looked good so I'd say it's RTBC.
Comment #4
drewish commentedviewing the data i think it might need a little more tweaking...
Comment #5
drewish commentedI started changing the timezone on my machine around to see what would happen and realized that getdate() uses the server's timezone. I've updated the patch to remove the cancel out the timezone.
Also, now the update now only runs UPDATE queries when the timestamp changes which, since the timestamps in the d.o'd database are already GMT, turns it into a very quick update.
I think this is finally good to go, but after the back and forth I've had with myself on this, I'm going to mark it needs review.
Comment #6
dwwUpon further consideration...
A) It's too bad the 2 updates duplicate so much code. If they run so fast now, can't we merge them back into a single update that just loops over all 4 tables?
B) Once this is actually RTBC and committed, how do we safely run this update on d.o? Aren't we screwed if any usage data comes in between the time the source is updated and the update runs? Should we temporarily disable usage data collection while we do the upgrade? I haven't really thought about it much, but I'd appreciate you spending a little time to come up with a coherent upgrade plan, so we don't break anything.
Thanks,
-Derek
Comment #7
dwwp.s. if it's still important to keep those 2 DB updates seperate for some reason, can we at least put the meat of the code into a helper function, invoked by both updates?
Comment #8
drewish commenteda) good call, they can be in the same function now.
b) won't be a problem. as soon as the patch hits new data will be rounded existing data that's not on a GMT will be rounded... based on the last db dump from d.o. there should be no values changed.
p.s) yeah, i actually think i should refactor some of the code to make it into functions for the module.
I'm rolling a patch now so I've got a "clean" copy of the changes. I'm leaving it as needs work because I need to apply some of the visibility patch to test it.
Comment #9
dwwMaybe this is crazy, but the only difference between the day and week cases in the DB update now is the rounding function to use. Couldn't you further consolidate via something like:
Comment #10
drewish commentedi wrote some simpletest tests which i'm attaching. i couldn't figure out how to add a file in a subdirectory (tests) to the patch. to get it to upload i had to add the .txt extension.
patch to follow.
Comment #11
drewish commentedhere's the patch... little bit different take on the changes you'd asked for in the update function. thanks for being such a pain in the ass, the code's looking much better ;)
restored the clean d.o database dump and re-ran the update. as i'd hoped, no queries were executed.
the patch also adds the simpletest hook needed to run the tests.
Comment #12
dwwWrong patch at #11? We've regressed to separate DB updates with a bunch of duplicated code.
Comment #13
drewish commentedyeah wrong patch.
Comment #14
drewish commentedon IRC dww pointed out a typo. i fixed that and another one in a comment.
Comment #15
dwwFinal review, tested on s.d.o, committed, installed on d.o and update_5000 run (without queries). Thanks!
Comment #16
(not verified) commented