-
Notifications
You must be signed in to change notification settings - Fork 125
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
InvalidDatabaseSchema error on RailsEventStoreActiveRecord::EventRepository #644
Comments
Can you tell me the output of following in rails console?
|
Btw. schema verification only runs when EventRepository is initialized: |
We've added Rails 6.0.0.rc1 to test matrix. Without further knowledge on columns or how the involved components (client, repository) are initialized and possibly reloaded (as this is a problem in development env so far) I cannot help more. Please reopen in case of new information. |
@pawelpacana It seems to happen on |
When the error occurs on app reload (dev mode), I checked the following:
The DB schemas definitely don't change in between code reloads, so something must be off here. |
Hi @pawelpacana Based on the column checks here: I noticed that
The column checks seem to be tripping up here based on the index order. Thoughts? |
I forgot that we recommend to define RES client as: Rails.configuration.to_prepare do
Rails.configuration.event_store = RailsEventStore::Client.new
...
end This Why would the columns be returned in a different order remains a question. Btw. what database do you use in development, Postgres? |
@pawelpacana We are using Postgres 9.6. There seems to be 2 issues. First, correct schema verification relies on order-dependent column comparison, and for whatever reason, ActiveRecord/PG column metadata doesn't seem to have predictable ordering. Second,
it will simply pass and no exception is raised. On production, this codepath is never re-executed so there is no further schema checks made. To fix the column check, how about using something like:
Let me know what you think. And thanks again for being super helpful on this. |
I tried to reproduce the case with different column order. I did not manage to observe it in my timebox on Rails 6 + Postgres 11, on a new app. I do however agree we should not depend on order here. To add some background — schema verifier was quite important when we were changing database schema around v0.18.2. Nowadays not much and I'm leaning towards removing it completely.
That could have changed across Rails versions. We've had an issue in the past (#464) where |
I've just released https://github.com/RailsEventStore/rails_event_store/releases/tag/v0.41.0 that lacks this schema verification mechanism. I hope that helps in 🙂 |
We recently upgraded to the latest version of RES (0.40.1) running on Rails 6.0.0.rc1. Things generally work OK, but very intermittently, we will see the following 500 Internal Server Error from client API requests:
which seems to be stemming from
Note: we've so far only seen this in development -- so not sure if there's some development specific setting that could trigger this, but it's unclear at the moment.
Has anyone seen this before? Strange how it would complain about DB schema integrity.
The text was updated successfully, but these errors were encountered: