Repository: ignite Updated Branches: refs/heads/ignite-9893 7b09d7970 -> fc4fb378a
Reintroduce debug logging. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/413ad628 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/413ad628 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/413ad628 Branch: refs/heads/ignite-9893 Commit: 413ad628fc1f30ed8d0c858caf8042d5f6295c2e Parents: 7b09d79 Author: Ilya Kasnacheev <[email protected]> Authored: Wed Dec 19 18:34:42 2018 +0300 Committer: Ilya Kasnacheev <[email protected]> Committed: Wed Dec 19 18:34:42 2018 +0300 ---------------------------------------------------------------------- .../hibernate/IgniteGeneralDataRegion.java | 16 +++++++- .../HibernateAccessStrategyAdapter.java | 18 +++++++-- .../HibernateNonStrictAccessStrategy.java | 8 +++- .../HibernateReadOnlyAccessStrategy.java | 8 +++- .../HibernateReadWriteAccessStrategy.java | 40 ++++++++++++++++++-- .../HibernateTransactionalAccessStrategy.java | 26 ++++++++++--- 6 files changed, 99 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/413ad628/modules/hibernate-5.3/src/main/java/org/apache/ignite/cache/hibernate/IgniteGeneralDataRegion.java ---------------------------------------------------------------------- diff --git a/modules/hibernate-5.3/src/main/java/org/apache/ignite/cache/hibernate/IgniteGeneralDataRegion.java b/modules/hibernate-5.3/src/main/java/org/apache/ignite/cache/hibernate/IgniteGeneralDataRegion.java index 1923703..4762054 100644 --- a/modules/hibernate-5.3/src/main/java/org/apache/ignite/cache/hibernate/IgniteGeneralDataRegion.java +++ b/modules/hibernate-5.3/src/main/java/org/apache/ignite/cache/hibernate/IgniteGeneralDataRegion.java @@ -19,6 +19,7 @@ package org.apache.ignite.cache.hibernate; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCheckedException; +import org.apache.ignite.IgniteLogger; import org.hibernate.cache.CacheException; import org.hibernate.cache.spi.DirectAccessRegion; import org.hibernate.cache.spi.QueryResultsRegion; @@ -32,6 +33,9 @@ import org.jetbrains.annotations.Nullable; * and {@link TimestampsRegion}. */ public class IgniteGeneralDataRegion extends HibernateRegion implements DirectAccessRegion { + /** */ + private final IgniteLogger log; + /** * @param factory Region factory. * @param name Region name. @@ -41,12 +45,19 @@ public class IgniteGeneralDataRegion extends HibernateRegion implements DirectAc IgniteGeneralDataRegion(RegionFactory factory, String name, Ignite ignite, HibernateCacheProxy cache) { super(factory, name, ignite, cache); + + log = ignite.log().getLogger(getClass()); } /** {@inheritDoc} */ @Nullable @Override public Object getFromCache(Object key, SharedSessionContractImplementor ses) throws CacheException { try { - return cache.get(key); + Object val = cache.get(key); + + if (log.isDebugEnabled()) + log.debug("Get [cache=" + cache.name() + ", key=" + key + ", val=" + val + ']'); + + return val; } catch (IgniteCheckedException e) { throw new CacheException(e); @@ -57,6 +68,9 @@ public class IgniteGeneralDataRegion extends HibernateRegion implements DirectAc @Override public void putIntoCache(Object key, Object val, SharedSessionContractImplementor ses) throws CacheException { try { cache.put(key, val); + + if (log.isDebugEnabled()) + log.debug("Put [cache=" + cache.name() + ", key=" + key + ", val=" + val + ']'); } catch (IgniteCheckedException e) { throw new CacheException(e); http://git-wip-us.apache.org/repos/asf/ignite/blob/413ad628/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateAccessStrategyAdapter.java ---------------------------------------------------------------------- diff --git a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateAccessStrategyAdapter.java b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateAccessStrategyAdapter.java index 557b018..44edf8e 100644 --- a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateAccessStrategyAdapter.java +++ b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateAccessStrategyAdapter.java @@ -100,7 +100,8 @@ public abstract class HibernateAccessStrategyAdapter { * @param cache Cache. * @param eConverter Exception converter. */ - protected HibernateAccessStrategyAdapter(Ignite ignite, + protected HibernateAccessStrategyAdapter( + Ignite ignite, HibernateCacheProxy cache, HibernateExceptionConverter eConverter) { this.cache = cache; @@ -124,7 +125,12 @@ public abstract class HibernateAccessStrategyAdapter { */ @Nullable public Object get(Object key) { try { - return cache.get(key); + Object val = cache.get(key); + + if (log.isDebugEnabled()) + log.debug("Get [cache=" + cache.name() + ", key=" + key + ", val=" + val + ']'); + + return val; } catch (IgniteCheckedException e) { throw convertException(e); @@ -147,6 +153,9 @@ public abstract class HibernateAccessStrategyAdapter { * @param val Value. */ public void putFromLoad(Object key, Object val) { + if (log.isDebugEnabled()) + log.debug("Put from load [cache=" + cache.name() + ", key=" + key + ", val=" + val + ']'); + try { cache.put(key, val); } @@ -225,6 +234,9 @@ public abstract class HibernateAccessStrategyAdapter { * Called to remove all data from cache without regard to transaction. */ public void evictAll() { + if (log.isDebugEnabled()) + log.debug("Evict all [cache=" + cache.name() + ']'); + try { evictAll(cache); } @@ -337,4 +349,4 @@ public abstract class HibernateAccessStrategyAdapter { cacheName = U.readString(in); } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/413ad628/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateNonStrictAccessStrategy.java ---------------------------------------------------------------------- diff --git a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateNonStrictAccessStrategy.java b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateNonStrictAccessStrategy.java index 06c6f3d..b7d27fe 100644 --- a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateNonStrictAccessStrategy.java +++ b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateNonStrictAccessStrategy.java @@ -109,6 +109,9 @@ public class HibernateNonStrictAccessStrategy extends HibernateAccessStrategyAda @Override public boolean afterUpdate(Object key, Object val) { WriteContext ctx = writeCtx.get(); + if (log.isDebugEnabled()) + log.debug("Put after update [cache=" + cache.name() + ", key=" + key + ", val=" + val + ']'); + if (ctx != null) { ctx.updated(key, val); @@ -127,6 +130,9 @@ public class HibernateNonStrictAccessStrategy extends HibernateAccessStrategyAda /** {@inheritDoc} */ @Override public boolean afterInsert(Object key, Object val) { + if (log.isDebugEnabled()) + log.debug("Put after insert [cache=" + cache.name() + ", key=" + key + ", val=" + val + ']'); + try { cache.put(key, val); @@ -227,4 +233,4 @@ public class HibernateNonStrictAccessStrategy extends HibernateAccessStrategyAda return S.toString(WriteContext.class, this); } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/413ad628/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadOnlyAccessStrategy.java ---------------------------------------------------------------------- diff --git a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadOnlyAccessStrategy.java b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadOnlyAccessStrategy.java index a0957fd..07570ba 100644 --- a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadOnlyAccessStrategy.java +++ b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadOnlyAccessStrategy.java @@ -55,7 +55,8 @@ public class HibernateReadOnlyAccessStrategy extends HibernateAccessStrategyAdap * @param cache Cache. * @param eConverter Exception converter. */ - public HibernateReadOnlyAccessStrategy(Ignite ignite, + public HibernateReadOnlyAccessStrategy( + Ignite ignite, HibernateCacheProxy cache, HibernateExceptionConverter eConverter) { super(ignite, cache, eConverter); @@ -68,6 +69,9 @@ public class HibernateReadOnlyAccessStrategy extends HibernateAccessStrategyAdap /** {@inheritDoc} */ @Override public boolean afterInsert(Object key, Object val) { + if (log.isDebugEnabled()) + log.debug("Put [cache=" + cache.name() + ", key=" + key + ']'); + try { cache.put(key, val); @@ -102,4 +106,4 @@ public class HibernateReadOnlyAccessStrategy extends HibernateAccessStrategyAdap @Override public boolean afterUpdate(Object key, Object val) { throw new UnsupportedOperationException("Updates are not supported for read-only access strategy."); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/413ad628/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadWriteAccessStrategy.java ---------------------------------------------------------------------- diff --git a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadWriteAccessStrategy.java b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadWriteAccessStrategy.java index 491553d..c3fba41 100644 --- a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadWriteAccessStrategy.java +++ b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadWriteAccessStrategy.java @@ -65,7 +65,8 @@ public class HibernateReadWriteAccessStrategy extends HibernateAccessStrategyAda * @param txCtx Thread local instance used to track updates done during one Hibernate transaction. * @param eConverter Exception converter. */ - protected HibernateReadWriteAccessStrategy(Ignite ignite, + protected HibernateReadWriteAccessStrategy( + Ignite ignite, HibernateCacheProxy cache, ThreadLocal txCtx, HibernateExceptionConverter eConverter) { @@ -78,12 +79,14 @@ public class HibernateReadWriteAccessStrategy extends HibernateAccessStrategyAda @Override public Object get(Object key) { boolean success = false; + Object val = null; + try { - Object o = cache.get(key); + val = cache.get(key); success = true; - return o; + return val; } catch (IgniteCheckedException e) { throw convertException(e); @@ -91,6 +94,11 @@ public class HibernateReadWriteAccessStrategy extends HibernateAccessStrategyAda finally { if (!success) rollbackCurrentTx(); + + if (log.isDebugEnabled()) { + log.debug("Get [cache=" + cache.name() + ", key=" + key + ", val=" + val + + ", success=" + success + ']'); + } } } @@ -109,6 +117,11 @@ public class HibernateReadWriteAccessStrategy extends HibernateAccessStrategyAda finally { if (!success) rollbackCurrentTx(); + + if (log.isDebugEnabled()) { + log.debug("Put from load [cache=" + cache.name() + ", key=" + key + ", val=" + val + + ", success=" + success + ']'); + } } } @@ -134,6 +147,9 @@ public class HibernateReadWriteAccessStrategy extends HibernateAccessStrategyAda finally { if (!success) rollbackCurrentTx(); + + if (log.isDebugEnabled()) + log.debug("Lock [cache=" + cache.name() + ", key=" + key + ", success=" + success + ']'); } } @@ -155,6 +171,9 @@ public class HibernateReadWriteAccessStrategy extends HibernateAccessStrategyAda finally { if (!success) rollbackCurrentTx(); + + if (log.isDebugEnabled()) + log.debug("Unlock [cache=" + cache.name() + ", key=" + key + ", success=" + success + ']'); } } @@ -189,6 +208,11 @@ public class HibernateReadWriteAccessStrategy extends HibernateAccessStrategyAda finally { if (!success) rollbackCurrentTx(); + + if (log.isDebugEnabled()) { + log.debug("Put after update [cache=" + cache.name() + ", key=" + key + ", val=" + val + + ", success=" + success + ']'); + } } } @@ -214,6 +238,11 @@ public class HibernateReadWriteAccessStrategy extends HibernateAccessStrategyAda finally { if (!success) rollbackCurrentTx(); + + if (log.isDebugEnabled()) { + log.debug("Put after insert [cache=" + cache.name() + ", key=" + key + ", val=" + val + + ", success=" + success + ']'); + } } } @@ -235,6 +264,9 @@ public class HibernateReadWriteAccessStrategy extends HibernateAccessStrategyAda finally { if (!success) rollbackCurrentTx(); + + if (log.isDebugEnabled()) + log.debug("Remove [cache=" + cache.name() + ", key=" + key + ", success=" + success + ']'); } } @@ -323,4 +355,4 @@ public class HibernateReadWriteAccessStrategy extends HibernateAccessStrategyAda return locked.isEmpty(); } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/413ad628/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalAccessStrategy.java ---------------------------------------------------------------------- diff --git a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalAccessStrategy.java b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalAccessStrategy.java index 6f4935b..259c6a8 100644 --- a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalAccessStrategy.java +++ b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalAccessStrategy.java @@ -68,7 +68,12 @@ public class HibernateTransactionalAccessStrategy extends HibernateAccessStrateg /** {@inheritDoc} */ @Nullable @Override public Object get(Object key) { try { - return cache.get(key); + Object val = cache.get(key); + + if (log.isDebugEnabled()) + log.debug("Get [cache=" + cache.name() + ", key=" + key + ", val=" + val + ']'); + + return val; } catch (IgniteCheckedException e) { throw convertException(e); @@ -79,6 +84,9 @@ public class HibernateTransactionalAccessStrategy extends HibernateAccessStrateg @Override public void putFromLoad(Object key, Object val) { try { cache.put(key, val); + + if (log.isDebugEnabled()) + log.debug("Put [cache=" + cache.name() + ", key=" + key + ", val=" + val + ']'); } catch (IgniteCheckedException e) { throw convertException(e); @@ -98,9 +106,12 @@ public class HibernateTransactionalAccessStrategy extends HibernateAccessStrateg /** {@inheritDoc} */ @Override public boolean update(Object key, Object val) { try { - cache.put(key, val); + boolean res = cache.put(key, val); - return true; + if (log.isDebugEnabled()) + log.debug("Update [cache=" + cache.name() + ", key=" + key + ", val=" + val + ", res=" + res + ']'); + + return res; } catch (IgniteCheckedException e) { throw convertException(e); @@ -115,9 +126,12 @@ public class HibernateTransactionalAccessStrategy extends HibernateAccessStrateg /** {@inheritDoc} */ @Override public boolean insert(Object key, Object val) { try { - cache.put(key, val); + boolean res = cache.put(key, val); + + if (log.isDebugEnabled()) + log.debug("Insert [cache=" + cache.name() + ", key=" + key + ", val=" + val + ", res=" + res + ']'); - return true; + return res; } catch (IgniteCheckedException e) { throw convertException(e); @@ -138,4 +152,4 @@ public class HibernateTransactionalAccessStrategy extends HibernateAccessStrateg throw convertException(e); } } -} \ No newline at end of file +}
