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
2 answers

Database Transaction Design Question

Consider the following two blocks of Java psedo-code in a system that uses optimistic transactions. Example A: try { txn.begin(); // database operations txn.commit(); } catch (Exception e) { txn.rollback(); } Example…
Travis Webb
  • 14,688
  • 7
  • 55
  • 109
0
votes
2 answers

ASP.NET PUT fails with DbUpdateConcurrencyException

I have a web API which has a scaffold-ed ApiController. In update method (PUT) following code segment updates the entity in the database. _context.Entry(customers).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch…
Nishan
  • 3,644
  • 1
  • 32
  • 41
0
votes
2 answers

Handle Concurrency Java level vs database/JPA level

Scenario: In any kind of online Reservation application there is possiblty that people may acesses the application at the same time. Because of this there could be a concurrency issues in that perticular application. Problem: In this case, if one…
0
votes
0 answers

JPA 2.1 Timestamp type field for versioning and optimistic locking always throwing OptimisticLockException

Environment: JPA 2.1, EclipseLink 2.6.3, SQL Server 2016 I want to use a field of type Timestamp for versioning and optimistic. I do not have option to use numeric column for versioning. My understanding is I just need to annotate the field with…
0
votes
2 answers

Entity framework update related entities without concurrency conflict

I have two related entities: User and UserProfile. A user can have many profiles (settings). I want to be able to update them together, but I am currently getting concurrency error when i do so: Store update, insert, or delete statement affected…
roca323
  • 455
  • 2
  • 8
  • 26
0
votes
1 answer

hibernate optimistic lock: another thread update in between 2 updates in current thread

the timeline looks like this: User(browser) ---------------------------> update TARGET 2-----------------> Thread ------> update TARGET 1 ---------> long_operation -----> update TARGET 3 I kick off a thread to execute an long_operation, and…
user2628641
  • 2,035
  • 4
  • 29
  • 45
0
votes
1 answer

EF 6 SaveChanges Store update, insert, or delete statement affected an unexpected number of rows (0)

We have two databases. This exception gets thrown only when the connection string points to the second one and I'm doing an edit. It shouldn't be an issue with the code since it works as expected with the first database. I've tried: try { …
end1dream
  • 119
  • 2
  • 6
0
votes
0 answers

Optimistic Concurrency in Model First Entity Framework 6

I'm having difficulty getting this to work. I have a product table with a version column that is of type binary fixed length 8, ConcurrencyMode=fixed, nullable=false, store generated pattern = computed. Now when I update a product entity in the code…
0
votes
1 answer

ConcurrencyExeption on ASP.NET MVC Application

Introduction to the Problem First of all I tried everything to figure out this problem by no result. I am currently trying to design a repository pattern on my own for the first time. My application is just a Blog Website and it has some…
0
votes
1 answer

Optimistic Concurrency Handling - Asp.Net WebApi Odata V4

This is the Patch method of my OdataController public async Task Patch([FromODataUri] int key, Delta patch) { Validate(patch.GetInstance()); Product product = await service.Products.GetAsync(key); if (product ==…
Rahul
  • 2,431
  • 3
  • 35
  • 77
0
votes
0 answers

How to synchronize cell values in the same table?

Big problem... I'm implementing an online ticket sale system in PHP and MySQL. I have a table called "block_of_tickets", or something like that... This table looks like: +-----------+------------+--------------+--------------+--------------+ |…
0
votes
0 answers

How to handle correctly UpSert operations on the table during asynchronous calls?

I am trying to find working and optimal solution for the following situation: I have WebService in the cloud written on c#; Endpoint of this service can be called in a random time with random frequency; During handling of request we call method…
0
votes
1 answer

is it possible with optimistic concurrency ensure this case?

I have a table that has a long column that is a GroupCode. I can have groups of products, so to get all the product of a group I just get all the products which GroupCode is the same. I can change a product from one group to another, and if I change…
0
votes
1 answer

TransactionScope and Optimistic concurrency

I would like to use optimistic concurrency with TransactionScope. Here's the code I come up so far: var options = new TransactionOptions {IsolationLevel = IsolationLevel.ReadCommitted}; using (var scope = new…
0
votes
0 answers

Azure Resource Manager - optimistic concurrency

I am using ARM (Rest API) to download resources and upload tags. Is there a way to use optimistic concurrency (etags maybe ?) to catch concurrency issues?
macpak
  • 1,190
  • 1
  • 14
  • 28