You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2015/12/24 09:23:52 UTC

[1/4] ignite git commit: ignite-1.5 Fixed test.

Repository: ignite
Updated Branches:
  refs/heads/ignite-843-rc2 56c742a88 -> 932656644


ignite-1.5 Fixed test.


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

Branch: refs/heads/ignite-843-rc2
Commit: 77e77e40fb9463ba3bccd01ddf3231ff9ef6f327
Parents: bd05fa9
Author: sboikov <sb...@gridgain.com>
Authored: Thu Dec 24 10:25:23 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Dec 24 10:25:23 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/binary/BinaryMarshallerSelfTest.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/77e77e40/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
index 9f7beb8..20b2258 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
@@ -2532,11 +2532,10 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
 
             assertNull(bVal);
 
-            for (NonSerializableA a : bArr) {
+            for (NonSerializableA a : bArr)
                 a.checkAfterUnmarshalled();
-            }
 
-            assertEquals(floatVal, 567.89F);
+            assertEquals(floatVal, 567.89F, 0);
         }
     }
 


[3/4] ignite git commit: ignite-1.5 Reverted BinaryContext.readResolve since it does not work from user thread and breaks tests

Posted by ak...@apache.org.
ignite-1.5 Reverted BinaryContext.readResolve since it does not work from user thread and breaks tests


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

Branch: refs/heads/ignite-843-rc2
Commit: 61c072e51b16f6776e3e73252bfd5d7f09c0f21e
Parents: 8f5445a
Author: sboikov <sb...@gridgain.com>
Authored: Thu Dec 24 10:47:50 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Dec 24 10:47:50 2015 +0300

----------------------------------------------------------------------
 .../main/java/org/apache/ignite/internal/binary/BinaryContext.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/61c072e5/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index a27a3d0..5c63fbd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -743,7 +743,7 @@ public class BinaryContext implements Externalizable {
      */
     protected Object readResolve() throws ObjectStreamException {
         try {
-            IgniteKernal g = IgnitionEx.localIgnite();
+            IgniteKernal g = IgnitionEx.gridx(gridName);
 
             if (g == null)
                 throw new IllegalStateException("Failed to find grid for name: " + gridName);


[4/4] ignite git commit: Merge branches 'ignite-1.5' and 'ignite-843-rc2' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-843-rc2

Posted by ak...@apache.org.
Merge branches 'ignite-1.5' and 'ignite-843-rc2' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-843-rc2


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

Branch: refs/heads/ignite-843-rc2
Commit: 932656644b35533b0117cfce74a2839c897446a4
Parents: 56c742a 61c072e
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Thu Dec 24 15:20:13 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Dec 24 15:20:13 2015 +0700

----------------------------------------------------------------------
 .../ignite/internal/binary/BinaryContext.java   |   2 +-
 .../internal/visor/util/VisorTaskUtils.java     | 122 ++++++++++++++++++-
 .../binary/BinaryMarshallerSelfTest.java        |   5 +-
 3 files changed, 121 insertions(+), 8 deletions(-)
----------------------------------------------------------------------



[2/4] ignite git commit: ignite-1.5 Implemented start of local node with specified configuration and custom environment variables.

Posted by ak...@apache.org.
ignite-1.5 Implemented start of local node with specified configuration and custom environment variables.


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

Branch: refs/heads/ignite-843-rc2
Commit: 8f5445ab934c0133f45a87b220b5d4841c9bca43
Parents: 77e77e4
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Thu Dec 24 14:41:18 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Dec 24 14:41:18 2015 +0700

----------------------------------------------------------------------
 .../internal/visor/util/VisorTaskUtils.java     | 122 ++++++++++++++++++-
 1 file changed, 118 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8f5445ab/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
index 579f50c..83dbda0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.visor.util;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileFilter;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.RandomAccessFile;
 import java.net.InetAddress;
@@ -36,6 +37,7 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.SortedMap;
@@ -101,6 +103,9 @@ public class VisorTaskUtils {
     /** Log files count limit */
     public static final int LOG_FILES_COUNT_LIMIT = 5000;
 
+    /** */
+    private static final int DFLT_BUFFER_SIZE = 4096;
+
     /** Only task event types that Visor should collect. */
     public static final int[] VISOR_TASK_EVTS = {
         EVT_JOB_STARTED,
@@ -558,7 +563,7 @@ public class VisorTaskUtils {
         try (RandomAccessFile raf = new RandomAccessFile(f, "r")) {
             FileChannel ch = raf.getChannel();
 
-            ByteBuffer buf = ByteBuffer.allocate(4096);
+            ByteBuffer buf = ByteBuffer.allocate(DFLT_BUFFER_SIZE);
 
             ch.read(buf);
 
@@ -823,6 +828,85 @@ public class VisorTaskUtils {
     }
 
     /**
+     * Start local node in terminal.
+     *
+     * @param log Logger.
+     * @param cfgPath Path to node configuration to start with.
+     * @param nodesToStart Number of nodes to start.
+     * @param quite If {@code true} then start node in quiet mode.
+     * @param envVars Optional map with environment variables.
+     * @return List of started processes.
+     * @throws IOException If failed to start.
+     */
+    public static List<Process> startLocalNode(@Nullable IgniteLogger log, String cfgPath, int nodesToStart,
+        boolean quite, Map<String, String> envVars) throws IOException {
+        String quitePar = quite ? "" : "-v";
+
+        String cmdFile = new File("bin", U.isWindows() ? "ignite.bat" : "ignite.sh").getPath();
+
+        File cmdFilePath = U.resolveIgnitePath(cmdFile);
+
+        if (cmdFilePath == null || !cmdFilePath.exists())
+            throw new FileNotFoundException(String.format("File not found: %s", cmdFile));
+
+        String ignite = cmdFilePath.getCanonicalPath();
+
+        File nodesCfgPath = U.resolveIgnitePath(cfgPath);
+
+        if (nodesCfgPath == null || !nodesCfgPath.exists())
+            throw new FileNotFoundException(String.format("File not found: %s", cfgPath));
+
+        String nodeCfg = nodesCfgPath.getCanonicalPath();
+
+        log(log, String.format("Starting %s local %s with '%s' config", nodesToStart, nodesToStart > 1 ? "nodes" : "node", nodeCfg));
+
+        List<Process> run = new ArrayList<>();
+
+        try {
+            for (int i = 0; i < nodesToStart; i++) {
+                if (U.isMacOs()) {
+                    StringBuilder envs = new StringBuilder();
+
+                    Map<String, String> macEnv = new HashMap<>(System.getenv());
+
+                    if (envVars != null) {
+                        for (Map.Entry<String, String> ent : envVars.entrySet())
+                            if (macEnv.containsKey(ent.getKey())) {
+                                String old = macEnv.get(ent.getKey());
+
+                                if (old == null || old.isEmpty())
+                                    macEnv.put(ent.getKey(), ent.getValue());
+                                else
+                                    macEnv.put(ent.getKey(), old + ':' + ent.getValue());
+                            }
+                            else
+                                macEnv.put(ent.getKey(), ent.getValue());
+                    }
+
+                    for (Map.Entry<String, String> entry : macEnv.entrySet()) {
+                        String val = entry.getValue();
+
+                        if (val.indexOf(';') < 0 && val.indexOf('\'') < 0)
+                            envs.append(String.format("export %s='%s'; ",
+                                    entry.getKey(), val.replace('\n', ' ').replace("'", "\'")));
+                    }
+
+                    run.add(openInConsole(envs.toString(), ignite, quitePar, nodeCfg));
+                } else
+                    run.add(openInConsole(null, envVars, ignite, quitePar, nodeCfg));
+            }
+
+            return run;
+        }
+        catch (Exception e) {
+            for (Process proc: run)
+                proc.destroy();
+
+            throw e;
+        }
+    }
+
+    /**
      * Run command in separated console.
      *
      * @param args A string array containing the program and its arguments.
@@ -839,9 +923,22 @@ public class VisorTaskUtils {
      * @param workFolder Work folder for command.
      * @param args A string array containing the program and its arguments.
      * @return Started process.
+     * @throws IOException in case of error.
+     */
+    public static Process openInConsole(@Nullable File workFolder, String... args) throws IOException {
+        return openInConsole(workFolder, null, args);
+    }
+
+    /**
+     * Run command in separated console.
+     *
+     * @param workFolder Work folder for command.
+     * @param envVars Optional map with environment variables.
+     * @param args A string array containing the program and its arguments.
+     * @return Started process.
      * @throws IOException If failed to start process.
      */
-    public static Process openInConsole(@Nullable File workFolder, String... args)
+    public static Process openInConsole(@Nullable File workFolder, Map<String, String> envVars, String... args)
         throws IOException {
         String[] commands = args;
 
@@ -862,6 +959,23 @@ public class VisorTaskUtils {
         if (workFolder != null)
             pb.directory(workFolder);
 
+        if (envVars != null) {
+            String sep = U.isWindows() ? ";" : ":";
+
+            Map<String, String> goalVars = pb.environment();
+
+            for (Map.Entry<String, String> var: envVars.entrySet()) {
+                String envVar = goalVars.get(var.getKey());
+
+                if (envVar == null || envVar.isEmpty())
+                    envVar = var.getValue();
+                else
+                    envVar += sep + var.getValue();
+
+                goalVars.put(var.getKey(), envVar);
+            }
+        }
+
         return pb.start();
     }
 
@@ -873,7 +987,7 @@ public class VisorTaskUtils {
      * @throws IOException If failed.
      */
     public static byte[] zipBytes(byte[] input) throws IOException {
-        return zipBytes(input, 4096);
+        return zipBytes(input, DFLT_BUFFER_SIZE);
     }
 
     /**
@@ -904,4 +1018,4 @@ public class VisorTaskUtils {
 
         return bos.toByteArray();
     }
-}
\ No newline at end of file
+}