You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by an...@apache.org on 2015/04/06 05:19:16 UTC
[34/34] incubator-ignite git commit: # ignite-564 Add debug output.
# ignite-564 Add debug output.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7fa7f425
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7fa7f425
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7fa7f425
Branch: refs/heads/ignite-564
Commit: 7fa7f425ff23ac2246f94e6816480123163b0507
Parents: 5e2704d
Author: Andrey Novikov <an...@gridgain.com>
Authored: Mon Apr 6 10:17:53 2015 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Mon Apr 6 10:17:53 2015 +0700
----------------------------------------------------------------------
.../store/jdbc/CacheAbstractJdbcStore.java | 73 ++++++++++++++------
.../yardstick/config/benchmark-store.properties | 5 +-
2 files changed, 51 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7fa7f425/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 f7bf272..df5345b 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
@@ -236,7 +236,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
if (dialect == null) {
dialect = resolveDialect();
- if (log.isDebugEnabled())
+ if (log.isDebugEnabled() && dialect.getClass() != BasicJdbcDialect.class)
log.debug("Resolved database dialect: " + U.getSimpleName(dialect.getClass()));
}
}
@@ -336,10 +336,10 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
finally {
U.closeQuiet(conn);
}
- }
- if (tx != null && log.isDebugEnabled())
- log.debug("Transaction ended [xid=" + tx.xid() + ", commit=" + commit + ']');
+ if (log.isDebugEnabled())
+ log.debug("Transaction ended [xid=" + tx.xid() + ", commit=" + commit + ']');
+ }
}
/**
@@ -648,11 +648,11 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
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() + " ]");
+ Connection conn = null;
+
try {
conn = connection();
@@ -948,13 +948,9 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
try {
conn = connection();
- Object currKeyTypeId = null;
-
String cacheName = session().cacheName();
- if (log.isDebugEnabled())
- log.debug("Start write entries to database [cache name=" + cacheName +
- ", count=" + entries.size() + "]");
+ Object currKeyTypeId = null;
if (dialect.hasMerge()) {
PreparedStatement mergeStmt = null;
@@ -979,6 +975,10 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
if (currKeyTypeId == null || !currKeyTypeId.equals(keyTypeId)) {
if (mergeStmt != null) {
+ if (log.isDebugEnabled())
+ log.debug("Start write entries to database [cache name=" + cacheName +
+ ", key type=" + em.keyType() + ", count=" + prepared + "]");
+
executeBatch(em, mergeStmt, "writeAll", fromIdx, prepared, lazyEntries);
U.closeQuiet(mergeStmt);
@@ -988,6 +988,8 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
currKeyTypeId = keyTypeId;
+ fromIdx += prepared;
+
prepared = 0;
}
@@ -998,20 +1000,35 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
mergeStmt.addBatch();
if (++prepared % batchSz == 0) {
+ if (log.isDebugEnabled())
+ log.debug("Start write entries to database [cache name=" + cacheName +
+ ", key type=" + em.keyType() + ", count=" + prepared + "]");
+
executeBatch(em, mergeStmt, "writeAll", fromIdx, prepared, lazyEntries);
+ fromIdx += prepared;
+
prepared = 0;
}
}
- if (mergeStmt != null && prepared % batchSz != 0)
+ if (mergeStmt != null && prepared % batchSz != 0) {
+ if (log.isDebugEnabled())
+ log.debug("Start write entries to database [cache name=" + cacheName +
+ ", key type=" + em.keyType() + ", count=" + prepared + "]");
+
executeBatch(em, mergeStmt, "writeAll", fromIdx, prepared, lazyEntries);
+
+ }
}
finally {
U.closeQuiet(mergeStmt);
}
}
else {
+ log.debug("Start write entries to database by one using update and insert statement [cache name=" +
+ cacheName + ", count=" + entries.size() + "]");
+
PreparedStatement insStmt = null;
PreparedStatement updStmt = null;
@@ -1145,24 +1162,21 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
try {
conn = connection();
- Object currKeyTypeId = null;
-
- EntryMapping em = null;
-
- PreparedStatement delStmt = null;
-
LazyValue<Object[]> lazyKeys = new LazyValue<Object[]>() {
@Override public Object[] create() {
return keys.toArray();
}
};
- int fromIdx = 0, prepared = 0;
-
String cacheName = session().cacheName();
- if (log.isDebugEnabled())
- log.debug("Start remove values from database [cache name=" + cacheName + ", count=" + keys.size() + "]");
+ Object currKeyTypeId = null;
+
+ EntryMapping em = null;
+
+ PreparedStatement delStmt = null;
+
+ int fromIdx = 0, prepared = 0;
for (Object key : keys) {
Object keyTypeId = keyTypeId(key);
@@ -1176,6 +1190,10 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
}
if (!currKeyTypeId.equals(keyTypeId)) {
+ if (log.isDebugEnabled())
+ log.debug("Start delete entries to database [cache name=" + cacheName +
+ ", key type=" + em.keyType() + ", count=" + prepared + "]");
+
executeBatch(em, delStmt, "deleteAll", fromIdx, prepared, lazyKeys);
fromIdx += prepared;
@@ -1190,6 +1208,10 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
delStmt.addBatch();
if (++prepared % batchSz == 0) {
+ if (log.isDebugEnabled())
+ log.debug("Start delete entries to database [cache name=" + cacheName +
+ ", key type=" + em.keyType() + ", count=" + prepared + "]");
+
executeBatch(em, delStmt, "deleteAll", fromIdx, prepared, lazyKeys);
fromIdx += prepared;
@@ -1198,8 +1220,13 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
}
}
- if (delStmt != null && prepared % batchSz != 0)
+ if (delStmt != null && prepared % batchSz != 0) {
+ if (log.isDebugEnabled())
+ log.debug("Start delete entries to database [cache name=" + cacheName +
+ ", key type=" + em.keyType() + ", count=" + prepared + "]");
+
executeBatch(em, delStmt, "deleteAll", fromIdx, prepared, lazyKeys);
+ }
}
catch (SQLException e) {
throw new CacheWriterException("Failed to remove values from database", e);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7fa7f425/modules/yardstick/config/benchmark-store.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-store.properties b/modules/yardstick/config/benchmark-store.properties
index 8a7c265..cb9e507 100644
--- a/modules/yardstick/config/benchmark-store.properties
+++ b/modules/yardstick/config/benchmark-store.properties
@@ -77,17 +77,14 @@ CONFIGS="\
-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStoreGetBenchmark -sn IgniteNode -cs -wb -ds atomic-writeBehind-get,\
-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStoreGetTxBenchmark -sn IgniteNode -ds tx-get,\
-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStoreGetTxBenchmark -sn IgniteNode -cs -ds tx-store-get,\
--cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStoreGetTxBenchmark -sn IgniteNode -cs -wb -ds tx-writeBehind-get,\
-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutBenchmark -sn IgniteNode -ds atomic-put,\
-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutBenchmark -sn IgniteNode -cs -ds atomic-store-put,\
-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutBenchmark -sn IgniteNode -cs -wb -ds atomic-writeBehind-put,\
-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutTxBenchmark -sn IgniteNode -ds tx-put,\
-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutTxBenchmark -sn IgniteNode -cs -ds tx-store-put,\
--cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutTxBenchmark -sn IgniteNode -cs -wb -ds tx-writeBehind-put,\
-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutGetBenchmark -sn IgniteNode -ds atomic-put-get,\
-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutGetBenchmark -sn IgniteNode -cs -ds atomic-store-put-get,\
-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutGetBenchmark -sn IgniteNode -cs -wb -ds atomic-writeBehind-put-get,\
-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutGetTxBenchmark -sn IgniteNode -ds tx-put-get,\
--cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutGetTxBenchmark -sn IgniteNode -cs -ds tx-store-put-get,\
--cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutGetTxBenchmark -sn IgniteNode -cs -wb -ds tx-writeBehind-put-get\
+-cfg ${SCRIPT_DIR}/../config/ignite-store-config.xml -nn ${nodesNum} -b 1 -w ${warm_up} -d ${run} -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcStorePutGetTxBenchmark -sn IgniteNode -cs -ds tx-store-put-get\
"