Skip to content

Improvments for startup and shutdown#926

Merged
lonvia merged 4 commits intokomoot:masterfrom
lonvia:proper-shutdown
Jul 19, 2025
Merged

Improvments for startup and shutdown#926
lonvia merged 4 commits intokomoot:masterfrom
lonvia:proper-shutdown

Conversation

@lonvia
Copy link
Collaborator

@lonvia lonvia commented Jul 18, 2025

On startup, Photon will now only create the database directory when in import mode. In all other mode if expects the directory to be existing and will bail out if it cannot be found. This should make it easier for users to understand the error when they have downloaded the wrong index dump (ElasticSearch vs. OpenSearch). OpenSearch makes an exception when using an external OS instance. The data directory will be ignored in this case. The situation is slightly different for ElasticSearch because it still needs to copy in the painless plugin.

On shutdown, Photon now catches when the API is stopped via Ctrl-C or similar and properly shuts down the node first when running with an internally started database. I've seen very rare cases of database corruption in the past. Proper shutdown hopefully solves those.

cursor[bot]

This comment was marked as outdated.

@lonvia
Copy link
Collaborator Author

lonvia commented Jul 18, 2025

Sure. And when we don't do this else-if, we have potentially esServer.close() being called concurrently from two different threads. Fun, isn't it?

@lonvia lonvia force-pushed the proper-shutdown branch from aef843e to db721b1 Compare July 18, 2025 08:20
@lonvia
Copy link
Collaborator Author

lonvia commented Jul 18, 2025

Alright, version with proper thread-safe shutdown of esServer. There might still be some odd errors in the log messages if Javalin is trying to server last requests while esServer is already in shutdown mode but that should be recoverable.

@lonvia lonvia merged commit d9d1e41 into komoot:master Jul 19, 2025
5 checks passed
@lonvia lonvia deleted the proper-shutdown branch July 19, 2025 20:27
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