dhiaayachi / temporal

Temporal service
https://docs.temporal.io
MIT License
0 stars 0 forks source link

schema checks at server start #122

Open dhiaayachi opened 2 months ago

dhiaayachi commented 2 months ago

The server should quit early if the Persistence Store database has a mismatched schema. Ideally, there'd be a check when the server initially connects to the database. Logging an error for a schema mismatch for the Visibility Store would also be valuable telemetry.

If this has already been implemented please go ahead and close. Otherwise if there's interest I'd be happy to take this on.

dhiaayachi commented 1 month ago

Server should quit early if the Persistence Store database has a mismatched schema.

This issue proposes that the Temporal server should exit early if it detects a schema mismatch with the Persistence Store database. Ideally, this check would occur when the server initially connects to the database. Additionally, logging an error for a schema mismatch for the Visibility Store would provide valuable telemetry.

This feature would improve server stability and prevent potential issues related to database schema mismatches.

Here's a breakdown of the proposal:

1. Early Exit on Schema Mismatch:

2. Logging Schema Mismatch Errors:

3. Implementation:

4. Benefits:

5. Existing Implementation:

6. References:

7. Next Steps:

This proposal aims to enhance the reliability and stability of the Temporal server by detecting and addressing schema mismatches with the Persistence Store and Visibility Store.

dhiaayachi commented 1 month ago

Thank you for the feature request! We appreciate you taking the time to share your idea with us.

While we don't currently have this feature, we think it would be valuable to ensure schema consistency and provide better telemetry.

For now, you can manually check the schema by using the temporal-sql-tool to query the database, and use the server logs to monitor for schema mismatches.

We will consider this for a future release.

dhiaayachi commented 1 month ago

Thank you for the feature request! It would be helpful to have the server quit early if there is a database schema mismatch. Currently, Temporal has no mechanism to automatically detect schema mismatches and gracefully shut down the server.

One way to work around this limitation is to add a step to your deployment process that performs a schema validation check before starting the Temporal Server. You can use a tool like temporal-sql-tool to compare your database schema with the expected schema provided in the Temporal repository.

We appreciate you bringing this to our attention and will consider adding schema validation functionality in future releases.

dhiaayachi commented 1 month ago

Thanks for reporting this issue! It's a great idea to have the server quit early if a schema mismatch is detected in the persistence store. Currently, Temporal doesn't have this feature, but you can manually check for schema mismatches by using temporal-sql-tool and comparing the current schema with the schemas found in the schema directory.