Questions tagged [optimistic-concurrency]

A concurrency control method applied to transactional systems that allows multiple transactions to frequently complete for resources without interfering with each other

A concurrency control method applied to transactional systems such as relational database management systems and software transactional memory. OCC assumes that multiple transactions can frequently complete without interfering with each other. While running, transactions use data resources without acquiring locks on those resources. Before committing, each transaction verifies that no other transaction has modified the data it has read.

Optimistic concurrency is generally used in environments with a low contention for data. Optimistic concurrency improves performance because no locking of records is required, and locking of records requires additional server resources. Also, in order to maintain record locks, a persistent connection to the database server is required.

http://en.wikipedia.org/wiki/Optimistic_concurrency_control
http://msdn.microsoft.com/en-us/library/aa0416cz%28v=vs.110%29.aspx

224 questions
0
votes
0 answers

What types of locks are automatically taken in Mysql?

In mysql, as per the official doc and other documentations, When the IsolationLevel = ReadUncommitted or ReadCommitted or RepeatableRead, it uses Optimistic CC (with MVCC) which usually doesn't takes much locks. In case of Serializable, we will see…
0
votes
0 answers

Optimistic Concurrency Exception - On Server Only

My WebAPI is successfully working in localhost (with UI in Angular and With postman as well) but when I am publishing it to the Azure server it starts throwing Optimistic Concurrency Exception when trying to update existing entity. Getting same…
Viral Maru
  • 33
  • 5
0
votes
1 answer

Java 8 Stamped Lock: Why this piece of code doesnt result into a deadlock?

In my attempt to understand Optimistic locking in Java 8,I came across the below piece of code. Original Blog Here. As explained in the blog, this piece of code is attempting to convert a read lock into a write lock.The code requests an explicit…
0
votes
1 answer

Optimistic lock in Postgres makes another Concurrent Update to Wait

I am using Postgres in my spring boot application , I am selecting a record from table and the same record can also be modified by another process. I was using PESSIMISTIC lock as below, public interface EntityRepository extends…
0
votes
0 answers

Expecting Concurrency Exceptions

Is it bad practice to expect to always have concurrency exceptions and to just keep retrying? I don't mean in the rare circumstances when two users might edit data at the same time, I mean where it is guaranteed to happen ALL the time time. For…
Luke
  • 59
  • 1
  • 6
0
votes
1 answer

What is wrong with that optimistic concurrency worker implementation?

I have tried to implement an optimistic concurrency 'worker'. Goal is to read a batch of data from the same database table (single table with no relations) with multiple parallel 'worker'. This did seem to work so far. I get optimistic concurrency…
0
votes
1 answer

MySQL - Avoid to select, and update, the same record on repeatable_read

i'm developping a PHP service that need to get a unique TOKEN from a MySQL table. The table is like: ID TOKEN ID_PROCESS 1 AAAAA 0 2 BBBBB 0 3 CCCCC 0 The table has millions of records with already generated TOKEN. I need to…
Jung
  • 63
  • 1
  • 8
0
votes
0 answers

How to handle concurrency conflict for Webtests trying to access added item

I have a webtest where I am making POST request request1 for adding an item and then request2 to remove same item. Upon running I am getting following error. Store update, insert, or delete statement affected an unexpected number of rows (0).…
0
votes
1 answer

Is owned scope bad solution for concurrent DbContext access?

I have encountered this error in a singleton service when two instances of a same class tried to use the same method that uses a repository Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException: Database operation expected to affect 1 row(s)…
0
votes
0 answers

Store update, insert, or delete statement affected an unexpected number of rows (0)..how do I resolve this issue

Error: Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. I am trying to upload a file into my database with few changes in it but each…
0
votes
0 answers

ASP.Net Core 3.0 UserManager UpdateSecurityStampAsync Optimistic concurrency failure, object has been modified

Any idea what's the purpose of UserManager.UpdateSecurityStamp? I call it every time a user logs in to my ASP.Net Core 3.0 application and occasionally gets Optimistic concurrency failure, object has been modified. Any advice and insight is…
0
votes
0 answers

How to handle concurrent updates in .NET framework

I have created a web application in .NET framework which uses entity framework as ORM. I have a entity as Accounts which contain account details such as ID,Balance and I have implemented Optimistic Concurrency(Row version). Now I am updating the…
0
votes
1 answer

JMteter Thread Group with Login run once and use the AccessToken to run other HTTP Requests with more Users / Threads

I am using the JMetter 5.1.1 to run load test against ASP.Net Core 2.2 with Identity framework. If I run the Login POST requests with many threads concurrently, it will result in AppIdentityDbContext optimistic concurrency exception when…
0
votes
1 answer

Hibernate @Version Field error when using Date

I’m looking at the out of the box options (number / date) for @Version in hibernate. I have number working as I would expect - sets version to 0 on initial insert, increments automatically on update, doesn’t increment or get in the way updating…
0
votes
1 answer

Can you configure JPA to use a UUID for @Version in optimistic concurrency

Is there a way to configure or override the JPA @Version annotation to use Strings (UUID's) ? I have a simple example of optimistic concurrency working using int as per examples int version @Version Public Integer getVersion () return…