-
Notifications
You must be signed in to change notification settings - Fork 28
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
Commit or rollback a connection pool #218
Comments
First of all, apologies for the delay in my response. (Life's been crazy lately.) I'll be honest, in my own personal experience, I've kept all of my own SQL very simple (extremely simple), My background is more in being a D guy than an SQL guy. Some years ago I ended up assuming the role of maintainer for this library simply because it was, and continues to be, very important to me, my other projects and (IMHO) the D ecosystem in general. Each previous maintainer had gradually, individually left due to various larger commitments, so I was left with a choice: assume the maintainer role myself, or let a library I absolutely rely on go under. So when it comes to SQL and databases, I'm pretty much a "pointy-haired boss" doing the best I can to avoid being a Dilbertian "pointy-haired boss". Probably most of what I know about SQL and MySQL/MariaDB comes directly from my various experiences maintaining this lib, and contributions from others. Because of that, I rely very heavily on outsiders such as yourself for SQL/database expertise. So, based on my extremely limited transaction experience, this use-case you bring up sounds potentially reasonable on the surface to me, but I feel that I lack enough direct experience with transactions in SQL to really be able to make a valid call. Honestly, this is the first time I've come across the idea of calling commit/rollback on all connections (as opposed to just one connection) so I'm really not sure what to make of it, or whether or not to simply blame it on my own inexperience. (Pinging @schveiguy and @sludwig for input on this. Anyone else to ping?) If you have any relevant links to point me to or further direct input or rationale, that would be helpful, too. What I can tell you is this: Right now, this lib's connection pool class has a hook named If others agree this is a useful and valid need, then we could certainly add functionality to |
I too have never used multiple connections for a single transaction. However, if you have a recent vibe-core, there is a mechanism in Vibe's connection pool to close all unused connections. We wrap this but do not call commit on any of them when closing. See https://github.com/mysql-d/mysql-native/blob/master/source/mysql/pool.d#L459-L470 It might be possible to either expose this functionality from vibe's connectionpool directly, or to accept a delegate handler that you can provide. Note that this only operates on connections that are allocated but not locked. But I think this is your use case, right? In other words, the mechanism is there, but just not exposed in a way that allows you to do what you want. If you can propose a PR to expose it, I can take a look. |
If anyone wants to work on this, I'll consider it, but it's not a high priority. So it likely won't get fixed by me. |
I'm trying to use manual commit / rollback with a MySQL connection pool, but I can't find a reasonable way to send the "COMMIT" / "ROLLBACK" statements to all used connections in the pool.
Is there something I'm missing?
I'm willing to send you a PR if we agree on a simple solution ;)
The text was updated successfully, but these errors were encountered: