ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [5/9] ignite git commit: debug
Date Wed, 18 Jan 2017 15:27:41 GMT
debug


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

Branch: refs/heads/ignite-db-x-opt
Commit: 3447cd4b3e5869fe49aa6882a351131e3faa42cd
Parents: 177f399
Author: sboikov <sboikov@gridgain.com>
Authored: Thu Dec 15 18:54:42 2016 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Thu Dec 15 18:54:42 2016 +0300

----------------------------------------------------------------------
 .../ignite/internal/GridKernalContextImpl.java  |  4 +--
 .../cache/IgniteCacheOffheapManagerImpl.java    | 35 ++++++++++++++++----
 .../cache/database/freelist/FreeListImpl.java   | 12 ++++---
 .../cache/database/tree/io/DataPageIO.java      |  4 ---
 .../dht/atomic/GridDhtAtomicCache.java          | 12 +------
 .../ignite/internal/util/PutStatistic.java      | 11 +++---
 .../cache/IgniteSqlQueryPutBenchmark.java       | 25 ++------------
 7 files changed, 45 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3447cd4b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
index d7c6e5d..29cff66 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
@@ -445,9 +445,9 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
                 @Override public void run() {
                     try {
                         while (true) {
-                            stat0.dump(log0);
+                            Thread.sleep(10000);
 
-                            Thread.sleep(5000);
+                            stat0.dump(log0);
                         }
                     }
                     catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/3447cd4b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
index da2c070..2343bb9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
@@ -50,9 +50,11 @@ import org.apache.ignite.internal.processors.cache.local.GridLocalCache;
 import org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.processors.query.GridQueryProcessor;
+import org.apache.ignite.internal.util.CacheStatistics;
 import org.apache.ignite.internal.util.GridAtomicLong;
 import org.apache.ignite.internal.util.GridCloseableIteratorAdapter;
 import org.apache.ignite.internal.util.GridEmptyCloseableIterator;
+import org.apache.ignite.internal.util.PutStatistic;
 import org.apache.ignite.internal.util.lang.GridCloseableIterator;
 import org.apache.ignite.internal.util.lang.GridCursor;
 import org.apache.ignite.internal.util.lang.GridIterator;
@@ -67,6 +69,7 @@ import org.jetbrains.annotations.Nullable;
 import static org.apache.ignite.internal.pagemem.PageIdAllocator.FLAG_IDX;
 import static org.apache.ignite.internal.pagemem.PageIdAllocator.INDEX_PARTITION;
 import static org.apache.ignite.internal.util.PutStatistic.Ops.FIND_ONE;
+import static org.apache.ignite.internal.util.PutStatistic.Ops.IDX_UPDATE;
 import static org.apache.ignite.internal.util.PutStatistic.Ops.STORE_ADD;
 import static org.apache.ignite.internal.util.PutStatistic.Ops.STORE_RMV;
 import static org.apache.ignite.internal.util.PutStatistic.Ops.TREE_PUT;
@@ -97,6 +100,8 @@ public class IgniteCacheOffheapManagerImpl extends GridCacheManagerAdapter
imple
     /** */
     private final GridAtomicLong globalRmvId = new GridAtomicLong(U.currentTimeMillis() *
1000_000);
 
+    private ConcurrentMap<KeyCacheObject, CacheDataRow> data = new ConcurrentHashMap<>();
+
     /** {@inheritDoc} */
     @Override public GridAtomicLong globalRemoveId() {
         return globalRmvId;
@@ -837,11 +842,17 @@ public class IgniteCacheOffheapManagerImpl extends GridCacheManagerAdapter
imple
             key.valueBytes(cctx.cacheObjectContext());
             val.valueBytes(cctx.cacheObjectContext());
 
-            cctx.stats().opStart(STORE_ADD);
+            if (true) {
+                cctx.stats().opStart(TREE_PUT);
 
-            rowStore.addRow(dataRow);
+                data.put(key, dataRow);
+
+                cctx.stats().opEnd(TREE_PUT);
+
+                return;
+            }
 
-            cctx.stats().opEnd(STORE_ADD);
+            rowStore.addRow(dataRow);
 
             assert dataRow.link() != 0 : dataRow;
 
@@ -855,6 +866,8 @@ public class IgniteCacheOffheapManagerImpl extends GridCacheManagerAdapter
imple
                 storageSize.incrementAndGet();
 
             if (indexingEnabled) {
+                cctx.stats().opStart(IDX_UPDATE);
+
                 GridCacheQueryManager qryMgr = cctx.queries();
 
                 assert qryMgr.enabled();
@@ -863,19 +876,26 @@ public class IgniteCacheOffheapManagerImpl extends GridCacheManagerAdapter
imple
                     qryMgr.store(key, p, old.value(), old.version(), val, ver, expireTime,
dataRow.link());
                 else
                     qryMgr.store(key, p, null, null, val, ver, expireTime, dataRow.link());
+
+                cctx.stats().opEnd(IDX_UPDATE);
             }
 
             if (old != null) {
                 assert old.link() != 0 : old;
 
-                if (pendingEntries != null && old.expireTime() != 0)
+                if (pendingEntries != null && old.expireTime() != 0) {
+                    if (true)
+                        throw new IgniteCheckedException("Error");
+
                     pendingEntries.remove(new PendingRow(old.expireTime(), old.link()));
+                }
 
-                cctx.stats().opStart(STORE_RMV);
+                CacheStatistics.opStart(PutStatistic.Ops.STORE_RMV);
 
                 rowStore.removeRow(old.link());
 
-                cctx.stats().opEnd(STORE_RMV);
+                CacheStatistics.opEnd(PutStatistic.Ops.STORE_RMV);
+
             }
 
             if (pendingEntries != null && expireTime != 0)
@@ -920,7 +940,8 @@ public class IgniteCacheOffheapManagerImpl extends GridCacheManagerAdapter
imple
             cctx.stats().opStart(FIND_ONE);
 
             try {
-                return dataTree.findOne(new KeySearchRow(key.hashCode(), key, 0));
+                return data.get(key);
+                //return dataTree.findOne(new KeySearchRow(key.hashCode(), key, 0));
             }
             finally {
                 cctx.stats().opEnd(FIND_ONE);

http://git-wip-us.apache.org/repos/asf/ignite/blob/3447cd4b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/freelist/FreeListImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/freelist/FreeListImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/freelist/FreeListImpl.java
index 5568867..43c6a46 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/freelist/FreeListImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/freelist/FreeListImpl.java
@@ -83,25 +83,25 @@ public class FreeListImpl extends PagesList implements FreeList, ReuseList
{
 
                 assert oldFreeSpace > 0 : oldFreeSpace;
 
-                CacheStatistics.opStart(PutStatistic.Ops.DATA_ADD);
+                CacheStatistics.opStart(PutStatistic.Ops.STORE_ADD);
 
                 // If the full row does not fit into this page write only a fragment.
                 written = (written == 0 && oldFreeSpace >= rowSize) ? addRow(page,
buf, io, row, rowSize):
                     addRowFragment(page, buf, io, row, written, rowSize);
 
-                CacheStatistics.opEnd(PutStatistic.Ops.DATA_ADD);
+                CacheStatistics.opEnd(PutStatistic.Ops.STORE_ADD);
 
                 // Reread free space after update.
                 int newFreeSpace = io.getFreeSpace(buf);
 
                 if (newFreeSpace > MIN_PAGE_FREE_SPACE) {
-                    CacheStatistics.opStart(PutStatistic.Ops.FREE_LIST_PUT);
+                    CacheStatistics.opStart(PutStatistic.Ops.STORE_ADD_FREE_LIST_PUT);
 
                     int bucket = bucket(newFreeSpace, false);
 
                     put(null, page, buf, bucket);
 
-                    CacheStatistics.opEnd(PutStatistic.Ops.FREE_LIST_PUT);
+                    CacheStatistics.opEnd(PutStatistic.Ops.STORE_ADD_FREE_LIST_PUT);
                 }
 
                 // Avoid boxing with garbage generation for usual case.
@@ -222,9 +222,13 @@ public class FreeListImpl extends PagesList implements FreeList, ReuseList
{
                     int oldBucket = bucket(oldFreeSpace, false);
 
                     if (oldBucket != newBucket) {
+                        CacheStatistics.opStart(PutStatistic.Ops.STORE_RMV_FREE_LIST_PUT);
+
                         // It is possible that page was concurrently taken for put, in this
case put will handle bucket change.
                         if (removeDataPage(page, buf, io, oldBucket))
                             put(null, page, buf, newBucket);
+
+                        CacheStatistics.opEnd(PutStatistic.Ops.STORE_RMV_FREE_LIST_PUT);
                     }
                 }
                 else

http://git-wip-us.apache.org/repos/asf/ignite/blob/3447cd4b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/DataPageIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/DataPageIO.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/DataPageIO.java
index a282d98..816a575 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/DataPageIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/DataPageIO.java
@@ -1129,8 +1129,6 @@ public class DataPageIO extends PageIO {
     private int compactDataEntries(ByteBuffer buf, int directCnt) {
         assert checkCount(directCnt) : directCnt;
 
-        CacheStatistics.opStart(PutStatistic.Ops.DATA_ADD1);
-
         int[] offs = new int[directCnt];
 
         for (int i = 0; i < directCnt; i++) {
@@ -1208,8 +1206,6 @@ public class DataPageIO extends PageIO {
             prevOff = off;
         }
 
-        CacheStatistics.opEnd(PutStatistic.Ops.DATA_ADD1);
-
         return prevOff;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3447cd4b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index c5ed1e7..2916050 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -1692,8 +1692,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
         GridNearAtomicAbstractUpdateRequest req,
         CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb
     ) {
-        ctx.stats().opStart(UPDATE_INTERNAL);
-
         GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(ctx.cacheId(),
nodeId, req.futureVersion(),
             ctx.deploymentEnabled());
 
@@ -1710,12 +1708,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
         try {
             // If batch store update is enabled, we need to lock all entries.
             // First, need to acquire locks on cache entries, then check filter.
-            ctx.stats().opStart(LOCK);
-
             List<GridDhtCacheEntry> locked = lockEntries(req, req.topologyVersion());
 
-            ctx.stats().opEnd(LOCK);
-
             Collection<IgniteBiTuple<GridDhtCacheEntry, GridCacheVersion>> deleted
= null;
 
             try {
@@ -1845,13 +1839,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
                 e.printStackTrace();
             }
             finally {
-                ctx.stats().opStart(UNLOCK);
-
                 if (locked != null)
                     unlockEntries(locked, req.topologyVersion());
 
-                ctx.stats().opEnd(UNLOCK);
-
                 // Enqueue if necessary after locks release.
                 if (deleted != null) {
                     assert !deleted.isEmpty();
@@ -1890,7 +1880,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
             return;
         }
         finally {
-            ctx.stats().opEnd(UPDATE_INTERNAL);
+            //ctx.stats().opEnd(UPDATE_INTERNAL);
         }
 
         if (remap) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/3447cd4b/modules/core/src/main/java/org/apache/ignite/internal/util/PutStatistic.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/PutStatistic.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/PutStatistic.java
index 389dad7..9747d6c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/PutStatistic.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/PutStatistic.java
@@ -62,19 +62,16 @@ public class PutStatistic extends OperationStatistic {
         FREE_LIST_FIND,
 
         /** */
-        FREE_LIST_PUT,
+        STORE_ADD_FREE_LIST_PUT,
 
         /** */
-        DATA_ADD,
-
-        /** */
-        DATA_ADD1,
+        STORE_RMV_FREE_LIST_PUT,
 
         /** */
-        DATA_ADD2,
+        DATA_ADD,
 
         /** */
-        DATA_ADD3
+        IDX_UPDATE,
         ;
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3447cd4b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java
index dfa4cbc..cf194e4 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java
@@ -48,30 +48,9 @@ public class IgniteSqlQueryPutBenchmark extends IgniteCacheAbstractBenchmark<Int
     @Override public boolean test(Map<Object, Object> ctx) throws Exception {
         ThreadLocalRandom rnd = ThreadLocalRandom.current();
 
-        if (rnd.nextBoolean()) {
-            double salary = rnd.nextDouble() * args.range() * 1000;
+        int i = rnd.nextInt(args.range());
 
-            double maxSalary = salary + 1000;
-
-            Collection<Cache.Entry<Integer, Object>> entries = executeQuery(salary,
maxSalary);
-
-            for (Cache.Entry<Integer, Object> entry : entries) {
-                Person p = (Person)entry.getValue();
-
-                if (p.getSalary() < salary || p.getSalary() > maxSalary)
-                    throw new Exception("Invalid person retrieved [min=" + salary + ", max="
+ maxSalary +
-                            ", person=" + p + ']');
-            }
-
-            qryCnt.getAndIncrement();
-        }
-        else {
-            int i = rnd.nextInt(args.range());
-
-            cache.put(i, new Person(i, "firstName" + i, "lastName" + i, i * 1000));
-
-            putCnt.getAndIncrement();
-        }
+        cache.put(i, new Person(i, "firstName" + i, "lastName" + i, i * 1000));
 
         return true;
     }


Mime
View raw message