Sarah Hoffmann [Thu, 25 Feb 2021 16:36:31 +0000 (17:36 +0100)]
improve deadlock detection for various versions of psycopg2
Psycopg2 has changed the kind of exception that is emitted on
deadlocks between versions 2.7 and 2.8. The code was already
trying to catch both kind of errors but because the
psycopg2.errors package is unknown in 2.7 and below, the
code would throw an exception on anything but a deadlock error.
This commit wraps the deadlock handling into a context manager
to avoid code duplication and uses module imports to detect if
the new error codes are available.
Also sets the required psycopg2 version to 2.7 or bigger as
versions below are difficult to test.
Sarah Hoffmann [Tue, 16 Feb 2021 14:05:14 +0000 (15:05 +0100)]
disable JIT and parallel execution for osm2pgsql updates again
The gazetteer output doesn't disable these functions when
writing to the place table but the triggers may contain
operations that cause misplanning for the query planner.
Sarah Hoffmann [Tue, 16 Feb 2021 16:47:06 +0000 (17:47 +0100)]
increase penalty for places without housenumber
Results where the housenumber was dropped are an unlikely result
when they refer to something other than a street. Therefore
increase their result rank so that other matches are tried first
before choosing them as a result.
Sarah Hoffmann [Tue, 9 Feb 2021 20:04:42 +0000 (21:04 +0100)]
add make install target
Installation includes PHP andPython libraries, settings, the basic
country data, the postgresql module and our custom version of
osm2pgsql. The latter is installed in our private library directory
so that it does not get in the way of a potentially installed
osm2pgsql from the distribution.
Sarah Hoffmann [Tue, 9 Feb 2021 19:04:08 +0000 (20:04 +0100)]
use DataDir constant for data only
So far the data directory constant has pointed to the source
directory to be usable with different subdirectories. Now only
the data subdirectory itself is being used with the constant,
so point to the directory directly.
Sarah Hoffmann [Tue, 9 Feb 2021 17:45:45 +0000 (18:45 +0100)]
introduce constant for configuration directory
This replaces {data_dir}/settings throughout the code, so that
the configuration may be placed somewhere else in the directory
structure (e.g. in /etc).
Sarah Hoffmann [Mon, 8 Feb 2021 10:48:45 +0000 (11:48 +0100)]
move postcode table setup to sql/
Also moves the call to the setup from the setup-db
step to the calculate-postcodes step. The tables also need
no longer be accessible by the webservice.
Sarah Hoffmann [Thu, 4 Feb 2021 10:47:11 +0000 (11:47 +0100)]
reintroduce timeout for replication file download
This ports the --socket-timeout parameter from
pyosmium-get-changes which ensures that the update
process eventually times out on hanging network connections.
Sarah Hoffmann [Wed, 3 Feb 2021 15:17:46 +0000 (16:17 +0100)]
replace make serve with nominatim serve command
With the website directory now tied to the project directory instead
of the build directory, it is no longer possible to use make for
running the web server.
Increasing the splitting results in geometries where with rounding
issues at the split points, so that contain operations do not
work as expected anymore.
Sarah Hoffmann [Tue, 2 Feb 2021 16:33:41 +0000 (17:33 +0100)]
do not overwrite custom set module paths
Given that the module is now copied to the project directory
when no module path is set, we need the information that the
module path is empty. Therefore hand in the default module path
in a separate variable.
Sarah Hoffmann [Tue, 2 Feb 2021 09:20:05 +0000 (10:20 +0100)]
copy database module on install
When no explicity database module is configured, then the
module is now copied into the project directory and used from
there. This means that Nominatim can be updated to a new
version of the module while existing installation keep their
version of normalisation.
Sarah Hoffmann [Sat, 30 Jan 2021 15:20:10 +0000 (16:20 +0100)]
introduce custom UsageError
This is a exception to be thrown when the error occures because
of bad user data. We don't want to print a full stack trace in
these cases but just tell the user what went wrong.
Sarah Hoffmann [Sun, 24 Jan 2021 13:35:35 +0000 (14:35 +0100)]
convert functon creation to python
The new functions always creates normal and partitioned functions.
Also adds specialised connection and cursor classes for adding
frequently used helper functions.
Sarah Hoffmann [Thu, 21 Jan 2021 09:19:38 +0000 (10:19 +0100)]
cli: import python modules for commands on demand
Given that only one command will be executed in the end, it is
not necessary to import what amounts to the whole library. This
becomes in particular important for update functions that have
a dependency on pyosmium. The dependency can remain optional for
people not using updates.