Skip to content
Permalink
Browse files
Using fake timestamp in OS version make some results invisible
https://bugs.webkit.org/show_bug.cgi?id=152289

Reviewed by Stephanie Lewis.

Added commit_order column to explicitly order OS versions. This fixes the bug whereby which
baseline results reported with only OS versions are shown with x coordinate set to 10 years ago.

To migrate the existing database, run:
    ALTER TABLE commits ADD COLUMN commit_order integer;
    CREATE INDEX commit_order_index ON commits(commit_order);

Then for each repository $1,
    UPDATE commits SET (commit_time, commit_order) = (NULL, CAST(EXTRACT(epoch from commit_time) as integer))
    WHERE commit_repository = $1;


* init-database.sql: Added the column.
* public/api/commits.php:
(fetch_commits_between): Use commit_order to order commits when commit_time is missing.
* public/api/report-commits.php:
(main): Set commit_order.
* tools/pull-os-versions.py:
(OSBuildFetcher.fetch_and_report_new_builds):
(OSBuildFetcher._assign_order): Renamed from _assign_fake_timestamps. Set the order instead of a fake timestmap.


Canonical link: https://commits.webkit.org/170399@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194088 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
rniwa committed Dec 15, 2015
1 parent cf5791c commit 66365fc0610a070e368e120719b4c40e434d0a3f
@@ -1,3 +1,31 @@
2015-12-14 Ryosuke Niwa <rniwa@webkit.org>

Using fake timestamp in OS version make some results invisible
https://bugs.webkit.org/show_bug.cgi?id=152289

Reviewed by Stephanie Lewis.

Added commit_order column to explicitly order OS versions. This fixes the bug whereby which
baseline results reported with only OS versions are shown with x coordinate set to 10 years ago.

To migrate the existing database, run:
ALTER TABLE commits ADD COLUMN commit_order integer;
CREATE INDEX commit_order_index ON commits(commit_order);

Then for each repository $1,
UPDATE commits SET (commit_time, commit_order) = (NULL, CAST(EXTRACT(epoch from commit_time) as integer))
WHERE commit_repository = $1;


* init-database.sql: Added the column.
* public/api/commits.php:
(fetch_commits_between): Use commit_order to order commits when commit_time is missing.
* public/api/report-commits.php:
(main): Set commit_order.
* tools/pull-os-versions.py:
(OSBuildFetcher.fetch_and_report_new_builds):
(OSBuildFetcher._assign_order): Renamed from _assign_fake_timestamps. Set the order instead of a fake timestmap.

2015-12-14 Ryosuke Niwa <rniwa@webkit.org>

Perf dashboard can't merge when the destination platform is missing baseline/target
@@ -87,11 +87,13 @@ CREATE TABLE commits (
commit_revision varchar(64) NOT NULL,
commit_parent integer REFERENCES commits ON DELETE CASCADE,
commit_time timestamp,
commit_order integer,
commit_committer integer REFERENCES committers ON DELETE CASCADE,
commit_message text,
commit_reported boolean NOT NULL DEFAULT FALSE,
CONSTRAINT commit_in_repository_must_be_unique UNIQUE(commit_repository, commit_revision));
CREATE INDEX commit_time_index ON commits(commit_time);
CREATE INDEX commit_order_index ON commits(commit_order);

CREATE TABLE build_commits (
commit_build integer NOT NULL REFERENCES builds ON DELETE CASCADE,
@@ -79,11 +79,18 @@ function fetch_commits_between($db, $repository_id, $first, $second, $keyword =
$second_commit = commit_from_revision($db, $repository_id, $second);
$first = $first_commit['commit_time'];
$second = $second_commit['commit_time'];
$column_name = 'commit_time';
if (!$first || !$second) {
$first = $first_commit['commit_order'];
$second = $second_commit['commit_order'];
$column_name = 'commit_order';
}

$in_order = $first < $second;
array_push($values, $in_order ? $first : $second);
$statements .= ' AND commit_time >= $' . count($values);
$statements .= ' AND ' . $column_name . ' >= $' . count($values);
array_push($values, $in_order ? $second : $first);
$statements .= ' AND commit_time <= $' . count($values);
$statements .= ' AND ' . $column_name . ' <= $' . count($values);
}

if ($keyword) {
@@ -95,7 +102,7 @@ function fetch_commits_between($db, $repository_id, $first, $second, $keyword =
AND ((committer_name LIKE $keyword_index OR committer_account LIKE $keyword_index) OR commit_revision = $revision_index)";
}

$commits = $db->query_and_fetch_all($statements . ' ORDER BY commit_time', $values);
$commits = $db->query_and_fetch_all($statements . ' ORDER BY commit_time, commit_order', $values);
if (!is_array($commits))
exit_with_error('FailedToFetchCommits', array('repository' => $repository_id, 'first' => $first, 'second' => $second));
foreach ($commits as &$commit)
@@ -62,6 +62,7 @@ function main($post_data) {
'repository' => $repository_id,
'revision' => $commit_info['revision'],
'parent' => $parent_id,
'order' => array_get($commit_info, 'order'),
'time' => array_get($commit_info, 'time'),
'committer' => $committer_id,
'message' => array_get($commit_info, 'message'),
@@ -64,14 +64,14 @@ def fetch_and_report_new_builds(self, server_config):
print 'Found %d builds' % len(available_builds)

available_builds = filter(lambda commit: commit['revision'] not in reported_revisions, available_builds)
self._assign_fake_timestamps(available_builds)
self._assign_order(available_builds)

print "Submitting %d builds" % len(available_builds)
submit_commits(available_builds, server_config['server']['url'], server_config['slave']['name'], server_config['slave']['password'])
reported_revisions |= set(map(lambda commit: commit['revision'], available_builds))

@staticmethod
def _assign_fake_timestamps(builds):
def _assign_order(builds):
build_name_regex = re.compile(r'(?P<major>\d+)(?P<kind>\w)(?P<minor>\d+)(?P<variant>\w*)')
for commit in builds:
match = build_name_regex.search(commit['revision'])
@@ -81,7 +81,7 @@ def _assign_fake_timestamps(builds):
variant = ord(match.group('variant').upper()) - ord('A') + 1 if match.group('variant') else 0
# These fake times won't conflict with real commit time since even 99Z9999z is still in Feb 1973
fake_time = datetime.utcfromtimestamp((major * 100 + kind) * 10000 + minor + float(variant) / 100)
commit['time'] = fake_time.isoformat()
commit['order'] = fake_time.isoformat()


def available_builds_from_command(repository_name, command, lines_to_ignore):

0 comments on commit 66365fc

Please sign in to comment.