transactions

SELECT FOR UPDATE holding entire table in MySQL rather than row by row

让人想犯罪 __ 提交于 2020-07-19 07:07:20
问题 I will have multiple clients entering data into a database and I must ensure that the transactions do not get intermingled. I read in the documentation that START TRANSACTION and SELECT ... FOR UPDATE locks each row that it reads: A SELECT ... FOR UPDATE reads the latest available data, setting exclusive locks on each row it reads. Thus, it sets the same locks a searched SQL UPDATE would set on the rows. See https://dev.mysql.com/doc/refman/5.0/en/innodb-locking-reads.html So I logged in one

Transactions, locks, isolation levels

巧了我就是萌 提交于 2020-07-17 08:45:27
问题 I have a few questions regarding subject from the title. First of all, lets assume that we work with JDBC, and there we have 2 transactions T1 and T2. In T1 we execute select statement on one particular row. Then we execute update on that row. In transaction T2 we execute select statement on the same row. Here are the questions: 1) When does transaction T1 acquire the lock on mentioned row? I assume it happens during select statement execution? 2) How long transaction T1 holds the lock? Does

Downside of using transactions in google firestore

我们两清 提交于 2020-07-10 09:18:51
问题 I'm developing a Flutter App and I'm using the Firebase services. I'd like to stick only to using transactions as I prefer consistency over simplicity. await Firestore.instance.collection('user').document(id).updateData({'name': 'new name'}); await Firestore.instance.runTransaction((transaction) async { transaction.update(Firestore.instance.collection('user').document(id), {'name': 'new name'}); }); Are there any (major) downsides to transactions? For example, are they more expensive

How does pgbouncer behave when transaction pooling is enabled and a single statement is issued?

蓝咒 提交于 2020-07-09 19:29:04
问题 I'm using pgbouncer on a web app and most threads begin with a BEGIN and end with a COMMIT or a ROLLBACK, so we're using transaction pooling and everything is fine. However, we also have some processes which don't use transactions: instead, they just issue commands one after another. I believe that, under transaction pooling, every command is a transaction by itself, just the way it is when you're connected directly to the server, and perhaps every command is getting a different connection

PHP PDO - There is no active transaction

为君一笑 提交于 2020-07-03 06:45:18
问题 I am having problem with transactions in php script. I would like to make multiply queries and be able to recall them all, if at least one of them fails. Below you can find a simple example of the script I am using: $tags_input = array(6,4,5); $conn = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8', DB_USER, DB_PASSW, array( PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'")); $conn-

Py2Neo Issue with Batch Transactions - AttributeError: 'Node' object has no attribute 'upper'

徘徊边缘 提交于 2020-06-29 07:05:22
问题 Following asking a previous question, I've tried to use batch transactions with Py2Neo to speed things up. I've adapted my code quite a bit, but seem unable to build and execute a batch of transactions. The matching works fine, it's only the transaction piece at the bottom which I'm having issues with - I thought I would include my entire code, just in case though. The current error I'm getting is as follows: AttributeError Traceback (most recent call last) <ipython-input-5-953d29f58a36> in

Firestore: Transactions crashing when offline

独自空忆成欢 提交于 2020-06-29 04:13:07
问题 I am aware that according to the changelog (0.12.9+5). It supposedly fixed a crash on android where Transaction s attempted while offline would result in an app crash. However, even with 0.13.7 (the version I'm using). I'm still running into app crashes. There is no error log in the console (just immediate crash). I've tried: Running my app in debug mode on a physical device (same behavior) Attaching error handle callback (not called) Lowering my cloud_firestore version down to 0.12.11 (the

pg-promise transaction with dependent queries in forEach loop gives warning Error: Querying against a released or lost connection

烂漫一生 提交于 2020-06-28 03:54:35
问题 I am trying to insert linked data in a pg-promise transaction. The transaction successfully inserts all the data correctly, but gives a warning UnhandledPromiseRejectionWarning: Error: Querying against a released or lost connection. . The code that causes this was originally: const item = { batch: { batch_number: 1 }, ingredients: [ { amount: '12', unit: 'kg' }, { amount: '4', unit: 'L' } ], } return await db.tx(async t => { const batchQueryString = pgp.helpers.insert(item.batch, null,

pg-promise transaction with dependent queries in forEach loop gives warning Error: Querying against a released or lost connection

房东的猫 提交于 2020-06-28 03:54:03
问题 I am trying to insert linked data in a pg-promise transaction. The transaction successfully inserts all the data correctly, but gives a warning UnhandledPromiseRejectionWarning: Error: Querying against a released or lost connection. . The code that causes this was originally: const item = { batch: { batch_number: 1 }, ingredients: [ { amount: '12', unit: 'kg' }, { amount: '4', unit: 'L' } ], } return await db.tx(async t => { const batchQueryString = pgp.helpers.insert(item.batch, null,

@AfterReturning aspect executes in same transaction of pointcut method?

落爺英雄遲暮 提交于 2020-06-26 12:13:14
问题 I have a requirement to do a task after execution of a function. I have used Aspect for this. but I have some confusion. I have a function A() in a spring service. @Transactional(readOnly = false, isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) void A() { //Do Something } I have an @Afterreturning aspect on this function. @AfterReturning(pointcut = "execution(Sevice.saverecord(..)) ") public void processNotifications(JoinPoint jp) {} I want