ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yzhda...@apache.org
Subject [03/30] incubator-ignite git commit: ignite-341 - fix attempt 3
Date Fri, 27 Mar 2015 09:44:59 GMT
ignite-341 - fix attempt 3


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

Branch: refs/heads/sprint-2
Commit: d930d6f7d0cedcde10af2540f16e4882c528855a
Parents: e2445bb
Author: S.Vladykin <svladykin@gridgain.com>
Authored: Mon Mar 23 17:45:53 2015 +0300
Committer: S.Vladykin <svladykin@gridgain.com>
Committed: Mon Mar 23 17:45:53 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheMapEntry.java       |  2 +-
 .../distributed/dht/GridDhtLocalPartition.java    |  2 ++
 .../processors/query/GridQueryProcessor.java      | 18 +++++++++++++++---
 .../query/h2/opt/GridH2AbstractKeyValueRow.java   | 10 +++++++++-
 .../processors/query/h2/opt/GridH2Table.java      |  4 ++--
 5 files changed, 29 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d930d6f7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index a22b35a..a36176c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -3710,7 +3710,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx
{
 
             if (qryMgr != null)
                 qryMgr.remove(key().value(cctx.cacheObjectContext(), false),
-                    prevVal.value(cctx.cacheObjectContext(), false));
+                    prevVal == null ? null : prevVal.value(cctx.cacheObjectContext(), false));
         }
         catch (IgniteCheckedException e) {
             throw new GridCacheIndexUpdateException(e);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d930d6f7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index efbbe21..74c23fd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -615,6 +615,8 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>
 
                     lastEntry = (GridDhtCacheEntry)cctx.cache().entryEx(key, false);
 
+                    lastEntry.unswap(true, true);
+
                     return lastEntry;
                 }
                 catch (IgniteCheckedException e) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d930d6f7/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index d3bfdf6..d6412d0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -334,6 +334,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
         assert key != null;
         assert val != null;
 
+        if (log.isDebugEnabled())
+            log.debug("Store [space=" + space + ", key=" + key + ", val=" + val + "]");
+
         ctx.indexing().store(space, key, val, expirationTime);
 
         if (idx == null)
@@ -343,9 +346,6 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             throw new IllegalStateException("Failed to write to index (grid is stopping).");
 
         try {
-            if (log.isDebugEnabled())
-                log.debug("Storing key to cache query index [key=" + key + ", value=" + val
+ "]");
-
             final Class<?> valCls = val.getClass();
 
             TypeId id;
@@ -604,6 +604,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
     public void remove(String space, Object key, Object val) throws IgniteCheckedException
{
         assert key != null;
 
+        if (log.isDebugEnabled())
+            log.debug("Remove [space=" + space + ", key=" + key + ", val=" + val + "]");
+
         ctx.indexing().remove(space, key);
 
         if (idx == null)
@@ -717,6 +720,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
      * @throws IgniteCheckedException If failed.
      */
     public void onSwap(String spaceName, Object key) throws IgniteCheckedException {
+        if (log.isDebugEnabled())
+            log.debug("Swap [space=" + spaceName + ", key=" + key + "]");
+
         ctx.indexing().onSwap(spaceName, key);
 
         if (idx == null)
@@ -744,6 +750,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
      */
     public void onUnswap(String spaceName, Object key, Object val, byte[] valBytes)
         throws IgniteCheckedException {
+        if (log.isDebugEnabled())
+            log.debug("Unswap [space=" + spaceName + ", key=" + key + ", val=" + val + "]");
+
         ctx.indexing().onUnswap(spaceName, key, val);
 
         if (idx == null)
@@ -768,6 +777,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
      * @throws IgniteCheckedException If undeploy failed.
      */
     public void onUndeploy(@Nullable String space, ClassLoader ldr) throws IgniteCheckedException
{
+        if (log.isDebugEnabled())
+            log.debug("Undeploy [space=" + space + "]");
+
         if (idx == null)
             return;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d930d6f7/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
index 5f52a77..90e329d 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
@@ -179,6 +179,7 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
 
         if (oldVal == null || oldVal instanceof WeakValue)
             onUnswap(val);
+        // Else we would assert that val.equals(oldVal) but value is not necessarily implements
equals() correctly.
     }
 
     /**
@@ -222,6 +223,8 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
             Value v = super.getValue(col);
 
             if (col == VAL_COL) {
+                int loops = 0;
+
                 while ((v = WeakValue.unwrap(v)) == null) {
                     v = getOffheapValue(VAL_COL);
 
@@ -234,8 +237,10 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
                         return v;
                     }
 
+                    Object k = getValue(KEY_COL).getObject();
+
                     try {
-                        Object valObj = desc.readFromSwap(getValue(KEY_COL).getObject());
+                        Object valObj = desc.readFromSwap(k);
 
                         if (valObj != null) {
                             Value upd = wrap(valObj, desc.valueType());
@@ -255,6 +260,9 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
                             // If nothing found in swap then we should be already unswapped.
                             v = syncValue();
                         }
+
+                        if (++loops == 1000)
+                            throw new IllegalStateException("Failed to get value for key:
" + k);
                     }
                     catch (IgniteCheckedException e) {
                         throw new IgniteException(e);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d930d6f7/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
index 27e756f..0b5d0b5 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
@@ -302,7 +302,6 @@ public class GridH2Table extends TableBase {
      */
     public boolean update(Object key, Object val, long expirationTime, boolean rmv) throws
IgniteCheckedException {
         assert desc != null;
-        assert val != null;
 
         GridH2Row row = desc.createRow(key, val, expirationTime);
 
@@ -382,7 +381,8 @@ public class GridH2Table extends TableBase {
                 if (old instanceof GridH2AbstractKeyValueRow) { // Unswap value.
                     Value v = row.getValue(GridH2AbstractKeyValueRow.VAL_COL);
 
-                    ((GridH2AbstractKeyValueRow)old).unswapBeforeRemove(v);
+                    if (v != null)
+                        ((GridH2AbstractKeyValueRow)old).unswapBeforeRemove(v);
                 }
 
                 if (old != null) {


Mime
View raw message