Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Problem with caching using globalDatabasePool [moved] #905

lvca opened this Issue · 1 comment

2 participants


This is Issue 905 moved from a Google Code project.
Added by 2012-06-21T14:34:27.000Z by
Please review that bug for more context and additional comments, but update this bug.

Original labels: Type-Defect, Priority-Medium, Release

Original description

OrientDB is build from trunk:
#Build Number for ANT. Do not edit!
#Wed Jun 20 11:36:17 CEST 2012

Short description of what I'm doing here: 
Create a ServiceModel document, fetch the Account document from the database and create an Edge between the two. This is done 3 times in the test.

I'm printing out the Account document version, connection hash (to identify the connection) and if the cache is enabled.

Caching is disabled this way for both runs:

1) Using OGraphDatabase:
2012-06-21 15:50:10,318 [main] TRACE (updateServiceModel  :182) Store ServiceModel: 7a38d519-d3ac-4e6f-8a80-fb685e1c85f6
2012-06-21 15:50:10,322 [main] INFO  (updateServiceModel  :194) Account: [11111111-1111-1111-1111-111111111111] v30
2012-06-21 15:50:10,324 [main] INFO  (updateServiceModel  :195) connection: 223205208
2012-06-21 15:50:10,325 [main] INFO  (updateServiceModel  :196) L1 cache=false
2012-06-21 15:50:10,325 [main] INFO  (updateServiceModel  :197) L2 cache=false
2012-06-21 15:50:10,495 [main] TRACE (updateServiceModel  :182) Store ServiceModel: 183886c1-21ae-4d95-91c2-641ccd40c656
2012-06-21 15:50:10,499 [main] INFO  (updateServiceModel  :194) Account: [11111111-1111-1111-1111-111111111111] v31
2012-06-21 15:50:10,500 [main] INFO  (updateServiceModel  :195) connection: 1505888432
2012-06-21 15:50:10,501 [main] INFO  (updateServiceModel  :196) L1 cache=false
2012-06-21 15:50:10,501 [main] INFO  (updateServiceModel  :197) L2 cache=false
2012-06-21 15:50:10,547 [main] TRACE (updateServiceModel  :182) Store ServiceModel: 2e788cdb-beca-4cec-a4b0-c89244cdbb89
2012-06-21 15:50:10,551 [main] INFO  (updateServiceModel  :194) Account: [11111111-1111-1111-1111-111111111111] v32
2012-06-21 15:50:10,551 [main] INFO  (updateServiceModel  :195) connection: 1154920537
2012-06-21 15:50:10,552 [main] INFO  (updateServiceModel  :196) L1 cache=false
2012-06-21 15:50:10,552 [main] INFO  (updateServiceModel  :197) L2 cache=false

2) Using globalDatabasePool:
2012-06-21 16:09:50,673 [main] INFO  (testListServiceModels:188) ============== testListServiceModels ==============
2012-06-21 16:09:50,680 [main] TRACE (updateServiceModel  :182) Store ServiceModel: 0d880007-cbfa-402f-89ed-a0443a7cc2fa
2012-06-21 16:09:50,699 [main] INFO  (updateServiceModel  :194) Account: [11111111-1111-1111-1111-111111111111] v36
2012-06-21 16:09:50,712 [main] INFO  (updateServiceModel  :195) connection: 386485576
2012-06-21 16:09:50,713 [main] INFO  (updateServiceModel  :196) L1 cache=false
2012-06-21 16:09:50,713 [main] INFO  (updateServiceModel  :197) L2 cache=false
2012-06-21 16:09:50,731 [main] TRACE (updateServiceModel  :182) Store ServiceModel: 20718801-92e9-4683-aa89-563625bad7eb
2012-06-21 16:09:50,734 [main] INFO  (updateServiceModel  :194) Account: [11111111-1111-1111-1111-111111111111] v35
2012-06-21 16:09:50,734 [main] INFO  (updateServiceModel  :195) connection: 434359633
2012-06-21 16:09:50,734 [main] INFO  (updateServiceModel  :196) L1 cache=false
2012-06-21 16:09:50,734 [main] INFO  (updateServiceModel  :197) L2 cache=false
2012-06-21 16:09:50,762 [main] ERROR (updateServiceModel  :361) Create ServiceModel failed
com.orientechnologies.orient.core.exception.OConcurrentModificationException: Cannot update record #9:1 in storage 'test' because the version is not the latest. Probably you are updating an old record or it has been modified by another user (db=v37 your=v35)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

As you can see from 1) works just fine, but when I'm using the database pool 2) I get the an old version of the Account document and the save fails.

Looks to me like the second connection (434359633) is returning an old version of the Account document. v35 is as you can see returned the second time instead of v37. 
I tried to isolate the problem in a test class without success; the connection pool returned the same connection each time and the problem did not occur.

In 2.0 We removed Level2 cache to avoid this problem.

@lvca lvca closed this
@lvca lvca added the bug label
@laa laa was assigned by lvca
@lvca lvca added this to the 2.0-M1 milestone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.