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
ERROR 'version-already-applied' in logs even when I start with a new database #80
Comments
I'm confused. I've just tried it and it works perfectly within docker. No issues at all. |
Sorry for the delay! I wasn't able to build the example you provided ( Oh, this is interesting... depending on the state of my system (image/layer caches? db state?), I get different results! Sometimes it shows nothing:
Sometimes it shows just the latest version warning:
And sometimes I can get it to show all version warnings! Usually if I restart the service...
|
I understand now why the schema code is running multiple times (app restarts, for example). I wonder if it's necessary to use |
Is it really necessary to https://www.postgresql.org/docs/current/static/plpgsql-errors-and-messages.html |
IMHO, yes. In that documentation link you provided there is a sentence:
|
It is an exception so that it aborts the rest of the script. And also the exception gets handled here: https://github.com/frankhommers/Hangfire.PostgreSql/blob/0085a3fe1fb9b02ebf4c245f7b1a0b7521ae74a5/src/Hangfire.PostgreSql/PostgreSqlObjectsInstaller.cs#L91 It would take a lot more changes than the ones in your pull request to fix this. |
I'm seeing this same When just running without the debugger, it all seems to run fine and after inspection the schema tables contains the version value 10. However, when running with the debugger, it manages to create the hangfire schema but throws an exception. After inspection the schema tables contains only the version value 7 so it seems to be breaking somewhere after logging I appreciate this isn't lots of information but any ideas as to the what the problem is? Using Hangfire.Core 1.6.25, Hangfire.AspNetCore 1.6.25 and Hangfire.PostgreSql 1.6.0 (but was also happening with Hangfire.PostgreSql 1.5.0) |
The exceptions are handled, so the debugger might trigger, but you can just continue. |
Ah yes, you're right! Turning off JetBrains Rider's "Break on user-unhandled exception" setting fixed my issue 👍 |
What should we do now? Since throwing exceptions were part of the design. |
I'm still of the mind that "version already applied" is a normal situation and should not pollute my service logs with exceptions. If I get some time, I can try to address the deeper workflow problem (this is why they say "don't use exceptions for control flow") |
You are free to rewrite the scripts so that they exit early and do not continue when the version is already applied without exceptions. A PR for this is welcome. Just changing Inspiration can be found here: https://github.com/HangfireIO/Hangfire/blob/master/src/Hangfire.SqlServer/Install.sql |
I fixed it myself. Will be in the next release. |
I have an ASP.NET Core application with HangFire + PostgresSQL.
The application and database are running in separate Docker containers, coordinated with a simple Docker Compose manifest.
Even if I start the system from scratch, I see all of these "install" ERRORs.
I definitely don't want to see ERRORs in my runtime log if nothing is actually wrong.
The text was updated successfully, but these errors were encountered: