Questions tagged [transaction-isolation]

Transaction isolation relates to the visibility and impact of changes made in one transaction on concurrent transactions.

256 questions
2
votes
2 answers

Maintain integrity on concurrent updates of the same row

In the following code snippet, I try to find, delete, and create the same item, but in 2 different transactions in 2 different threads. In Thread 1, I create transaction 1, find the item, and delete it. Once that is done, I allow thread 2 to create…
robbieperry22
  • 1,753
  • 1
  • 18
  • 49
2
votes
1 answer

Spring transaction propagation and isolation

There are a lot of questions on this topic. I have searched through stack exchange to find a question which is the same as mine, but haven't found any. Please excuse me if this question has already been asked. My question is: When using Spring…
2
votes
1 answer

Postgres SSI Behavior

I'm trying to get an understanding of how SSI is actually supposed to behave in Postgres. My understanding is, if I have two transactions interacting with the same table, but the transactions aren't interacting with the same rows in the table, then…
2
votes
3 answers

How is a T-SQL transaction not thread-safe?

The following (sanitized) code sometimes produces these errors: Cannot drop the table 'database.dbo.Table', because it does not exist or you do not have permission. There is already an object named 'Table' in the database. begin transaction …
Adam A
  • 14,469
  • 6
  • 30
  • 38
2
votes
0 answers

does isolation level have any effect on data modification queries?

Based on my reading Update will acquire Update(U) lock on rows it is updating Insert will acquire either Update or Range lock Delete will acquire Exclusive(X) lock on rows it is deleting Truncate will acquire Exclusive(X) lock on the table It…
Steve
  • 11,696
  • 7
  • 43
  • 81
2
votes
1 answer

How to prevent SQL Server transactions to get stuck?

I am using remote connections to connect a client and server, after 6 months of working smoothly a transaction got stuck, probably because there was a cut in the connection while the transaction was running. How can I prevent a transaction to get…
2
votes
1 answer

What is the difference between inconsistent analysis and non-repeatable reads?

I've seen a lot of comparison to inconsistent analysis and dirty reads and non-repeatable reads to dirty reads but i can't seem to grasp the difference between an inconsistent (incorrect) analysis vs a non repeatable read? Is there a better way to…
2
votes
2 answers

SQL Server allows to read rows with exclusive lock

Recently I came across a scenario related to Microsoft SQL Server locking and it looks quite simple. However I have a trouble of understanding the real concept behind one of the scenarios. I have created a table in SQL Server called locktest with…
keth
  • 793
  • 2
  • 11
  • 36
2
votes
0 answers

transaction isolation level (READ UNCOMMITTED) of Spring Batch

I want to set transaction isolation level to READ UNCOMMITTED, but is doesn't work. Here is my job source. TestJobConfiguration.java @Slf4j @Configuration public class TestJobConfiguration { @Autowired private JobBuilderFactory…
2
votes
2 answers

Transaction isolation - INSERTS dependant on previous records values

This question is related/came from discussion about another thing: What is the correct isolation level for Order header - Order lines transactions? Imagine scenario where we have usual Orders_Headers and Orders_LineItems tables. Lets say also that…
dee zg
  • 13,793
  • 10
  • 42
  • 82
2
votes
1 answer

SQL Server Insert query for a forum

Considering a forum table and many users simultaneously inserting messages into it, how safe is this transaction? SET TRANSACTION ISOLATION LEVEL SERIALIZABLE BEGIN TRANSACTION DECLARE @LastMessageId SMALLINT SELECT @LastMessageId =…
Hamed
  • 279
  • 1
  • 3
  • 13
2
votes
1 answer

Azure Sql Server fails to keep data consistency using a check constraint and a trigger

I'm trying to keep data consistency in my Azure Sql Server database and implemented two scenarios: check constraint insert/update trigger None of them work and I still able to reproduce a situation when my check is bypassed. The rule is simple -…
2
votes
1 answer

Nhibernate : generates insert then update statements, in multithreaded environment leads to deadlock issues

I've experienced the following scenario when using NHibernate with SQL Server 2005. I have a business process which involves the following steps: Start transaction Create nhibernate mapped object Save nhibernate mapped object Perform other business…
user85034
  • 73
  • 4
2
votes
1 answer

Isolation Level Change in MySQL

I have a MySQL 5.7 installed on my system which is set with default transaction isolation level "REPEATABLE-READ". My scenario requires "READ-COMMITTED". So I changed the isolation level in the configuration file so that I can have "READ-COMMITTED"…
Yashwanth Aluru
  • 1,125
  • 6
  • 21
  • 28
2
votes
2 answers

Setting Isolation level in ruby v 2.1.3

I have been struggling with putting a record level lock on my table, to avoid any dirty reads and race condition while updating the record. I am using ruby 2.1.3 and rails version 3.2.13. I tried using the command: Account.connection.execute("SET…