ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [1/9] ignite git commit: ignite-2.0 - Added logging for binary metadata processor
Date Fri, 28 Apr 2017 12:40:10 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-5075-cacheStart dfad84346 -> 0c66d0e01


ignite-2.0 - Added logging for binary metadata processor


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

Branch: refs/heads/ignite-5075-cacheStart
Commit: ba32b40faa357b2b3deab6708ebec9c5f3f90bc4
Parents: d4b6fec
Author: Sergey Chugunov <sergey.chugunov@gmail.com>
Authored: Thu Apr 27 18:22:43 2017 +0300
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Thu Apr 27 18:22:43 2017 +0300

----------------------------------------------------------------------
 .../cache/binary/BinaryMetadataHolder.java      |  7 ++++
 .../cache/binary/BinaryMetadataTransport.java   | 34 +++++++++++++++++---
 .../binary/CacheObjectBinaryProcessorImpl.java  | 27 +++++++++++++---
 .../binary/ClientMetadataRequestFuture.java     |  5 +++
 4 files changed, 63 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ba32b40f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataHolder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataHolder.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataHolder.java
index bbc929e..7a6ed37 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataHolder.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataHolder.java
@@ -70,4 +70,11 @@ final class BinaryMetadataHolder implements Serializable {
     int acceptedVersion() {
         return acceptedVer;
     }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return "[typeId=" + metadata.typeId() +
+            ", pendingVer=" + pendingVer +
+            ", acceptedVer=" + acceptedVer + "]";
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ba32b40f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataTransport.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataTransport.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataTransport.java
index 770fa32..e4df075 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataTransport.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataTransport.java
@@ -149,6 +149,9 @@ final class BinaryMetadataTransport {
     GridFutureAdapter<MetadataUpdateResult> requestMetadataUpdate(BinaryMetadata metadata)
throws IgniteCheckedException {
         MetadataUpdateResultFuture resFut = new MetadataUpdateResultFuture();
 
+        if (log.isDebugEnabled())
+            log.debug("Requesting metadata update for " + metadata.typeId());
+
         synchronized (this) {
             unlabeledFutures.add(resFut);
 
@@ -244,6 +247,7 @@ final class BinaryMetadataTransport {
             int acceptedVer;
 
             if (msg.pendingVersion() == 0) {
+                //coordinator receives update request
                 if (holder != null) {
                     pendingVer = holder.pendingVersion() + 1;
                     acceptedVer = holder.acceptedVersion();
@@ -253,6 +257,13 @@ final class BinaryMetadataTransport {
                     acceptedVer = 0;
                 }
 
+                if (log.isDebugEnabled())
+                    log.debug("Versions are stamped on coordinator" +
+                        " [typeId=" + typeId +
+                        ", pendingVer=" + pendingVer +
+                        ", acceptedVer=" + acceptedVer + "]"
+                    );
+
                 msg.pendingVersion(pendingVer);
                 msg.acceptedVersion(acceptedVer);
 
@@ -314,7 +325,12 @@ final class BinaryMetadataTransport {
                     else {
                         initSyncFor(typeId, pendingVer, fut);
 
-                        metaLocCache.put(typeId, new BinaryMetadataHolder(msg.metadata(),
pendingVer, acceptedVer));
+                        BinaryMetadataHolder newHolder = new BinaryMetadataHolder(msg.metadata(),
pendingVer, acceptedVer);
+
+                        if (log.isDebugEnabled())
+                            log.debug("Updated metadata on originating node: " + newHolder);
+
+                        metaLocCache.put(typeId, newHolder);
                     }
                 }
             }
@@ -344,8 +360,12 @@ final class BinaryMetadataTransport {
                                 } while (!metaLocCache.replace(typeId, holder, newHolder));
                             }
                         }
-                        else
+                        else {
+                            if (log.isDebugEnabled())
+                                log.debug("Updated metadata on server node: " + newHolder);
+
                             metaLocCache.put(typeId, newHolder);
+                        }
                     }
                     catch (BinaryObjectException ignored) {
                         assert false : msg;
@@ -410,6 +430,10 @@ final class BinaryMetadataTransport {
                 int oldAcceptedVer = holder.acceptedVersion();
 
                 if (oldAcceptedVer >= newAcceptedVer) {
+                    if (log.isDebugEnabled())
+                        log.debug("Marking ack as duplicate [holder=" + holder +
+                            ", newAcceptedVer: " + newAcceptedVer + ']');
+
                     //this is duplicate ack
                     msg.duplicated(true);
 
@@ -424,6 +448,9 @@ final class BinaryMetadataTransport {
 
             GridFutureAdapter<MetadataUpdateResult> fut = syncMap.get(new SyncKey(typeId,
newAcceptedVer));
 
+            if (log.isDebugEnabled())
+                log.debug("Completing future for " + metaLocCache.get(typeId));
+
             if (fut != null)
                 fut.onDone(MetadataUpdateResult.createSuccessfulResult());
         }
@@ -435,9 +462,6 @@ final class BinaryMetadataTransport {
      */
     private final class MetadataUpdateResultFuture extends GridFutureAdapter<MetadataUpdateResult>
{
         /** */
-        private static final long serialVersionUID = 0L;
-
-        /** */
         MetadataUpdateResultFuture() {
             // No-op.
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ba32b40f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
index d06cde1..636d149 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
@@ -22,7 +22,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
@@ -58,7 +57,6 @@ import org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl;
 import org.apache.ignite.internal.binary.streams.BinaryInputStream;
 import org.apache.ignite.internal.binary.streams.BinaryOffheapInputStream;
 import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.CacheObject;
 import org.apache.ignite.internal.processors.cache.CacheObjectContext;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
@@ -77,7 +75,6 @@ import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.lang.IgniteClosure;
 import org.apache.ignite.lang.IgniteFuture;
-import org.apache.ignite.lang.IgniteProductVersion;
 import org.apache.ignite.marshaller.Marshaller;
 import org.apache.ignite.spi.IgniteNodeValidationResult;
 import org.apache.ignite.spi.discovery.DiscoveryDataBag;
@@ -111,7 +108,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
     @GridToStringExclude
     private IgniteBinary binaries;
 
-    /** Listener removes all registred binary schemas after the local client reconnected.
*/
+    /** Listener removes all registered binary schemas after the local client reconnected.
*/
     private final GridLocalEventListener clientDisconLsnr = new GridLocalEventListener()
{
         @Override public void onEvent(Event evt) {
             binaryContext().unregisterBinarySchemas();
@@ -455,6 +452,12 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
             if (holder.pendingVersion() - holder.acceptedVersion() > 0) {
                 GridFutureAdapter<MetadataUpdateResult> fut = transport.awaitMetadataUpdate(typeId,
holder.pendingVersion());
 
+                if (log.isDebugEnabled() && !fut.isDone())
+                    log.debug("Waiting for update for" +
+                            " [typeId=" + typeId +
+                            ", pendingVer=" + holder.pendingVersion() +
+                            ", acceptedVer=" + holder.acceptedVersion() + "]");
+
                 try {
                     fut.get();
                 }
@@ -491,6 +494,13 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
                         typeId,
                         holder.pendingVersion());
 
+                if (log.isDebugEnabled() && !fut.isDone())
+                    log.debug("Waiting for update for" +
+                            " [typeId=" + typeId
+                            + ", schemaId=" + schemaId
+                            + ", pendingVer=" + holder.pendingVersion()
+                            + ", acceptedVer=" + holder.acceptedVersion() + "]");
+
                 try {
                     fut.get();
                 }
@@ -832,7 +842,14 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
             for (Map.Entry<Integer, BinaryMetadataHolder> e : receivedData.entrySet())
{
                 BinaryMetadataHolder holder = e.getValue();
 
-                metadataLocCache.put(e.getKey(), new BinaryMetadataHolder(holder.metadata(),
holder.pendingVersion(), holder.pendingVersion()));
+                BinaryMetadataHolder localHolder = new BinaryMetadataHolder(holder.metadata(),
+                        holder.pendingVersion(),
+                        holder.pendingVersion());
+
+                if (log.isDebugEnabled())
+                    log.debug("Received metadata on join: " + localHolder);
+
+                metadataLocCache.put(e.getKey(), localHolder);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ba32b40f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/ClientMetadataRequestFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/ClientMetadataRequestFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/ClientMetadataRequestFuture.java
index 658e9da..d229e65 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/ClientMetadataRequestFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/ClientMetadataRequestFuture.java
@@ -95,6 +95,11 @@ final class ClientMetadataRequestFuture extends GridFutureAdapter<MetadataUpdate
                 ClusterNode srvNode = aliveSrvNodes.poll();
 
                 try {
+                    if (log.isDebugEnabled())
+                        log.debug("Requesting metadata for typeId " + typeId +
+                            " from node " + srvNode.id()
+                        );
+
                     ioMgr.sendToGridTopic(srvNode,
                             GridTopic.TOPIC_METADATA_REQ,
                             new MetadataRequestMessage(typeId),


Mime
View raw message