Repository navigation
Description
We cannot add CH preparations to an existing graph folder. However, this does work for LM preparations. I'd like to get rid of this asymmetry. There are three levels to support this kind of 'delta import' that I can think of:
- Do not allow adding anything to an existing graph folder. This is the simplest approach, but also the most frustrating one for users. To change anything about the preparations one needs to remove the graph folder and run the import again.
- Allow adding CH (LM) preparations to an existing graph folder, but only as long as there are no CH (LM) preparations.
- Allow adding CH (LM) preparations no matter whether there are some already or not.
Currently we support 3) for LM (we can just add more LM preparations), but under no circumstances can we add CH preparations.
I would not have mentioned 2) if there weren't these prepare.ch/lm.done flags in the properties file. These flags imply that LM or CH preparation is either "done" or not, so adding preparations would only be possible if there weren't any others yet (case 2)). However, the flag for LM is only written, but never read. The flag for CH is written and read, but I think before it is read adding CH preparations already fails in checkIfConfiguredAndLoadedWeightingsCompatible() which checks the graph.ch.profiles field of the properties file during GraphHopperStorage#loadExisting.
We also have these version flags like graph.profiles.car.version=-1833937352, which, are used for LM and CH and overwrite each other:
graphhopper/core/src/main/java/com/graphhopper/GraphHopper.java
Lines 1057 to 1060 in e82ca45
| for (LMProfile profile : lmPreparationHandler.getLMProfiles()) { | |
| // potentially overwrite existing keys from CH | |
| setProfileVersion(profile.getProfile(), profilesByName.get(profile.getProfile()).getVersion()); | |
| } |
I think we should just use graph.profiles.ch/lm.car.version (store one separate version hash for each CH and LM preparation, if not just store the actual profile) instead of graph.profiles.car.version that is currently used for both CH and LM. We should also remove prepare.lm.done because it is never read anyway and then we should also remove prepare.ch.done so we can add CH preparations just like LM. graph.ch.profiles we should also just get rid of.
Here is a little todo list:
- decide whether or not we want to support this whole idea of 'delta imports' -> we do
if yes:
- remove
prepare.lm.donebecause it is not used anyway - replace
graph.profiles.car.versionwithgraph.profiles.ch.car.versionandgraph.profiles.lm.car.version - remove
prepare.ch.doneand usegraph.profiles.ch.car.versioninstead - get rid of
graph.ch.profilesand no longer require adding CHs toGraphHopperStoragebefore the CH preparation - maybe store the actual profiles instead of the version hashs for each preparation so we can load each preparation without providing the original profile that was used during import
I think adding CH preparation to an existing folder can come in handy, but the main reason I ran into this issue is that all these prepare flags unecessarily entangle the code in GraphHopper, CH/LMPreparationHandler and GraphHopperStorage and make it hard to separate import and loading code (c.f. #1895).
Activity
Remove `prepare.lm.done` from properties file
michaz commentedon Nov 11, 2021
+1 This would be (long-term) super-useful for transit.
easbar commentedon Dec 8, 2021
Fixed by #2481