ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [06/37] incubator-ignite git commit: # ignite-564 WIP
Date Tue, 07 Apr 2015 11:55:03 GMT
# ignite-564 WIP


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

Branch: refs/heads/ignite-688
Commit: e69ef35b6c89c22dd34fcf1623cee4856060ae44
Parents: 6c3f101
Author: anovikov <anovikov@gridgain.com>
Authored: Fri Apr 3 14:23:56 2015 +0700
Committer: anovikov <anovikov@gridgain.com>
Committed: Fri Apr 3 15:31:04 2015 +0700

----------------------------------------------------------------------
 .../store/jdbc/CacheAbstractJdbcStore.java      | 41 ++++++++++++++++----
 1 file changed, 34 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e69ef35b/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 75e2080..f7bf272 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
@@ -233,8 +233,12 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K,
V>,
         if (dataSrc == null)
             throw new IgniteException("Failed to initialize cache store (data source is not
provided).");
 
-        if (dialect == null)
+        if (dialect == null) {
             dialect = resolveDialect();
+
+            if (log.isDebugEnabled())
+                log.debug("Resolved database dialect: " + U.getSimpleName(dialect.getClass()));
+        }
     }
 
     /** {@inheritDoc} */
@@ -616,6 +620,8 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K,
V>,
         ExecutorService pool = null;
 
         try {
+            String cacheName = session().cacheName();
+
             pool = Executors.newFixedThreadPool(maxPoolSz);
 
             Collection<Future<?>> futs = new ArrayList<>();
@@ -627,8 +633,6 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K,
V>,
                 if (log.isDebugEnabled())
                     log.debug("Start loading entries from db using user queries from arguments");
 
-                String cacheName = session().cacheName();
-
                 for (int i = 0; i < args.length; i += 2) {
                     String keyType = args[i].toString();
 
@@ -642,13 +646,13 @@ public abstract class CacheAbstractJdbcStore<K, V> implements
CacheStore<K, V>,
             else {
                 Collection<EntryMapping> entryMappings = cacheMappings(session().cacheName()).values();
 
-                if (log.isDebugEnabled())
-                    log.debug("Start loading all cache types entries from db");
-
                 for (EntryMapping em : entryMappings) {
                     if (parallelLoadCacheMinThreshold > 0) {
                         Connection conn = null;
 
+                        log.debug("Start parallel loading entries of one type from db [cache
name=" + cacheName +
+                            ", key type=" + em.keyType() + " ]");
+
                         try {
                             conn = connection();
 
@@ -691,13 +695,21 @@ public abstract class CacheAbstractJdbcStore<K, V> implements
CacheStore<K, V>,
                             U.closeQuiet(conn);
                         }
                     }
-                    else
+                    else {
+                        if (log.isDebugEnabled())
+                            log.debug("Start loading entries of one type from db [cache name="
+ cacheName +
+                                ", key type=" + em.keyType() + " ]");
+
                         futs.add(pool.submit(loadCacheFull(em, clo)));
+                    }
                 }
             }
 
             for (Future<?> fut : futs)
                 U.get(fut);
+
+            if (log.isDebugEnabled())
+                log.debug("Finished load cache: " + cacheName + " from db");
         }
         catch (IgniteCheckedException e) {
             throw new CacheLoaderException("Failed to load cache", e.getCause());
@@ -940,6 +952,10 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K,
V>,
 
             String cacheName = session().cacheName();
 
+            if (log.isDebugEnabled())
+                log.debug("Start write entries to database [cache name=" + cacheName +
+                    ", count=" + entries.size() + "]");
+
             if (dialect.hasMerge()) {
                 PreparedStatement mergeStmt = null;
 
@@ -1145,6 +1161,9 @@ public abstract class CacheAbstractJdbcStore<K, V> implements
CacheStore<K, V>,
 
             String cacheName = session().cacheName();
 
+            if (log.isDebugEnabled())
+                log.debug("Start remove values from database [cache name=" + cacheName +
", count=" + keys.size() + "]");
+
             for (Object key : keys) {
                 Object keyTypeId = keyTypeId(key);
 
@@ -1600,6 +1619,10 @@ public abstract class CacheAbstractJdbcStore<K, V> implements
CacheStore<K, V>,
 
         /** {@inheritDoc} */
         @Override public Void call() throws Exception {
+            if (log.isDebugEnabled())
+                log.debug("Start load cache using custom query [cache name= " + em.cacheName
+
+                    ", key type=" + em.keyType() + ", query=" + qry + "]");
+
             Connection conn = null;
 
             PreparedStatement stmt = null;
@@ -1692,6 +1715,10 @@ public abstract class CacheAbstractJdbcStore<K, V> implements
CacheStore<K, V>,
 
         /** {@inheritDoc} */
         @Override public Map<K1, V1> call() throws Exception {
+            if (log.isDebugEnabled())
+                log.debug("Start load values from database [table= " + em.fullTableName()
+
+                    ", key count=" + keys.size() + "]");
+
             PreparedStatement stmt = null;
 
             try {


Mime
View raw message