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

Does MySQL have an equivalent of SQL Server rowversion?

I am migrating a SQL Server database schema over to MySQL. Some of the tables on SQL Server have a column of type rowversion. This is an integer value that is set when the row is first inserted and then again each time any column of the row is…
Phil Wright
  • 22,580
  • 14
  • 83
  • 137
8
votes
1 answer

Implementing Optimistic lock using Hibernate and Spring

I am trying to implement Optimistic locking in-order to avoid lost update situation. In my application when two user fetch same record and the first user updates it with some changes. This change is not visible to the second user who view the same…
Leejoy
  • 1,356
  • 5
  • 23
  • 36
7
votes
2 answers

Is it possible to make conditional inserts with Azure Table Storage

Is it possible to make a conditional insert with the Windows Azure Table Storage Service? Basically, what I'd like to do is to insert a new row/entity into a partition of the Table Storage Service if and only if nothing changed in that partition…
7
votes
2 answers

Implementing optimistic concurrency on a legacy database

I have a database with some tables and also data in them.I need to implement for all tables optimistic concurrency. I was wondering what would be the best way. Query with a predicate will be created on the application side. My concern is how-to…
user256034
  • 4,289
  • 5
  • 37
  • 44
7
votes
2 answers

Are nullable foreign keys allowed in Entity Framework 4?

I have a problem updating a foreign key in an Entity Framework entity. I am using self tracking entities and have an entity with some relations where the foreign key is also present as a property (one of the new features of EF4). The key (an…
7
votes
1 answer

Optimistic concurrency in ADO.NET Entity Framework

I found an MSDN article that describes how EF handles concurrency when saving changes: By default [...] Object Services saves object changes to the database without checking for concurrency. For properties that might experience a high degree of…
bernhof
  • 6,219
  • 2
  • 45
  • 71
6
votes
3 answers

OptimisticConcurrencyException with System.Web.Providers

I'm using the new Universal Providers from Microsoft for session in SQL Server. The old implementation of session on SQL Server required a job (running every minute) to clear expired sessions. The new one does this check and clear on every request.…
icrf
  • 364
  • 3
  • 13
6
votes
1 answer

Hibernate: Should I include the 'version' field to hashcode() and equals() methods

I know that when overriding hashcode() and equals() of my persistent entities I should not include ID and only include the meaningful properties that uniquely identify the object. But what about version field which is used for the optimistic…
6
votes
1 answer

Entity Framework Optimistic Concurrency Exception not occuring

We have an ASP.Net MVC application that uses EF4 as its data access layer and we're seeing unexpected behaviour with regards to OptimisitcConcurrencyExceptions not being thrown when we think they should be. We have simplified the problem down to the…
6
votes
1 answer

Understanding Entity Framework optimistic concurrency (database wins) pattern

See Resolving optimistic concurrency exceptions with Reload (database wins) : using (var context = new BloggingContext()) { var blog = context.Blogs.Find(1); blog.Name = "The New ADO.NET Blog"; bool saveFailed; do { …
DeeRain
  • 1,344
  • 1
  • 15
  • 24
6
votes
2 answers

Getting latest rowversion/timestamp value in update statement - Sql Server

I'm using rowversion columns for handling optimistic concurrency and want to get the new rowversion value back when I've done an update so that my data layer has the latest value and can perform another update with getting a concurrency exception…
Simon Vane
  • 1,914
  • 3
  • 19
  • 23
5
votes
2 answers

Event store and optimistic concurrency

Greg Young in his document on CQRS in the "Building an event storage" section, when writing events to the event store he checked for optimistic concurrency. I do not really get why he made that check, can anyone explain to me with a concrete…
5
votes
0 answers

Properly handling DbUpdateConcurrencyException

This is from docs about lifetime of DBContext: When working with Windows Presentation Foundation (WPF) or Windows Forms, use a context instance per form. This lets you use change-tracking functionality that context provides. I've read that…
5
votes
2 answers

Implementing an Event Store with optimistic concurrency checks over multiple clients

I'm trying to implement an event sourcing system using the practices and principles in line with the various Greg Young inspired examples I have seen. I understand how the version checking logic works and that when saving the aggregate, if the…
Mark Kennedy
  • 421
  • 5
  • 9
5
votes
2 answers

can ZooKeeper get znode data and znode data version (stat) in one single operation?

I am developing an application that use ZooKeeper as the datastore. For one of the methods in the application, I need to use the optimistic concurrent control. For example, I need to implement a get method which get the znode data, and I use the…
1
2
3
14 15