2

appengine 1.6.4 datanucleus-appengine-2.0.0 datanucleus cache 3.0.1

こんにちは、みんな

datanucleusレベル2キャッシュを使用して、読み取りクエリから古いデータが返されます。

私の永続的な構成にはキャッシュ設定がないため、ドキュメントからはデフォルト設定を使用しています。

問題

ステップ1:TX1で、エンティティMerchantPromotion(5)で単純なマージを実行します。

結果1:データストアビューアは、エンティティが正しく更新されたことを示します。

ステップ2:TX2で、エンティティMerchantPromotion(5)の読み取りを実行します。

結果2:返されるデータは、変更されたデータではなく、事前にマージされたデータです。

レベル2キャッシュがNONEに設定されている場合、操作は正常に機能するため、レベル2キャッシュに関連しているようです。

DNトレースが添付されます。

助けていただければ幸いです。

-lp

<persistence-unit name="transactions-optional">
    <provider>org.datanucleus.api.jpa.PersistenceProviderImpl</provider>
    <properties>
        <property name="datanucleus.ConnectionURL" value="appengine"/>
        <property name="datanucleus.metadata.allowLoadAtRuntime" value="true"/>
        <property name="datanucleus.appengine.ignorableMetaDataBehavior" value="ERROR"/>
        <property name="datanucleus.DetachAllOnCommit" value="true" />
        <property name="datanucleus.DetachOnClose" value="true" />
        <property name="datanucleus.appengine.datastoreEnableXGTransactions" value="true"/>           

    </properties>
</persistence-unit>

既存のエンティティをマージする

07/05/2012 11:00:43 PM com.asteriski.mingle.venueportal.managedbeans.PromotionBackingBean saveAction
INFO: saveSun May 06 00:00:00 UTC 2012
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl initialiseLevel1Cache
FINE: Level 1 Cache of type "soft" initialised
07/05/2012 11:00:43 PM     com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl$DatastoreManagedConnection <init>
FINE: Created ManagedConnection using DatastoreService = com.google.appengine.api.datastore.DatastoreServiceImpl@136fb9fd
07/05/2012 11:00:43 PM org.datanucleus.store.connection.ConnectionManagerImpl allocateConnection
FINE: Connection added to the pool : com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl$DatastoreManagedConnection@47d77d9e for key=org.datanucleus.ObjectManagerImpl@1f4790be in factory=ConnectionFactory:tx[com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl@7fac4f3e]
07/05/2012 11:00:43 PM com.asteriski.mingle.venueportal.service.PromotionService save
INFO: com.asteriski.mingle.venueportal.beans.PromotionBean@147834eb
07/05/2012 11:00:43 PM com.asteriski.mingle.venueportal.dao.PromotionDAO save
INFO: content:another one here11
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl putObjectIntoCache
FINE: Object "com.asteriski.mingle.venueportal.entity.MerchantPromotion@6ac1abcf" (id="org.datanucleus.identity.IdentityReference@20e74663") added to Level 1 cache (loadedFlags="[YYYYYYYYYY]")
07/05/2012 11:00:43 PM org.datanucleus.store.connection.ConnectionManagerImpl allocateConnection
FINE: Connection found in the pool : com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl$DatastoreManagedConnection@47d77d9e for key=org.datanucleus.ObjectManagerImpl@1f4790be in factory=ConnectionFactory:tx[com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl@7fac4f3e]
07/05/2012 11:00:43 PM org.datanucleus.store.connection.ConnectionManagerImpl allocateConnection
FINE: Connection found in the pool : com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl$DatastoreManagedConnection@47d77d9e for key=org.datanucleus.ObjectManagerImpl@1f4790be in factory=ConnectionFactory:tx[com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl@7fac4f3e]
07/05/2012 11:00:43 PM org.datanucleus.store.connection.ConnectionManagerImpl allocateConnection
FINE: Connection found in the pool : com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl$DatastoreManagedConnection@47d77d9e for key=org.datanucleus.ObjectManagerImpl@1f4790be in factory=ConnectionFactory:tx[com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl@7fac4f3e]
07/05/2012 11:00:43 PM org.datanucleus.store.connection.ConnectionManagerImpl allocateConnection
FINE: Connection found in the pool : com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl$DatastoreManagedConnection@47d77d9e for key=org.datanucleus.ObjectManagerImpl@1f4790be in factory=ConnectionFactory:tx[com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl@7fac4f3e]
07/05/2012 11:00:43 PM org.datanucleus.store.connection.ConnectionManagerImpl allocateConnection
FINE: Connection found in the pool : com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl$DatastoreManagedConnection@47d77d9e for key=org.datanucleus.ObjectManagerImpl@1f4790be in factory=ConnectionFactory:tx[com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl@7fac4f3e]
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl replaceObjectId
FINE: Object "com.asteriski.mingle.venueportal.entity.MerchantPromotion@6ac1abcf" (id="org.datanucleus.identity.IdentityReference@20e74663") being changed to be referenced by id="com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(5)" in Level 1 cache
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl putObjectIntoCache
FINE: Object "com.asteriski.mingle.venueportal.entity.MerchantPromotion@6ac1abcf" (id="com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(5)") added to Level 1 cache (loadedFlags="[YYYYYYYYYY]")
07/05/2012 11:00:43 PM org.datanucleus.store.connection.ConnectionManagerImpl allocateConnection
FINE: Connection found in the pool : com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl$DatastoreManagedConnection@47d77d9e for key=org.datanucleus.ObjectManagerImpl@1f4790be in factory=ConnectionFactory:tx[com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl@7fac4f3e]
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl performLevel2CacheUpdateAtCommit
FINE: Object with id="org.datanucleus.identity.IdentityReference@20e74663" removed from Level 2 cache since was updated yet object has been GCed
07/05/2012 11:00:43 PM org.datanucleus.store.connection.ConnectionManagerImpl$1 managedConnectionPostClose
FINE: Connection removed from the pool : com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl$DatastoreManagedConnection@47d77d9e for key=org.datanucleus.ObjectManagerImpl@1f4790be in factory=ConnectionFactory:tx[com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl@7fac4f3e]
07/05/2012 11:00:43 PM org.datanucleus.state.LifeCycleState changeState
FINE: Object "com.asteriski.mingle.venueportal.entity.MerchantPromotion@6ac1abcf" (id="com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(5)") has a lifecycle change : "P_NEW"->"DETACHED_CLEAN"
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl removeObjectFromCache
FINE: Object with id="com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(5)" being removed from Level 1 cache [current cache size = 1]
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl disconnectSMCache
FINE: Level 1 Cache cleared

