ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [6/8] ignite git commit: IGNITE-3936 Added check for already processed key types on load cache. Added info message about started/finished load cache. Improved exceptions messages.
Date Wed, 21 Sep 2016 08:58:29 GMT
IGNITE-3936 Added check for already processed key types on load cache. Added info message about
started/finished load cache. Improved exceptions messages.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4ee52f0a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4ee52f0a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4ee52f0a

Branch: refs/heads/master
Commit: 4ee52f0a50d9cf8bc64a277f2d02600a832d6ca6
Parents: b3ba8b8
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Wed Sep 21 15:37:52 2016 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Wed Sep 21 15:37:52 2016 +0700

----------------------------------------------------------------------
 .../store/jdbc/CacheAbstractJdbcStore.java      | 42 ++++++++++++--------
 .../cache/store/jdbc/CacheJdbcPojoStore.java    |  5 ++-
 2 files changed, 29 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4ee52f0a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
index a33a1e6..fe8a50b 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
@@ -827,17 +827,31 @@ public abstract class CacheAbstractJdbcStore<K, V> implements
CacheStore<K, V>,
                         throw new CacheLoaderException("Provided key type is not found in
store or cache configuration " +
                             "[cache=" + U.maskName(cacheName) + ", key=" + keyType + "]");
 
-                    String selQry = args[i + 1].toString();
+                    String qry = args[i + 1].toString();
 
                     EntryMapping em = entryMapping(cacheName, typeIdForTypeName(kindForName(keyType),
keyType));
 
-                    futs.add(pool.submit(new LoadCacheCustomQueryWorker<>(em, selQry,
clo)));
+                    if (log.isInfoEnabled())
+                        log.info("Started load cache using custom query [cache=" + U.maskName(cacheName)
+
+                            ", keyType=" + keyType + ", query=" + qry + "]");
+
+                    futs.add(pool.submit(new LoadCacheCustomQueryWorker<>(em, qry,
clo)));
                 }
             }
             else {
-                Collection<EntryMapping> entryMappings = mappings.values();
+                Collection<String> processedKeyTypes = new HashSet<>();
+
+                for (EntryMapping em : mappings.values()) {
+                    String keyType = em.keyType();
+
+                    if (processedKeyTypes.contains(keyType))
+                        continue;
+
+                    processedKeyTypes.add(keyType);
+
+                    if (log.isInfoEnabled())
+                        log.info("Started load cache [cache=" + U.maskName(cacheName) + ",
keyType=" + keyType + "]");
 
-                for (EntryMapping em : entryMappings) {
                     if (parallelLoadCacheMinThreshold > 0) {
                         Connection conn = null;
 
@@ -853,7 +867,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K,
V>,
                             if (rs.next()) {
                                 if (log.isDebugEnabled())
                                     log.debug("Multithread loading entries from db [cache="
+ U.maskName(cacheName) +
-                                        ", keyType=" + em.keyType() + " ]");
+                                        ", keyType=" + keyType + "]");
 
                                 int keyCnt = em.keyCols.size();
 
@@ -876,13 +890,13 @@ public abstract class CacheAbstractJdbcStore<K, V> implements
CacheStore<K, V>,
                                 }
 
                                 futs.add(pool.submit(loadCacheRange(em, clo, upperBound,
null, 0)));
-
-                                continue;
                             }
+
+                            continue;
                         }
                         catch (SQLException e) {
-                            log.warning("Failed to load entries from db in multithreaded
mode " +
-                                "[cache=" + U.maskName(cacheName) + ", keyType=" + em.keyType()
+ " ]", e);
+                            log.warning("Failed to load entries from db in multithreaded
mode, will try in single thread " +
+                                "[cache=" + U.maskName(cacheName) + ", keyType=" + keyType
+ " ]", e);
                         }
                         finally {
                             U.closeQuiet(conn);
@@ -891,7 +905,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K,
V>,
 
                     if (log.isDebugEnabled())
                         log.debug("Single thread loading entries from db [cache=" + U.maskName(cacheName)
+
-                            ", keyType=" + em.keyType() + " ]");
+                            ", keyType=" + keyType + "]");
 
                     futs.add(pool.submit(loadCacheFull(em, clo)));
                 }
@@ -900,8 +914,8 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K,
V>,
             for (Future<?> fut : futs)
                 U.get(fut);
 
-            if (log.isDebugEnabled())
-                log.debug("Cache loaded from db: " + U.maskName(cacheName));
+            if (log.isInfoEnabled())
+                log.info("Finished load cache: " + U.maskName(cacheName));
         }
         catch (IgniteCheckedException e) {
             throw new CacheLoaderException("Failed to load cache: " + U.maskName(cacheName),
e.getCause());
@@ -1941,10 +1955,6 @@ public abstract class CacheAbstractJdbcStore<K, V> implements
CacheStore<K, V>,
 
         /** {@inheritDoc} */
         @Override public Void call() throws Exception {
-            if (log.isDebugEnabled())
-                log.debug("Load cache using custom query [cache= " + U.maskName(em.cacheName)
+
-                    ", keyType=" + em.keyType() + ", query=" + qry + "]");
-
             Connection conn = null;
 
             PreparedStatement stmt = null;

http://git-wip-us.apache.org/repos/asf/ignite/blob/4ee52f0a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
index 798b84a..dd3e812 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
@@ -102,7 +102,8 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K,
V> {
             return prop.get(obj);
         }
         catch (Exception e) {
-            throw new CacheException("Failed to read object of class: " + typeName, e);
+            throw new CacheException("Failed to read object property [cache=" + U.maskName(cacheName)
+
+                ", type=" + typeName + ", prop=" + fldName + "]", e);
         }
     }
 
@@ -262,7 +263,7 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K,
V> {
             return builder.build();
         }
         catch (SQLException e) {
-            throw new CacheException("Failed to read binary object", e);
+            throw new CacheException("Failed to read binary object: " + typeName, e);
         }
     }
 


Mime
View raw message