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

"Fix: Improved Schema Version Validation and Error Handling" #158

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Manas-Dikshit
Copy link

This Pull Request addresses an issue where executing Osmosis v0.48.3 on macOS throws a schema version mismatch error:

pgsql
Copy
Edit
SEVERE: Thread for task 1-read-pbf failed
org.openstreetmap.osmosis.core.OsmosisRuntimeException: The database schema version of 5 does not match the expected version of 6.
at org.openstreetmap.osmosis.pgsnapshot.common.SchemaVersionValidator.validateDBVersion(SchemaVersionValidator.java:67)
The root cause of this issue was that the database schema version defined in pgsimple_schema_0.6.sql was set to version 5 instead of the expected version 6.

🛠️ Changes Made
Updated Schema Validation Logic:

Modified the SchemaVersionValidator class to correctly compare the schema version from the schema migrations table with the expected version.
Improved error handling to provide clearer and more actionable feedback when there’s a mismatch.
Enhanced Error Messages:

Added detailed suggestions to help users resolve version conflicts, including hints for upgrading the schema or disabling strict validation.
Resource Management Improvements:

Utilized Java’s AutoCloseable interface for better resource handling during database connections and queries.
✅ How to Test the Fix
Run Osmosis with the updated schema version.
Verify that the tool no longer throws version mismatch errors.
Ensure smooth execution of tasks like reading .pbf files without breaking existing functionality.
🔍 Related Issue
Closes #5935

📈 Impact of the Fix
Prevents schema version mismatch errors during execution.
Provides clearer guidance for users facing version-related issues.
Improves stability and maintainability of the schema validation process.
🙏 Additional Notes
I am open to feedback and ready to make any necessary adjustments based on the review.

"Fixed schema version mismatch issue with clearer resolution guidance."
@brettch
Copy link
Member

brettch commented Mar 1, 2025

Hi there. How did you install the postgresql schema? It looks like you've only run the scripts up to version 5 of the schema. Have you run the version 5-6 upgrade script?

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.

2 participants