Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce global persistent database properties #582

Merged
merged 6 commits into from
Jun 1, 2021

Conversation

lonvia
Copy link
Collaborator

@lonvia lonvia commented May 31, 2021

With this change import settings can be saved in the database and retrieved at update time and when running the server. The settings are saved in a document with a special ID in an non-indexed field. They can only be retrieved via the ID or matchAll(). Currently two properties are saved: database version and language settings.

With the database version it is now possible to check that the right version of Photon is used against the database. If we have incompatible changes to the mapping schema in the future then Photon will refuse to run when software version and database version do not match.

The language settings are saved so that it is no longer necessary to supply the '-language' parameter each time Photon is started in server mode. The server will simply use the settings from the import. '-language' can still be used to reduce the set of available languages. It is no longer possible to add a language that was not imported. When running updates from the command line then the '-language' parameter is ignored completely and the database setting used.

This PR also removes the `-recreate-index' command line option. It is not very useful anymore as the import will always start with wiping the database now. If somebody was still using this command, please shout.

All of the command line arguments that are handed into the Server
class are used in exactly one function. Instead of saving them as
a class member, hand them in, when they are actually needed.
This operation is not really needed anymore as a new index gets
automatically created when a new import is started.

Fixes komoot#383.
These properties describe settings of the Photon database that
need to remain stable between import, update and application runs.

At the moment, there are two properties available: the current
version of the database and the languages used during import.
When running photon for updates or as a server, the language
settings from the database are used. That means it is no longer
necessary to supply the language parameter.
@lonvia lonvia merged commit 6b674bd into komoot:master Jun 1, 2021
@lonvia lonvia deleted the persistent-database-properties branch June 1, 2021 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant