You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/05/03 07:21:46 UTC

[08/50] [abbrv] ignite git commit: GG-11860 Implement snapshot status on platform level -refactoring moveSnapshot operation

GG-11860 Implement snapshot status on platform level
-refactoring moveSnapshot operation


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

Branch: refs/heads/ignite-gg-8.0.3.ea6-clients-test
Commit: 4f859170d7eebaec47470fb3ff4286936e4dac9a
Parents: 5ad1933
Author: EdShangGG <es...@gridgain.com>
Authored: Fri Feb 17 18:39:32 2017 +0300
Committer: EdShangGG <es...@gridgain.com>
Committed: Fri Feb 17 18:39:32 2017 +0300

----------------------------------------------------------------------
 .../communication/GridIoMessageFactory.java     |   4 +-
 .../snapshot/SnapshotFinishedMessage.java       | 158 ----------------
 .../SnapshotOperationFinishedMessage.java       | 181 +++++++++++++++++++
 .../resources/META-INF/classnames.properties    |   2 +-
 4 files changed, 184 insertions(+), 161 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4f859170/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index 979e8db..1574909 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -33,7 +33,7 @@ import org.apache.ignite.internal.managers.deployment.GridDeploymentInfoBean;
 import org.apache.ignite.internal.managers.deployment.GridDeploymentRequest;
 import org.apache.ignite.internal.managers.deployment.GridDeploymentResponse;
 import org.apache.ignite.internal.managers.eventstorage.GridEventStorageMessage;
-import org.apache.ignite.internal.pagemem.snapshot.SnapshotFinishedMessage;
+import org.apache.ignite.internal.pagemem.snapshot.SnapshotOperationFinishedMessage;
 import org.apache.ignite.internal.pagemem.snapshot.SnapshotProgressMessage;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.GridChangeGlobalStateMessageResponse;
