FailoverConnectionPlugin SessionStateTransferCallable capability #766
-
hi -- We are trying to validate the SessionStateTransferCallable configuration It looks like SessionStateTransferCallable is called only by switchCurrentConnectionTo(), which requires a non-null value for this.pluginService.getCurrentConnection() in order to call transferSessionState() to copy properties from the old connection to the new. But switchCurrentConnectionTo() is only actually called when this.pluginService.getCurrentConnection() is null. This, I think, means switchCurrentConnectionTo() will never call transferSessionState() to copy properties from the old connection to the new. As a result the failover just always goes through failoverReader() or failoverWriter(), which functionally does recover, but the switchCurrentConnectionTo() path is never taken, as far as I can tell -- Am I reading this correctly? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Hello @scott-long-adp, As you have mentioned, SessionStateTransferCallable transfer connection properties when switchCurrentConnectionTo() is called. switchCurrentConnectionTo() is usually called when pickNewConnection() is called, and a the new connection then gets all its properties transfered. Meanwhile, RestoreSessionStateCallable will set locally stored properties in a new connection during a writer or reader failover, when failoverReader() and failoverWriter() is called and when the original connection is lost. One of the questions here on whether they should both transfer the same set of attributes, is what are the attributes do we believe the driver should keep track internally in the case of a change in a connection. Could you provide a more in-depth description of your use case so we could better understand which properties you might want to carry over through connections. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hello @scott-long-adp, Thank you for reporting this issue. We might have to look a bit back into it to figure out how both functions are working and whether there is an issue with the connection switch. We have opened an internal investigation on that and will keep you updated about it. Thanks! |
Beta Was this translation helpful? Give feedback.
-
I found this all a bit confusing, as well. It's worth pointing out that this has since had a significant refactor. My use case was that I am using the aws-advanced-jdbc-wrapper with HikariCP and have an initial session state configured to be applied for all connections in the pool (e.g. I might have an initialization query that sets a max execution time for connections in a read pool), but the wrapper does not keep track of all relevant session state changes. I suspect this is the more common use case for most folks. If you have some bit of session state that you're not setting at initialization and for the lifetime of the connection or that you expect to live beyond the scope of a single transaction (which won't live across a failover anyways) I'd suspect that to be a fairly exotic use case? Initially I thought I may need to use the new |
Beta Was this translation helpful? Give feedback.
Hello @scott-long-adp,
Thank you for reporting this issue. We might have to look a bit back into it to figure out how both functions are working and whether there is an issue with the connection switch. We have opened an internal investigation on that and will keep you updated about it.
Thanks!