From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Wei Liu <wei.liu2@citrix.com>,
Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: [OSSTEST PATCH 06/17] db updates: Make all INSERTs (except into steps) name columns explicitly
Date: Fri, 30 Jun 2017 17:25:09 +0100 [thread overview]
Message-ID: <1498839920-17025-7-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1498839920-17025-1-git-send-email-ian.jackson@eu.citrix.com>
This makes the code more robust against schema updates. Specifically,
if any columns were to be deleted, these runes would break. (Also if
any column was inserted other than after the existing columns,
although this is not something Postgres can currently do AIUI.)
Affected tables are:
flights_harness_touched
jobs
resources
runvars
steps
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
Osstest/JobDB/Executive.pm | 4 +++-
Osstest/TestSupport.pm | 12 +++++++++---
cs-adjust-flight | 7 ++++---
cs-bisection-step | 3 ++-
mg-allocate | 2 +-
mg-hosts | 1 +
tcl/JobDB-Executive.tcl | 4 +++-
7 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/Osstest/JobDB/Executive.pm b/Osstest/JobDB/Executive.pm
index 45aabd4..0d1b3be 100644
--- a/Osstest/JobDB/Executive.pm
+++ b/Osstest/JobDB/Executive.pm
@@ -191,7 +191,9 @@ END
if (!$already) {
$dbh_tests->do(<<END, {}, $fl,$rev);
- INSERT INTO flights_harness_touched VALUES (?,?)
+ INSERT INTO flights_harness_touched
+ (flight, harness)
+ VALUES (?,?)
END
}
}
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index e6599db..f10d56e 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -309,7 +309,9 @@ sub store_runvar ($$) {
WHERE flight=? AND job=? AND name=? AND synth='t'
END
$dbh_tests->do(<<END,{}, $flight,$job, $param,$value);
- INSERT INTO runvars VALUES (?,?,?,?,'t')
+ INSERT INTO runvars
+ (flight, job, name, val, synth)
+ VALUES (?,?,?,?,'t')
END
});
$r{$param}= get_runvar($param, "$flight.$job");
@@ -368,7 +370,9 @@ END
WHERE flight=? AND job=? AND name=? AND synth='t'
END
$dbh_tests->do(<<END, undef, $flight, $job, $param, $value+1);
- INSERT INTO runvars VALUES (?,?,?,?,'t')
+ INSERT INTO runvars
+ (flight, job, name, val, synth)
+ VALUES (?,?,?,?,'t')
END
});
logm("runvar increment: $param=$value");
@@ -1775,7 +1779,9 @@ END
logm("select_ether $prefix:... $ether (first in flight)");
}
$dbh_tests->do(<<END, {}, $flight,$job,$vn,$ether);
- INSERT INTO runvars VALUES (?,?,?,?,'t')
+ INSERT INTO runvars
+ (flight, job, name, val, synth)
+ VALUES (?,?,?,?,'t')
END
my $chkrow= $dbh_tests->selectrow_hashref(<<END,{}, $flight);
SELECT val, count(*) FROM runvars WHERE flight=?
diff --git a/cs-adjust-flight b/cs-adjust-flight
index 03257a6..0be104e 100755
--- a/cs-adjust-flight
+++ b/cs-adjust-flight
@@ -196,11 +196,11 @@ sub copy_jobs ($$) {
my ($srcflight, $jobs) = @_;
prep_rm_jobs();
my @job_copy_qs = map { $dbh_tests->prepare($_) }
- ("INSERT INTO jobs".
+ ("INSERT INTO jobs (flight, job, recipe, status)".
" SELECT ?, job, recipe, 'queued'".
" FROM jobs".
" WHERE flight = ? AND job = ?",
- "INSERT INTO runvars".
+ "INSERT INTO runvars (flight, job, name, val, synth)".
" SELECT ?, job, name, val, 'f'".
" FROM runvars".
" WHERE flight = ? AND job = ? AND NOT synth");
@@ -246,7 +246,8 @@ sub change__copy_jobs {
our $runvar_rm_q = $dbh_tests->prepare
("DELETE FROM runvars WHERE flight = ? AND job = ? AND name = ?");
our $runvar_insert_q = $dbh_tests->prepare
- ("INSERT INTO runvars VALUES (?, ?, ?, ?, 'f')");
+ ("INSERT INTO runvars (flight, job, name, val, synth)".
+ " VALUES (?, ?, ?, ?, 'f')");
sub runvar_set ($$$;$) {
my ($job, $name, $val, $xwhat) = @_;
diff --git a/cs-bisection-step b/cs-bisection-step
index 76f5010..13ccd7a 100755
--- a/cs-bisection-step
+++ b/cs-bisection-step
@@ -1255,7 +1255,8 @@ END
" from $copyflight)\n";
$dbh_tests->do(<<END, {}, $popflight,$popjob,$recipe);
- INSERT INTO jobs VALUES (?, ?, ?, 'queued')
+ INSERT INTO jobs (flight, job, recipe, status)
+ VALUES (?, ?, ?, 'queued')
END
$dbh_tests->do(<<END, {}, $popflight,$popjob);
INSERT INTO runvars (
diff --git a/mg-allocate b/mg-allocate
index 4f02ce5..dadac3c 100755
--- a/mg-allocate
+++ b/mg-allocate
@@ -180,7 +180,7 @@ sub alloc_1rescand ($$) {
if ($allocate && $restype eq 'share-flight' && $shareix == $tid) {
$dbh_tests->do(<<END,{},
- INSERT INTO resources
+ INSERT INTO resources (restype, resname, shareix, owntaskid)
(SELECT ? AS restype,
? AS resname,
? AS shareix,
diff --git a/mg-hosts b/mg-hosts
index bd67a0a..5cdece5 100755
--- a/mg-hosts
+++ b/mg-hosts
@@ -178,6 +178,7 @@ sub cmd_create_like () {
foreach my $dst (l($dsts)) {
$dbh_tests->do(<<END,{}, $dst,$src);
INSERT INTO resources
+ (restype, resname, shareix, owntaskid)
SELECT restype,
? AS resname,
0 AS shareix,
diff --git a/tcl/JobDB-Executive.tcl b/tcl/JobDB-Executive.tcl
index 6b9bcb0..414a77e 100644
--- a/tcl/JobDB-Executive.tcl
+++ b/tcl/JobDB-Executive.tcl
@@ -282,7 +282,9 @@ proc spawn-step-begin {flight job ts stepnovar} {
set stepno 1
}
db-execute "
- INSERT INTO steps
+ INSERT INTO steps (flight, job, stepno,
+ step, status,
+ testid)
VALUES ([pg_quote $flight], [pg_quote $job], $stepno,
[pg_quote $ts], 'running',
'STARTING')
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-06-30 16:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-30 16:25 [OSSTEST PATCH 00/17] Fix substep (eg XTF) logfile links Ian Jackson
2017-06-30 16:25 ` [OSSTEST PATCH 01/17] Developer docs: A rune for flight comparision Ian Jackson
2017-06-30 16:25 ` [OSSTEST PATCH 02/17] schema updates: Fix typo in developer doc Ian Jackson
2017-06-30 16:25 ` [OSSTEST PATCH 03/17] schema updates: Document how to remove a used column Ian Jackson
2017-06-30 16:25 ` [OSSTEST PATCH 04/17] schema updates: mg-schema-test-database: Cope with applied updates Ian Jackson
2017-06-30 16:25 ` [OSSTEST PATCH 05/17] schema updates: Be willing to apply Ready changes Ian Jackson
2017-06-30 16:25 ` Ian Jackson [this message]
2017-06-30 16:25 ` [OSSTEST PATCH 07/17] step logfiles: Break out $logfilename in two places Ian Jackson
2017-06-30 16:25 ` [OSSTEST PATCH 08/17] step logfiles: Standalone mode: Do not print uninformative $script value Ian Jackson
2017-06-30 16:25 ` [OSSTEST PATCH 09/17] substep logfiles: Move defaulting of $script into Executive Ian Jackson
2017-06-30 16:25 ` [OSSTEST PATCH 10/17] step logfiles: Provide new column Ian Jackson
2017-06-30 16:25 ` [OSSTEST PATCH 11/17] substep logfiles: Populate new logfile column, at all, for substeps Ian Jackson
2017-06-30 16:25 ` [OSSTEST PATCH 12/17] substep logfiles: Set logfile and step columns correctly " Ian Jackson
2017-06-30 16:25 ` [OSSTEST PATCH 13/17] step logfiles: Honour new logfile column Ian Jackson
2017-06-30 16:25 ` [OSSTEST PATCH 14/17] step logfiles: Make substep_* take $logfile, not $script Ian Jackson
2017-06-30 16:25 ` [OSSTEST PATCH 15/17] step logfiles: sg-run-job: Break out step-log-leafname Ian Jackson
2017-06-30 16:25 ` [OSSTEST PATCH 16/17] step logfiles: Populate logfile column with logfile name Ian Jackson
2017-06-30 16:25 ` [OSSTEST PATCH 17/17] step logfiles: Rely on new logfile column Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1498839920-17025-7-git-send-email-ian.jackson@eu.citrix.com \
--to=ian.jackson@eu.citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).