You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Better transaction management with MVCC in golang
#9634
Right now, I need to use BEGIN CONCURRENT for multiple connection to write at the same time, so when I am using the sql.DB struct in golang, I cannot use the BeginTx method to create a new transaction, as it is running BEGIN instead of BEGIN CONCURRENT. If I want multiple writer right now, I need to create a new connection, run BEGIN CONCURRENT and manage the transaction along with the connection manually.
If I can set journal_mode (and other PRAGMA options) in the connection string, then if the journal_mode is mvcc, BeginTx start a transaction with BEGIN CONCURRENT, otherwise start with BEGIN. This way I can manage the transaction with just Tx easily, like other database engine, as it gets a connection and start a new transaction automatically.
Another way to achieve the same goal could be a boolean PRAGMA option to start concurrent write with just BEGIN, this could also works but I think the first one is more intuitive.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Right now, I need to use
BEGIN CONCURRENTfor multiple connection to write at the same time, so when I am using thesql.DBstruct in golang, I cannot use theBeginTxmethod to create a new transaction, as it is runningBEGINinstead ofBEGIN CONCURRENT. If I want multiple writer right now, I need to create a new connection, runBEGIN CONCURRENTand manage the transaction along with the connection manually.If I can set
journal_mode(and otherPRAGMAoptions) in the connection string, then if thejournal_modeismvcc,BeginTxstart a transaction withBEGIN CONCURRENT, otherwise start withBEGIN. This way I can manage the transaction with justTxeasily, like other database engine, as it gets a connection and start a new transaction automatically.Another way to achieve the same goal could be a boolean
PRAGMAoption to start concurrent write with justBEGIN, this could also works but I think the first one is more intuitive.All reactions