← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/fix-ldr-times into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/fix-ldr-times into lp:launchpad.

Commit message:
Fix DB patch durations stored in LaunchpadDatabaseRevision.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/fix-ldr-times/+merge/147291

This branch fixes the incorrect patch durations stored in LaunchpadDatabaseRevision and reported by upgrade.py, by simply changing the default value of LDR.end_time from statement_timestamp() to clock_timestamp(). statement_timestamp() is the time of the last client command, which isn't what we want here, since the patch is now run by a single execute call. clock_timestamp() is whatever the actual execution time was.

This probably broke when we stopped pushing patches through slonik, as it split them up by statement.
-- 
https://code.launchpad.net/~wgrant/launchpad/fix-ldr-times/+merge/147291
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/fix-ldr-times into lp:launchpad.
=== added file 'database/schema/patch-2209-42-0.sql'
--- database/schema/patch-2209-42-0.sql	1970-01-01 00:00:00 +0000
+++ database/schema/patch-2209-42-0.sql	2013-02-08 04:39:23 +0000
@@ -0,0 +1,12 @@
+-- Copyright 2013 Canonical Ltd.  This software is licensed under the
+-- GNU Affero General Public License version 3 (see the file LICENSE).
+
+SET client_min_messages=ERROR;
+
+-- statement_timestamp() is the time of the last client command, which
+-- isn't what we want here (the patch is run by a single execute call).
+-- clock_timestamp() is whatever the actual execution time was.
+ALTER TABLE launchpaddatabaserevision ALTER COLUMN end_time
+    SET DEFAULT (clock_timestamp() AT TIME ZONE 'UTC');
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 42, 0);