]> xenbits.xensource.com Git - osstest.git/log
osstest.git
4 years agoTCP fix: Do not wait for ownerdaemon to speak
Ian Jackson [Mon, 28 Sep 2020 11:43:30 +0000 (12:43 +0100)]
TCP fix: Do not wait for ownerdaemon to speak

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoTCP fix: Do not wait for queuedaemon to speak
Ian Jackson [Mon, 28 Sep 2020 11:41:13 +0000 (12:41 +0100)]
TCP fix: Do not wait for queuedaemon to speak

This depends on the preceding daemonlib patch and an ms-queuedaemon
restart.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agodaemonlib: Provide a "noop" command
Ian Jackson [Mon, 28 Sep 2020 11:37:33 +0000 (12:37 +0100)]
daemonlib: Provide a "noop" command

We are going to want clients to speak before waiting for the server
banner.  A noop command is useful for that.

Putting this here makes it apply to both ownerdaemon and queuedaemon.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoschema: Provide index on flights by start time
Ian Jackson [Wed, 19 Aug 2020 14:59:09 +0000 (15:59 +0100)]
schema: Provide index on flights by start time

We often use flight number as a proxy for ordering, but this is not
always appropriate and not always done (and sometimes it's a bit of a
bodge).

Provide an index to find flights by start time.  This significantly
speeds up the host allocation $equivstatusq query, and the duration
estimator.

