Em terça-feira, 23 de outubro de 2012 22h04min13s UTC-2, Rodrigo Rosenfeld Rosas escreveu: > > Em terça-feira 23 outubro 2012, às 20:28:47, Jeremy Evans escreveu: > > On Tuesday, October 23, 2012 9:09:25 AM UTC-7, Jeremy Evans > wrote: > > > On Monday, October 22, 2012 6:20:41 PM UTC-7, Rodrigo > Rosenfeld Rosas > > > > > > wrote: > > >> Em segunda-feira, 22 de outubro de 2012 19h34min26s UTC-2, > Jeremy Evans > > >> > > >> escreveu: > > >>> On Monday, October 22, 2012 11:47:29 AM UTC-7, Rodrigo > Rosenfeld Rosas > > >>> > > >>> wrote: > > >>>> I had to restart the PostgreSQL service in our database > server and the > > >>>> Rails apps using Sequel stopped working. > > >>>> > > >>>> Is there a way to instruct Sequel to try to reconnect on such > cases? > > >>>> One > > >>>> that works both for MRI and JRuby? > > >>> > > >>> Sequel should be removing the connections from the pool, > reraising the > > >>> exceptions, and creating new connections as needed in the > future. So > > >>> it's expected that some DatabaseDisconnectErrors will be > raised, but > > >>> Sequel should recover, assuming that it correctly recognizes > the > > >>> disconnections (which it should on the postgres and > jdbc/postgres > > >>> adapters). If that isn't what you experienced, please try to put > > >>> together a reproducible test case and I'll take a look. > > >> > > >> But this is a problem for our setup as we have a cluster with a > dozen > > >> servers and there will be as many reported errors as there are > servers > > >> in the cluster and all of them end up in our SLA errors log which > > >> affects our contract :( > > >> > > >> Is there a way of just instructing Sequel to query something like > > >> "select 1" before attempting to use the connection? Hibernate > has an > > >> option to do so and it works. Our application is a mix of a Grails > and > > >> a Rails app. We only had to restart the Rails servers of the > cluster as > > >> the Grails ones that used Hibernate with this option enabled > didn't > > >> experience any issues. > > >> > > >> We'd like to be able to do something like with Sequel as well. > > >> > > >> Would that be possible? > > > > > > It's actually something I'm planning to implement as a extension > very > > > soon. The recently committed refactoring of the database <-> > connection > > > pool interface is the first step, I need to add code to check > connections > > > for validity and then an extension that automatically checks > connections > > > for validity when they are checked out from the pool. > > > > The code to check connections for validity has been pushed. I have > the > > extension that automatically checks connections for validity on pool > > checkout written and apparently working based on the integration- > level > > tests, but I still need to add documentation and extension-level > tests. I > > expect that the extension will be pushed to the master branch > sometime > > tomorrow. > > Wow! This is really great news! Thank you so much! >
By the way, I hope this will help me with another issue I'm having. Yesterday I had to restart the Rails apps because of EBADF (Bad File Descriptor) errors in a Sequel line like "User[id]". For some reason we're having some troubles with our connection to the PG server even when we don't restart the server. :( -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/sequel-talk/-/RFrvDDVgKHEJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
