This page is for Importer admins to document how to perform various tasks with the installer in production.

Overview

The importer is a few separate processes:

and a few helper scripts:

Architecture

mass-import runs all the time to do the dispatching, for which it starts up new processes to get a process boundary to catch all types of failures (it can notice a python segfault). It is looping and when there is a free slot it either starts the highest priority job, or runs an idle task, or sleeps. import_package.py then works out what it has to do on a package, and performs anything it has to do, if anything.

mass-import uses a lock to ensure it is single instance, and import_package.py uses locks to ensure only one is running at any moment for any package.

They are designed to recover from complete failure, so it is safe to kill them at any time. When restarted mass-import will start jobs for any packages it was part-way through when killed. Every time import_package.py is run for a package it checks for half-finished imports on the local disk, and either blows them away, or continues them, depending on what stage was reached. It uses a three-phase commit procedure to allow this.

The only problem with this comes when e.g. bzr makes half a .bzr on LP and is then killed. In those cases some manual intervention will be required when the package later fails with an error pointing to that.

There is a polite way to stop the processes though, see below.

Getting in

The importer runs on jubany, under the pkg_import user (sudo su - pkg_import).

It is rooted in /srv/package-import.canonical.com/new/, with the scripts imaginatively placed in the "scripts" directory.

Tasks

Starting and stopping

NOTE: there are currently some issues with stopping when requested, due to children hanging and not being killed. If that happens then killing the children (import_package.py processes) should fix it, and if the main process still runs it can be killed directly.

Retrying failures

Bumping priority

Catching missed uploads

Updating the code

Investigating collisions

If there is a collision that you believe is spurious you will have the following things:

Looking at where the branches diverged and the last revision on the saved branch you can infer what state the branches were in when the collision happened. You can cross reference this with the log file to see the trace of what happened. Search for "Collision for <version number> <suite>" in the log file to find where it reported the problem. You can also search for "import .*<version number>" to see all the times it tried to import that version.

The line that tells you about the collision will tell you what revids it expected the tags to be at, and working from that you can get some idea of where the mistake may have happened.

There's no fixed way to work out what went wrong, as it is usually a new bug that causes spurious collisions, and often that bug was in the way the data was stored, rather than the way it is being interpreted now.

Setting a branch as official

Sometimes you want to set another branch as official (e.g. where it is a packaging branch that predates UDD) this process is currently rather convoluted (but should be a rare operation.

First remove all the links for the package

(set_official.py is in lp:udd)

Then set the new branch:

Then ssh to the import machine and clear the audit information in the db, as it will all be invalid now:

If nothing looks amiss:

Kick off an import to have the importer make friends with the new branch

Then watch for the result to see what happens.

Adjusting number of parallel imports

To adjust the number of parallel imports at runtime you can change the number in a file

where N is the number of threads that you want. Going much above 8 is not advised as it has been known to cause issues for Launchpad codehosting (though that may have been due to a bug in the importer causing it to not re-use existing connections). Obviously 0 is not a good number of threads to request. -1 would be even worse.

This will not kill any imports in progress, just avoid starting any new ones until there is a free slot, so it may take some time before you see the effect

Getting some numbers and timing from the logs

The progress_log[.N] files contains a lot of output from the imports and since they run in parallel it may be hard to analyse for some sort of analysis at least

will gives some overall timings for the importer driver/controller and the individual imports. If some process crosses the log file boundary, the times are approximated and prefixed with '<' or '>'.

Common Issues

When maintaining the importer, there are some failures that are known, and how you should handle them. DistributedDevelopment/UnderTheHood/Importer/CommonFailures

DistributedDevelopment/UnderTheHood/Importer/Operational (last edited 2011-02-18 17:55:39 by lec67-4-82-230-53-244)