Transaction isolation relates to the visibility and impact of changes made in one transaction on concurrent transactions.
Questions tagged [transaction-isolation]
256 questions
3
votes
1 answer
Transaction management with Spring and hibernate, using isolation_serializable
I am using Spring transaction management to control a application with hibernate, it uses two instance of threads to access concurrency database and modify one table. It is ensuring that the values are conserved.
The table before is:
…

aliel
- 157
- 1
- 2
- 8
3
votes
1 answer
Can I avoid locking rows for unnecessary amounts of time [in Django]?
Take the following code for example (ignore the lack of usefulness in its functionality, as it's just a simple example to include the things I need):
@transaction.commit_on_success
def test_for_success(username)
person =…

orokusaki
- 55,146
- 59
- 179
- 257
3
votes
1 answer
How to avoid "double-create" race condition using JPA/Hibernate
I'm in the following situation.
There are several threads that can read/update MonthlySales persistent objects. Problem is that these objects may not exist and have to be dynamically created upon request.
So, two different threads my end up creating…

gd1
- 11,300
- 7
- 49
- 88
3
votes
4 answers
Lock a set of DB operations in Java
I have a requirement in my Java application to execute a set of DB statements in an atomic & isolated fashion. For example, the application needs to read data rows from one table and update a data row in another table.
QueryRunner queryRunner = new…

garlicbulb
- 306
- 3
- 11
2
votes
6 answers
Two threads reading from the same table:how do i make both thread not to read the same set of data from the TASKS table
I have a tasks thread running in two separate instances of tomcat.
The Task threads concurrently reads (using select) TASKS table on certain where condition and then does some processing.
Issue is ,sometimes both the threads pick the same task ,…

Sudhakar
- 4,823
- 2
- 35
- 42
2
votes
1 answer
Under Snapshot isolation in SQL Server, "update conflict" errors do not produce pretty graphs like Deadlocks do. Is there an analogous tool for these?
When using the Snapshot transaction isolation level, deadlocks are exceedingly rare, but snapshot update conflict errors are common (in a busy OLTP system). These errors are often expected under certain workloads, but if you have something in your…

ahalbert
- 21
- 1
2
votes
1 answer
Read write problem on an append only table
Suppose I have this append-only SQL table representing deposits/withdraws from/to accounts. The 3 rows below will render the balance of account A to be -$10
ID
Account
Credit
1
A
$100
2
A
-$50
3
A
-$60
If the inserts are concurrent,…

Xiaoguo Ge
- 2,177
- 20
- 26
2
votes
1 answer
in-flight collision of DB transaction with different Isolation Level
I have some doubts with respect to transactions and isolation levels:
1) In case the DB transaction level is set to Serializable / Repeatable Read and there are two concurrent transactions trying to modify the same data then one of the transaction…

Kumar
- 1,536
- 2
- 23
- 33
2
votes
3 answers
Prevent lost updates with high transaction isolation levels: Is this a common misconception?
I noticed that my applications often write values to a database that depend on a former read operation. A common example is a bank account where a user could deposit money:
void deposit(amount) {
balance = getAccountBalance()
…

fishbone
- 3,140
- 2
- 37
- 50
2
votes
3 answers
Serializable Isolation Level Confusion - Write Skew (Postgres)
I'm running Postgres12 and confused about the behavior of the serializable transaction level.
Tables:
Events
id
difficulty
Managers
id
level
Intended behavior (within serialized transaction):
check if there are 7 or more events of…

njz2104
- 43
- 6
2
votes
1 answer
How wildfly resets properties set on connection when returned to connection pool
I am doing jndi lookup for datasource configured in JBOSS
DataSource dataSource = (DataSource) new InitialContext().lookup(dataSourceStr);
return dataSource.getConnection();
Connection is closed by using try-with-resource.
Once I get connection…

Archana Mundaye
- 523
- 1
- 5
- 19
2
votes
0 answers
Managing transactions across threads
I have been experimenting with (readiness) health checks for my application (running in kubernetes). I had previously had a readiness health check that would check that the application could connect to a database and make dummy queries. However,…

Connor Butch
- 648
- 1
- 10
- 28
2
votes
3 answers
How to change transaction isolation level globally?
How can I change the default transaction isolation level for the database?
The postgres docs show how to change it per transaction and per session - but not how to alter the default for the database or cluster.
In MySQL the operation is
SET GLOBAL…

Ulad Kasach
- 11,558
- 11
- 61
- 87
2
votes
2 answers
What is the relationship between setting isolation level in application code (like @Transactional) and the same configured on a db server?
I am having great difficulty in piecing all the information together. So let me explain as much detail as I can.
Working on a spring-jdbc, spring-transaction, MySQL db application, I want to be able to lock rows of data from a table while selecting…

djpanda
- 835
- 10
- 20
2
votes
1 answer
MySQL exclusive lock
We have the tables below:
mysql> desc journeys ;
+---------------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+------------+------+-----+---------+-------+
| journey_id …

Stavros Zavrakas
- 3,045
- 1
- 17
- 30