エンティティの読み取り

07/05/2012 11:00:43 PM com.google.appengine.datanucleus.query.JPQLQuery performExecute
FINE: JPQL Query : Execution Time = 6 ms
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl getObjectFromCache
FINE: Object with id "com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(3)" not found in Level 1 cache [cache size = 0]
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl getObjectFromCache
FINE: Object with id="com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(3)" taken from Level 2 cache (loadedFlags="[YYYYYYYYYY]", relationFields="null") - extracting into managed persistable object
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl putObjectIntoCache
FINE: Object "com.asteriski.mingle.venueportal.entity.MerchantPromotion@1aa3c177" (id="com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(3)") added to Level 1 cache (loadedFlags="[NNNYNNNNNN]")
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl getObjectFromCache
FINE: Object with id="com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(3)" taken from Level 2 cache represented as "com.asteriski.mingle.venueportal.entity.MerchantPromotion@1aa3c177" 
07/05/2012 11:00:43 PM org.datanucleus.state.LifeCycleState changeState
FINE: Object "com.asteriski.mingle.venueportal.entity.MerchantPromotion@1aa3c177" (id="com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(3)") has a lifecycle change : "P_CLEAN"->"P_NONTRANS"
07/05/2012 11:00:43 PM org.datanucleus.store.connection.ConnectionManagerImpl allocateConnection
FINE: Connection found in the pool : com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl$DatastoreManagedConnection@230cc23b for key=org.datanucleus.ObjectManagerImpl@2db1d931 in factory=ConnectionFactory:tx[com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl@7fac4f3e]
07/05/2012 11:00:43 PM com.asteriski.mingle.venueportal.service.PromotionService find
INFO: published:MerchantLocation does not exist
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl getObjectFromCache
FINE: Object with id "com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(4)" not found in Level 1 cache [cache size = 1]
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl getObjectFromCache
FINE: Object with id="com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(4)" taken from Level 2 cache (loadedFlags="[YYYYYYYYYY]", relationFields="null") - extracting into managed persistable object
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl putObjectIntoCache
FINE: Object "com.asteriski.mingle.venueportal.entity.MerchantPromotion@74f2794a" (id="com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(4)") added to Level 1 cache (loadedFlags="[NNNYNNNNNN]")
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl getObjectFromCache
FINE: Object with id="com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(4)" taken from Level 2 cache represented as "com.asteriski.mingle.venueportal.entity.MerchantPromotion@74f2794a" 
07/05/2012 11:00:43 PM org.datanucleus.state.LifeCycleState changeState
FINE: Object "com.asteriski.mingle.venueportal.entity.MerchantPromotion@74f2794a" (id="com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(4)") has a lifecycle change : "P_CLEAN"->"P_NONTRANS"
07/05/2012 11:00:43 PM org.datanucleus.store.connection.ConnectionManagerImpl allocateConnection
FINE: Connection found in the pool : com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl$DatastoreManagedConnection@230cc23b for key=org.datanucleus.ObjectManagerImpl@2db1d931 in factory=ConnectionFactory:tx[com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl@7fac4f3e]
07/05/2012 11:00:43 PM com.asteriski.mingle.venueportal.service.PromotionService find
INFO: published:MerchantLocation does not exist
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl getObjectFromCache
FINE: Object with id "com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(5)" not found in Level 1 cache [cache size = 2]
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl getObjectFromCache
FINE: Object with id="com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(5)" taken from Level 2 cache (loadedFlags="[YYYYYYYYYY]", relationFields="null") - extracting into managed persistable object
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl putObjectIntoCache
FINE: Object "com.asteriski.mingle.venueportal.entity.MerchantPromotion@574a3347" (id="com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(5)") added to Level 1 cache (loadedFlags="[NNNYNNNNNN]")
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl getObjectFromCache
FINE: Object with id="com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(5)" taken from Level 2 cache represented as "com.asteriski.mingle.venueportal.entity.MerchantPromotion@574a3347" 
07/05/2012 11:00:43 PM org.datanucleus.state.LifeCycleState changeState
FINE: Object "com.asteriski.mingle.venueportal.entity.MerchantPromotion@574a3347" (id="com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(5)") has a lifecycle change : "P_CLEAN"->"P_NONTRANS"
07/05/2012 11:00:43 PM org.datanucleus.store.connection.ConnectionManagerImpl allocateConnection
FINE: Connection found in the pool : com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl$DatastoreManagedConnection@230cc23b for key=org.datanucleus.ObjectManagerImpl@2db1d931 in factory=ConnectionFactory:tx[com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl@7fac4f3e]
07/05/2012 11:00:43 PM com.asteriski.mingle.venueportal.service.PromotionService find
INFO: published:null
07/05/2012 11:00:43 PM org.datanucleus.store.connection.ConnectionManagerImpl$1 managedConnectionPostClose
FINE: Connection removed from the pool : com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl$DatastoreManagedConnection@230cc23b for key=org.datanucleus.ObjectManagerImpl@2db1d931 in factory=ConnectionFactory:tx[com.google.appengine.datanucleus.DatastoreConnectionFactoryImpl@7fac4f3e]
07/05/2012 11:00:43 PM org.datanucleus.state.LifeCycleState changeState
FINE: Object "com.asteriski.mingle.venueportal.entity.MerchantPromotion@574a3347" (id="com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(5)") has a lifecycle change : "P_NONTRANS"->"DETACHED_CLEAN"
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl removeObjectFromCache
FINE: Object with id="com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(5)" being removed from Level 1 cache [current cache size = 3]
07/05/2012 11:00:43 PM org.datanucleus.state.LifeCycleState changeState
FINE: Object "com.asteriski.mingle.venueportal.entity.MerchantPromotion@74f2794a" (id="com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(4)") has a lifecycle change : "P_NONTRANS"->"DETACHED_CLEAN"
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl removeObjectFromCache
FINE: Object with id="com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(4)" being removed from Level 1 cache [current cache size = 2]
07/05/2012 11:00:43 PM org.datanucleus.state.LifeCycleState changeState
FINE: Object "com.asteriski.mingle.venueportal.entity.MerchantPromotion@1aa3c177" (id="com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(3)") has a lifecycle change : "P_NONTRANS"->"DETACHED_CLEAN"
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl removeObjectFromCache
FINE: Object with id="com.asteriski.mingle.venueportal.entity.MerchantPromotion:MerchantPromotion(3)" being removed from Level 1 cache [current cache size = 1]
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl disconnectSMCache
FINE: Level 1 Cache cleared
07/05/2012 11:00:43 PM org.datanucleus.ObjectManagerImpl initialiseLevel1Cache
FINE: Level 1 Cache of type "soft" initialised
4

1 に答える 1

0

アプリエンジンでdatanucleusを使用してjpaを使用しています。クエリ「DELETE FROM SOMETABLENAME a」を実行し、後でその ID でオブジェクトをフェッチしても、キャッシュはそれを返します!

私のpersistance.xmlファイルに追加すると、問題が修正されました。

現在のライブラリのバージョンは

datanucleus-api-jdo-3.1.1 
datanucleus-api-jpa-3.1.1
datanucleus-core-3.1.1

スタック トレースの一部

ObjectManagerImpl.getObjectFromCache(Object) line: 5030 
ObjectManagerImpl.findObject(Object, boolean, boolean, String) line: 3282   
JPAEntityManager.find(Class<T>, Object, LockModeType, Map<String,Object>) line: 358 
JPAEntityManager.find(Class, Object) line: 256  

これは過去 6 か月以内に発生した更新ですか? このバージョンに更新する前は、すべての単体テストは問題ありませんでした。キャッシュを無効にした後、すべてが再びチェックアウトされます。アプリ エンジンは新しい設定を尊重しますか?

于 2012-12-05T12:43:39.027 に答える