@@ -186,7 +186,7 @@ public class GridIoMessageFactory implements MessageFactory {
                 break;
 
             case -45:
-                msg = new SnapshotFinishedMessage();
+                msg = new SnapshotOperationFinishedMessage();
 
                 break;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/4f859170/modules/core/src/main/java/org/apache/ignite/internal/pagemem/snapshot/SnapshotFinishedMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/snapshot/SnapshotFinishedMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/snapshot/SnapshotFinishedMessage.java
deleted file mode 100644
index 8ccef42..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/snapshot/SnapshotFinishedMessage.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.ignite.internal.pagemem.snapshot;
-
-import java.nio.ByteBuffer;
-import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-
-/**
- * Message indicating that snapshot has been finished on a single node.
- */
-public class SnapshotFinishedMessage implements Message {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** */
-    private long snapshotId;
-
-    /** Operation type. */
-    private int operationType;
-
-    /** */
-    private boolean success;
-
-    /** */
-    public SnapshotFinishedMessage() {
-    }
-
-    /**
-     * @param snapshotId Snapshot ID.
-     */
-    public SnapshotFinishedMessage(long snapshotId, SnapshotOperationType type, boolean success) {
-        this.snapshotId = snapshotId;
-        this.operationType = type.ordinal();
-        this.success = success;
-    }
-
-    /**
-     * @return Snapshot ID.
-     */
-    public long snapshotId() {
-        return snapshotId;
-    }
-
-    /** */
-    public SnapshotOperationType operationType() {
-        return SnapshotOperationType.values()[operationType];
-    }
-
-    /** */
-    public boolean success() {
-        return success;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-        writer.setBuffer(buf);
-
-        if (!writer.isHeaderWritten()) {
-            if (!writer.writeHeader(directType(), fieldsCount()))
-                return false;
-
-            writer.onHeaderWritten();
-        }
-
-        switch (writer.state()) {
-            case 0:
-                if (!writer.writeLong("snapshotId", snapshotId))
-                    return false;
-
-                writer.incrementState();
-
-            case 1:
-                if (!writer.writeInt("operationType", operationType))
-                    return false;
-
-                writer.incrementState();
-
-            case 2:
-                if (!writer.writeBoolean("success", success))
-                    return false;
-
-                writer.incrementState();
-
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
-        reader.setBuffer(buf);
-
-        if (!reader.beforeMessageRead())
-            return false;
-
-        switch (reader.state()) {
-            case 0:
-                snapshotId = reader.readLong("snapshotId");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 1:
-                operationType = reader.readInt("operationType");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 2:
-                success = reader.readBoolean("success");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-        }
-
-        return reader.afterMessageRead(SnapshotFinishedMessage.class);
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte directType() {
-        return -45;
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte fieldsCount() {
-        return 3;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void onAckReceived() {
-        // No-op
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/4f859170/modules/core/src/main/java/org/apache/ignite/internal/pagemem/snapshot/SnapshotOperationFinishedMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/snapshot/SnapshotOperationFinishedMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/snapshot/SnapshotOperationFinishedMessage.java
new file mode 100644
index 0000000..8986e5c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/snapshot/SnapshotOperationFinishedMessage.java
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.ignite.internal.pagemem.snapshot;
+
+import java.nio.ByteBuffer;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+
+/**
+ * Message indicating that snapshot has been finished on a single node.
+ */
+public class SnapshotOperationFinishedMessage implements Message {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
+    private long snapshotId;
+
+    /** Operation type. */
+    private int operationType;
+
+    /** */
+    private boolean success;
+
+    /** Error message. */
+    private String errorMsg;
+
+    /** */
+    public SnapshotOperationFinishedMessage() {
+    }
+
+    /**
+     * @param snapshotId Snapshot ID.
+     * @param errorMsg
+     */
+    public SnapshotOperationFinishedMessage(long snapshotId, SnapshotOperationType type, boolean success, String errorMsg) {
+        this.snapshotId = snapshotId;
+        this.operationType = type.ordinal();
+        this.success = success;
+        this.errorMsg = errorMsg;
+    }
+
+    /**
+     * @return Snapshot ID.
+     */
+    public long snapshotId() {
+        return snapshotId;
+    }
+
+    /** */
+    public SnapshotOperationType operationType() {
+        return SnapshotOperationType.values()[operationType];
+    }
+
+    /** */
+    public boolean success() {
+        return success;
+    }
+
+    /** */
+    public String errorMessage() {
+        return errorMsg;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+        writer.setBuffer(buf);
+
+        if (!writer.isHeaderWritten()) {
+            if (!writer.writeHeader(directType(), fieldsCount()))
+                return false;
+
+            writer.onHeaderWritten();
+        }
+
+        switch (writer.state()) {
+            case 0:
+                if (!writer.writeLong("snapshotId", snapshotId))
+                    return false;
+
+                writer.incrementState();
+
+            case 1:
+                if (!writer.writeInt("operationType", operationType))
+                    return false;
+
+                writer.incrementState();
+
+            case 2:
+                if (!writer.writeBoolean("success", success))
+                    return false;
+
+                writer.incrementState();
+
+            case 3:
+                if (!writer.writeString("errorMsg", errorMsg))
+                    return false;
+
+                writer.incrementState();
+
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+        reader.setBuffer(buf);
+
+        if (!reader.beforeMessageRead())
+            return false;
+
+        switch (reader.state()) {
+            case 0:
+                snapshotId = reader.readLong("snapshotId");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 1:
+                operationType = reader.readInt("operationType");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 2:
+                success = reader.readBoolean("success");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 3:
+                errorMsg = reader.readString("errorMsg");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+        }
+
+        return reader.afterMessageRead(SnapshotOperationFinishedMessage.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte directType() {
+        return -45;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte fieldsCount() {
+        return 4;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onAckReceived() {
+        // No-op
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/4f859170/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index a0838b1..13a3bce 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -326,7 +326,7 @@ org.apache.ignite.internal.managers.loadbalancer.GridLoadBalancerAdapter
 org.apache.ignite.internal.managers.loadbalancer.GridLoadBalancerManager$1
 org.apache.ignite.internal.mem.OutOfMemoryException
 org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl$Segment
-org.apache.ignite.internal.pagemem.snapshot.SnapshotFinishedMessage
+org.apache.ignite.internal.pagemem.snapshot.SnapshotOperationFinishedMessage
 org.apache.ignite.internal.pagemem.snapshot.SnapshotProgressMessage
 org.apache.ignite.internal.pagemem.snapshot.StartSnapshotOperationAckDiscoveryMessage
 org.apache.ignite.internal.pagemem.snapshot.StartFullSnapshotDiscoveryMessage