(I have tested this by creating a trial index in the production
database.  That index can be dropped again, preferably after this
commit makes it to production.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agots-hosts-allocate-Executive: Do a pre-check
Ian Jackson [Wed, 19 Aug 2020 11:52:04 +0000 (12:52 +0100)]
ts-hosts-allocate-Executive: Do a pre-check

Call attempt_allocation with an empty plan and $mayalloc=0.

In the usual case this will arrange to prime our memoisation caches
before we get involved with the queueing system.

It will also arrange for various errors to be reported sooner.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v2: Improved error and result handling

4 years agohost allocation: Memoise $equivstatus query results
Ian Jackson [Wed, 19 Aug 2020 12:09:49 +0000 (13:09 +0100)]
host allocation: Memoise $equivstatus query results

This provides a very significant speedup.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohost allocation: Memoise duration estimates
Ian Jackson [Wed, 19 Aug 2020 12:00:58 +0000 (13:00 +0100)]
host allocation: Memoise duration estimates

We look at our own branch to estimate durations.  If somehow we are
one of multiple concurrent flights on this branch with the appropriate
blessing, we don't mind not noticing the doing of our peer flights so
that if our estimates are a bit out of date.

So it is fine to use an estimate no older than our own runtime.

Right now we generate a new duration estimator during each queueing
round, because it contains a statement handle and we must disconnect
from the db while waiting.  So the internal memo table gets thrown
away each time and is useless.

To actually memoise, pass our own hash which lives as long as we do.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoduration estimates: Memoise results
Ian Jackson [Wed, 19 Aug 2020 11:55:20 +0000 (12:55 +0100)]
duration estimates: Memoise results

The caller may provide a memoisation hash.  If they don't we embed
one in the estimator.

The estimator contains a db statement handle so shouldn't be so
long-lived that this gives significantly wrong answers.

I am aiming this work at ts-hosts-allocate-Executive, but it is
possible that this might speed up sg-report-flight.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoresource allocation: Provide OSSTEST_ALLOC_FAKE_PLAN test facility
Ian Jackson [Wed, 19 Aug 2020 11:13:23 +0000 (12:13 +0100)]
resource allocation: Provide OSSTEST_ALLOC_FAKE_PLAN test facility

Set this variable (to a data-plan.final.pl, say) and it becomes
possible to test host allocation programs without actually allocating
anything and without engaging with the queue system.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agots-hosts-allocate-Executive: Fix broken call to $duration_estimator
Ian Jackson [Wed, 19 Aug 2020 12:05:22 +0000 (13:05 +0100)]
ts-hosts-allocate-Executive: Fix broken call to $duration_estimator

The debug subref is passed to the constructor (and indeed we do that).
The final argument to the actual estimator is $uptoincl_testid (but we
didn't say $will_uptoincl_testid, so it is ignored).

The code was wrong, but with no effect.  So no functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-job-history: Increase default limit
Ian Jackson [Mon, 10 Aug 2020 16:36:35 +0000 (17:36 +0100)]
sg-report-job-history: Increase default limit

Now this is a *lot* faster, we can print a lot more history.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-job-history: Provide --time-limit
Ian Jackson [Mon, 10 Aug 2020 16:32:58 +0000 (17:32 +0100)]
sg-report-job-history: Provide --time-limit

Calculate a minflight based on the time limit, and set the time limit
to a year ago by default.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-host-history: Cache report_run_getinfo
Ian Jackson [Wed, 12 Aug 2020 10:08:44 +0000 (11:08 +0100)]
sg-report-host-history: Cache report_run_getinfo

No logical change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-job-history: Cache report_run_getinfo
Ian Jackson [Wed, 12 Aug 2020 09:59:47 +0000 (10:59 +0100)]
sg-report-job-history: Cache report_run_getinfo

No logical change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-job-history (nfc): Abolish $fromstuff
Ian Jackson [Mon, 10 Aug 2020 16:34:55 +0000 (17:34 +0100)]
sg-report-job-history (nfc): Abolish $fromstuff

This used to be reused, but that is no longer the case.  Do away with
it, for clarity and simplicity.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting: Break out minflight_by_time
Ian Jackson [Mon, 10 Aug 2020 16:30:20 +0000 (17:30 +0100)]
history reporting: Break out minflight_by_time

Move this from sg-report-host-history so we can reuse it.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-job-history: Cache osstestrevs
Ian Jackson [Mon, 10 Aug 2020 16:20:53 +0000 (17:20 +0100)]
sg-report-job-history: Cache osstestrevs

No logical change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-job-history (nfc): Refactor osstestrevs code
Ian Jackson [Mon, 10 Aug 2020 16:19:09 +0000 (17:19 +0100)]
sg-report-job-history (nfc): Refactor osstestrevs code

Split this into (1) get the data from the db (2) process it into the
form we want.

This will make it easy to cache (1).

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-job-history: Cache the per-flight revisions
Ian Jackson [Mon, 10 Aug 2020 16:08:44 +0000 (17:08 +0100)]
sg-report-job-history: Cache the per-flight revisions

This involves changing %revisions to %$revisions in the code which
uses the value.

No logical change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Quote keys too
Ian Jackson [Mon, 10 Aug 2020 16:14:40 +0000 (17:14 +0100)]
history reporting (nfc): Quote keys too

Right now all the callers have keys which don't need quoting.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): url-quoting: quote = too
Ian Jackson [Fri, 14 Aug 2020 15:24:08 +0000 (16:24 +0100)]
history reporting (nfc): url-quoting: quote = too

We are going to want to url-encode keys.  If key contains =, we still
need to be able to tell where it ends, so it must be encoded.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Break out $url_ok_chars
Ian Jackson [Fri, 14 Aug 2020 15:22:20 +0000 (16:22 +0100)]
history reporting (nfc): Break out $url_ok_chars

We will want this in a moment.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Break out url_unquote
Ian Jackson [Mon, 10 Aug 2020 16:13:10 +0000 (17:13 +0100)]
history reporting (nfc): Break out url_unquote

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Break out url_quote
Ian Jackson [Mon, 10 Aug 2020 16:11:59 +0000 (17:11 +0100)]
history reporting (nfc): Break out url_quote

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-job-history: Introduce use of cache, for hosts query
Ian Jackson [Mon, 10 Aug 2020 15:52:01 +0000 (16:52 +0100)]
sg-report-job-history: Introduce use of cache, for hosts query

* Set up the cache.
* Call the per-row setup hook.
* Cache the computation of $ri->{Hosts}.
* Call the per-row cache write hook.
* Finalise the cache.

Output is the same, but with cache information in the output html, and
faster.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Provide cache_set_task_print
Ian Jackson [Mon, 10 Aug 2020 15:57:44 +0000 (16:57 +0100)]
history reporting (nfc): Provide cache_set_task_print

This takes a string which gets added to the cache messages.  This
will allow us to distinguish the output from different processes
when using parallel by fork.

Nothing sets this yet.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-job-history (nfc): Drop $hostsq query
Ian Jackson [Wed, 12 Aug 2020 12:51:32 +0000 (13:51 +0100)]
sg-report-job-history (nfc): Drop $hostsq query

We have eliminated all the users of @hostvarcols before @hostvarcols2
is calculated from the row data.

The query which produces this is very slow and can't be cached.  We
can abolish it now and just use the @hostvarcols2 calculation.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-job-history (nfc): Query hosts runvars in one go
Ian Jackson [Mon, 10 Aug 2020 15:10:50 +0000 (16:10 +0100)]
sg-report-job-history (nfc): Query hosts runvars in one go

Rather than doing one query for each entry in @hostvarcols, do one
query for all the relevant runvars.  This is quite a bit faster and
will enable us to use the cache.

This is correct because @hostvarcols was the union of all the host
runvars, so this produces the same answers as the individual queries.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-job-history (nfc): Add new hostvarcols calculation
Ian Jackson [Mon, 10 Aug 2020 15:04:39 +0000 (16:04 +0100)]
sg-report-job-history (nfc): Add new hostvarcols calculation

We are going to want to replace the existing @hostvarcols
calculation.  Provide a new one based on $ri->{Hosts}.

Right now, die if they don't produce the same answers.  This still
works, which shows that the calculation is right.

Tested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-job-history (nfc): Make $ri->{Hosts} a hash
Ian Jackson [Mon, 10 Aug 2020 15:02:00 +0000 (16:02 +0100)]
sg-report-job-history (nfc): Make $ri->{Hosts} a hash

This will make it easier to cache this.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-job-history: Refactor "ALL" handling
Ian Jackson [Mon, 10 Aug 2020 14:43:33 +0000 (15:43 +0100)]
sg-report-job-history: Refactor "ALL" handling

* Make an explicit entry ALL in @branches, rather than implicitly
  processing ALL as well.

* Consequently, put explicit ALL entries in @tasks too, rather than
  putting in entries without a branch name.

* Pass ALL to processjobbranch rather than undef, and turn it into
  the internally-used undef at the start.

When used with --flight (findflight), this has no functional change.
When used with --job, ALL must now be included in the branch
list passed to --branches.  The only in-tree call is with --flight.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Make cacheable_fn work without cache
Ian Jackson [Wed, 12 Aug 2020 09:55:43 +0000 (10:55 +0100)]
history reporting (nfc): Make cacheable_fn work without cache

This would allow us to use this in call sites without a cache.

I changed my mind about the code that prompted this, but it still
seems plausibly useful, so I'm keeping this commit.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Add another test rune to the notes
Ian Jackson [Mon, 10 Aug 2020 12:06:48 +0000 (13:06 +0100)]
history reporting (nfc): Add another test rune to the notes

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-job-history (nfc): Remove needless conditional
Ian Jackson [Tue, 4 Aug 2020 16:27:04 +0000 (17:27 +0100)]
sg-report-job-history (nfc): Remove needless conditional

$htmlout is now always defined.

Nothing other than indentation change, and removal of the surrounding
if block.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-job-history: Always write HTML output
Ian Jackson [Tue, 4 Aug 2020 16:25:40 +0000 (17:25 +0100)]
sg-report-job-history: Always write HTML output

Previously, unlike sg-report-host-history, if you didn't specify
--html-dir, it would would do a lot work to no effect.

This is not useful and nothing calls it this way.  So abolish this
notion.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-job-history (nfc): Have main program decide HTML filename
Ian Jackson [Tue, 4 Aug 2020 16:26:38 +0000 (17:26 +0100)]
sg-report-job-history (nfc): Have main program decide HTML filename

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-job-history: Use one child per report
Ian Jackson [Tue, 4 Aug 2020 16:23:18 +0000 (17:23 +0100)]
sg-report-job-history: Use one child per report

Rather than one child per job, which then did one report per branch.

This will mean we can use the cache machinery, which is rather global
so wouldn't cope well with processing multiple job history reports
within a process.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-job-history: Use fork-based parallelism
Ian Jackson [Tue, 4 Aug 2020 16:08:14 +0000 (17:08 +0100)]
sg-report-job-history: Use fork-based parallelism

For now, one child per job (for all branches).  This is already a
speedup.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-job-history: Prep for fork: Move $revisionsq query
Ian Jackson [Mon, 10 Aug 2020 12:09:28 +0000 (13:09 +0100)]
sg-report-job-history: Prep for fork: Move $revisionsq query

We will need to prepare this in add_revisions so that it works when we
do each (job,branch) in a different process.

It is OK that it is still global, becauswe we only call add_revisions
in the children.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-job-history: Prep for fork: Move $buildsq query
Ian Jackson [Mon, 10 Aug 2020 11:50:59 +0000 (12:50 +0100)]
sg-report-job-history: Prep for fork: Move $buildsq query

We will need to prepare this once per (job,branch) so that it works
when we do each of those in a different process.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoparallel by fork: Fix a variable name to $task
Ian Jackson [Mon, 10 Aug 2020 15:57:35 +0000 (16:57 +0100)]
parallel by fork: Fix a variable name to $task

This code came from sg-report-host-history where tasks were hosts.
But in the more general context, the names are wrong.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoparallel by fork: Disconnect $dbh_tests as well as undefing it
Ian Jackson [Thu, 6 Aug 2020 11:57:31 +0000 (12:57 +0100)]
parallel by fork: Disconnect $dbh_tests as well as undefing it

If the caller is buggy and has statement handles still open, they can
still "work" even if we have thrown away the db handle.

Where, after forking, "work" means "use the same connection in
multiple processes simultaneously, without locking".  This could
result in arbitrary crazy nbehaviour (eg, TLS crypto failures).

No functional change with existing callers since they don't have this
bug.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoparallel by fork: Break out into HistoryReport
Ian Jackson [Tue, 4 Aug 2020 17:10:25 +0000 (18:10 +0100)]
parallel by fork: Break out into HistoryReport

Move this code from sg-report-host-history to HistoryReport, so that
it can be reused.

No significant functional change.  Some changes to debug messages.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-host-history: Write cache entry for unfinished jobs
Ian Jackson [Tue, 4 Aug 2020 15:20:49 +0000 (16:20 +0100)]
sg-report-host-history: Write cache entry for unfinished jobs

We have to also check ->{finished}, rather than the existence of a row
at all, since now unfinished jobs can appear in the cache.

Because the cache key includes the job status, when the job becomes
finished the cache entry will be invalidated.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting: Improve an error message slightly
Ian Jackson [Tue, 4 Aug 2020 14:35:31 +0000 (15:35 +0100)]
history reporting: Improve an error message slightly

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting: Print debug for cache misses
Ian Jackson [Tue, 4 Aug 2020 16:48:50 +0000 (17:48 +0100)]
history reporting: Print debug for cache misses

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting: Cache data limit now in History module
Ian Jackson [Tue, 4 Aug 2020 16:49:55 +0000 (17:49 +0100)]
history reporting: Cache data limit now in History module

Replace the ad-hoc query-specific limit strategy in
sg-report-host-history with a new, more principled, arrangement, in
HistoryReport.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Documentation for the new module
Ian Jackson [Wed, 5 Aug 2020 12:09:59 +0000 (13:09 +0100)]
history reporting (nfc): Documentation for the new module

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting: Skip undefined keys
Ian Jackson [Tue, 4 Aug 2020 13:41:09 +0000 (14:41 +0100)]
history reporting: Skip undefined keys

This makes it work if the caller's cached hash contains an key which
is bound to undef.

sg-report-host-history already does this, which currently causes:

 Use of uninitialized value $_ in substitution (s///) at Osstest/HistoryReport.pm line 134.
 Use of uninitialized value $_ in printf at Osstest/HistoryReport.pm line 135.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Rename some module variables, remove "cache"
Ian Jackson [Tue, 4 Aug 2020 17:22:20 +0000 (18:22 +0100)]
history reporting (nfc): Rename some module variables, remove "cache"

This makes the code terser and easier to read.  No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Move cache code into HistoryReport module
Ian Jackson [Wed, 5 Aug 2020 11:41:09 +0000 (12:41 +0100)]
history reporting (nfc): Move cache code into HistoryReport module

Finally this is now reuseable code and we can put it in the
HistoryReport module.

Pure cut-and-paste.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Introduce empty HistoryReport module
Ian Jackson [Tue, 4 Aug 2020 17:31:40 +0000 (18:31 +0100)]
history reporting (nfc): Introduce empty HistoryReport module

This is the boilerplate.  Code will appear in it in a moment.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Remove now-obsolete stats variables
Ian Jackson [Wed, 5 Aug 2020 12:04:41 +0000 (13:04 +0100)]
history reporting (nfc): Remove now-obsolete stats variables

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting: Cache stats reporting: Centralise and rework
Ian Jackson [Wed, 5 Aug 2020 12:09:54 +0000 (13:09 +0100)]
history reporting: Cache stats reporting: Centralise and rework

This uses the new variables instead of the old ones.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Record more row-specific stats
Ian Jackson [Wed, 5 Aug 2020 12:09:01 +0000 (13:09 +0100)]
history reporting (nfc): Record more row-specific stats

Prep work.  Nothing uses these yet.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Introduce cache_set_key_cols
Ian Jackson [Tue, 4 Aug 2020 17:42:21 +0000 (18:42 +0100)]
history reporting (nfc): Introduce cache_set_key_cols

This setter function will be needed when this becomes its own module.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Use cacheable_fn for power methods
Ian Jackson [Tue, 4 Aug 2020 17:39:46 +0000 (18:39 +0100)]
history reporting (nfc): Use cacheable_fn for power methods

Avoids open-coding knowledge of the $jr convention at this use site.
%powers becomes %$powers, so it's a bit noisy.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Move cacheable_* further up the file
Ian Jackson [Wed, 5 Aug 2020 12:04:33 +0000 (13:04 +0100)]
history reporting (nfc): Move cacheable_* further up the file

Pure code motion.  Brings these together with the other work-cacheing
code.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Record query-specific stats
Ian Jackson [Wed, 5 Aug 2020 11:55:41 +0000 (12:55 +0100)]
history reporting (nfc): Record query-specific stats

Prep work.  Nothing uses these yet.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Rename $cachehits to $rows_hit
Ian Jackson [Wed, 5 Aug 2020 11:55:31 +0000 (12:55 +0100)]
history reporting (nfc): Rename $cachehits to $rows_hit

Prep work.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Bind by name in cacheable_query
Ian Jackson [Tue, 4 Aug 2020 17:19:57 +0000 (18:19 +0100)]
history reporting (nfc): Bind by name in cacheable_query

cacheable_query used to simply pass $jr->{flight} and ->{job}.  But we
want this to be reuseable for other kinds of query, with different
cache keys.

So bind by name: we expect the caller to use :name placeholders in the
query.  We can then look through the prepared query parameters, and
fish the corresponding values out of $jr.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Provide cacheable_fn
Ian Jackson [Tue, 4 Aug 2020 17:17:08 +0000 (18:17 +0100)]
history reporting (nfc): Provide cacheable_fn

Prep work.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Rename "existing" to "previous"
Ian Jackson [Tue, 4 Aug 2020 17:07:34 +0000 (18:07 +0100)]
history reporting (nfc): Rename "existing" to "previous"

This seems more idiomatic use of English.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Break out cache_row_lookup_prep
Ian Jackson [Tue, 4 Aug 2020 17:03:49 +0000 (18:03 +0100)]
history reporting (nfc): Break out cache_row_lookup_prep

Prep work.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Rename jobquery to cacheable_query
Ian Jackson [Tue, 4 Aug 2020 17:00:27 +0000 (18:00 +0100)]
history reporting (nfc): Rename jobquery to cacheable_query

Prep work.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Make cache_write_entry into a top-level sub
Ian Jackson [Fri, 31 Jul 2020 17:30:23 +0000 (18:30 +0100)]
history reporting (nfc): Make cache_write_entry into a top-level sub

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Refactor to generalise, cache_read_existing
Ian Jackson [Wed, 5 Aug 2020 12:23:41 +0000 (13:23 +0100)]
history reporting (nfc): Refactor to generalise, cache_read_existing

* Introduce @cache_row_key_cols and cache_row_key
* Handle $html_file pathname construction and $read_existing
  at the call site.
* Rename cache_read_existing.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting: Delete two debug prints
Ian Jackson [Wed, 5 Aug 2020 12:23:36 +0000 (13:23 +0100)]
history reporting: Delete two debug prints

These are going to become invalid and I don't think it's important to
save them.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Add some test runes to the notes
Ian Jackson [Tue, 4 Aug 2020 11:44:09 +0000 (12:44 +0100)]
history reporting (nfc): Add some test runes to the notes

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agohistory reporting (nfc): Do not key cache on hostname any more
Ian Jackson [Fri, 31 Jul 2020 16:54:57 +0000 (17:54 +0100)]
history reporting (nfc): Do not key cache on hostname any more

Now we process only one host at a time, so we don't need to
distinguish.

Replace all references to $tcache with %cache.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoproduction-config: Use infra.t, not infra
Ian Jackson [Tue, 18 Aug 2020 15:43:29 +0000 (16:43 +0100)]
production-config: Use infra.t, not infra

This works better with some quirk of the networking we seem to now
have after the buster upgrade to the colo systems.

To avoid blocking on resolving that issue, change the the config.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agomg-allocate: Do not override multiple -l if no arguments
Ian Jackson [Tue, 18 Aug 2020 13:52:07 +0000 (14:52 +0100)]
mg-allocate: Do not override multiple -l if no arguments

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agotcl: JobDB: Do not require particular Pgtcl version
Ian Jackson [Mon, 17 Aug 2020 17:56:49 +0000 (18:56 +0100)]
tcl: JobDB: Do not require particular Pgtcl version

This just serves to complicate upgrades.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoTcl: Use tclsh8.6
Ian Jackson [Mon, 17 Aug 2020 17:45:43 +0000 (18:45 +0100)]
Tcl: Use tclsh8.6

This is needed to run on buster.

I have checked that tclsh8.6 and TclX works on osstest.test-lab.  TclX
seems to be provided by tcl8.4 but work with tcl8.6 (at least on
buster).

Deployment note: hosts running earlier Debian (including
osstest.xs.citrite.net, the Citrix Cambridge instance), may need
OSSTEST_DAEMON_TCLSH=tclsh8.4 or similar in ~/.xen-osstest/settings.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
4 years agosg-report-flight: Use WITH OFFSET 0 for optimisation fence
Ian Jackson [Fri, 14 Aug 2020 11:35:26 +0000 (12:35 +0100)]
sg-report-flight: Use WITH OFFSET 0 for optimisation fence

I am not best pleased.

CC: George Dunlap <George.Dunlap@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoSQL: Change "... LIKE '...\_...' ..." to "... LIKE '...\\_...' ..."
Ian Jackson [Mon, 10 Aug 2020 15:19:16 +0000 (16:19 +0100)]
SQL: Change "... LIKE '...\_...' ..." to "... LIKE '...\\_...' ..."

Perl's "" quotes, and corresponding <<END constructs, do
\-interpolation, so remove these \ which we carefully added in
   e7a408dd01184df0a57ae5d9072d15225c52a99f
   SQL: Change LIKE E'...\\_...' to LIKE '...\_...'

This is only not a performance problem due to query mismathes with the
available indices, because the test indices are still present in the
Massachusetts instance.

I have verified that this has the intended chanve everywhere by
 1. Double-checking that eacbh of these instances is within <<END
    or "" or equivalent.
 2. Running git-ls-files | xargs perl -i -pe 's/\\\\_/\\_/g'
    and manually examining the diff against this patch's parent.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agotiming traces: cri-args-hostlists: Add some timestamps
Ian Jackson [Mon, 10 Aug 2020 10:52:44 +0000 (11:52 +0100)]
timing traces: cri-args-hostlists: Add some timestamps

Pass --report-processing-start-time, and add some calls to date >&2.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agotiming traces: Executive: Provide processing timestamp facilities
Ian Jackson [Mon, 10 Aug 2020 10:46:02 +0000 (11:46 +0100)]
timing traces: Executive: Provide processing timestamp facilities

Nothing uses these yet.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agotiming traces: sg-check-tested: Add prints of (show_abs_time time)
Ian Jackson [Mon, 10 Aug 2020 10:45:44 +0000 (11:45 +0100)]
timing traces: sg-check-tested: Add prints of (show_abs_time time)

More tools to see where it is faffing too much.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agotiming traces: cr-daily-branch: Add more calls to date >&2
Ian Jackson [Mon, 10 Aug 2020 10:45:10 +0000 (11:45 +0100)]
timing traces: cr-daily-branch: Add more calls to date >&2

More tools to see where it is faffing too much.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agotiming traces: cr-publish-flight-logs: Report more progress
Ian Jackson [Mon, 10 Aug 2020 10:31:34 +0000 (11:31 +0100)]
timing traces: cr-publish-flight-logs: Report more progress

More tools to see where it is faffing too much.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v2: Fix ( ) syntax with +

4 years agocr-publish-flight-logs: Make a proper option parser
Ian Jackson [Mon, 10 Aug 2020 10:27:11 +0000 (11:27 +0100)]
cr-publish-flight-logs: Make a proper option parser

I was going to add another option but changed my mind.  But, let's
keep this patch anyway.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoInstall libtirpc-dev for libvirt builds
Jim Fehlig [Thu, 23 Jul 2020 21:31:34 +0000 (22:31 +0100)]
Install libtirpc-dev for libvirt builds

The check for XDR support was changed in libvirt commit d7147b3797
to use libtirpc pkg-config instead of complicated AC_CHECK_LIB,
AC_COMPILE_IFELSE, et. al. logic. The libvirt OSSTEST has been
failing since this change hit libvirt.git master. Fix it by adding
libtirpc-dev to the list of 'extra_packages' installed for libvirt
builds.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agocri-args-hostlists: Add some calls to date(1)
Ian Jackson [Tue, 4 Aug 2020 11:43:44 +0000 (12:43 +0100)]
cri-args-hostlists: Add some calls to date(1)

This will make it easier to see perf changes etc.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agoduration_estimator: Clarify recentflights query a bit
Ian Jackson [Fri, 31 Jul 2020 10:43:55 +0000 (11:43 +0100)]
duration_estimator: Clarify recentflights query a bit

The condition on r.job is more naturally thought of as a join
condition than a where condition.  (This is an inner join, so the
semantics are identical.)

Also, for clarity, swap the flight and job conditions round, so that
the ON clause is a series of r.thing = otherthing.

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reviewed-by: George Dunlap <George.Dunlap@citrix.com>
---
v3: Fix daft syntax error.
v2: New patch.

4 years agocs-bisection-step: Lay out the revision tuple graph once
Ian Jackson [Fri, 24 Jul 2020 18:27:28 +0000 (19:27 +0100)]
cs-bisection-step: Lay out the revision tuple graph once

The graph layout algorithm is not very fast, particularly if the
revision graph is big.  In my test case this saves about 10s.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v2: New patch.

4 years agocs-bisection-step: Add a debug print when we run dot(1)
Ian Jackson [Fri, 24 Jul 2020 18:24:37 +0000 (19:24 +0100)]
cs-bisection-step: Add a debug print when we run dot(1)

Amongst other things this was useful for perf investigation.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v2: New patch.

4 years agoSQL: Change LIKE E'...\\_...' to LIKE '...\_...'
Ian Jackson [Mon, 27 Jul 2020 11:43:45 +0000 (12:43 +0100)]
SQL: Change LIKE E'...\\_...' to LIKE '...\_...'

E'...' means to interpret \-escapes.  But we don't want them: without
E, we can avoid some toothpick-doubling.

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v2: New patch.

4 years agocs-bisection-step: temporary table: Insert only rows we care about
Ian Jackson [Fri, 24 Jul 2020 18:13:22 +0000 (19:13 +0100)]
cs-bisection-step: temporary table: Insert only rows we care about

Every use of this table has a WHERE or ON which invokes at least one
of these conditions.  So put only those rows into the table.

This provides a significant speedup (which I haven't properly
measured).

No overall functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v2: New patch.

4 years agocs-bisection-step: Use db_prepare a few times instead of ->do
Ian Jackson [Fri, 24 Jul 2020 18:03:40 +0000 (19:03 +0100)]
cs-bisection-step: Use db_prepare a few times instead of ->do

With $dbh_tests->do(...), we can only get a debug trace of the queries
by using DBI_TRACE which produces voluminous output.  Using our own
db_prepare invokes our own debugging.

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v2: New patch.

4 years agocs-bisection-step: Break out qtxt_common_ok
Ian Jackson [Fri, 31 Jul 2020 11:06:41 +0000 (12:06 +0100)]
cs-bisection-step: Break out qtxt_common_ok

Make this bit of query into a subref which takes a $table argument.

No change to the generated query.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v2: New patch.

4 years agocs-bisection-step: Move an AND
Ian Jackson [Fri, 31 Jul 2020 11:06:38 +0000 (12:06 +0100)]
cs-bisection-step: Move an AND

This obviously-fine change makes the next commit easier to review.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v2: New patch.

4 years agocs-bisection-step: Generalise qtxt_common_rev_ok
Ian Jackson [Mon, 27 Jul 2020 11:22:51 +0000 (12:22 +0100)]
cs-bisection-step: Generalise qtxt_common_rev_ok

* Make it into a subref which takes a $table argument.
* Change the two references into function calls using the @{...} syntax
* Move the definition earlier in the file

No change to the generated query.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v2: New patch.

4 years agoadhoc-revtuple-generator: Fix an undef warning in a debug print
Ian Jackson [Fri, 24 Jul 2020 18:09:04 +0000 (19:09 +0100)]
adhoc-revtuple-generator: Fix an undef warning in a debug print

$parents might be undef here.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
New in v2.

4 years agosg-report-host-history: Fork
Ian Jackson [Fri, 24 Jul 2020 16:02:57 +0000 (17:02 +0100)]
sg-report-host-history: Fork

Run each host's report in a separate child.  This is considerably
faster.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-host-history: Drop a redundznt AND clause
Ian Jackson [Fri, 24 Jul 2020 16:17:24 +0000 (17:17 +0100)]
sg-report-host-history: Drop a redundznt AND clause

This condition is the same as $flightcond.  (This has no effect on the
db performance since the query planner figures it out, but it is
confusing.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-host-history: Rerganisation: Change loops
Ian Jackson [Fri, 24 Jul 2020 15:52:10 +0000 (16:52 +0100)]
sg-report-host-history: Rerganisation: Change loops

Move the per-host code all into the same per-host loop.  One effect is
to transpose the db_retry and host loops for mainquery.

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-host-history: Rerganisation: Read old logs later
Ian Jackson [Fri, 24 Jul 2020 15:51:28 +0000 (16:51 +0100)]
sg-report-host-history: Rerganisation: Read old logs later

Perhaps at one point something read from these logs influenced the db
query for thye flights range, but that is no longer the case and it
doesn't seem likely to need to come back.

We want to move the per-host stuff together.

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-host-history: Rerganisation: Make mainquery per-host
Ian Jackson [Fri, 24 Jul 2020 15:50:07 +0000 (16:50 +0100)]
sg-report-host-history: Rerganisation: Make mainquery per-host

This moves the loop over hosts into the main program.  We are working
our way to a new code structure.

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
4 years agosg-report-host-history: Do the main query per host
Ian Jackson [Fri, 24 Jul 2020 15:11:49 +0000 (16:11 +0100)]
sg-report-host-history: Do the main query per host

In f6001d628c3b3fd42b10cd15351981a04bc02572 we combined these
queries into one:
  sg-report-host-history: Aggregate runvars query for all hosts

Now that we have an index, there is a faster way for the db to do this
query: via that index.  But it doesn't like to do that if be aggregate
the queries.  Experimentally, doing this query separately once per
host is significantly faster.

Also, later, it will allow us to parallelise this work.

So, we undo that.  (Not by reverting, though.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v2: Use proper \ escaping for underscores in LIKE