nhibernate - SQL server version column updates more than it should -


We are using NHibernate to update the account table with the balance for a user that is a test case that prevents us It is:

  var s = NHibernateHelper.OpenSession (); Var q = s.CreateQuery ("Account Set Balance = Update, Where User Id =? And Version =?"); Var acc = s.Load (1); ITransaction tx = null; For (int j = 0; j & lt; NUM_UPDATES; j ++) {int rowcount = 0; Var tx = s.BeginTransaction (); What to do (R.Refresh (ACC); Q.SetDouble (0, acc.Balance + _amount) .SetInt32 (1, 1) .SetBinary (2, acc.Version); Row number = q.ExecuteUpdate ();} While (Line number & lt; = 0); tx.Commit ();}  

This code should be executed in both the thread and in concurrent (hence the version) in multiple threads It is implemented correctly, but - version number has increased by a number which is more than actual update count (NUM_UPDATES) based on actual value.

A If we update 16 for the drawdown, the version number increases to 16 or 17. If we update 1000, the version number has increased by 1004.

If 16 threads run this code (On the 4-core machine) with 1000 updates of each, then we get many more attempts, and the version increases from 16064 (1004 * 16).

What is happening with any idea? What is the reason for the alarm?

If the version is column type timestamp or lineWarson, then it is updated using the global counter The global counter is incremented when line queue column is inserted or updated in any row in any row. So this is not the cause of concern. It only shows other activities within the database.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -