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 2016/07/07 06:01:26 UTC
[01/50] [abbrv] ignite git commit: IGNITE-2879: ODBC: Added decimal
support.
Repository: ignite
Updated Branches:
refs/heads/ignite-1232 3fd608e81 -> 45ce0fd7d
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/core-test/src/dynamic_size_array_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/dynamic_size_array_test.cpp b/modules/platforms/cpp/core-test/src/dynamic_size_array_test.cpp
new file mode 100644
index 0000000..fb9a468
--- /dev/null
+++ b/modules/platforms/cpp/core-test/src/dynamic_size_array_test.cpp
@@ -0,0 +1,360 @@
+/*
+ * 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.
+ */
+
+#ifndef _MSC_VER
+# define BOOST_TEST_DYN_LINK
+#endif
+
+#include <boost/test/unit_test.hpp>
+
+#include <ignite/common/dynamic_size_array.h>
+
+using namespace ignite;
+using namespace ignite::common;
+
+
+struct TestStruct
+{
+ int32_t one;
+ int32_t two;
+
+ TestStruct() :
+ one(1),
+ two(2)
+ {
+ // No-op.
+ }
+
+ TestStruct(int32_t a, int32_t b) :
+ one(a),
+ two(b)
+ {
+ // No-op.
+ }
+
+ void Clear()
+ {
+ one = two = 0;
+ }
+};
+
+
+BOOST_AUTO_TEST_SUITE(DynamicSizeArrayTestSuite)
+
+BOOST_AUTO_TEST_CASE(BasicConstruction)
+{
+ DynamicSizeArray<int> test(16);
+
+ BOOST_CHECK_EQUAL(test.GetSize(), 0);
+ BOOST_CHECK(test.GetCapasity() >= 16);
+}
+
+BOOST_AUTO_TEST_CASE(ResizeInt)
+{
+ DynamicSizeArray<int> test;
+
+ test.Resize(16);
+
+ for (int i = 0; i < test.GetSize(); ++i)
+ BOOST_CHECK_EQUAL(test[i], 0);
+}
+
+BOOST_AUTO_TEST_CASE(ResizeBool)
+{
+ DynamicSizeArray<bool> test;
+
+ test.Resize(16);
+
+ for (int i = 0; i < test.GetSize(); ++i)
+ BOOST_CHECK_EQUAL(test[i], false);
+}
+
+BOOST_AUTO_TEST_CASE(ResizeStruct)
+{
+ DynamicSizeArray<TestStruct> test;
+
+ test.Resize(16);
+
+ for (int i = 0; i < test.GetSize(); ++i)
+ {
+ BOOST_CHECK_EQUAL(test[i].one, 1);
+ BOOST_CHECK_EQUAL(test[i].two, 2);
+ }
+}
+
+BOOST_AUTO_TEST_CASE(PushBack)
+{
+ DynamicSizeArray<int> test;
+
+ test.PushBack(1);
+ test.PushBack(2);
+ test.PushBack(42);
+ test.PushBack(88);
+
+ BOOST_CHECK_EQUAL(test.GetSize(), 4);
+ BOOST_CHECK(test.GetCapasity() >= 4);
+
+ BOOST_CHECK_EQUAL(test[0], 1);
+ BOOST_CHECK_EQUAL(test[1], 2);
+ BOOST_CHECK_EQUAL(test[2], 42);
+ BOOST_CHECK_EQUAL(test[3], 88);
+
+ BOOST_CHECK_EQUAL(test.Back(), 88);
+ BOOST_CHECK_EQUAL(test.Front(), 1);
+}
+
+BOOST_AUTO_TEST_CASE(ResizeGrowing)
+{
+ DynamicSizeArray<TestStruct> test;
+
+ test.PushBack(TestStruct(3, 7));
+ test.PushBack(TestStruct(5, 6));
+ test.PushBack(TestStruct(42, 55));
+ test.PushBack(TestStruct(47334, 3));
+
+ BOOST_CHECK_EQUAL(test.GetSize(), 4);
+
+ test.Resize(8);
+
+ BOOST_CHECK_EQUAL(test[0].one, 3);
+ BOOST_CHECK_EQUAL(test[1].one, 5);
+ BOOST_CHECK_EQUAL(test[2].one, 42);
+ BOOST_CHECK_EQUAL(test[3].one, 47334);
+
+ BOOST_CHECK_EQUAL(test[0].two, 7);
+ BOOST_CHECK_EQUAL(test[1].two, 6);
+ BOOST_CHECK_EQUAL(test[2].two, 55);
+ BOOST_CHECK_EQUAL(test[3].two, 3);
+
+ for (int i = 4; i < test.GetSize(); ++i)
+ {
+ BOOST_CHECK_EQUAL(test[i].one, 1);
+ BOOST_CHECK_EQUAL(test[i].two, 2);
+
+ test[i] = TestStruct(i * 3, i * 32508 + i);
+ }
+}
+
+BOOST_AUTO_TEST_CASE(ResizeShrinking)
+{
+ DynamicSizeArray<TestStruct> test;
+
+ test.PushBack(TestStruct(3, 7));
+ test.PushBack(TestStruct(5, 6));
+ test.PushBack(TestStruct(42, 55));
+ test.PushBack(TestStruct(47334, 3));
+
+ BOOST_CHECK_EQUAL(test.GetSize(), 4);
+
+ test.Resize(2);
+
+ BOOST_CHECK_EQUAL(test.GetSize(), 2);
+
+ BOOST_CHECK_EQUAL(test[0].one, 3);
+ BOOST_CHECK_EQUAL(test[1].one, 5);
+
+ BOOST_CHECK_EQUAL(test[0].two, 7);
+ BOOST_CHECK_EQUAL(test[1].two, 6);
+}
+
+BOOST_AUTO_TEST_CASE(ResizeKeep)
+{
+ DynamicSizeArray<TestStruct> test;
+
+ test.PushBack(TestStruct(3, 7));
+ test.PushBack(TestStruct(5, 6));
+ test.PushBack(TestStruct(42, 55));
+ test.PushBack(TestStruct(47334, 3));
+
+ BOOST_CHECK_EQUAL(test.GetSize(), 4);
+
+ test.Resize(4);
+
+ BOOST_CHECK_EQUAL(test[0].one, 3);
+ BOOST_CHECK_EQUAL(test[1].one, 5);
+ BOOST_CHECK_EQUAL(test[2].one, 42);
+ BOOST_CHECK_EQUAL(test[3].one, 47334);
+
+ BOOST_CHECK_EQUAL(test[0].two, 7);
+ BOOST_CHECK_EQUAL(test[1].two, 6);
+ BOOST_CHECK_EQUAL(test[2].two, 55);
+ BOOST_CHECK_EQUAL(test[3].two, 3);
+}
+
+BOOST_AUTO_TEST_CASE(ReserveMore)
+{
+ DynamicSizeArray<TestStruct> test;
+
+ test.PushBack(TestStruct(3, 7));
+ test.PushBack(TestStruct(5, 6));
+ test.PushBack(TestStruct(42, 55));
+ test.PushBack(TestStruct(47334, 3));
+
+ BOOST_CHECK_EQUAL(test.GetSize(), 4);
+
+ int32_t capasity = test.GetCapasity();
+
+ test.Reserve(capasity + 1);
+
+ BOOST_CHECK(test.GetCapasity() > capasity);
+ BOOST_CHECK(test.GetCapasity() >= capasity + 1);
+ BOOST_CHECK_EQUAL(test.GetSize(), 4);
+
+ BOOST_CHECK_EQUAL(test[0].one, 3);
+ BOOST_CHECK_EQUAL(test[1].one, 5);
+ BOOST_CHECK_EQUAL(test[2].one, 42);
+ BOOST_CHECK_EQUAL(test[3].one, 47334);
+
+ BOOST_CHECK_EQUAL(test[0].two, 7);
+ BOOST_CHECK_EQUAL(test[1].two, 6);
+ BOOST_CHECK_EQUAL(test[2].two, 55);
+ BOOST_CHECK_EQUAL(test[3].two, 3);
+}
+
+BOOST_AUTO_TEST_CASE(ReserveLess)
+{
+ DynamicSizeArray<TestStruct> test;
+
+ test.PushBack(TestStruct(3, 7));
+ test.PushBack(TestStruct(5, 6));
+ test.PushBack(TestStruct(42, 55));
+ test.PushBack(TestStruct(47334, 3));
+
+ BOOST_CHECK_EQUAL(test.GetSize(), 4);
+
+ int32_t capasity = test.GetCapasity();
+
+ test.Reserve(capasity - 1);
+
+ BOOST_CHECK(test.GetCapasity() == capasity);
+ BOOST_CHECK_EQUAL(test.GetSize(), 4);
+
+ BOOST_CHECK_EQUAL(test[0].one, 3);
+ BOOST_CHECK_EQUAL(test[1].one, 5);
+ BOOST_CHECK_EQUAL(test[2].one, 42);
+ BOOST_CHECK_EQUAL(test[3].one, 47334);
+
+ BOOST_CHECK_EQUAL(test[0].two, 7);
+ BOOST_CHECK_EQUAL(test[1].two, 6);
+ BOOST_CHECK_EQUAL(test[2].two, 55);
+ BOOST_CHECK_EQUAL(test[3].two, 3);
+}
+
+BOOST_AUTO_TEST_CASE(Append)
+{
+ DynamicSizeArray<TestStruct> test1;
+ DynamicSizeArray<TestStruct> test2;
+
+ test1.PushBack(TestStruct(3, 7));
+ test1.PushBack(TestStruct(5, 6));
+
+ test2.PushBack(TestStruct(42, 55));
+ test2.PushBack(TestStruct(47334, 3));
+
+ BOOST_CHECK_EQUAL(test1.GetSize(), 2);
+ BOOST_CHECK_EQUAL(test2.GetSize(), 2);
+
+ test1.Append(test2.GetData(), test2.GetSize());
+
+ BOOST_CHECK_EQUAL(test1.GetSize(), 4);
+ BOOST_CHECK_EQUAL(test2.GetSize(), 2);
+
+ BOOST_CHECK_EQUAL(test1[0].one, 3);
+ BOOST_CHECK_EQUAL(test1[1].one, 5);
+ BOOST_CHECK_EQUAL(test1[2].one, 42);
+ BOOST_CHECK_EQUAL(test1[3].one, 47334);
+
+ BOOST_CHECK_EQUAL(test1[0].two, 7);
+ BOOST_CHECK_EQUAL(test1[1].two, 6);
+ BOOST_CHECK_EQUAL(test1[2].two, 55);
+ BOOST_CHECK_EQUAL(test1[3].two, 3);
+
+ BOOST_CHECK_EQUAL(test2[0].one, 42);
+ BOOST_CHECK_EQUAL(test2[1].one, 47334);
+
+ BOOST_CHECK_EQUAL(test2[0].two, 55);
+ BOOST_CHECK_EQUAL(test2[1].two, 3);
+}
+
+BOOST_AUTO_TEST_CASE(ConstructionArray)
+{
+ int someVals[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+
+ DynamicSizeArray<int> test(someVals, 10);
+
+ for (int i = 0; i < test.GetSize(); ++i)
+ BOOST_CHECK_EQUAL(test[i], i);
+}
+
+BOOST_AUTO_TEST_CASE(ConstructionCopy)
+{
+ DynamicSizeArray<int> test1(10);
+
+ for (int i = 0; i < test1.GetSize(); ++i)
+ test1[i] = i * 5;
+
+ DynamicSizeArray<int> test2(test1);
+
+ for (int i = 0; i < test2.GetSize(); ++i)
+ BOOST_CHECK_EQUAL(test2[i], i * 5);
+}
+
+BOOST_AUTO_TEST_CASE(IsEmpty)
+{
+ DynamicSizeArray<int> test;
+
+ BOOST_CHECK(test.IsEmpty());
+
+ test.Resize(16);
+
+ BOOST_CHECK(!test.IsEmpty());
+
+ test.Clear();
+
+ BOOST_CHECK(test.IsEmpty());
+}
+
+BOOST_AUTO_TEST_CASE(Swap)
+{
+ DynamicSizeArray<std::string> test1(3);
+ DynamicSizeArray<std::string> test2(2);
+
+ test1.PushBack("Hello");
+ test1.PushBack("World");
+ test1.PushBack("!!!");
+
+ test2.PushBack("Hi");
+ test2.PushBack("!");
+
+ BOOST_CHECK_EQUAL(test1[0], std::string("Hello"));
+ BOOST_CHECK_EQUAL(test1[1], std::string("World"));
+ BOOST_CHECK_EQUAL(test1[2], std::string("!!!"));
+
+ BOOST_CHECK_EQUAL(test2[0], std::string("Hi"));
+ BOOST_CHECK_EQUAL(test2[1], std::string("!"));
+
+ test1.Swap(test2);
+
+ BOOST_CHECK_EQUAL(test2[0], std::string("Hello"));
+ BOOST_CHECK_EQUAL(test2[1], std::string("World"));
+ BOOST_CHECK_EQUAL(test2[2], std::string("!!!"));
+
+ BOOST_CHECK_EQUAL(test1[0], std::string("Hi"));
+ BOOST_CHECK_EQUAL(test1[1], std::string("!"));
+}
+
+BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/core-test/src/fixed_size_array_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/fixed_size_array_test.cpp b/modules/platforms/cpp/core-test/src/fixed_size_array_test.cpp
new file mode 100644
index 0000000..4574a98
--- /dev/null
+++ b/modules/platforms/cpp/core-test/src/fixed_size_array_test.cpp
@@ -0,0 +1,208 @@
+/*
+ * 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.
+ */
+
+#ifndef _MSC_VER
+# define BOOST_TEST_DYN_LINK
+#endif
+
+#include <boost/test/unit_test.hpp>
+
+#include <ignite/common/fixed_size_array.h>
+
+using namespace ignite;
+using namespace ignite::common;
+
+
+struct TestStruct
+{
+ int32_t one;
+ int32_t two;
+
+ TestStruct() :
+ one(1),
+ two(2)
+ {
+ // No-op.
+ }
+
+ void Clear()
+ {
+ one = two = 0;
+ }
+};
+
+
+BOOST_AUTO_TEST_SUITE(FixedSizeArrayTestSuite)
+
+BOOST_AUTO_TEST_CASE(ConstructionInt)
+{
+ FixedSizeArray<int> zeroed(16);
+
+ for (int i = 0; i < zeroed.GetSize(); ++i)
+ BOOST_CHECK_EQUAL(zeroed[i], 0);
+}
+
+BOOST_AUTO_TEST_CASE(ConstructionBool)
+{
+ FixedSizeArray<bool> fbool(16);
+
+ for (int i = 0; i < fbool.GetSize(); ++i)
+ BOOST_CHECK_EQUAL(fbool[i], false);
+}
+
+BOOST_AUTO_TEST_CASE(ConstructionStruct)
+{
+ FixedSizeArray<TestStruct> test(16);
+
+ for (int i = 0; i < test.GetSize(); ++i)
+ {
+ BOOST_CHECK_EQUAL(test[i].one, 1);
+ BOOST_CHECK_EQUAL(test[i].two, 2);
+ }
+}
+
+BOOST_AUTO_TEST_CASE(ConstructionArray)
+{
+ int someVals[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+
+ FixedSizeArray<int> test(someVals, 10);
+
+ for (int i = 0; i < test.GetSize(); ++i)
+ BOOST_CHECK_EQUAL(test[i], i);
+}
+
+BOOST_AUTO_TEST_CASE(ConstructionCopy)
+{
+ FixedSizeArray<int> test1(10);
+
+ for (int i = 0; i < test1.GetSize(); ++i)
+ test1[i] = i * 5;
+
+ FixedSizeArray<int> test2(test1);
+
+ for (int i = 0; i < test2.GetSize(); ++i)
+ BOOST_CHECK_EQUAL(test2[i], i * 5);
+}
+
+BOOST_AUTO_TEST_CASE(ResetInt)
+{
+ FixedSizeArray<int> test(16);
+
+ for (int i = 0; i < test.GetSize(); ++i)
+ test[i] = 42;
+
+ test.Reset(16);
+
+ for (int i = 0; i < test.GetSize(); ++i)
+ BOOST_CHECK_EQUAL(test[i], 0);
+}
+
+BOOST_AUTO_TEST_CASE(ResetBool)
+{
+ FixedSizeArray<bool> test(16);
+
+ for (int i = 0; i < test.GetSize(); ++i)
+ test[i] = true;
+
+ test.Reset(16);
+
+ for (int i = 0; i < test.GetSize(); ++i)
+ BOOST_CHECK_EQUAL(test[i], false);
+}
+
+BOOST_AUTO_TEST_CASE(ResetStruct)
+{
+ FixedSizeArray<TestStruct> test(16);
+
+ for (int i = 0; i < test.GetSize(); ++i)
+ test[i].Clear();
+
+ test.Reset(16);
+
+ for (int i = 0; i < test.GetSize(); ++i)
+ {
+ BOOST_CHECK_EQUAL(test[i].one, 1);
+ BOOST_CHECK_EQUAL(test[i].two, 2);
+ }
+}
+
+BOOST_AUTO_TEST_CASE(ResetSizeChange)
+{
+ FixedSizeArray<int> test(4);
+
+ BOOST_CHECK_EQUAL(test.GetSize(), 4);
+
+ for (int i = 0; i < test.GetSize(); ++i)
+ test[i] = 42;
+
+ test.Reset(16);
+
+ BOOST_CHECK_EQUAL(test.GetSize(), 16);
+
+ for (int i = 0; i < test.GetSize(); ++i)
+ {
+ BOOST_CHECK_EQUAL(test[i], 0);
+
+ test[i] = 100500;
+ }
+}
+
+BOOST_AUTO_TEST_CASE(IsEmpty)
+{
+ FixedSizeArray<int> test;
+
+ BOOST_CHECK(test.IsEmpty());
+
+ test.Reset(16);
+
+ BOOST_CHECK(!test.IsEmpty());
+
+ test.Reset();
+
+ BOOST_CHECK(test.IsEmpty());
+}
+
+BOOST_AUTO_TEST_CASE(Swap)
+{
+ FixedSizeArray<std::string> test1(3);
+ FixedSizeArray<std::string> test2(2);
+
+ test1[0] = "Hello";
+ test1[1] = "World";
+ test1[2] = "!!!";
+
+ test2[0] = "Hi";
+ test2[1] = "!";
+
+ BOOST_CHECK_EQUAL(test1[0], std::string("Hello"));
+ BOOST_CHECK_EQUAL(test1[1], std::string("World"));
+ BOOST_CHECK_EQUAL(test1[2], std::string("!!!"));
+
+ BOOST_CHECK_EQUAL(test2[0], std::string("Hi"));
+ BOOST_CHECK_EQUAL(test2[1], std::string("!"));
+
+ test1.Swap(test2);
+
+ BOOST_CHECK_EQUAL(test2[0], std::string("Hello"));
+ BOOST_CHECK_EQUAL(test2[1], std::string("World"));
+ BOOST_CHECK_EQUAL(test2[2], std::string("!!!"));
+
+ BOOST_CHECK_EQUAL(test1[0], std::string("Hi"));
+ BOOST_CHECK_EQUAL(test1[1], std::string("!"));
+}
+
+BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/core/include/ignite/cache/cache_entry.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/cache/cache_entry.h b/modules/platforms/cpp/core/include/ignite/cache/cache_entry.h
index 9810600..c737940 100644
--- a/modules/platforms/cpp/core/include/ignite/cache/cache_entry.h
+++ b/modules/platforms/cpp/core/include/ignite/cache/cache_entry.h
@@ -119,4 +119,4 @@ namespace ignite
}
}
-#endif _IGNITE_CACHE_CACHE_ENTRY
+#endif //_IGNITE_CACHE_CACHE_ENTRY
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/odbc-test/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/Makefile.am b/modules/platforms/cpp/odbc-test/Makefile.am
index 45a824b..48b193a 100644
--- a/modules/platforms/cpp/odbc-test/Makefile.am
+++ b/modules/platforms/cpp/odbc-test/Makefile.am
@@ -67,7 +67,6 @@ ignite_odbc_tests_SOURCES = \
../odbc/src/config/configuration.cpp \
../odbc/src/row.cpp \
../odbc/src/column.cpp \
- ../odbc/src/decimal.cpp \
../odbc/src/utility.cpp \
../odbc/src/result_page.cpp
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
index d634cb3..fbc0929 100644
--- a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
+++ b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
@@ -157,7 +157,6 @@
<ClCompile Include="..\..\..\odbc\src\config\configuration.cpp" />
<ClCompile Include="..\..\..\odbc\src\config\connection_info.cpp" />
<ClCompile Include="..\..\..\odbc\src\cursor.cpp" />
- <ClCompile Include="..\..\..\odbc\src\decimal.cpp" />
<ClCompile Include="..\..\..\odbc\src\result_page.cpp" />
<ClCompile Include="..\..\..\odbc\src\row.cpp" />
<ClCompile Include="..\..\..\odbc\src\utility.cpp" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters
index f47d990..2e38c24 100644
--- a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters
+++ b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters
@@ -58,9 +58,6 @@
<ClCompile Include="..\..\..\odbc\src\cursor.cpp">
<Filter>Externals</Filter>
</ClCompile>
- <ClCompile Include="..\..\..\odbc\src\decimal.cpp">
- <Filter>Externals</Filter>
- </ClCompile>
<ClCompile Include="..\..\..\odbc\src\result_page.cpp">
<Filter>Externals</Filter>
</ClCompile>
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/odbc-test/src/application_data_buffer_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/application_data_buffer_test.cpp b/modules/platforms/cpp/odbc-test/src/application_data_buffer_test.cpp
index d2ed033..1900e75 100644
--- a/modules/platforms/cpp/odbc-test/src/application_data_buffer_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/application_data_buffer_test.cpp
@@ -24,7 +24,8 @@
#include <boost/test/unit_test.hpp>
#include <ignite/guid.h>
-#include <ignite/odbc/decimal.h>
+#include <ignite/common/decimal.h>
+
#include <ignite/odbc/app/application_data_buffer.h>
#include <ignite/odbc/utility.h>
@@ -271,7 +272,7 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToDouble)
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_DOUBLE, &numBuf, sizeof(numBuf), &reslen, 0);
- Decimal decimal;
+ common::Decimal decimal;
BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(decimal), 0.0, FLOAT_PRECISION);
@@ -280,14 +281,14 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToDouble)
int8_t mag1[] = { 1, 0 };
- decimal = Decimal(0, mag1, sizeof(mag1));
+ decimal = common::Decimal(mag1, sizeof(mag1), 0, 1);
appBuf.PutDecimal(decimal);
BOOST_CHECK_CLOSE_FRACTION(numBuf, 256.0, FLOAT_PRECISION);
int8_t mag2[] = { 2, 23 };
- decimal = Decimal(1 | 0x80000000, mag2, sizeof(mag2));
+ decimal = common::Decimal(mag2, sizeof(mag2), 1, -1);
appBuf.PutDecimal(decimal);
BOOST_CHECK_CLOSE_FRACTION(numBuf, -53.5, FLOAT_PRECISION);
@@ -300,21 +301,21 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToLong)
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_LONG, &numBuf, sizeof(numBuf), &reslen, 0);
- Decimal decimal;
+ common::Decimal decimal;
appBuf.PutDecimal(decimal);
BOOST_CHECK(numBuf == 0);
int8_t mag1[] = { 1, 0 };
- decimal = Decimal(0, mag1, sizeof(mag1));
+ decimal = common::Decimal(mag1, sizeof(mag1), 0, 1);
appBuf.PutDecimal(decimal);
BOOST_CHECK(numBuf == 256);
int8_t mag2[] = { 2, 23 };
- decimal = Decimal(1 | 0x80000000, mag2, sizeof(mag2));
+ decimal = common::Decimal(mag2, sizeof(mag2), 1, -1);
appBuf.PutDecimal(decimal);
BOOST_CHECK(numBuf == -53);
@@ -327,21 +328,21 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToString)
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, 0);
- Decimal decimal;
+ common::Decimal decimal;
appBuf.PutDecimal(decimal);
BOOST_CHECK(std::string(strBuf, reslen) == "0");
int8_t mag1[] = { 1, 0 };
- decimal = Decimal(0, mag1, sizeof(mag1));
+ decimal = common::Decimal(mag1, sizeof(mag1), 0, 1);
appBuf.PutDecimal(decimal);
BOOST_CHECK(std::string(strBuf, reslen) == "256");
int8_t mag2[] = { 2, 23 };
- decimal = Decimal(1 | 0x80000000, mag2, sizeof(mag2));
+ decimal = common::Decimal(mag2, sizeof(mag2), 1, -1);
appBuf.PutDecimal(decimal);
BOOST_CHECK(std::string(strBuf, reslen) == "-53.5");
@@ -354,12 +355,12 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToNumeric)
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_NUMERIC, &buf, sizeof(buf), &reslen, 0);
- Decimal decimal;
+ common::Decimal decimal;
appBuf.PutDecimal(decimal);
BOOST_CHECK_EQUAL(1, buf.sign); // Positive
BOOST_CHECK_EQUAL(0, buf.scale); // Scale is 0 by default according to specification
- BOOST_CHECK_EQUAL(20, buf.precision); // Precision is driver specific. We use 20.
+ BOOST_CHECK_EQUAL(1, buf.precision); // Precision is 1 for default constructed Decimal (0).
for (int i = 0; i < SQL_MAX_NUMERIC_LEN; ++i)
BOOST_CHECK_EQUAL(0, buf.val[i]);
@@ -367,12 +368,12 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToNumeric)
// Trying to store 123.45 => 12345 => 0x3039 => [0x30, 0x39].
uint8_t mag1[] = { 0x30, 0x39 };
- decimal = Decimal(2, reinterpret_cast<int8_t*>(mag1), sizeof(mag1));
+ decimal = common::Decimal(reinterpret_cast<int8_t*>(mag1), sizeof(mag1), 2, 1);
appBuf.PutDecimal(decimal);
BOOST_CHECK_EQUAL(1, buf.sign); // Positive
BOOST_CHECK_EQUAL(0, buf.scale); // Scale is 0 by default according to specification
- BOOST_CHECK_EQUAL(20, buf.precision); // Precision is driver specific. We use 20.
+ BOOST_CHECK_EQUAL(3, buf.precision); // Precision is 3, as the scale is set to 0.
// 123.45 => (scale=0) 123 => 0x7B => [0x7B].
BOOST_CHECK_EQUAL(buf.val[0], 0x7B);
@@ -383,12 +384,12 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToNumeric)
// Trying to store 12345.678 => 12345678 => 0xBC614E => [0xBC, 0x61, 0x4E].
uint8_t mag2[] = { 0xBC, 0x61, 0x4E };
- decimal = Decimal(3 | 0x80000000, reinterpret_cast<int8_t*>(mag2), sizeof(mag2));
+ decimal = common::Decimal(reinterpret_cast<int8_t*>(mag2), sizeof(mag2), 3, -1);
appBuf.PutDecimal(decimal);
- BOOST_CHECK_EQUAL(2, buf.sign); // Negative
+ BOOST_CHECK_EQUAL(0, buf.sign); // Negative
BOOST_CHECK_EQUAL(0, buf.scale); // Scale is 0 by default according to specification
- BOOST_CHECK_EQUAL(20, buf.precision); // Precision is driver specific. We use 20.
+ BOOST_CHECK_EQUAL(5, buf.precision); // Precision is 5, as the scale is set to 0.
// 12345.678 => (scale=0) 12345 => 0x3039 => [0x39, 0x30].
BOOST_CHECK_EQUAL(buf.val[0], 0x39);
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/odbc-test/src/row_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/row_test.cpp b/modules/platforms/cpp/odbc-test/src/row_test.cpp
index bbf0e3d..1fcd43e 100644
--- a/modules/platforms/cpp/odbc-test/src/row_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/row_test.cpp
@@ -32,8 +32,9 @@ using namespace ignite::odbc;
std::string GetStrColumnValue(size_t rowIdx)
{
- std::stringstream generator("Column 2 test string, row num: ");
- generator << rowIdx << ". Some trailing bytes";
+ std::stringstream generator;
+ generator << "Column 2 test string, row num: "
+ << rowIdx << ". Some trailing bytes";
return generator.str();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/odbc/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/Makefile.am b/modules/platforms/cpp/odbc/Makefile.am
index cb9a2aa..29f0ef4 100644
--- a/modules/platforms/cpp/odbc/Makefile.am
+++ b/modules/platforms/cpp/odbc/Makefile.am
@@ -54,7 +54,6 @@ libignite_odbc_la_SOURCES = \
src/config/connection_info.cpp \
src/connection.cpp \
src/cursor.cpp \
- src/decimal.cpp \
src/diagnostic/diagnosable_adapter.cpp \
src/diagnostic/diagnostic_record.cpp \
src/diagnostic/diagnostic_record_storage.cpp \
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/odbc/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/Makefile.am b/modules/platforms/cpp/odbc/include/Makefile.am
index db4ffe0..192021d 100644
--- a/modules/platforms/cpp/odbc/include/Makefile.am
+++ b/modules/platforms/cpp/odbc/include/Makefile.am
@@ -51,7 +51,6 @@ noinst_HEADERS = \
ignite/odbc/cursor.h \
ignite/odbc/common_types.h \
ignite/odbc/result_page.h \
- ignite/odbc/decimal.h \
ignite/odbc/type_traits.h
uninstall-hook:
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/odbc/include/ignite/odbc/app/application_data_buffer.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/app/application_data_buffer.h b/modules/platforms/cpp/odbc/include/ignite/odbc/app/application_data_buffer.h
index 4d7460b..ed24359 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/app/application_data_buffer.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/app/application_data_buffer.h
@@ -25,8 +25,8 @@
#include <ignite/guid.h>
#include <ignite/date.h>
#include <ignite/timestamp.h>
+#include <ignite/common/decimal.h>
-#include "ignite/odbc/decimal.h"
#include "ignite/odbc/common_types.h"
#include "ignite/odbc/type_traits.h"
@@ -164,7 +164,7 @@ namespace ignite
*
* @param value Value to put.
*/
- void PutDecimal(const Decimal& value);
+ void PutDecimal(const common::Decimal& value);
/**
* Put date to buffer.
@@ -251,6 +251,13 @@ namespace ignite
Timestamp GetTimestamp() const;
/**
+ * Get value of type Decimal.
+ *
+ * @param val Result is placed here.
+ */
+ void GetDecimal(common::Decimal& val) const;
+
+ /**
* Get raw data.
*
* @return Buffer data.
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/odbc/include/ignite/odbc/decimal.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/decimal.h b/modules/platforms/cpp/odbc/include/ignite/odbc/decimal.h
deleted file mode 100644
index 8f7932a..0000000
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/decimal.h
+++ /dev/null
@@ -1,137 +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.
- */
-
-#ifndef _IGNITE_ODBC_DECIMAL
-#define _IGNITE_ODBC_DECIMAL
-
-#include <stdint.h>
-
-namespace ignite
-{
-
- /**
- * Big decimal number implementation.
- * @todo Move to binary or common library.
- */
- class Decimal
- {
- friend void swap(Decimal& first, Decimal& second);
- public:
- /**
- * Default constructor.
- */
- Decimal();
-
- /**
- * Constructor.
- *
- * @param scale Scale.
- * @param mag Magnitude. Value is copied.
- * @param len Magnitude length in bytes.
- */
- Decimal(int32_t scale, const int8_t* mag, int32_t len);
-
- /**
- * Copy constructor.
- *
- * @param other Other instance.
- */
- Decimal(const Decimal& other);
-
- /**
- * Destructor.
- */
- ~Decimal();
-
- /**
- * Copy operator.
- *
- * @param other Other instance.
- * @return This.
- */
- Decimal& operator=(const Decimal& other);
-
- /**
- * Convert to double.
- */
- operator double() const;
-
- /**
- * Get scale.
- *
- * @return Scale.
- */
- int32_t GetScale() const;
-
- /**
- * Get sign.
- *
- * @return Sign: -1 if negative and 1 if positive.
- */
- int32_t GetSign() const;
-
- /**
- * Check if the value is negative.
- *
- * @return True if negative and false otherwise.
- */
- bool IsNegative() const;
-
- /**
- * Get magnitude length in bytes.
- *
- * @return Magnitude length in bytes.
- */
- int32_t GetLength() const;
-
- /**
- * Get number of significant bits of the magnitude.
- *
- * @return Number of significant bits of the magnitude.
- */
- int32_t BitLength() const;
-
- /**
- * Get magnitude pointer.
- *
- * @return Magnitude pointer.
- */
- const int8_t* GetMagnitude() const;
-
- private:
- /** Scale. */
- int32_t scale;
-
- /** Magnitude lenght. */
- int32_t len;
-
- /** Magnitude. */
- int8_t* magnitude;
- };
-
- /**
- * Swap function for the Decimal type.
- *
- * @param first First instance.
- * @param second Second instance.
- */
- void swap(Decimal& first, Decimal& second);
-}
-
-
-
-#endif //_IGNITE_ODBC_DECIMAL
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/odbc/include/ignite/odbc/utility.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/utility.h b/modules/platforms/cpp/odbc/include/ignite/odbc/utility.h
index b2a1639..34627c1 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/utility.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/utility.h
@@ -29,11 +29,11 @@
#include <algorithm>
#include <ignite/common/utils.h>
+#include <ignite/common/decimal.h>
#include "ignite/impl/binary/binary_reader_impl.h"
#include "ignite/impl/binary/binary_writer_impl.h"
-#include "ignite/odbc/decimal.h"
#ifdef ODBC_DEBUG
@@ -56,7 +56,7 @@ namespace ignite
namespace utility
{
/** Using common version of the util. */
- using ignite::common::IntoLower;
+ using common::IntoLower;
/**
* Skip leading spaces.
@@ -141,14 +141,14 @@ namespace ignite
* @param reader Reader.
* @param str String.
*/
- void ReadString(ignite::impl::binary::BinaryReaderImpl& reader, std::string& str);
+ void ReadString(impl::binary::BinaryReaderImpl& reader, std::string& str);
/**
* Write string using writer.
* @param writer Writer.
* @param str String.
*/
- void WriteString(ignite::impl::binary::BinaryWriterImpl& writer, const std::string& str);
+ void WriteString(impl::binary::BinaryWriterImpl& writer, const std::string& str);
/**
* Read decimal value using reader.
@@ -156,7 +156,7 @@ namespace ignite
* @param reader Reader.
* @param decimal Decimal value.
*/
- void ReadDecimal(ignite::impl::binary::BinaryReaderImpl& reader, Decimal& decimal);
+ void ReadDecimal(impl::binary::BinaryReaderImpl& reader, common::Decimal& decimal);
/**
* Write decimal value using writer.
@@ -164,7 +164,7 @@ namespace ignite
* @param writer Writer.
* @param decimal Decimal value.
*/
- void WriteDecimal(ignite::impl::binary::BinaryWriterImpl& writer, const Decimal& decimal);
+ void WriteDecimal(impl::binary::BinaryWriterImpl& writer, const common::Decimal& decimal);
/**
* Convert SQL string buffer to std::string.
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj b/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj
index ca5587d..5820030 100644
--- a/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj
+++ b/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj
@@ -162,7 +162,6 @@
<ClCompile Include="..\..\src\config\connection_info.cpp" />
<ClCompile Include="..\..\src\connection.cpp" />
<ClCompile Include="..\..\src\cursor.cpp" />
- <ClCompile Include="..\..\src\decimal.cpp" />
<ClCompile Include="..\..\src\diagnostic\diagnosable_adapter.cpp" />
<ClCompile Include="..\..\src\diagnostic\diagnostic_record.cpp" />
<ClCompile Include="..\..\src\diagnostic\diagnostic_record_storage.cpp" />
@@ -197,7 +196,6 @@
<ClInclude Include="..\..\include\ignite\odbc\config\connection_info.h" />
<ClInclude Include="..\..\include\ignite\odbc\connection.h" />
<ClInclude Include="..\..\include\ignite\odbc\cursor.h" />
- <ClInclude Include="..\..\include\ignite\odbc\decimal.h" />
<ClInclude Include="..\..\include\ignite\odbc\diagnostic\diagnosable.h" />
<ClInclude Include="..\..\include\ignite\odbc\diagnostic\diagnosable_adapter.h" />
<ClInclude Include="..\..\include\ignite\odbc\diagnostic\diagnostic_record.h" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj.filters b/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj.filters
index 804fc2d..6ca58e2 100644
--- a/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj.filters
+++ b/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj.filters
@@ -103,9 +103,6 @@
<ClCompile Include="..\..\os\win\src\system\socket_client.cpp">
<Filter>Code\system</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\decimal.cpp">
- <Filter>Code</Filter>
- </ClCompile>
<ClCompile Include="..\..\src\query\type_info_query.cpp">
<Filter>Code\query</Filter>
</ClCompile>
@@ -215,9 +212,6 @@
<ClInclude Include="..\..\include\ignite\odbc\system\socket_client.h">
<Filter>Code\system</Filter>
</ClInclude>
- <ClInclude Include="..\..\include\ignite\odbc\decimal.h">
- <Filter>Code</Filter>
- </ClInclude>
<ClInclude Include="..\..\include\ignite\odbc\query\type_info_query.h">
<Filter>Code\query</Filter>
</ClInclude>
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp b/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
index 600dc86..eab6750 100644
--- a/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
+++ b/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <sstream>
+#include "ignite/common/bits.h"
+
#include "ignite/impl/binary/binary_utils.h"
#include "ignite/odbc/system/odbc_constants.h"
@@ -154,15 +156,15 @@ namespace ignite
SQL_NUMERIC_STRUCT* out =
reinterpret_cast<SQL_NUMERIC_STRUCT*>(GetData());
- out->precision = 20; // Max int64_t precision
+ uint64_t uval = static_cast<uint64_t>(value < 0 ? -value : value);
+
+ out->precision = common::bits::DigitLength(uval);
out->scale = 0;
- out->sign = value < 0 ? 2 : 1;
+ out->sign = value < 0 ? 0 : 1;
memset(out->val, 0, SQL_MAX_NUMERIC_LEN);
- int64_t intVal = static_cast<int64_t>(std::abs(value));
-
- memcpy(out->val, &intVal, std::min<int>(SQL_MAX_NUMERIC_LEN, sizeof(intVal)));
+ memcpy(out->val, &uval, std::min<int>(SQL_MAX_NUMERIC_LEN, sizeof(uval)));
}
break;
}
@@ -354,7 +356,11 @@ namespace ignite
case IGNITE_ODBC_C_TYPE_UNSIGNED_BIGINT:
case IGNITE_ODBC_C_TYPE_NUMERIC:
{
- std::stringstream converter(value);
+ std::stringstream converter;
+
+ converter << value;
+
+ converter << value;
int64_t numValue;
@@ -370,7 +376,11 @@ namespace ignite
case IGNITE_ODBC_C_TYPE_FLOAT:
case IGNITE_ODBC_C_TYPE_DOUBLE:
{
- std::stringstream converter(value);
+ std::stringstream converter;
+
+ converter << value;
+
+ converter << value;
double numValue;
@@ -532,7 +542,7 @@ namespace ignite
*GetResLen() = SQL_NULL_DATA;
}
- void ApplicationDataBuffer::PutDecimal(const Decimal& value)
+ void ApplicationDataBuffer::PutDecimal(const common::Decimal& value)
{
using namespace type_traits;
switch (type)
@@ -546,28 +556,86 @@ namespace ignite
case IGNITE_ODBC_C_TYPE_UNSIGNED_LONG:
case IGNITE_ODBC_C_TYPE_SIGNED_BIGINT:
case IGNITE_ODBC_C_TYPE_UNSIGNED_BIGINT:
+ {
+ PutNum<int64_t>(value.ToInt64());
+
+ converter << value;
+
+ PutString(converter.str());
+
+ break;
+ }
+
case IGNITE_ODBC_C_TYPE_FLOAT:
case IGNITE_ODBC_C_TYPE_DOUBLE:
+ {
+ PutNum<double>(value.ToDouble());
+
+ break;
+ }
+
case IGNITE_ODBC_C_TYPE_CHAR:
case IGNITE_ODBC_C_TYPE_WCHAR:
- case IGNITE_ODBC_C_TYPE_NUMERIC:
{
- PutNum<double>(static_cast<double>(value));
+ std::stringstream converter;
+
+ converter << value;
+
+ PutString(converter.str());
+
+ common::FixedSizeArray<int8_t> bytesBuffer;
+
+ const common::BigInteger& unscaled = zeroScaled.GetUnscaledValue();
+
+ unscaled.MagnitudeToBytes(bytesBuffer);
+
+ for (int32_t i = 0; i < SQL_MAX_NUMERIC_LEN; ++i)
+ {
+ int32_t bufIdx = bytesBuffer.GetSize() - 1 - i;
+ if (bufIdx >= 0)
+ numeric->val[i] = bytesBuffer[bufIdx];
+ else
+ numeric->val[i] = 0;
+ }
+
+ numeric->scale = 0;
+ numeric->sign = unscaled.GetSign() < 0 ? 0 : 1;
+ numeric->precision = unscaled.GetPrecision();
break;
}
- case IGNITE_ODBC_C_TYPE_DEFAULT:
+ case IGNITE_ODBC_C_TYPE_NUMERIC:
{
- if (GetData())
- memcpy(GetData(), &value, std::min(static_cast<size_t>(buflen), sizeof(value)));
+ SQL_NUMERIC_STRUCT* numeric =
+ reinterpret_cast<SQL_NUMERIC_STRUCT*>(GetData());
- if (GetResLen())
- *GetResLen() = sizeof(value);
+ common::Decimal zeroScaled;
+ value.SetScale(0, zeroScaled);
+
+ common::FixedSizeArray<int8_t> bytesBuffer;
+
+ const common::BigInteger& unscaled = zeroScaled.GetUnscaledValue();
+
+ unscaled.MagnitudeToBytes(bytesBuffer);
+
+ for (int32_t i = 0; i < SQL_MAX_NUMERIC_LEN; ++i)
+ {
+ int32_t bufIdx = bytesBuffer.GetSize() - 1 - i;
+ if (bufIdx >= 0)
+ numeric->val[i] = bytesBuffer[bufIdx];
+ else
+ numeric->val[i] = 0;
+ }
+
+ numeric->scale = 0;
+ numeric->sign = unscaled.GetSign() < 0 ? 0 : 1;
+ numeric->precision = unscaled.GetPrecision();
break;
}
+ case IGNITE_ODBC_C_TYPE_DEFAULT:
case IGNITE_ODBC_C_TYPE_BINARY:
default:
{
@@ -659,11 +727,11 @@ namespace ignite
case IGNITE_ODBC_C_TYPE_BINARY:
case IGNITE_ODBC_C_TYPE_DEFAULT:
{
- if (GetData())
- memcpy(GetData(), &value, std::min(static_cast<size_t>(buflen), sizeof(value)));
+ SQL_NUMERIC_STRUCT* numeric =
+ reinterpret_cast<SQL_NUMERIC_STRUCT*>(GetData());
- if (GetResLen())
- *GetResLen() = sizeof(value);
+ common::Decimal zeroScaled;
+ value.SetScale(0, zeroScaled);
break;
}
@@ -677,6 +745,12 @@ namespace ignite
case IGNITE_ODBC_C_TYPE_UNSIGNED_LONG:
case IGNITE_ODBC_C_TYPE_SIGNED_BIGINT:
case IGNITE_ODBC_C_TYPE_UNSIGNED_BIGINT:
+ {
+ PutNum<int64_t>(value.ToInt64());
+
+ break;
+ }
+
case IGNITE_ODBC_C_TYPE_FLOAT:
case IGNITE_ODBC_C_TYPE_DOUBLE:
case IGNITE_ODBC_C_TYPE_NUMERIC:
@@ -914,7 +988,11 @@ namespace ignite
{
std::string str(reinterpret_cast<const char*>(GetData()), static_cast<size_t>(buflen));
- std::stringstream converter(str);
+ std::stringstream converter;
+
+ converter << str;
+
+ converter << str;
converter >> res;
@@ -979,7 +1057,11 @@ namespace ignite
{
std::string str = GetString(static_cast<size_t>(buflen));
- std::stringstream converter(str);
+ std::stringstream converter;
+
+ converter << str;
+
+ converter << str;
// Workaround for char types which are recognised as
// symbolyc types and not numeric types.
@@ -1063,20 +1145,10 @@ namespace ignite
const SQL_NUMERIC_STRUCT* numeric =
reinterpret_cast<const SQL_NUMERIC_STRUCT*>(GetData());
- int64_t resInt;
-
- // TODO: implement propper conversation from numeric type.
- memcpy(&resInt, numeric->val, std::min<int>(SQL_MAX_NUMERIC_LEN, sizeof(resInt)));
+ common::Decimal dec(reinterpret_cast<const int8_t*>(numeric->val),
+ SQL_MAX_NUMERIC_LEN, numeric->scale, numeric->sign ? 1 : -1, false);
- if (numeric->sign == 2)
- resInt *= -1;
-
- double resDouble = static_cast<double>(resInt);
-
- for (SQLSCHAR scale = numeric->scale; scale > 0; --scale)
- resDouble /= 10.0;
-
- res = static_cast<T>(resDouble);
+ res = static_cast<T>(dec.ToInt64());
break;
}
@@ -1202,6 +1274,76 @@ namespace ignite
return BinaryUtils::CTmToTimestamp(tmTime, nanos);
}
+ void ApplicationDataBuffer::GetDecimal(common::Decimal& val) const
+ {
+ using namespace type_traits;
+
+ switch (type)
+ {
+ case IGNITE_ODBC_C_TYPE_CHAR:
+ {
+ std::string str = GetString(static_cast<size_t>(buflen));
+
+ std::stringstream converter;
+
+ converter << str;
+
+ converter >> val;
+
+ break;
+ }
+
+ case IGNITE_ODBC_C_TYPE_SIGNED_TINYINT:
+ case IGNITE_ODBC_C_TYPE_BIT:
+ case IGNITE_ODBC_C_TYPE_SIGNED_SHORT:
+ case IGNITE_ODBC_C_TYPE_SIGNED_LONG:
+ case IGNITE_ODBC_C_TYPE_SIGNED_BIGINT:
+ {
+ val.AssignInt64(GetNum<int64_t>());
+
+ break;
+ }
+
+ case IGNITE_ODBC_C_TYPE_UNSIGNED_TINYINT:
+ case IGNITE_ODBC_C_TYPE_UNSIGNED_SHORT:
+ case IGNITE_ODBC_C_TYPE_UNSIGNED_LONG:
+ case IGNITE_ODBC_C_TYPE_UNSIGNED_BIGINT:
+ {
+ val.AssignUint64(GetNum<uint64_t>());
+
+ break;
+ }
+
+ case IGNITE_ODBC_C_TYPE_FLOAT:
+ case IGNITE_ODBC_C_TYPE_DOUBLE:
+ {
+ val.AssignDouble(GetNum<double>());
+
+ break;
+ }
+
+ case IGNITE_ODBC_C_TYPE_NUMERIC:
+ {
+ const SQL_NUMERIC_STRUCT* numeric =
+ reinterpret_cast<const SQL_NUMERIC_STRUCT*>(GetData());
+
+ common::Decimal dec(reinterpret_cast<const int8_t*>(numeric->val),
+ SQL_MAX_NUMERIC_LEN, numeric->scale, numeric->sign ? 1 : -1, false);
+
+ val.Swap(dec);
+
+ break;
+ }
+
+ default:
+ {
+ val.AssignInt64(0);
+
+ break;
+ }
+ }
+ }
+
template<typename T>
T* ApplicationDataBuffer::ApplyOffset(T* ptr) const
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/odbc/src/app/parameter.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/app/parameter.cpp b/modules/platforms/cpp/odbc/src/app/parameter.cpp
index 3ced3e8..3e14642 100644
--- a/modules/platforms/cpp/odbc/src/app/parameter.cpp
+++ b/modules/platforms/cpp/odbc/src/app/parameter.cpp
@@ -156,7 +156,11 @@ namespace ignite
case SQL_DECIMAL:
{
- //TODO: Add Decimal type support.
+ common::Decimal dec;
+ buffer.GetDecimal(dec);
+
+ utility::WriteDecimal(writer, dec);
+
break;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/odbc/src/column.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/column.cpp b/modules/platforms/cpp/odbc/src/column.cpp
index 61a55ca..ec779ac 100644
--- a/modules/platforms/cpp/odbc/src/column.cpp
+++ b/modules/platforms/cpp/odbc/src/column.cpp
@@ -254,11 +254,11 @@ namespace ignite
case IGNITE_TYPE_DECIMAL:
{
- Decimal res;
+ common::Decimal res;
utility::ReadDecimal(reader, res);
- sizeTmp = res.GetLength() + 8;
+ sizeTmp = res.GetMagnitudeLength() + 8;
break;
}
@@ -437,7 +437,7 @@ namespace ignite
case IGNITE_TYPE_DECIMAL:
{
- Decimal res;
+ common::Decimal res;
utility::ReadDecimal(reader, res);
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/odbc/src/connection.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/connection.cpp b/modules/platforms/cpp/odbc/src/connection.cpp
index 59a25f9..2441759 100644
--- a/modules/platforms/cpp/odbc/src/connection.cpp
+++ b/modules/platforms/cpp/odbc/src/connection.cpp
@@ -25,7 +25,6 @@
#include "ignite/odbc/message.h"
#include "ignite/odbc/config/configuration.h"
-// TODO: implement appropriate protocol with de-/serialisation.
namespace
{
#pragma pack(push, 1)
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/odbc/src/decimal.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/decimal.cpp b/modules/platforms/cpp/odbc/src/decimal.cpp
deleted file mode 100644
index c1b2c44..0000000
--- a/modules/platforms/cpp/odbc/src/decimal.cpp
+++ /dev/null
@@ -1,135 +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.
- */
-
-#include <cstring>
-#include <utility>
-
-#include "ignite/common/utils.h"
-
-#include "ignite/odbc/decimal.h"
-
-namespace ignite
-{
- Decimal::Decimal() :
- scale(0), len(0), magnitude(0)
- {
- // No-op.
- }
-
- Decimal::Decimal(int32_t scale, const int8_t* mag, int32_t len) :
- scale(scale), len(len), magnitude(0)
- {
- magnitude = new int8_t[len];
-
- memcpy(magnitude, mag, len);
- }
-
- Decimal::Decimal(const Decimal& other) :
- scale(other.scale), len(other.len), magnitude(0)
- {
- magnitude = new int8_t[len];
-
- memcpy(magnitude, other.magnitude, len);
- }
-
- Decimal::~Decimal()
- {
- if (magnitude)
- delete[] magnitude;
- }
-
- Decimal& Decimal::operator=(const Decimal& other)
- {
- Decimal tmp(other);
-
- swap(tmp, *this);
-
- return *this;
- }
-
- Decimal::operator double() const
- {
- double res = 0;
-
- for (int32_t i = 0; i < len; ++i)
- res = (res * 256) + static_cast<uint8_t>(magnitude[i]);
-
- for (int32_t i = 0; i < GetScale(); ++i)
- res /= 10.0;
-
- return res * GetSign();
- }
-
- int32_t Decimal::GetScale() const
- {
- return scale & 0x7FFFFFFF;
- }
-
- int32_t Decimal::GetSign() const
- {
- return IsNegative() ? -1 : 1;
- }
-
- bool Decimal::IsNegative() const
- {
- return (scale & 0x80000000) != 0;
- }
-
- int32_t Decimal::GetLength() const
- {
- return len;
- }
-
- int32_t Decimal::BitLength() const
- {
- using namespace common;
-
- if (len == 0)
- return 0;
-
- int32_t bitsLen = (len - 1) * 8 +
- BitLengthForOctet(magnitude[len - 1]);
-
- if (IsNegative()) {
-
- // Check if magnitude is a power of two
- bool pow2 = PowerOfTwo(magnitude[len - 1]);
- for (int i = 0; i < len - 1 && pow2; ++i)
- pow2 = (magnitude[i] == 0);
-
- if (pow2)
- --bitsLen;
- }
-
- return bitsLen;
- }
-
- const int8_t* Decimal::GetMagnitude() const
- {
- return magnitude;
- }
-
- void swap(Decimal& first, Decimal& second)
- {
- using std::swap;
-
- std::swap(first.scale, second.scale);
- std::swap(first.len, second.len);
- std::swap(first.magnitude, second.magnitude);
- }
-}
-
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/odbc/src/odbc.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/odbc.cpp b/modules/platforms/cpp/odbc/src/odbc.cpp
index 53717c7..3b31f1d 100644
--- a/modules/platforms/cpp/odbc/src/odbc.cpp
+++ b/modules/platforms/cpp/odbc/src/odbc.cpp
@@ -638,7 +638,6 @@ namespace ignite
if (!statement)
return SQL_INVALID_HANDLE;
- //TODO: reset diagnostic here.
return statement->DataAvailable() ? SQL_SUCCESS : SQL_NO_DATA;
}
@@ -887,7 +886,6 @@ namespace ignite
if (!statement)
return SQL_INVALID_HANDLE;
- //TODO: move this logic into Statement.
switch (attr)
{
case SQL_ATTR_APP_ROW_DESC:
@@ -974,7 +972,6 @@ namespace ignite
if (!statement)
return SQL_INVALID_HANDLE;
- //TODO: move this logic into Statement.
switch (attr)
{
case SQL_ATTR_ROW_ARRAY_SIZE:
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/odbc/src/utility.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/utility.cpp b/modules/platforms/cpp/odbc/src/utility.cpp
index 8cdfdb6..133f059 100644
--- a/modules/platforms/cpp/odbc/src/utility.cpp
+++ b/modules/platforms/cpp/odbc/src/utility.cpp
@@ -77,7 +77,7 @@ namespace ignite
writer.WriteString(str.data(), static_cast<int32_t>(str.size()));
}
- void ReadDecimal(ignite::impl::binary::BinaryReaderImpl& reader, Decimal& decimal)
+ void ReadDecimal(ignite::impl::binary::BinaryReaderImpl& reader, common::Decimal& decimal)
{
int8_t hdr = reader.ReadInt8();
@@ -93,20 +93,31 @@ namespace ignite
impl::binary::BinaryUtils::ReadInt8Array(reader.GetStream(), mag.data(), static_cast<int32_t>(mag.size()));
- Decimal res(scale, mag.data(), static_cast<int32_t>(mag.size()));
+ int32_t sign = (scale & 0x80000000) ? -1 : 1;
+ scale = scale & 0x7FFFFFFF;
- swap(decimal, res);
+ common::Decimal res(mag.data(), static_cast<int32_t>(mag.size()), scale, sign);
+
+ decimal.Swap(res);
}
- void WriteDecimal(ignite::impl::binary::BinaryWriterImpl& writer, const Decimal& decimal)
+ void WriteDecimal(ignite::impl::binary::BinaryWriterImpl& writer, const common::Decimal& decimal)
{
writer.WriteInt8(ignite::impl::binary::IGNITE_TYPE_DECIMAL);
- writer.WriteInt32(decimal.GetScale() | (decimal.IsNegative() ? 0x80000000 : 0));
+ const common::BigInteger &unscaled = decimal.GetUnscaledValue();
+
+ int32_t signFlag = unscaled.GetSign() == -1 ? 0x80000000 : 0;
+
+ writer.WriteInt32(decimal.GetScale() | signFlag);
+
+ common::FixedSizeArray<int8_t> magnitude;
+
+ unscaled.MagnitudeToBytes(magnitude);
- writer.WriteInt32(decimal.GetLength());
+ writer.WriteInt32(magnitude.GetSize());
- impl::binary::BinaryUtils::WriteInt8Array(writer.GetStream(), decimal.GetMagnitude(), decimal.GetLength());
+ impl::binary::BinaryUtils::WriteInt8Array(writer.GetStream(), magnitude.GetData(), magnitude.GetSize());
}
std::string SqlStringToString(const unsigned char* sqlStr, int32_t sqlStrLen)
[30/50] [abbrv] ignite git commit: IGNITE-3185: Hadoop: Improved
classpath resolution logic.
Posted by sb...@apache.org.
IGNITE-3185: Hadoop: Improved classpath resolution logic.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/34798d3a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/34798d3a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/34798d3a
Branch: refs/heads/ignite-1232
Commit: 34798d3ae007c99c4c813d7a1e060f4f145b4ec2
Parents: 9d033e5
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Jul 1 15:39:40 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Jul 6 09:54:18 2016 +0300
----------------------------------------------------------------------
.../processors/hadoop/HadoopClasspathUtils.java | 160 +++++++++++++------
.../processors/hadoop/HadoopLocations.java | 79 +++++++--
.../processors/hadoop/HadoopProcessor.java | 12 +-
3 files changed, 179 insertions(+), 72 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/34798d3a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClasspathUtils.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClasspathUtils.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClasspathUtils.java
index 986b23e..121fcab 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClasspathUtils.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClasspathUtils.java
@@ -33,6 +33,24 @@ import java.util.List;
* Hadoop classpath utilities.
*/
public class HadoopClasspathUtils {
+ /** Prefix directory. */
+ public static final String PREFIX = "HADOOP_PREFIX";
+
+ /** Home directory. */
+ public static final String HOME = "HADOOP_HOME";
+
+ /** Home directory. */
+ public static final String COMMON_HOME = "HADOOP_COMMON_HOME";
+
+ /** Home directory. */
+ public static final String HDFS_HOME = "HADOOP_HDFS_HOME";
+
+ /** Home directory. */
+ public static final String MAPRED_HOME = "HADOOP_MAPRED_HOME";
+
+ /** Empty string. */
+ private static final String EMPTY_STR = "";
+
/**
* Gets Hadoop class path as list of classpath elements for process.
*
@@ -80,16 +98,77 @@ public class HadoopClasspathUtils {
/**
* Gets Hadoop locations.
*
- * @return The Hadoop locations, never null.
+ * @return The locations as determined from the environment.
*/
- public static HadoopLocations hadoopLocations() throws IOException {
- final String hadoopHome = systemOrEnv("HADOOP_HOME", systemOrEnv("HADOOP_PREFIX", null));
+ public static HadoopLocations locations() throws IOException {
+ // Query environment.
+ String hadoopHome = systemOrEnv(PREFIX, systemOrEnv(HOME, EMPTY_STR));
+
+ String commonHome = systemOrEnv(COMMON_HOME, EMPTY_STR);
+ String hdfsHome = systemOrEnv(HDFS_HOME, EMPTY_STR);
+ String mapredHome = systemOrEnv(MAPRED_HOME, EMPTY_STR);
- String commonHome = resolveLocation("HADOOP_COMMON_HOME", hadoopHome, "/share/hadoop/common");
- String hdfsHome = resolveLocation("HADOOP_HDFS_HOME", hadoopHome, "/share/hadoop/hdfs");
- String mapredHome = resolveLocation("HADOOP_MAPRED_HOME", hadoopHome, "/share/hadoop/mapreduce");
+ // If any composite location is defined, use only them.
+ if (!isEmpty(commonHome) || !isEmpty(hdfsHome) || !isEmpty(mapredHome)) {
+ HadoopLocations res = new HadoopLocations(hadoopHome, commonHome, hdfsHome, mapredHome);
- return new HadoopLocations(hadoopHome, commonHome, hdfsHome, mapredHome);
+ if (res.valid())
+ return res;
+ else
+ throw new IOException("Failed to resolve Hadoop classpath because some environment variables are " +
+ "either undefined or point to nonexistent directories [" +
+ "[env=" + COMMON_HOME + ", value=" + commonHome + ", exists=" + res.commonExists() + "], " +
+ "[env=" + HDFS_HOME + ", value=" + hdfsHome + ", exists=" + res.hdfsExists() + "], " +
+ "[env=" + MAPRED_HOME + ", value=" + mapredHome + ", exists=" + res.mapredExists() + "]]");
+ }
+ else if (!isEmpty(hadoopHome)) {
+ // All further checks will be based on HADOOP_HOME, so check for it's existence.
+ if (!exists(hadoopHome))
+ throw new IOException("Failed to resolve Hadoop classpath because " + HOME + " environment " +
+ "variable points to nonexistent directory: " + hadoopHome);
+
+ // Probe Apache Hadoop.
+ HadoopLocations res = new HadoopLocations(
+ hadoopHome,
+ hadoopHome + "/share/hadoop/common",
+ hadoopHome + "/share/hadoop/hdfs",
+ hadoopHome + "/share/hadoop/mapreduce"
+ );
+
+ if (res.valid())
+ return res;
+
+ // Probe CDH.
+ res = new HadoopLocations(
+ hadoopHome,
+ hadoopHome,
+ hadoopHome + "/../hadoop-hdfs",
+ hadoopHome + "/../hadoop-mapreduce"
+ );
+
+ if (res.valid())
+ return res;
+
+ // Probe HDP.
+ res = new HadoopLocations(
+ hadoopHome,
+ hadoopHome,
+ hadoopHome + "/../hadoop-hdfs-client",
+ hadoopHome + "/../hadoop-mapreduce-client"
+ );
+
+ if (res.valid())
+ return res;
+
+ // Failed.
+ throw new IOException("Failed to resolve Hadoop classpath because " + HOME + " environment variable " +
+ "is either invalid or points to non-standard Hadoop distribution: " + hadoopHome);
+ }
+ else {
+ // Advise to set HADOOP_HOME only as this is preferred way to configure classpath.
+ throw new IOException("Failed to resolve Hadoop classpath (please define " + HOME + " environment " +
+ "variable and point it to your Hadoop distribution).");
+ }
}
/**
@@ -99,57 +178,30 @@ public class HadoopClasspathUtils {
* @throws IOException if a mandatory classpath location is not found.
*/
private static Collection<SearchDirectory> classpathDirectories() throws IOException {
- HadoopLocations loc = hadoopLocations();
+ HadoopLocations loc = locations();
Collection<SearchDirectory> res = new ArrayList<>();
- res.add(new SearchDirectory(new File(loc.commonHome(), "lib"), null));
- res.add(new SearchDirectory(new File(loc.hdfsHome(), "lib"), null));
- res.add(new SearchDirectory(new File(loc.mapredHome(), "lib"), null));
+ res.add(new SearchDirectory(new File(loc.common(), "lib"), null));
+ res.add(new SearchDirectory(new File(loc.hdfs(), "lib"), null));
+ res.add(new SearchDirectory(new File(loc.mapred(), "lib"), null));
- res.add(new SearchDirectory(new File(loc.commonHome()), "hadoop-common-"));
- res.add(new SearchDirectory(new File(loc.commonHome()), "hadoop-auth-"));
+ res.add(new SearchDirectory(new File(loc.common()), "hadoop-common-"));
+ res.add(new SearchDirectory(new File(loc.common()), "hadoop-auth-"));
- res.add(new SearchDirectory(new File(loc.hdfsHome()), "hadoop-hdfs-"));
+ res.add(new SearchDirectory(new File(loc.hdfs()), "hadoop-hdfs-"));
- res.add(new SearchDirectory(new File(loc.mapredHome()), "hadoop-mapreduce-client-common"));
- res.add(new SearchDirectory(new File(loc.mapredHome()), "hadoop-mapreduce-client-core"));
+ res.add(new SearchDirectory(new File(loc.mapred()), "hadoop-mapreduce-client-common"));
+ res.add(new SearchDirectory(new File(loc.mapred()), "hadoop-mapreduce-client-core"));
return res;
}
/**
- * Resolves a Hadoop location directory.
- *
- * @param envVarName Environment variable name. The value denotes the location path.
- * @param hadoopHome Hadoop home location, may be null.
- * @param expHadoopHomeRelativePath The path relative to Hadoop home, expected to start with path separator.
- * @throws IOException If the value cannot be resolved to an existing directory.
- */
- private static String resolveLocation(String envVarName, String hadoopHome, String expHadoopHomeRelativePath)
- throws IOException {
- String val = systemOrEnv(envVarName, null);
-
- if (val == null) {
- // The env. variable is not set. Try to resolve the location relative HADOOP_HOME:
- if (!directoryExists(hadoopHome))
- throw new IOException("Failed to resolve Hadoop installation location. " +
- envVarName + " or HADOOP_HOME environment variable should be set.");
-
- val = hadoopHome + expHadoopHomeRelativePath;
- }
-
- if (!directoryExists(val))
- throw new IOException("Failed to resolve Hadoop location [path=" + val + ']');
-
- return val;
- }
-
- /**
- * Note that this method does not treat empty value as an absent value.
+ * Get system property or environment variable with the given name.
*
* @param name Variable name.
- * @param dflt Default.
+ * @param dflt Default value.
* @return Value.
*/
private static String systemOrEnv(String name, String dflt) {
@@ -158,7 +210,7 @@ public class HadoopClasspathUtils {
if (res == null)
res = System.getenv(name);
- return res == null ? dflt : res;
+ return res != null ? res : dflt;
}
/**
@@ -167,7 +219,7 @@ public class HadoopClasspathUtils {
* @param path The directory path.
* @return {@code True} if the given path denotes an existing directory.
*/
- private static boolean directoryExists(String path) {
+ public static boolean exists(String path) {
if (path == null)
return false;
@@ -177,6 +229,16 @@ public class HadoopClasspathUtils {
}
/**
+ * Check if string is empty.
+ *
+ * @param val Value.
+ * @return {@code True} if empty.
+ */
+ private static boolean isEmpty(String val) {
+ return val == null || val.isEmpty();
+ }
+
+ /**
* Simple pair-like structure to hold directory name and a mask assigned to it.
*/
private static class SearchDirectory {
@@ -196,7 +258,7 @@ public class HadoopClasspathUtils {
this.dir = dir;
this.filter = filter;
- if (!directoryExists(dir.getAbsolutePath()))
+ if (!exists(dir.getAbsolutePath()))
throw new IOException("Directory cannot be read: " + dir.getAbsolutePath());
}
@@ -230,4 +292,4 @@ public class HadoopClasspathUtils {
return filter != null;
}
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/34798d3a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopLocations.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopLocations.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopLocations.java
index b3e2d12..a90007f 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopLocations.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopLocations.java
@@ -25,27 +25,42 @@ public class HadoopLocations {
private final String home;
/** Common home. */
- private final String commonHome;
+ private final String common;
/** HDFS home. */
- private final String hdfsHome;
+ private final String hdfs;
/** Mapred home. */
- private final String mapredHome;
+ private final String mapred;
+
+ /** Whether common home exists. */
+ private final boolean commonExists;
+
+ /** Whether HDFS home exists. */
+ private final boolean hdfsExists;
+
+ /** Whether mapred home exists. */
+ private final boolean mapredExists;
/**
* Constructor.
*
* @param home Hadoop home.
- * @param commonHome Common home.
- * @param hdfsHome HDFS home.
- * @param mapredHome Mapred home.
+ * @param common Common home.
+ * @param hdfs HDFS home.
+ * @param mapred Mapred home.
*/
- public HadoopLocations(String home, String commonHome, String hdfsHome, String mapredHome) {
+ public HadoopLocations(String home, String common, String hdfs, String mapred) {
+ assert common != null && hdfs != null && mapred != null;
+
this.home = home;
- this.commonHome = commonHome;
- this.hdfsHome = hdfsHome;
- this.mapredHome = mapredHome;
+ this.common = common;
+ this.hdfs = hdfs;
+ this.mapred = mapred;
+
+ commonExists = HadoopClasspathUtils.exists(common);
+ hdfsExists = HadoopClasspathUtils.exists(hdfs);
+ mapredExists = HadoopClasspathUtils.exists(mapred);
}
/**
@@ -58,21 +73,51 @@ public class HadoopLocations {
/**
* @return Common home.
*/
- public String commonHome() {
- return commonHome;
+ public String common() {
+ return common;
}
/**
* @return HDFS home.
*/
- public String hdfsHome() {
- return hdfsHome;
+ public String hdfs() {
+ return hdfs;
}
/**
* @return Mapred home.
*/
- public String mapredHome() {
- return mapredHome;
+ public String mapred() {
+ return mapred;
+ }
+
+ /**
+ * @return Whether common home exists.
+ */
+ public boolean commonExists() {
+ return commonExists;
+ }
+
+ /**
+ * @return Whether HDFS home exists.
+ */
+ public boolean hdfsExists() {
+ return hdfsExists;
+ }
+
+ /**
+ * @return Whether mapred home exists.
+ */
+ public boolean mapredExists() {
+ return mapredExists;
+ }
+
+ /**
+ * Whether all required directories exists.
+ *
+ * @return {@code True} if exists.
+ */
+ public boolean valid() {
+ return commonExists && hdfsExists && mapredExists;
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/34798d3a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
index bb10565..b9c20c3 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
@@ -27,6 +27,7 @@ import org.apache.ignite.internal.processors.hadoop.jobtracker.HadoopJobTracker;
import org.apache.ignite.internal.processors.hadoop.shuffle.HadoopShuffle;
import org.apache.ignite.internal.processors.hadoop.taskexecutor.HadoopEmbeddedTaskExecutor;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -190,14 +191,13 @@ public class HadoopProcessor extends HadoopProcessorAdapter {
@Override public void validateEnvironment() throws IgniteCheckedException {
// Perform some static checks as early as possible, so that any recoverable exceptions are thrown here.
try {
- HadoopLocations loc = HadoopClasspathUtils.hadoopLocations();
+ HadoopLocations loc = HadoopClasspathUtils.locations();
- if (loc.home() != null)
- U.quietAndInfo(log, "HADOOP_HOME is set to " + loc.home());
+ if (!F.isEmpty(loc.home()))
+ U.quietAndInfo(log, HadoopClasspathUtils.HOME + " is set to " + loc.home());
- U.quietAndInfo(log, "HADOOP_COMMON_HOME is set to " + loc.commonHome());
- U.quietAndInfo(log, "HADOOP_HDFS_HOME is set to " + loc.hdfsHome());
- U.quietAndInfo(log, "HADOOP_MAPRED_HOME is set to " + loc.mapredHome());
+ U.quietAndInfo(log, "Resolved Hadoop classpath locations: " + loc.common() + ", " + loc.hdfs() + ", " +
+ loc.mapred());
}
catch (IOException ioe) {
throw new IgniteCheckedException(ioe.getMessage(), ioe);
[06/50] [abbrv] ignite git commit: updated BinaryObjectBuilder
documentation
Posted by sb...@apache.org.
updated BinaryObjectBuilder documentation
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/16ffe6e2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/16ffe6e2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/16ffe6e2
Branch: refs/heads/ignite-1232
Commit: 16ffe6e20f80854dfb7c0c1284117f7a58cd27a7
Parents: 735cc7c
Author: Denis Magda <dm...@gridgain.com>
Authored: Wed Jun 29 14:40:30 2016 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Jun 29 14:40:30 2016 +0300
----------------------------------------------------------------------
.../org/apache/ignite/binary/BinaryObjectBuilder.java | 11 +++++++++++
1 file changed, 11 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/16ffe6e2/modules/core/src/main/java/org/apache/ignite/binary/BinaryObjectBuilder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/binary/BinaryObjectBuilder.java b/modules/core/src/main/java/org/apache/ignite/binary/BinaryObjectBuilder.java
index 156ddb9..21f1c37 100644
--- a/modules/core/src/main/java/org/apache/ignite/binary/BinaryObjectBuilder.java
+++ b/modules/core/src/main/java/org/apache/ignite/binary/BinaryObjectBuilder.java
@@ -60,6 +60,17 @@ import org.jetbrains.annotations.Nullable;
* String city = personBinaryObj.getField("address").getField("city");
* </pre>
*
+ * <p>
+ * Make sure to set values for all the fields that an object from your domain model has.
+ * If you need to set null as a value use {@link #setField(String, Object, Class)} method directly specifying
+ * field's type.
+ * <p>
+ * If to follow this recommendation you'll reduce the size of internal metadata object that
+ * every binary object of a particular type has. Usually the metadata size grows because particular fields are not set
+ * to an instance of a binary object constructed with the builder. Every time when you construct an object
+ * setting only a subset of the fields the metadata object related to this type is expanded by the metadata
+ * processor which treats every new combination of the fields as the new version of the binary object.
+ *
* @see org.apache.ignite.IgniteBinary#builder(String)
* @see org.apache.ignite.IgniteBinary#builder(BinaryObject)
*/
[46/50] [abbrv] ignite git commit: Merge branch 'gridgain-7.6.2' of
https://github.com/gridgain/apache-ignite
Posted by sb...@apache.org.
Merge branch 'gridgain-7.6.2' of https://github.com/gridgain/apache-ignite
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b7d6ef7c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b7d6ef7c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b7d6ef7c
Branch: refs/heads/ignite-1232
Commit: b7d6ef7c148678d308546ef955136f4a6777be1c
Parents: 1e8757b d27e735
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Wed Jul 6 20:37:58 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Jul 6 20:37:58 2016 +0700
----------------------------------------------------------------------
.../resources/META-INF/classnames.properties | 165 +++++++++++++------
1 file changed, 114 insertions(+), 51 deletions(-)
----------------------------------------------------------------------
[12/50] [abbrv] ignite git commit: IGNITE-3383: Hadoop: fixed missing
Hadoop environment printout.
Posted by sb...@apache.org.
IGNITE-3383: Hadoop: fixed missing Hadoop environment printout.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fb876900
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fb876900
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fb876900
Branch: refs/heads/ignite-1232
Commit: fb876900c5fdddfe0c581262ae9c8d3a9b8e39bb
Parents: 00ce209
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Jun 29 16:51:23 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Jun 30 10:19:33 2016 +0300
----------------------------------------------------------------------
.../src/main/java/org/apache/ignite/internal/IgniteKernal.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb876900/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 0c1bd93..c839375 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -1121,7 +1121,11 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
throw new IgniteCheckedException("Hadoop module cannot be used with peer class loading enabled " +
"(set IgniteConfiguration.peerClassLoadingEnabled to \"false\").");
- return IgniteComponentType.HADOOP.createIfInClassPath(ctx, true);
+ HadoopProcessorAdapter res = IgniteComponentType.HADOOP.createIfInClassPath(ctx, true);
+
+ res.validateEnvironment();
+
+ return res;
}
else {
HadoopProcessorAdapter cmp = null;
[47/50] [abbrv] ignite git commit: IGNITE-3363 Forward Java output to
the .NET console
Posted by sb...@apache.org.
IGNITE-3363 Forward Java output to the .NET console
This closes #833
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4e468a8c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4e468a8c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4e468a8c
Branch: refs/heads/ignite-1232
Commit: 4e468a8cda774b1712231a0c356431f5a0910e88
Parents: b7d6ef7
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Jul 6 17:50:42 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed Jul 6 17:50:42 2016 +0300
----------------------------------------------------------------------
.../platform/PlatformAbstractBootstrap.java | 5 +
.../processors/platform/PlatformBootstrap.java | 6 +
.../processors/platform/PlatformIgnition.java | 7 +-
.../callback/PlatformCallbackGateway.java | 10 ++
.../callback/PlatformCallbackUtils.java | 8 +
.../dotnet/PlatformDotNetBootstrap.java | 12 ++
.../dotnet/PlatformDotNetConsoleStream.java | 54 ++++++
.../cpp/jni/include/ignite/jni/exports.h | 3 +
.../platforms/cpp/jni/include/ignite/jni/java.h | 6 +
modules/platforms/cpp/jni/project/vs/module.def | 2 +
modules/platforms/cpp/jni/src/exports.cpp | 8 +
modules/platforms/cpp/jni/src/java.cpp | 57 +++++-
.../Apache.Ignite.Core.Tests.csproj | 1 +
.../ConsoleRedirectTest.cs | 177 +++++++++++++++++++
.../Apache.Ignite.Core.Tests/TestRunner.cs | 21 ++-
.../Impl/Unmanaged/IgniteJniNativeMethods.cs | 6 +
.../Impl/Unmanaged/UnmanagedCallbacks.cs | 36 +++-
.../Impl/Unmanaged/UnmanagedUtils.cs | 16 ++
18 files changed, 426 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e468a8c/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractBootstrap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractBootstrap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractBootstrap.java
index 6fc46c4..a28677f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractBootstrap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractBootstrap.java
@@ -49,6 +49,11 @@ public abstract class PlatformAbstractBootstrap implements PlatformBootstrap {
}
}
+ /** {@inheritDoc} */
+ @Override public void init() {
+ // No-op.
+ }
+
/**
* Get configuration transformer closure.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e468a8c/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformBootstrap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformBootstrap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformBootstrap.java
index 956a02d..07847a7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformBootstrap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformBootstrap.java
@@ -36,4 +36,10 @@ public interface PlatformBootstrap {
*/
public PlatformProcessor start(IgniteConfiguration cfg, @Nullable GridSpringResourceContext springCtx,
long envPtr, long dataPtr);
+
+ /**
+ * Init the bootstrap.
+ *
+ */
+ public void init();
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e468a8c/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformIgnition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformIgnition.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformIgnition.java
index 928aa66..d754b7c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformIgnition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformIgnition.java
@@ -61,6 +61,11 @@ public class PlatformIgnition {
Thread.currentThread().setContextClassLoader(PlatformProcessor.class.getClassLoader());
try {
+ PlatformBootstrap bootstrap = bootstrap(factoryId);
+
+ // This should be done before Spring XML initialization so that redirected stream is picked up.
+ bootstrap.init();
+
IgniteBiTuple<IgniteConfiguration, GridSpringResourceContext> cfg = configuration(springCfgPath);
if (gridName != null)
@@ -68,8 +73,6 @@ public class PlatformIgnition {
else
gridName = cfg.get1().getGridName();
- PlatformBootstrap bootstrap = bootstrap(factoryId);
-
PlatformProcessor proc = bootstrap.start(cfg.get1(), cfg.get2(), envPtr, dataPtr);
PlatformProcessor old = instances.put(gridName, proc);
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e468a8c/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java
index 88532fc..41d3802 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java
@@ -1040,6 +1040,16 @@ public class PlatformCallbackGateway {
}
/**
+ * Redirects the console output to platform.
+ *
+ * @param str String to write.
+ * @param isErr Whether this is stdErr or stdOut.
+ */
+ public static void consoleWrite(String str, boolean isErr) {
+ PlatformCallbackUtils.consoleWrite(str, isErr);
+ }
+
+ /**
* Enter gateway.
*/
protected void enter() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e468a8c/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils.java
index 7b36e5e..63c6682 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils.java
@@ -545,6 +545,14 @@ public class PlatformCallbackUtils {
static native void affinityFunctionDestroy(long envPtr, long ptr);
/**
+ * Redirects the console output.
+ *
+ * @param str String to write.
+ * @param isErr Whether this is stdErr or stdOut.
+ */
+ static native void consoleWrite(String str, boolean isErr);
+
+ /**
* Private constructor.
*/
private PlatformCallbackUtils() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e468a8c/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetBootstrap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetBootstrap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetBootstrap.java
index 837ded9..9278246 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetBootstrap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetBootstrap.java
@@ -20,11 +20,23 @@ package org.apache.ignite.internal.processors.platform.dotnet;
import org.apache.ignite.internal.processors.platform.PlatformAbstractBootstrap;
import org.apache.ignite.internal.processors.platform.PlatformAbstractConfigurationClosure;
+import java.io.PrintStream;
+
/**
* Interop .Net bootstrap.
*/
public class PlatformDotNetBootstrap extends PlatformAbstractBootstrap {
/** {@inheritDoc} */
+ @Override public void init() {
+ // Initialize console propagation.
+ // This call is idempotent, doing it on each node start is fine.
+ System.setOut(new PrintStream(new PlatformDotNetConsoleStream(false)));
+ System.setErr(new PrintStream(new PlatformDotNetConsoleStream(true)));
+
+ super.init();
+ }
+
+ /** {@inheritDoc} */
@Override protected PlatformAbstractConfigurationClosure closure(long envPtr) {
return new PlatformDotNetConfigurationClosure(envPtr);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e468a8c/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConsoleStream.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConsoleStream.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConsoleStream.java
new file mode 100644
index 0000000..028c3ab
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConsoleStream.java
@@ -0,0 +1,54 @@
+/*
+ * 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.processors.platform.dotnet;
+
+import org.apache.ignite.internal.processors.platform.callback.PlatformCallbackGateway;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * Stream that writes to the .NET console.
+ */
+public class PlatformDotNetConsoleStream extends OutputStream {
+ /** Indicates whether this is an error stream. */
+ private final boolean isErr;
+
+ /**
+ * Ctor.
+ *
+ * @param err Error stream flag.
+ */
+ public PlatformDotNetConsoleStream(boolean err) {
+ isErr = err;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void write(byte[] b, int off, int len) throws IOException {
+ String s = new String(b, off, len);
+
+ PlatformCallbackGateway.consoleWrite(s, isErr);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void write(int b) throws IOException {
+ String s = String.valueOf((char) b);
+
+ PlatformCallbackGateway.consoleWrite(s, isErr);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e468a8c/modules/platforms/cpp/jni/include/ignite/jni/exports.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/include/ignite/jni/exports.h b/modules/platforms/cpp/jni/include/ignite/jni/exports.h
index bf278e2..3f400fb 100644
--- a/modules/platforms/cpp/jni/include/ignite/jni/exports.h
+++ b/modules/platforms/cpp/jni/include/ignite/jni/exports.h
@@ -181,6 +181,9 @@ extern "C" {
bool IGNITE_CALL IgniteListenableCancel(gcj::JniContext* ctx, void* obj);
bool IGNITE_CALL IgniteListenableIsCancelled(gcj::JniContext* ctx, void* obj);
+
+ void IGNITE_CALL IgniteSetConsoleHandler(gcj::ConsoleWriteHandler consoleHandler);
+ void IGNITE_CALL IgniteRemoveConsoleHandler(gcj::ConsoleWriteHandler consoleHandler);
}
#endif //_IGNITE_JNI_EXPORTS
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e468a8c/modules/platforms/cpp/jni/include/ignite/jni/java.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/include/ignite/jni/java.h b/modules/platforms/cpp/jni/include/ignite/jni/java.h
index 13e6e8d..41d7caa 100644
--- a/modules/platforms/cpp/jni/include/ignite/jni/java.h
+++ b/modules/platforms/cpp/jni/include/ignite/jni/java.h
@@ -105,6 +105,8 @@ namespace ignite
typedef void(JNICALL *AffinityFunctionAssignPartitionsHandler)(void* target, long long ptr, long long inMemPtr, long long outMemPtr);
typedef void(JNICALL *AffinityFunctionRemoveNodeHandler)(void* target, long long ptr, long long memPtr);
typedef void(JNICALL *AffinityFunctionDestroyHandler)(void* target, long long ptr);
+
+ typedef void(JNICALL *ConsoleWriteHandler)(const char* chars, int charsLen, unsigned char isErr);
/**
* JNI handlers holder.
@@ -505,6 +507,8 @@ namespace ignite
static int Reallocate(long long memPtr, int cap);
static void Detach();
static void Release(jobject obj);
+ static void SetConsoleHandler(ConsoleWriteHandler consoleHandler);
+ static int RemoveConsoleHandler(ConsoleWriteHandler consoleHandler);
jobject IgnitionStart(char* cfgPath, char* name, int factoryId, long long dataPtr);
jobject IgnitionStart(char* cfgPath, char* name, int factoryId, long long dataPtr, JniErrorInfo* errInfo);
@@ -757,6 +761,8 @@ namespace ignite
JNIEXPORT void JNICALL JniAffinityFunctionAssignPartitions(JNIEnv *env, jclass cls, jlong envPtr, jlong ptr, jlong inMemPtr, jlong outMemPtr);
JNIEXPORT void JNICALL JniAffinityFunctionRemoveNode(JNIEnv *env, jclass cls, jlong envPtr, jlong ptr, jlong memPtr);
JNIEXPORT void JNICALL JniAffinityFunctionDestroy(JNIEnv *env, jclass cls, jlong envPtr, jlong ptr);
+
+ JNIEXPORT void JNICALL JniConsoleWrite(JNIEnv *env, jclass cls, jstring str, jboolean isErr);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e468a8c/modules/platforms/cpp/jni/project/vs/module.def
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/project/vs/module.def b/modules/platforms/cpp/jni/project/vs/module.def
index cfe658c..ddddace 100644
--- a/modules/platforms/cpp/jni/project/vs/module.def
+++ b/modules/platforms/cpp/jni/project/vs/module.def
@@ -134,4 +134,6 @@ IgniteProcessorCreateNearCache @131
IgniteProcessorGetOrCreateNearCache @132
IgniteProcessorGetCacheNames @133
IgniteProjectionForServers @134
+IgniteSetConsoleHandler @135
+IgniteRemoveConsoleHandler @136
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e468a8c/modules/platforms/cpp/jni/src/exports.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/src/exports.cpp b/modules/platforms/cpp/jni/src/exports.cpp
index 6c4760c..2950d15 100644
--- a/modules/platforms/cpp/jni/src/exports.cpp
+++ b/modules/platforms/cpp/jni/src/exports.cpp
@@ -558,4 +558,12 @@ extern "C" {
bool IGNITE_CALL IgniteListenableIsCancelled(gcj::JniContext* ctx, void* obj) {
return ctx->ListenableIsCancelled(static_cast<jobject>(obj));
}
+
+ void IGNITE_CALL IgniteSetConsoleHandler(gcj::ConsoleWriteHandler consoleHandler) {
+ gcj::JniContext::SetConsoleHandler(consoleHandler);
+ }
+
+ void IGNITE_CALL IgniteRemoveConsoleHandler(gcj::ConsoleWriteHandler consoleHandler) {
+ gcj::JniContext::RemoveConsoleHandler(consoleHandler);
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e468a8c/modules/platforms/cpp/jni/src/java.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/src/java.cpp b/modules/platforms/cpp/jni/src/java.cpp
index 87f1e03..685afd3 100644
--- a/modules/platforms/cpp/jni/src/java.cpp
+++ b/modules/platforms/cpp/jni/src/java.cpp
@@ -15,9 +15,11 @@
* limitations under the License.
*/
-#include <cstring>
#include <string>
#include <exception>
+#include <vector>
+#include <algorithm>
+#include <stdexcept>
#include "ignite/jni/utils.h"
#include "ignite/common/concurrent.h"
@@ -368,6 +370,8 @@ namespace ignite
JniMethod M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_ASSIGN_PARTITIONS = JniMethod("affinityFunctionAssignPartitions", "(JJJJ)V", true);
JniMethod M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_REMOVE_NODE = JniMethod("affinityFunctionRemoveNode", "(JJJ)V", true);
JniMethod M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_DESTROY = JniMethod("affinityFunctionDestroy", "(JJ)V", true);
+
+ JniMethod M_PLATFORM_CALLBACK_UTILS_CONSOLE_WRITE = JniMethod("consoleWrite", "(Ljava/lang/String;Z)V", true);
const char* C_PLATFORM_UTILS = "org/apache/ignite/internal/processors/platform/utils/PlatformUtils";
JniMethod M_PLATFORM_UTILS_REALLOC = JniMethod("reallocate", "(JI)V", true);
@@ -436,8 +440,10 @@ namespace ignite
/* STATIC STATE. */
gcc::CriticalSection JVM_LOCK;
+ gcc::CriticalSection CONSOLE_LOCK;
JniJvm JVM;
bool PRINT_EXCEPTION = false;
+ std::vector<ConsoleWriteHandler> consoleWriteHandlers;
/* HELPER METHODS. */
@@ -828,7 +834,7 @@ namespace ignite
void RegisterNatives(JNIEnv* env) {
{
- JNINativeMethod methods[59];
+ JNINativeMethod methods[60];
int idx = 0;
@@ -910,6 +916,7 @@ namespace ignite
AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_ASSIGN_PARTITIONS, reinterpret_cast<void*>(JniAffinityFunctionAssignPartitions));
AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_REMOVE_NODE, reinterpret_cast<void*>(JniAffinityFunctionRemoveNode));
AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_DESTROY, reinterpret_cast<void*>(JniAffinityFunctionDestroy));
+ AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_CONSOLE_WRITE, reinterpret_cast<void*>(JniConsoleWrite));
jint res = env->RegisterNatives(FindClass(env, C_PLATFORM_CALLBACK_UTILS), methods, idx);
@@ -2501,6 +2508,35 @@ namespace ignite
}
}
+ void JniContext::SetConsoleHandler(ConsoleWriteHandler consoleHandler) {
+ if (!consoleHandler)
+ throw std::invalid_argument("consoleHandler can not be null");
+
+ CONSOLE_LOCK.Enter();
+
+ consoleWriteHandlers.push_back(consoleHandler);
+
+ CONSOLE_LOCK.Leave();
+ }
+
+ int JniContext::RemoveConsoleHandler(ConsoleWriteHandler consoleHandler) {
+ if (!consoleHandler)
+ throw std::invalid_argument("consoleHandler can not be null");
+
+ CONSOLE_LOCK.Enter();
+
+ int oldSize = static_cast<int>(consoleWriteHandlers.size());
+
+ consoleWriteHandlers.erase(remove(consoleWriteHandlers.begin(), consoleWriteHandlers.end(),
+ consoleHandler), consoleWriteHandlers.end());
+
+ int removedCnt = oldSize - static_cast<int>(consoleWriteHandlers.size());
+
+ CONSOLE_LOCK.Leave();
+
+ return removedCnt;
+ }
+
void JniContext::ThrowToJava(char* msg) {
JNIEnv* env = Attach();
@@ -2867,6 +2903,23 @@ namespace ignite
JNIEXPORT void JNICALL JniAffinityFunctionDestroy(JNIEnv *env, jclass cls, jlong envPtr, jlong ptr) {
IGNITE_SAFE_PROC(env, envPtr, AffinityFunctionDestroyHandler, affinityFunctionDestroy, ptr);
}
+
+ JNIEXPORT void JNICALL JniConsoleWrite(JNIEnv *env, jclass cls, jstring str, jboolean isErr) {
+ CONSOLE_LOCK.Enter();
+
+ if (consoleWriteHandlers.size() > 0) {
+ ConsoleWriteHandler consoleWrite = consoleWriteHandlers.at(0);
+
+ const char* strChars = env->GetStringUTFChars(str, nullptr);
+ const int strCharsLen = env->GetStringUTFLength(str);
+
+ consoleWrite(strChars, strCharsLen, isErr);
+
+ env->ReleaseStringUTFChars(str, strChars);
+ }
+
+ CONSOLE_LOCK.Leave();
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e468a8c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index a601dbd..d0d1934 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -113,6 +113,7 @@
<Compile Include="Compute\SerializableClosureTaskTest.cs" />
<Compile Include="Compute\TaskAdapterTest.cs" />
<Compile Include="Compute\TaskResultTest.cs" />
+ <Compile Include="ConsoleRedirectTest.cs" />
<Compile Include="Dataload\DataStreamerTest.cs" />
<Compile Include="Dataload\DataStreamerTestTopologyChange.cs" />
<Compile Include="DataStructures\AtomicLongTest.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e468a8c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ConsoleRedirectTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ConsoleRedirectTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ConsoleRedirectTest.cs
new file mode 100644
index 0000000..bb44dcc
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ConsoleRedirectTest.cs
@@ -0,0 +1,177 @@
+\ufeff/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Tests
+{
+ using System;
+ using System.IO;
+ using System.Text;
+ using System.Text.RegularExpressions;
+ using Apache.Ignite.Core.Common;
+ using Apache.Ignite.Core.Communication.Tcp;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Tests that Java console output is redirected to .NET console.
+ /// </summary>
+ public class ConsoleRedirectTest
+ {
+ /** */
+ private StringBuilder _outSb;
+
+ /** */
+ private StringBuilder _errSb;
+
+ /** */
+ private TextWriter _stdOut;
+
+ /** */
+ private TextWriter _stdErr;
+
+ /// <summary>
+ /// Sets up the test.
+ /// </summary>
+ [SetUp]
+ public void SetUp()
+ {
+ _stdOut = Console.Out;
+ _stdErr = Console.Error;
+
+ _outSb = new StringBuilder();
+ Console.SetOut(new StringWriter(_outSb));
+
+ _errSb = new StringBuilder();
+ Console.SetError(new StringWriter(_errSb));
+ }
+
+ /// <summary>
+ /// Tears down the test.
+ /// </summary>
+ [TearDown]
+ public void TearDown()
+ {
+ Console.SetOut(_stdOut);
+ Console.SetError(_stdErr);
+ }
+
+ /// <summary>
+ /// Tests the startup output.
+ /// </summary>
+ [Test]
+ public void TestStartupOutput()
+ {
+ using (Ignition.Start(TestUtils.GetTestConfiguration()))
+ {
+ Assert.IsTrue(_outSb.ToString().Contains("[ver=1, servers=1, clients=0,"));
+ }
+ }
+
+ /// <summary>
+ /// Tests startup error in Java.
+ /// </summary>
+ [Test]
+ public void TestStartupJavaError()
+ {
+ // Invalid config
+ Assert.Throws<IgniteException>(() =>
+ Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration())
+ {
+ CommunicationSpi = new TcpCommunicationSpi
+ {
+ IdleConnectionTimeout = TimeSpan.MinValue
+ }
+ }));
+
+ Assert.IsTrue(_errSb.ToString().Contains("SPI parameter failed condition check: idleConnTimeout > 0"));
+ }
+
+ /// <summary>
+ /// Tests multiple appdomains and multiple console handlers.
+ /// </summary>
+ [Test]
+ public void TestMultipleDomains()
+ {
+ using (var ignite = Ignition.Start(TestUtils.GetTestConfiguration()))
+ {
+ Assert.IsTrue(_outSb.ToString().Contains("[ver=1, servers=1, clients=0,"));
+
+ // Run twice
+ RunInNewDomain();
+ RunInNewDomain();
+
+ Assert.AreEqual(5, ignite.GetCluster().TopologyVersion);
+
+ var outTxt = _outSb.ToString();
+
+ // Check output from another domain (2 started + 2 stopped = 4)
+ Assert.AreEqual(4, Regex.Matches(outTxt, ">>> Grid name: newDomainGrid").Count);
+
+ // Both domains produce the topology snapshot on node enter
+ Assert.AreEqual(2, Regex.Matches(outTxt, "ver=2, servers=2, clients=0,").Count);
+ Assert.AreEqual(1, Regex.Matches(outTxt, "ver=3, servers=1, clients=0,").Count);
+ Assert.AreEqual(2, Regex.Matches(outTxt, "ver=4, servers=2, clients=0,").Count);
+ Assert.AreEqual(1, Regex.Matches(outTxt, "ver=5, servers=1, clients=0,").Count);
+ }
+ }
+
+ /// <summary>
+ /// Runs the Ignite in a new domain.
+ /// </summary>
+ private static void RunInNewDomain()
+ {
+ AppDomain childDomain = null;
+
+ try
+ {
+ childDomain = AppDomain.CreateDomain("Child", null, new AppDomainSetup
+ {
+ ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
+ ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile,
+ ApplicationName = AppDomain.CurrentDomain.SetupInformation.ApplicationName,
+ LoaderOptimization = LoaderOptimization.MultiDomainHost
+ });
+
+ var runner = (IIgniteRunner)childDomain.CreateInstanceAndUnwrap(
+ typeof(IgniteRunner).Assembly.FullName, typeof(IgniteRunner).FullName);
+
+ runner.Run();
+ }
+ finally
+ {
+ if (childDomain != null)
+ AppDomain.Unload(childDomain);
+ }
+ }
+
+ private interface IIgniteRunner
+ {
+ void Run();
+ }
+
+ private class IgniteRunner : MarshalByRefObject, IIgniteRunner
+ {
+ public void Run()
+ {
+ var ignite = Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration())
+ {
+ GridName = "newDomainGrid"
+ });
+ Ignition.Stop(ignite.Name, true);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e468a8c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs
index 149fa35..5403ebe 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs
@@ -48,7 +48,7 @@ namespace Apache.Ignite.Core.Tests
return;
}
- TestOne(typeof(AffinityFunctionTest), "TestSimpleInheritance");
+ TestOne(typeof(ConsoleRedirectTest), "TestMultipleDomains");
//TestAll(typeof (AffinityFunctionTest));
//TestAllInAssembly();
@@ -56,7 +56,12 @@ namespace Apache.Ignite.Core.Tests
private static int TestOne(Type testClass, string method)
{
- string[] args = { "/run:" + testClass.FullName + "." + method, Assembly.GetAssembly(testClass).Location };
+ string[] args =
+ {
+ "/noshadow",
+ "/run:" + testClass.FullName + "." + method,
+ Assembly.GetAssembly(testClass).Location
+ };
int returnCode = Runner.Main(args);
@@ -68,7 +73,11 @@ namespace Apache.Ignite.Core.Tests
private static void TestAll(Type testClass)
{
- string[] args = { "/run:" + testClass.FullName, Assembly.GetAssembly(testClass).Location };
+ string[] args =
+ {
+ "/noshadow",
+ "/run:" + testClass.FullName, Assembly.GetAssembly(testClass).Location
+ };
int returnCode = Runner.Main(args);
@@ -78,7 +87,11 @@ namespace Apache.Ignite.Core.Tests
private static void TestAllInAssembly()
{
- string[] args = { Assembly.GetAssembly(typeof(InteropMemoryTest)).Location };
+ string[] args =
+ {
+ "/noshadow",
+ Assembly.GetAssembly(typeof(InteropMemoryTest)).Location
+ };
int returnCode = Runner.Main(args);
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e468a8c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
index 4619080..2da4192 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
@@ -429,5 +429,11 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
[DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteListenableIsCancelled")]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool ListenableIsCancelled(void* ctx, void* target);
+
+ [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteSetConsoleHandler")]
+ public static extern void SetConsoleHandler(void* consoleHandler);
+
+ [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteRemoveConsoleHandler")]
+ public static extern int RemoveConsoleHandler(void* consoleHandler);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e468a8c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
index ef901cb..4cbdf8f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
@@ -55,6 +55,13 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
Justification = "This class instance usually lives as long as the app runs.")]
internal unsafe class UnmanagedCallbacks
{
+ /** Console write delegate. */
+ private static readonly ConsoleWriteDelegate ConsoleWriteDel = ConsoleWrite;
+
+ /** Console write pointer. */
+ private static readonly void* ConsoleWritePtr =
+ Marshal.GetFunctionPointerForDelegate(ConsoleWriteDel).ToPointer();
+
/** Unmanaged context. */
private volatile UnmanagedContext _ctx;
@@ -71,7 +78,7 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
/** Initialized flag. */
private readonly ManualResetEventSlim _initEvent = new ManualResetEventSlim(false);
- /** Actions to be called upon Ignite initialisation. */
+ /** Actions to be called upon Ignite initialization. */
private readonly List<Action<Ignite>> _initActions = new List<Action<Ignite>>();
/** GC handle to UnmanagedCallbacks instance to prevent it from being GCed. */
@@ -172,6 +179,8 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
private delegate void AffinityFunctionRemoveNodeDelegate(void* target, long ptr, long memPtr);
private delegate void AffinityFunctionDestroyDelegate(void* target, long ptr);
+ private delegate void ConsoleWriteDelegate(sbyte* chars, int charsLen, bool isErr);
+
/// <summary>
/// constructor.
/// </summary>
@@ -1105,6 +1114,23 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
});
}
+ private static void ConsoleWrite(sbyte* chars, int charsLen, bool isErr)
+ {
+ try
+ {
+ var str = IgniteUtils.Utf8UnmanagedToString(chars, charsLen);
+
+ var target = isErr ? Console.Error : Console.Out;
+
+ target.Write(str);
+
+ }
+ catch (Exception ex)
+ {
+ Console.Error.WriteLine("ConsoleWrite unmanaged callback failed: " + ex);
+ }
+ }
+
#endregion
#region AffinityFunction
@@ -1291,5 +1317,13 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
_handleRegistry.Close();
}
+
+ /// <summary>
+ /// Gets the console write handler.
+ /// </summary>
+ public static void* ConsoleWriteHandler
+ {
+ get { return ConsoleWritePtr; }
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e468a8c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
index 924259c..0e9556d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
@@ -18,6 +18,7 @@
namespace Apache.Ignite.Core.Impl.Unmanaged
{
using System;
+ using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using Apache.Ignite.Core.Common;
@@ -48,6 +49,21 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
if (ptr == IntPtr.Zero)
throw new IgniteException(string.Format("Failed to load {0}: {1}",
IgniteUtils.FileIgniteJniDll, Marshal.GetLastWin32Error()));
+
+ AppDomain.CurrentDomain.DomainUnload += CurrentDomain_DomainUnload;
+
+ JNI.SetConsoleHandler(UnmanagedCallbacks.ConsoleWriteHandler);
+ }
+
+ /// <summary>
+ /// Handles the DomainUnload event of the current AppDomain.
+ /// </summary>
+ private static void CurrentDomain_DomainUnload(object sender, EventArgs e)
+ {
+ // Clean the handler to avoid JVM crash.
+ var removedCnt = JNI.RemoveConsoleHandler(UnmanagedCallbacks.ConsoleWriteHandler);
+
+ Debug.Assert(removedCnt == 1);
}
/// <summary>
[40/50] [abbrv] ignite git commit: ignite-1802:
Ignite.countDownLatch() can return null if latch has been already created.
Posted by sb...@apache.org.
ignite-1802: Ignite.countDownLatch() can return null if latch has been already created.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/aabe815f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/aabe815f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/aabe815f
Branch: refs/heads/ignite-1232
Commit: aabe815f41545e7ad261fa4c46f580380b0b456a
Parents: ad76dda
Author: Denis Magda <dm...@gridgain.com>
Authored: Wed Jul 6 12:37:37 2016 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Jul 6 12:37:37 2016 +0300
----------------------------------------------------------------------
.../cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java | 2 --
1 file changed, 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aabe815f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java
index f6d0287..e9b83d9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java
@@ -287,8 +287,6 @@ public abstract class IgniteCountDownLatchAbstractSelfTest extends IgniteAtomics
* @throws Exception If failed.
*/
public void testLatchMultinode1() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-1802");
-
if (gridCount() == 1)
return;
[48/50] [abbrv] ignite git commit: IGNITE-3417: Cassandra packages
have no descriptions
Posted by sb...@apache.org.
IGNITE-3417: Cassandra packages have no descriptions
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b2fd2aa6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b2fd2aa6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b2fd2aa6
Branch: refs/heads/ignite-1232
Commit: b2fd2aa6d7a74e63ea5957408192112e539cf6a7
Parents: d27e735
Author: Igor Rudyak <ir...@gmail.com>
Authored: Wed Jul 6 19:37:36 2016 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Jul 6 19:37:36 2016 +0300
----------------------------------------------------------------------
.../store/cassandra/common/package-info.java | 21 ++++++++++++++++++++
.../cassandra/datasource/package-info.java | 21 ++++++++++++++++++++
.../cache/store/cassandra/package-info.java | 21 ++++++++++++++++++++
.../cassandra/persistence/package-info.java | 21 ++++++++++++++++++++
.../cassandra/serializer/package-info.java | 21 ++++++++++++++++++++
.../store/cassandra/session/package-info.java | 21 ++++++++++++++++++++
.../cassandra/session/pool/package-info.java | 21 ++++++++++++++++++++
.../store/cassandra/utils/package-info.java | 21 ++++++++++++++++++++
.../tests/load/cassandra/package-info.java | 21 ++++++++++++++++++++
.../ignite/tests/load/ignite/package-info.java | 21 ++++++++++++++++++++
.../apache/ignite/tests/load/package-info.java | 21 ++++++++++++++++++++
.../org/apache/ignite/tests/package-info.java | 21 ++++++++++++++++++++
.../apache/ignite/tests/pojos/package-info.java | 21 ++++++++++++++++++++
.../apache/ignite/tests/utils/package-info.java | 21 ++++++++++++++++++++
14 files changed, 294 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b2fd2aa6/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/common/package-info.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/common/package-info.java b/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/common/package-info.java
new file mode 100644
index 0000000..c4f5d3b
--- /dev/null
+++ b/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/common/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Contains commonly used helper classes
+ */
+package org.apache.ignite.cache.store.cassandra.common;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b2fd2aa6/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/datasource/package-info.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/datasource/package-info.java b/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/datasource/package-info.java
new file mode 100644
index 0000000..d5003ae
--- /dev/null
+++ b/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/datasource/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Contains data source implementation
+ */
+package org.apache.ignite.cache.store.cassandra.datasource;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b2fd2aa6/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/package-info.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/package-info.java b/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/package-info.java
new file mode 100644
index 0000000..46f5635
--- /dev/null
+++ b/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Contains {@link org.apache.ignite.cache.store.CacheStore} implementation backed by Cassandra database
+ */
+package org.apache.ignite.cache.store.cassandra;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b2fd2aa6/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/persistence/package-info.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/persistence/package-info.java b/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/persistence/package-info.java
new file mode 100644
index 0000000..76d32fb
--- /dev/null
+++ b/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/persistence/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Contains persistent settings configuration
+ */
+package org.apache.ignite.cache.store.cassandra.persistence;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b2fd2aa6/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/serializer/package-info.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/serializer/package-info.java b/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/serializer/package-info.java
new file mode 100644
index 0000000..4edd759
--- /dev/null
+++ b/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/serializer/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Contains serializers implementation, to store BLOBs into Cassandra
+ */
+package org.apache.ignite.cache.store.cassandra.serializer;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b2fd2aa6/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/session/package-info.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/session/package-info.java b/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/session/package-info.java
new file mode 100644
index 0000000..ecbbe78
--- /dev/null
+++ b/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/session/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Contains classes responsible for handling sessions and communication with Cassandra
+ */
+package org.apache.ignite.cache.store.cassandra.session;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b2fd2aa6/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/session/pool/package-info.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/session/pool/package-info.java b/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/session/pool/package-info.java
new file mode 100644
index 0000000..21c292f
--- /dev/null
+++ b/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/session/pool/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Contains session pool implenetation for Cassandra sessions
+ */
+package org.apache.ignite.cache.store.cassandra.session.pool;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b2fd2aa6/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/utils/package-info.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/utils/package-info.java b/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/utils/package-info.java
new file mode 100644
index 0000000..2460dfe
--- /dev/null
+++ b/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/utils/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Contains utility classes
+ */
+package org.apache.ignite.cache.store.cassandra.utils;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b2fd2aa6/modules/cassandra/src/test/java/org/apache/ignite/tests/load/cassandra/package-info.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/java/org/apache/ignite/tests/load/cassandra/package-info.java b/modules/cassandra/src/test/java/org/apache/ignite/tests/load/cassandra/package-info.java
new file mode 100644
index 0000000..bcf66b6
--- /dev/null
+++ b/modules/cassandra/src/test/java/org/apache/ignite/tests/load/cassandra/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Contains load tests workers implementation for Cassandra cluster
+ */
+package org.apache.ignite.tests.load.cassandra;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b2fd2aa6/modules/cassandra/src/test/java/org/apache/ignite/tests/load/ignite/package-info.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/java/org/apache/ignite/tests/load/ignite/package-info.java b/modules/cassandra/src/test/java/org/apache/ignite/tests/load/ignite/package-info.java
new file mode 100644
index 0000000..af1d098
--- /dev/null
+++ b/modules/cassandra/src/test/java/org/apache/ignite/tests/load/ignite/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Contains load tests workers implementation for Ignite-Cassandra cluster
+ */
+package org.apache.ignite.tests.load.ignite;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b2fd2aa6/modules/cassandra/src/test/java/org/apache/ignite/tests/load/package-info.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/java/org/apache/ignite/tests/load/package-info.java b/modules/cassandra/src/test/java/org/apache/ignite/tests/load/package-info.java
new file mode 100644
index 0000000..55b7344
--- /dev/null
+++ b/modules/cassandra/src/test/java/org/apache/ignite/tests/load/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Contains load tests classes
+ */
+package org.apache.ignite.tests.load;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b2fd2aa6/modules/cassandra/src/test/java/org/apache/ignite/tests/package-info.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/java/org/apache/ignite/tests/package-info.java b/modules/cassandra/src/test/java/org/apache/ignite/tests/package-info.java
new file mode 100644
index 0000000..2d627f1
--- /dev/null
+++ b/modules/cassandra/src/test/java/org/apache/ignite/tests/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Contains unit tests
+ */
+package org.apache.ignite.tests;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b2fd2aa6/modules/cassandra/src/test/java/org/apache/ignite/tests/pojos/package-info.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/java/org/apache/ignite/tests/pojos/package-info.java b/modules/cassandra/src/test/java/org/apache/ignite/tests/pojos/package-info.java
new file mode 100644
index 0000000..fb166b5
--- /dev/null
+++ b/modules/cassandra/src/test/java/org/apache/ignite/tests/pojos/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Contains sample POJO objects used in unit tests
+ */
+package org.apache.ignite.tests.pojos;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b2fd2aa6/modules/cassandra/src/test/java/org/apache/ignite/tests/utils/package-info.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/java/org/apache/ignite/tests/utils/package-info.java b/modules/cassandra/src/test/java/org/apache/ignite/tests/utils/package-info.java
new file mode 100644
index 0000000..4734e4a
--- /dev/null
+++ b/modules/cassandra/src/test/java/org/apache/ignite/tests/utils/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Contains utility classes for unit tests
+ */
+package org.apache.ignite.tests.utils;
\ No newline at end of file
[17/50] [abbrv] ignite git commit: IGNITE-3403 Fixed partitions size.
Posted by sb...@apache.org.
IGNITE-3403 Fixed partitions size.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/860167c9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/860167c9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/860167c9
Branch: refs/heads/ignite-1232
Commit: 860167c96f518b1890c0ea261bab20e2eacf525a
Parents: 474b00e
Author: vsisko <vs...@gridgain.com>
Authored: Tue Jul 5 00:21:07 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Tue Jul 5 00:21:07 2016 +0700
----------------------------------------------------------------------
.../ignite/internal/visor/cache/VisorCachePartitionsTask.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/860167c9/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTask.java
index 80836c6..9cee477 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTask.java
@@ -126,7 +126,7 @@ public class VisorCachePartitionsTask extends VisorMultiNodeTask<String, Map<UUI
for (GridDhtLocalPartition part : locParts) {
int p = part.id();
- int sz = part.size();
+ int sz = part.publicSize();
// Pass -1 as topology version in order not to wait for topology version.
if (part.primary(AffinityTopologyVersion.NONE))
[09/50] [abbrv] ignite git commit: IGNITE-3367: Hadoop: greater idle
timeout for protocol client.
Posted by sb...@apache.org.
IGNITE-3367: Hadoop: greater idle timeout for protocol client.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/00c3383f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/00c3383f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/00c3383f
Branch: refs/heads/ignite-1232
Commit: 00c3383fcb1732b1a78606b80ef7e0dcd9f0e9c8
Parents: 1af9052
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Jun 24 17:36:55 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Jun 30 10:18:27 2016 +0300
----------------------------------------------------------------------
.../ignite/hadoop/mapreduce/IgniteHadoopClientProtocolProvider.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/00c3383f/modules/hadoop/src/main/java/org/apache/ignite/hadoop/mapreduce/IgniteHadoopClientProtocolProvider.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/mapreduce/IgniteHadoopClientProtocolProvider.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/mapreduce/IgniteHadoopClientProtocolProvider.java
index e40abe0..583af35 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/mapreduce/IgniteHadoopClientProtocolProvider.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/mapreduce/IgniteHadoopClientProtocolProvider.java
@@ -117,6 +117,7 @@ public class IgniteHadoopClientProtocolProvider extends ClientProtocolProvider {
cliCfg.setProtocol(TCP);
cliCfg.setServers(Collections.singletonList(addr));
cliCfg.setMarshaller(new GridClientJdkMarshaller());
+ cliCfg.setMaxConnectionIdleTime(24 * 60 * 60 * 1000L); // 1 day.
cliCfg.setDaemon(true);
try {
[31/50] [abbrv] ignite git commit: IGNITE-3154: More efficient
BinaryObject.type() implmentation.
Posted by sb...@apache.org.
IGNITE-3154: More efficient BinaryObject.type() implmentation.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/955a5f84
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/955a5f84
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/955a5f84
Branch: refs/heads/ignite-1232
Commit: 955a5f84f1b2e8c99c5a3ad6c4f27ba068b7e5fc
Parents: 34798d3
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Jul 5 14:58:25 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Jul 6 09:57:57 2016 +0300
----------------------------------------------------------------------
.../ignite/internal/binary/BinaryContext.java | 50 ++++-----
.../internal/binary/BinaryEnumObjectImpl.java | 9 +-
.../ignite/internal/binary/BinaryObjectEx.java | 11 ++
.../internal/binary/BinaryObjectExImpl.java | 4 +-
.../internal/binary/BinaryObjectImpl.java | 8 +-
.../binary/BinaryObjectOffheapImpl.java | 8 +-
.../ignite/internal/binary/BinaryTypeProxy.java | 111 +++++++++++++++++++
.../ignite/internal/binary/BinaryUtils.java | 35 +++++-
.../binary/CacheObjectBinaryProcessorImpl.java | 3 +-
.../processors/query/GridQueryProcessor.java | 3 +-
10 files changed, 202 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/955a5f84/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 593e8af..27e9440 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
@@ -17,30 +17,6 @@
package org.apache.ignite.internal.binary;
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.math.BigDecimal;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentMap;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
@@ -99,7 +75,6 @@ import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaFileUnlockProcess
import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdatePropertiesProcessor;
import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdateTimesProcessor;
import org.apache.ignite.internal.processors.platform.PlatformJavaObjectFactoryProxy;
-import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.internal.util.lang.GridMapEntry;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.T2;
@@ -110,6 +85,31 @@ import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentMap;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
/**
* Binary context.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/955a5f84/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
index e58edd2..c9874ed 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
@@ -130,7 +130,12 @@ public class BinaryEnumObjectImpl implements BinaryObjectEx, Externalizable, Cac
/** {@inheritDoc} */
@Override public BinaryType type() throws BinaryObjectException {
- return ctx.metadata(typeId());
+ return BinaryUtils.typeProxy(ctx, this);
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public BinaryType rawType() throws BinaryObjectException {
+ return BinaryUtils.type(ctx, this);
}
/** {@inheritDoc} */
@@ -198,7 +203,7 @@ public class BinaryEnumObjectImpl implements BinaryObjectEx, Externalizable, Cac
BinaryType type;
try {
- type = type();
+ type = rawType();
}
catch (Exception e) {
type = null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/955a5f84/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectEx.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectEx.java
index ba15d13..e3566bc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectEx.java
@@ -18,6 +18,9 @@
package org.apache.ignite.internal.binary;
import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryType;
+import org.jetbrains.annotations.Nullable;
/**
* Extended binary object interface.
@@ -27,4 +30,12 @@ public interface BinaryObjectEx extends BinaryObject {
* @return Type ID.
*/
public int typeId();
+
+ /**
+ * Get raw type.
+ *
+ * @return Raw type
+ * @throws BinaryObjectException If failed.
+ */
+ @Nullable public BinaryType rawType() throws BinaryObjectException;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/955a5f84/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java
index ddf17f0..b4e909e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java
@@ -176,7 +176,7 @@ public abstract class BinaryObjectExImpl implements BinaryObjectEx {
BinaryType meta;
try {
- meta = type();
+ meta = rawType();
}
catch (BinaryObjectException ignore) {
meta = null;
@@ -222,7 +222,7 @@ public abstract class BinaryObjectExImpl implements BinaryObjectEx {
Integer idHash0 = handles.get(val);
if (idHash0 != null) { // Circular reference.
- BinaryType meta0 = po.type();
+ BinaryType meta0 = po.rawType();
assert meta0 != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/955a5f84/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
index fa10de3..7998ee3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
@@ -257,10 +257,12 @@ public final class BinaryObjectImpl extends BinaryObjectExImpl implements Extern
/** {@inheritDoc} */
@Nullable @Override public BinaryType type() throws BinaryObjectException {
- if (ctx == null)
- throw new BinaryObjectException("BinaryContext is not set for the object.");
+ return BinaryUtils.typeProxy(ctx, this);
+ }
- return ctx.metadata(typeId());
+ /** {@inheritDoc} */
+ @Nullable @Override public BinaryType rawType() throws BinaryObjectException {
+ return BinaryUtils.type(ctx, this);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/955a5f84/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
index c687192..2225b7a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
@@ -146,10 +146,12 @@ public class BinaryObjectOffheapImpl extends BinaryObjectExImpl implements Exter
/** {@inheritDoc} */
@Nullable @Override public BinaryType type() throws BinaryObjectException {
- if (ctx == null)
- throw new BinaryObjectException("BinaryContext is not set for the object.");
+ return BinaryUtils.typeProxy(ctx, this);
+ }
- return ctx.metadata(typeId());
+ /** {@inheritDoc} */
+ @Nullable @Override public BinaryType rawType() throws BinaryObjectException {
+ return BinaryUtils.type(ctx, this);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/955a5f84/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryTypeProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryTypeProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryTypeProxy.java
new file mode 100644
index 0000000..17b0bc6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryTypeProxy.java
@@ -0,0 +1,111 @@
+/*
+ * 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.binary;
+
+import org.apache.ignite.binary.BinaryField;
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryType;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+import java.util.Collection;
+
+/**
+ * Binary type proxy. Is used to delay or completely avoid metadata lookup.
+ */
+public class BinaryTypeProxy implements BinaryType {
+ /** Binary context. */
+ @GridToStringExclude
+ private final BinaryContext ctx;
+
+ /** Type ID. */
+ private final int typeId;
+
+ /** Target type. */
+ @GridToStringExclude
+ private volatile BinaryType target;
+
+ /**
+ * Constrcutor.
+ *
+ * @param ctx Context.
+ * @param typeId Type ID.
+ */
+ public BinaryTypeProxy(BinaryContext ctx, int typeId) {
+ this.ctx = ctx;
+ this.typeId = typeId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int typeId() {
+ return typeId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public BinaryField field(String fieldName) {
+ return ctx.createField(typeId, fieldName);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String typeName() {
+ return target().typeName();
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<String> fieldNames() {
+ return target().fieldNames();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String fieldTypeName(String fieldName) {
+ return target().fieldTypeName(fieldName);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String affinityKeyFieldName() {
+ return target().affinityKeyFieldName();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isEnum() {
+ return target().isEnum();
+ }
+
+ /**
+ * @return Target type.
+ */
+ private BinaryType target() {
+ if (target == null) {
+ synchronized (this) {
+ if (target == null) {
+ target = ctx.metadata(typeId);
+
+ if (target == null)
+ throw new BinaryObjectException("Failed to get binary type details [typeId=" + typeId + ']');
+ }
+ }
+ }
+
+ return target;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(BinaryTypeProxy.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/955a5f84/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
index a9ae64e..76e5b31 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
@@ -54,6 +54,7 @@ import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.binary.BinaryObjectException;
import org.apache.ignite.binary.BinaryRawReader;
import org.apache.ignite.binary.BinaryRawWriter;
+import org.apache.ignite.binary.BinaryType;
import org.apache.ignite.binary.Binarylizable;
import org.apache.ignite.internal.binary.builder.BinaryLazyValue;
import org.apache.ignite.internal.binary.streams.BinaryInputStream;
@@ -602,6 +603,7 @@ public class BinaryUtils {
* @param map Map.
* @return New map of the same type or null.
*/
+ @SuppressWarnings("unchecked")
public static <K, V> Map<K, V> newKnownMap(Object map) {
Class<?> cls = map == null ? null : map.getClass();
@@ -676,6 +678,7 @@ public class BinaryUtils {
* @param col Collection.
* @return New empty collection.
*/
+ @SuppressWarnings("unchecked")
public static <V> Collection<V> newKnownCollection(Object col) {
Class<?> cls = col == null ? null : col.getClass();
@@ -1392,6 +1395,7 @@ public class BinaryUtils {
/**
* @return Value.
*/
+ @SuppressWarnings("ConstantConditions")
public static Object doReadProxy(BinaryInputStream in, BinaryContext ctx, ClassLoader ldr,
BinaryReaderHandlesHolder handles) {
Class<?>[] intfs = new Class<?>[in.readInt()];
@@ -2123,8 +2127,7 @@ public class BinaryUtils {
throw new BinaryObjectException("Malformed input around byte: " + (off - 1));
res[charArrCnt++] = (char)(((c & 0x0F) << 12) |
- ((c2 & 0x3F) << 6) |
- ((c3 & 0x3F) << 0));
+ ((c2 & 0x3F) << 6) | (c3 & 0x3F));
break;
default:
@@ -2183,6 +2186,34 @@ public class BinaryUtils {
}
/**
+ * Create binary type proxy.
+ *
+ * @param ctx Context.
+ * @param obj Binary object.
+ * @return Binary type proxy.
+ */
+ public static BinaryType typeProxy(BinaryContext ctx, BinaryObjectEx obj) {
+ if (ctx == null)
+ throw new BinaryObjectException("BinaryContext is not set for the object.");
+
+ return new BinaryTypeProxy(ctx, obj.typeId());
+ }
+
+ /**
+ * Create binary type which is used by users.
+ *
+ * @param ctx Context.
+ * @param obj Binary object.
+ * @return Binary type.
+ */
+ public static BinaryType type(BinaryContext ctx, BinaryObjectEx obj) {
+ if (ctx == null)
+ throw new BinaryObjectException("BinaryContext is not set for the object.");
+
+ return ctx.metadata(obj.typeId());
+ }
+
+ /**
* Enum type.
*/
private static class EnumType {
http://git-wip-us.apache.org/repos/asf/ignite/blob/955a5f84/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 139a8a2..8079a0c 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
@@ -26,7 +26,6 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import javax.cache.Cache;
@@ -667,7 +666,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
*/
public Object affinityKey(BinaryObject po) {
try {
- BinaryType meta = po.type();
+ BinaryType meta = po instanceof BinaryObjectEx ? ((BinaryObjectEx)po).rawType() : po.type();
if (meta != null) {
String affKeyFieldName = meta.affinityKeyFieldName();
http://git-wip-us.apache.org/repos/asf/ignite/blob/955a5f84/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 074e7e5..a42eb98 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
@@ -36,6 +36,7 @@ import org.apache.ignite.events.CacheQueryExecutedEvent;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.binary.BinaryMarshaller;
+import org.apache.ignite.internal.binary.BinaryObjectEx;
import org.apache.ignite.internal.processors.GridProcessorAdapter;
import org.apache.ignite.internal.processors.cache.CacheEntryImpl;
import org.apache.ignite.internal.processors.cache.CacheObject;
@@ -2021,7 +2022,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
BinaryField field0 = field;
if (field0 == null && !fieldTaken) {
- BinaryType type = obj.type();
+ BinaryType type = obj instanceof BinaryObjectEx ? ((BinaryObjectEx)obj).rawType() : obj.type();
if (type != null) {
field0 = type.field(propName);
[32/50] [abbrv] ignite git commit: ignite-3418 Avoid unnecessary
discovery messages (cherry picked from #b0a5128)
Posted by sb...@apache.org.
ignite-3418 Avoid unnecessary discovery messages (cherry picked from #b0a5128)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2e65beb4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2e65beb4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2e65beb4
Branch: refs/heads/ignite-1232
Commit: 2e65beb4f628e0ba138abc2dfab707bc9a5e965e
Parents: 955a5f8
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jul 6 10:43:38 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jul 6 10:43:38 2016 +0300
----------------------------------------------------------------------
.../ignite/spi/discovery/tcp/ClientImpl.java | 2 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 109 ++++++---
.../tcp/internal/TcpDiscoveryStatistics.java | 45 +++-
.../tcp/TcpDiscoveryMultiThreadedTest.java | 222 +++++++++++++++++++
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 63 +++++-
5 files changed, 395 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2e65beb4/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
index 31d614f..9821134 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
@@ -616,7 +616,7 @@ class ClientImpl extends TcpDiscoveryImpl {
spi.writeToSocket(sock, msg, timeoutHelper.nextTimeoutChunk(spi.getSocketTimeout()));
- spi.stats.onMessageSent(msg, U.currentTimeMillis() - tstamp);
+ spi.stats.onMessageSent(msg, U.currentTimeMillis() - tstamp, 0);
if (log.isDebugEnabled())
log.debug("Message has been sent to address [msg=" + msg + ", addr=" + addr +
http://git-wip-us.apache.org/repos/asf/ignite/blob/2e65beb4/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index b1c56c0..6db1e87 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -206,7 +206,10 @@ class ServerImpl extends TcpDiscoveryImpl {
private StatisticsPrinter statsPrinter;
/** Failed nodes (but still in topology). */
- private final Collection<TcpDiscoveryNode> failedNodes = new HashSet<>();
+ private final Map<TcpDiscoveryNode, UUID> failedNodes = new HashMap<>();
+
+ /** */
+ private final Collection<UUID> failedNodesMsgSent = new HashSet<>();
/** Leaving nodes (but still in topology). */
private final Collection<TcpDiscoveryNode> leavingNodes = new HashSet<>();
@@ -782,7 +785,7 @@ class ServerImpl extends TcpDiscoveryImpl {
if (nodeAlive) {
synchronized (mux) {
- nodeAlive = !F.transform(failedNodes, F.node2id()).contains(nodeId) &&
+ nodeAlive = !F.transform(failedNodes.keySet(), F.node2id()).contains(nodeId) &&
!F.transform(leavingNodes, F.node2id()).contains(nodeId);
}
}
@@ -1107,7 +1110,7 @@ class ServerImpl extends TcpDiscoveryImpl {
boolean ignore = false;
synchronized (failedNodes) {
- for (TcpDiscoveryNode failedNode : failedNodes) {
+ for (TcpDiscoveryNode failedNode : failedNodes.keySet()) {
if (failedNode.id().equals(res.creatorNodeId())) {
if (log.isDebugEnabled())
log.debug("Ignore response from node from failed list: " + res);
@@ -1137,7 +1140,7 @@ class ServerImpl extends TcpDiscoveryImpl {
spi.writeToSocket(sock, msg, timeoutHelper.nextTimeoutChunk(spi.getSocketTimeout()));
- spi.stats.onMessageSent(msg, U.currentTimeMillis() - tstamp);
+ long tstamp0 = U.currentTimeMillis();
if (debugMode)
debugLog(msg, "Message has been sent directly to address [msg=" + msg + ", addr=" + addr +
@@ -1152,7 +1155,11 @@ class ServerImpl extends TcpDiscoveryImpl {
// E.g. due to class not found issue.
joinReqSent = msg instanceof TcpDiscoveryJoinRequestMessage;
- return spi.readReceipt(sock, timeoutHelper.nextTimeoutChunk(ackTimeout0));
+ int receipt = spi.readReceipt(sock, timeoutHelper.nextTimeoutChunk(ackTimeout0));
+
+ spi.stats.onMessageSent(msg, tstamp0 - tstamp, U.currentTimeMillis() - tstamp0);
+
+ return receipt;
}
catch (ClassCastException e) {
// This issue is rarely reproducible on AmazonEC2, but never
@@ -1386,7 +1393,7 @@ class ServerImpl extends TcpDiscoveryImpl {
@Nullable private TcpDiscoveryNode resolveCoordinator(
@Nullable Collection<TcpDiscoveryNode> filter) {
synchronized (mux) {
- Collection<TcpDiscoveryNode> excluded = F.concat(false, failedNodes, leavingNodes);
+ Collection<TcpDiscoveryNode> excluded = F.concat(false, failedNodes.keySet(), leavingNodes);
if (!F.isEmpty(filter))
excluded = F.concat(false, excluded, filter);
@@ -1545,7 +1552,7 @@ class ServerImpl extends TcpDiscoveryImpl {
TcpDiscoveryNode next;
synchronized (mux) {
- next = ring.nextNode(failedNodes);
+ next = ring.nextNode(failedNodes.keySet());
}
if (next != null)
@@ -1618,7 +1625,7 @@ class ServerImpl extends TcpDiscoveryImpl {
b.append("Failed nodes: ").append(U.nl());
- for (TcpDiscoveryNode node : failedNodes)
+ for (TcpDiscoveryNode node : failedNodes.keySet())
b.append(" ").append(node.id()).append(U.nl());
b.append(U.nl());
@@ -1814,10 +1821,14 @@ class ServerImpl extends TcpDiscoveryImpl {
if (failedNode != null) {
if (!failedNode.isLocal()) {
- boolean added;
+ boolean added = false;
synchronized (mux) {
- added = failedNodes.add(failedNode);
+ if (!failedNodes.containsKey(failedNode)) {
+ failedNodes.put(failedNode, msg.senderNodeId() != null ? msg.senderNodeId() : getLocalNodeId());
+
+ added = true;
+ }
}
if (added && log.isDebugEnabled())
@@ -2426,7 +2437,7 @@ class ServerImpl extends TcpDiscoveryImpl {
TcpDiscoverySpiState state;
synchronized (mux) {
- failedNodes = U.arrayList(ServerImpl.this.failedNodes);
+ failedNodes = U.arrayList(ServerImpl.this.failedNodes.keySet());
state = spiState;
}
@@ -2655,12 +2666,7 @@ class ServerImpl extends TcpDiscoveryImpl {
assert !forceSndPending || msg instanceof TcpDiscoveryNodeLeftMessage;
- boolean sndPending=
- (newNextNode && ring.minimumNodeVersion().compareTo(CUSTOM_MSG_ALLOW_JOINING_FOR_VERIFIED_SINCE) >= 0) ||
- failure ||
- forceSndPending;
-
- if (sndPending) {
+ if (failure || forceSndPending) {
if (log.isDebugEnabled())
log.debug("Pending messages will be sent [failure=" + failure +
", newNextNode=" + newNextNode +
@@ -2688,10 +2694,12 @@ class ServerImpl extends TcpDiscoveryImpl {
clearNodeAddedMessage(pendingMsg);
}
- spi.stats.onMessageSent(pendingMsg, U.currentTimeMillis() - tstamp);
+ long tstamp0 = U.currentTimeMillis();
int res = spi.readReceipt(sock, timeoutHelper.nextTimeoutChunk(ackTimeout0));
+ spi.stats.onMessageSent(pendingMsg, tstamp0 - tstamp, U.currentTimeMillis() - tstamp0);
+
if (log.isDebugEnabled())
log.debug("Pending message has been sent to next node [msgId=" + msg.id() +
", pendingMsgId=" + pendingMsg.id() + ", next=" + next.id() +
@@ -2735,10 +2743,12 @@ class ServerImpl extends TcpDiscoveryImpl {
spi.writeToSocket(sock, out, msg, timeoutHelper.nextTimeoutChunk(spi.getSocketTimeout()));
- spi.stats.onMessageSent(msg, U.currentTimeMillis() - tstamp);
+ long tstamp0 = U.currentTimeMillis();
int res = spi.readReceipt(sock, timeoutHelper.nextTimeoutChunk(ackTimeout0));
+ spi.stats.onMessageSent(msg, tstamp0 - tstamp, U.currentTimeMillis() - tstamp0);
+
onMessageExchanged();
if (log.isDebugEnabled()) {
@@ -2840,7 +2850,7 @@ class ServerImpl extends TcpDiscoveryImpl {
}
synchronized (mux) {
- failedNodes.removeAll(ServerImpl.this.failedNodes);
+ failedNodes.removeAll(ServerImpl.this.failedNodes.keySet());
}
if (!failedNodes.isEmpty()) {
@@ -2854,7 +2864,13 @@ class ServerImpl extends TcpDiscoveryImpl {
}
synchronized (mux) {
- ServerImpl.this.failedNodes.addAll(failedNodes);
+ for (TcpDiscoveryNode failedNode : failedNodes) {
+ if (!ServerImpl.this.failedNodes.containsKey(failedNode))
+ ServerImpl.this.failedNodes.put(failedNode, locNodeId);
+ }
+
+ for (TcpDiscoveryNode failedNode : failedNodes)
+ failedNodesMsgSent.add(failedNode.id());
}
for (TcpDiscoveryNode n : failedNodes)
@@ -4233,6 +4249,8 @@ class ServerImpl extends TcpDiscoveryImpl {
failedNodes.remove(leftNode);
leavingNodes.remove(leftNode);
+
+ failedNodesMsgSent.remove(leftNode.id());
}
}
@@ -4292,7 +4310,7 @@ class ServerImpl extends TcpDiscoveryImpl {
boolean contains;
synchronized (mux) {
- contains = failedNodes.contains(sndNode);
+ contains = failedNodes.containsKey(sndNode);
}
if (contains) {
@@ -4321,7 +4339,8 @@ class ServerImpl extends TcpDiscoveryImpl {
assert !node.isLocal() || !msg.verified() : msg;
synchronized (mux) {
- failedNodes.add(node);
+ if (!failedNodes.containsKey(node))
+ failedNodes.put(node, msg.senderNodeId() != null ? msg.senderNodeId() : getLocalNodeId());
}
}
else {
@@ -4382,6 +4401,8 @@ class ServerImpl extends TcpDiscoveryImpl {
leavingNodes.remove(node);
+ failedNodesMsgSent.remove(node.id());
+
ClientMessageWorker worker = clientMsgWorkers.remove(node.id());
if (worker != null)
@@ -4657,7 +4678,7 @@ class ServerImpl extends TcpDiscoveryImpl {
boolean failedNode;
synchronized (mux) {
- failedNode = failedNodes.contains(clientNode);
+ failedNode = failedNodes.containsKey(clientNode);
}
if (!failedNode) {
@@ -4896,24 +4917,44 @@ class ServerImpl extends TcpDiscoveryImpl {
}
/**
- * Checks failed nodes list and sends {@link TcpDiscoveryNodeFailedMessage} if failed node
- * is still in the ring.
+ * Checks failed nodes list and sends {@link TcpDiscoveryNodeFailedMessage} if failed node is still in the
+ * ring and node detected failure left ring.
*/
private void checkFailedNodesList() {
List<TcpDiscoveryNodeFailedMessage> msgs = null;
synchronized (mux) {
- for (Iterator<TcpDiscoveryNode> it = failedNodes.iterator(); it.hasNext();) {
- TcpDiscoveryNode node = it.next();
+ if (!failedNodes.isEmpty()) {
+ for (Iterator<Map.Entry<TcpDiscoveryNode, UUID>> it = failedNodes.entrySet().iterator(); it.hasNext(); ) {
+ Map.Entry<TcpDiscoveryNode, UUID> e = it.next();
- if (ring.node(node.id()) != null) {
- if (msgs == null)
- msgs = new ArrayList<>(failedNodes.size());
+ TcpDiscoveryNode node = e.getKey();
+ UUID failSndNode = e.getValue();
- msgs.add(new TcpDiscoveryNodeFailedMessage(getLocalNodeId(), node.id(), node.internalOrder()));
+ if (ring.node(node.id()) == null) {
+ it.remove();
+
+ continue;
+ }
+
+ if (!nodeAlive(failSndNode) && !failedNodesMsgSent.contains(node.id())) {
+ if (msgs == null)
+ msgs = new ArrayList<>();
+
+ msgs.add(new TcpDiscoveryNodeFailedMessage(getLocalNodeId(), node.id(), node.internalOrder()));
+
+ failedNodesMsgSent.add(node.id());
+ }
+ }
+ }
+
+ if (!failedNodesMsgSent.isEmpty()) {
+ for (Iterator<UUID> it = failedNodesMsgSent.iterator(); it.hasNext(); ) {
+ UUID nodeId = it.next();
+
+ if (ring.node(nodeId) == null)
+ it.remove();
}
- else
- it.remove();
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2e65beb4/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryStatistics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryStatistics.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryStatistics.java
index f6232ba..9e73632 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryStatistics.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryStatistics.java
@@ -89,6 +89,14 @@ public class TcpDiscoveryStatistics {
/** Ring messages sent timestamps. */
private final Map<IgniteUuid, Long> ringMsgsSndTs = new GridBoundedLinkedHashMap<>(1024);
+ /** */
+ @GridToStringInclude
+ private final Map<String, Long> avgMsgsAckTimes = new HashMap<>();
+
+ /** */
+ @GridToStringInclude
+ private final Map<String, Long> maxMsgsAckTimes = new HashMap<>();
+
/** Average time messages is in queue. */
private long avgMsgQueueTime;
@@ -302,8 +310,9 @@ public class TcpDiscoveryStatistics {
*
* @param msg Sent message.
* @param time Time taken to serialize message.
+ * @param ackTime Time taken to receive message acknowledge.
*/
- public synchronized void onMessageSent(TcpDiscoveryAbstractMessage msg, long time) {
+ public synchronized void onMessageSent(TcpDiscoveryAbstractMessage msg, long time, long ackTime) {
assert msg != null;
assert time >= 0 : time;
@@ -326,7 +335,24 @@ public class TcpDiscoveryStatistics {
sentMsgs.put(msg.getClass().getSimpleName(), ++cnt);
- Long avgTime = F.addIfAbsent(avgMsgsSndTimes, msg.getClass().getSimpleName(), new Callable<Long>() {
+ addTimeInfo(avgMsgsSndTimes, maxMsgsSndTimes, msg, cnt, time);
+
+ addTimeInfo(avgMsgsAckTimes, maxMsgsAckTimes, msg, cnt, time);
+ }
+
+ /**
+ * @param avgTimes Average times.
+ * @param maxTimes Max times.
+ * @param msg Message.
+ * @param cnt Total message count.
+ * @param time Time.
+ */
+ private void addTimeInfo(Map<String, Long> avgTimes,
+ Map<String, Long> maxTimes,
+ TcpDiscoveryAbstractMessage msg,
+ int cnt,
+ long time) {
+ Long avgTime = F.addIfAbsent(avgTimes, msg.getClass().getSimpleName(), new Callable<Long>() {
@Override public Long call() {
return 0L;
}
@@ -336,9 +362,9 @@ public class TcpDiscoveryStatistics {
avgTime = (avgTime * (cnt - 1) + time) / cnt;
- avgMsgsSndTimes.put(msg.getClass().getSimpleName(), avgTime);
+ avgTimes.put(msg.getClass().getSimpleName(), avgTime);
- Long maxTime = F.addIfAbsent(maxMsgsSndTimes, msg.getClass().getSimpleName(), new Callable<Long>() {
+ Long maxTime = F.addIfAbsent(maxTimes, msg.getClass().getSimpleName(), new Callable<Long>() {
@Override public Long call() {
return 0L;
}
@@ -347,7 +373,7 @@ public class TcpDiscoveryStatistics {
assert maxTime != null;
if (time > maxTime)
- maxMsgsSndTimes.put(msg.getClass().getSimpleName(), time);
+ maxTimes.put(msg.getClass().getSimpleName(), time);
}
/**
@@ -474,6 +500,13 @@ public class TcpDiscoveryStatistics {
}
/**
+ * @return Sent messages counts (grouped by type).
+ */
+ public synchronized Map<String, Integer> sentMessages() {
+ return new HashMap<>(sentMsgs);
+ }
+
+ /**
* Gets max messages send time (grouped by type).
*
* @return Map containing messages types and max send times.
@@ -621,6 +654,7 @@ public class TcpDiscoveryStatistics {
avgClientSockInitTime = 0;
avgMsgProcTime = 0;
avgMsgQueueTime = 0;
+ avgMsgsAckTimes.clear();
avgMsgsSndTimes.clear();
avgRingMsgTime = 0;
avgSrvSockInitTime = 0;
@@ -634,6 +668,7 @@ public class TcpDiscoveryStatistics {
maxClientSockInitTime = 0;
maxMsgProcTime = 0;
maxMsgQueueTime = 0;
+ maxMsgsAckTimes.clear();
maxMsgsSndTimes.clear();
maxProcTimeMsgCls = null;
maxRingMsgTime = 0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/2e65beb4/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
index 5053c2d..28b527e 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
@@ -28,9 +28,17 @@ import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
+import javax.cache.Cache;
+import javax.cache.event.CacheEntryEvent;
+import javax.cache.event.CacheEntryUpdatedListener;
import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteClientDisconnectedException;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.query.ContinuousQuery;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
@@ -42,6 +50,7 @@ import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.spi.IgniteSpiException;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
@@ -483,4 +492,217 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
stopAllGrids();
}
}
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void _testCustomEventOnJoinCoordinatorStop() throws Exception {
+ for (int k = 0; k < 10; k++) {
+ log.info("Iteration: " + k);
+
+ clientFlagGlobal = false;
+
+ final int START_NODES = 5;
+ final int JOIN_NODES = 5;
+
+ startGrids(START_NODES);
+
+ final AtomicInteger startIdx = new AtomicInteger(START_NODES);
+
+ final AtomicBoolean stop = new AtomicBoolean();
+
+ IgniteInternalFuture<?> fut1 = GridTestUtils.runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ CacheConfiguration ccfg = new CacheConfiguration();
+
+ Ignite ignite = ignite(START_NODES - 1);
+
+ while (!stop.get()) {
+ ignite.createCache(ccfg);
+
+ ignite.destroyCache(ccfg.getName());
+ }
+
+ return null;
+ }
+ });
+
+ try {
+ final CyclicBarrier barrier = new CyclicBarrier(JOIN_NODES + 1);
+
+ IgniteInternalFuture<?> fut2 = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ int idx = startIdx.getAndIncrement();
+
+ Thread.currentThread().setName("start-thread-" + idx);
+
+ barrier.await();
+
+ Ignite ignite = startGrid(idx);
+
+ assertFalse(ignite.configuration().isClientMode());
+
+ log.info("Started node: " + ignite.name());
+
+ IgniteCache<Object, Object> cache = ignite.getOrCreateCache((String)null);
+
+ ContinuousQuery<Object, Object> qry = new ContinuousQuery<>();
+
+ qry.setLocalListener(new CacheEntryUpdatedListener<Object, Object>() {
+ @Override public void onUpdated(Iterable<CacheEntryEvent<?, ?>> evts) {
+ // No-op.
+ }
+ });
+
+ QueryCursor<Cache.Entry<Object, Object>> cur = cache.query(qry);
+
+ cur.close();
+
+ return null;
+ }
+ }, JOIN_NODES, "start-thread");
+
+ barrier.await();
+
+ U.sleep(ThreadLocalRandom.current().nextInt(10, 100));
+
+ for (int i = 0; i < START_NODES - 1; i++) {
+ GridTestUtils.invoke(ignite(i).configuration().getDiscoverySpi(), "simulateNodeFailure");
+
+ stopGrid(i);
+ }
+
+ stop.set(true);
+
+ fut1.get();
+ fut2.get();
+ }
+ finally {
+ stop.set(true);
+
+ fut1.get();
+ }
+
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void _testClientContinuousQueryCoordinatorStop() throws Exception {
+ for (int k = 0; k < 10; k++) {
+ log.info("Iteration: " + k);
+
+ clientFlagGlobal = false;
+
+ final int START_NODES = 5;
+ final int JOIN_NODES = 5;
+
+ startGrids(START_NODES);
+
+ ignite(0).createCache(new CacheConfiguration<>());
+
+ final AtomicInteger startIdx = new AtomicInteger(START_NODES);
+
+ final CyclicBarrier barrier = new CyclicBarrier(JOIN_NODES + 1);
+
+ clientFlagGlobal = true;
+
+ IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ int idx = startIdx.getAndIncrement();
+
+ Thread.currentThread().setName("start-thread-" + idx);
+
+ barrier.await();
+
+ Ignite ignite = startGrid(idx);
+ assertTrue(ignite.configuration().isClientMode());
+
+ log.info("Started node: " + ignite.name());
+
+ IgniteCache<Object, Object> cache = ignite.getOrCreateCache((String)null);
+
+ for (int i = 0; i < 10; i++) {
+ ContinuousQuery<Object, Object> qry = new ContinuousQuery<>();
+
+ qry.setLocalListener(new CacheEntryUpdatedListener<Object, Object>() {
+ @Override public void onUpdated(Iterable<CacheEntryEvent<?, ?>> evts) {
+ // No-op.
+ }
+ });
+
+ cache.query(qry);
+ }
+
+ return null;
+ }
+ }, JOIN_NODES, "start-thread");
+
+ barrier.await();
+
+ U.sleep(ThreadLocalRandom.current().nextInt(100, 500));
+
+ for (int i = 0; i < START_NODES - 1; i++) {
+ GridTestUtils.invoke(ignite(i).configuration().getDiscoverySpi(), "simulateNodeFailure");
+
+ stopGrid(i);
+ }
+
+ fut.get();
+
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void _testCustomEventNodeRestart() throws Exception {
+ clientFlagGlobal = false;
+
+ Ignite ignite = startGrid(0);
+
+ ignite.getOrCreateCache(new CacheConfiguration<>());
+
+ final long stopTime = System.currentTimeMillis() + 60_000;
+
+ GridTestUtils.runMultiThreaded(new IgniteInClosure<Integer>() {
+ @Override public void apply(Integer idx) {
+ try {
+ while (System.currentTimeMillis() < stopTime) {
+ Ignite ignite = startGrid(idx + 1);
+
+ IgniteCache<Object, Object> cache = ignite.cache(null);
+
+ int qryCnt = ThreadLocalRandom.current().nextInt(10) + 1;
+
+ for (int i = 0; i < qryCnt; i++) {
+ ContinuousQuery<Object, Object> qry = new ContinuousQuery<>();
+
+ qry.setLocalListener(new CacheEntryUpdatedListener<Object, Object>() {
+ @Override public void onUpdated(Iterable<CacheEntryEvent<?, ?>> evts) {
+ // No-op.
+ }
+ });
+
+ QueryCursor<Cache.Entry<Object, Object>> cur = cache.query(qry);
+
+ cur.close();
+ }
+
+ GridTestUtils.invoke(ignite.configuration().getDiscoverySpi(), "simulateNodeFailure");
+
+ ignite.close();
+ }
+ }
+ catch (Exception e) {
+ log.error("Unexpected error: " + e, e);
+
+ throw new IgniteException(e);
+ }
+ }
+ }, 5, "node-restart");
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2e65beb4/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
index 96c0e66..d5ea46c 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
@@ -58,6 +58,7 @@ import org.apache.ignite.internal.processors.port.GridPortRecord;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.typedef.PA;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiPredicate;
@@ -68,6 +69,7 @@ import org.apache.ignite.spi.IgniteSpiException;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.spi.discovery.DiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode;
+import org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryStatistics;
import org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage;
@@ -109,7 +111,8 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
/** */
private static ThreadLocal<TcpDiscoverySpi> nodeSpi = new ThreadLocal<>();
- private GridStringLogger strLogger;
+ /** */
+ private GridStringLogger strLog;
/**
* @throws Exception If fails.
@@ -197,10 +200,10 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
else if (gridName.contains("testNoRingMessageWorkerAbnormalFailureSegmentedNode")) {
cfg.setFailureDetectionTimeout(6_000);
- cfg.setGridLogger(strLogger = new GridStringLogger());
+ cfg.setGridLogger(strLog = new GridStringLogger());
}
else if (gridName.contains("testNodeShutdownOnRingMessageWorkerFailureFailedNode"))
- cfg.setGridLogger(strLogger = new GridStringLogger());
+ cfg.setGridLogger(strLog = new GridStringLogger());
return cfg;
}
@@ -1438,7 +1441,7 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
assertTrue(disconnected.get());
- String result = strLogger.toString();
+ String result = strLog.toString();
assert result.contains("TcpDiscoverSpi's message worker thread failed abnormally") : result;
}
@@ -1520,7 +1523,7 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
Thread.sleep(10_000);
- String result = strLogger.toString();
+ String result = strLog.toString();
assert result.contains("Local node SEGMENTED") &&
!result.contains("TcpDiscoverSpi's message worker thread failed abnormally") : result;
@@ -1910,6 +1913,54 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
}
/**
+ * @throws Exception If failed.
+ */
+ public void testNoExtraNodeFailedMessage() throws Exception {
+ try {
+ final int NODES = 10;
+
+ startGridsMultiThreaded(NODES);
+
+ int stopIdx = 5;
+
+ Ignite failIgnite = ignite(stopIdx);
+
+ ((TcpDiscoverySpi)failIgnite.configuration().getDiscoverySpi()).simulateNodeFailure();
+
+ for (int i = 0; i < NODES; i++) {
+ if (i != stopIdx) {
+ final Ignite ignite = ignite(i);
+
+ GridTestUtils.waitForCondition(new PA() {
+ @Override public boolean apply() {
+ return ignite.cluster().topologyVersion() >= NODES + 1;
+ }
+ }, 10_000);
+
+ TcpDiscoverySpi spi = (TcpDiscoverySpi)ignite.configuration().getDiscoverySpi();
+
+ TcpDiscoveryStatistics stats = GridTestUtils.getFieldValue(spi, "stats");
+
+ Integer cnt = stats.sentMessages().get(TcpDiscoveryNodeFailedMessage.class.getSimpleName());
+
+ log.info("Count1: " + cnt);
+
+ assertTrue("Invalid message count: " + cnt, cnt == null || cnt <= 2);
+
+ cnt = stats.receivedMessages().get(TcpDiscoveryNodeFailedMessage.class.getSimpleName());
+
+ log.info("Count2: " + cnt);
+
+ assertTrue("Invalid message count: " + cnt, cnt == null || cnt <= 2);
+ }
+ }
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
* @param nodeName Node name.
* @throws Exception If failed.
*/
@@ -1925,7 +1976,7 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
return true;
}
}
- }, 10_000);
+ }, 30_000);
if (!wait)
U.dumpThreads(log);
[15/50] [abbrv] ignite git commit: IGNITE-3184: Hadoop: fixed Windows
setenv.bat.
Posted by sb...@apache.org.
IGNITE-3184: Hadoop: fixed Windows setenv.bat.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/68144107
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/68144107
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/68144107
Branch: refs/heads/ignite-1232
Commit: 68144107607585a92249cc174160af6839778f46
Parents: b5e6a70
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Jun 30 16:15:15 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Jun 30 16:16:39 2016 +0300
----------------------------------------------------------------------
bin/include/setenv.bat | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/68144107/bin/include/setenv.bat
----------------------------------------------------------------------
diff --git a/bin/include/setenv.bat b/bin/include/setenv.bat
index dec1ee5..9d55521 100644
--- a/bin/include/setenv.bat
+++ b/bin/include/setenv.bat
@@ -47,9 +47,9 @@ if exist %IGNITE_HOME%\libs\ignite-hadoop set HADOOP_EDITION=1
if defined USER_LIBS set IGNITE_LIBS=%USER_LIBS%;%IGNITE_LIBS%
-FOR /F "delims=" %%i IN ('%JAVA_HOME%\bin\java.exe -cp %IGNITE_HOME%\libs\ignite-hadoop\* org.apache.ignite.internal.processors.hadoop.HadoopClasspathMain ";"' ) DO set IGNITE_HADOOP_CLASSPATH=%%i
+if "%HADOOP_EDITION%" == "1" FOR /F "delims=" %%i IN ('%JAVA_HOME%\bin\java.exe -cp %IGNITE_HOME%\libs\ignite-hadoop\* org.apache.ignite.internal.processors.hadoop.HadoopClasspathMain ";"' ) DO set IGNITE_HADOOP_CLASSPATH=%%i
-if "[%IGNITE_HADOOP_CLASSPATH%]" == "[]" exit 1
+if "%IGNITE_HADOOP_CLASSPATH%" == "" goto :eof
set IGNITE_LIBS=%IGNITE_LIBS%;%IGNITE_HADOOP_CLASSPATH%
[36/50] [abbrv] ignite git commit: ignite-3336 Added properties
IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT,
IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT. Refactored cache message logging. (cherry
picked from commit 8ed13e8)
Posted by sb...@apache.org.
ignite-3336 Added properties IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT, IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT. Refactored cache message logging.
(cherry picked from commit 8ed13e8)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ad76dda5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ad76dda5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ad76dda5
Branch: refs/heads/ignite-1232
Commit: ad76dda5216fd79c1dd54f27b0df83314227801e
Parents: 6be26ad
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jul 6 10:18:26 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jul 6 11:18:49 2016 +0300
----------------------------------------------------------------------
.../apache/ignite/IgniteSystemProperties.java | 3 +
.../apache/ignite/internal/IgniteKernal.java | 21 ++
.../processors/cache/GridCacheAdapter.java | 4 +
.../processors/cache/GridCacheIoManager.java | 150 +++++++++-
.../processors/cache/GridCacheMessage.java | 9 +
.../GridCachePartitionExchangeManager.java | 103 +++++++
.../cache/GridCacheSharedContext.java | 68 +++++
.../processors/cache/GridCacheUtils.java | 21 ++
.../distributed/GridCacheTxRecoveryFuture.java | 70 ++++-
.../distributed/GridCacheTxRecoveryRequest.java | 8 +
.../GridCacheTxRecoveryResponse.java | 8 +
.../distributed/GridDistributedLockRequest.java | 6 +
.../GridDistributedLockResponse.java | 6 +
.../GridDistributedTxFinishRequest.java | 7 +
.../GridDistributedTxFinishResponse.java | 8 +
.../GridDistributedTxPrepareRequest.java | 6 +
.../GridDistributedTxPrepareResponse.java | 9 +-
.../GridDistributedUnlockRequest.java | 6 +
.../distributed/dht/GridDhtLockFuture.java | 59 ++--
.../dht/GridDhtTransactionalCacheAdapter.java | 77 ++++-
.../distributed/dht/GridDhtTxFinishFuture.java | 92 +++++-
.../cache/distributed/dht/GridDhtTxLocal.java | 27 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 124 +++++++-
.../dht/atomic/GridDhtAtomicCache.java | 138 ++++++---
.../GridDhtAtomicDeferredUpdateResponse.java | 7 +
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 47 ++-
.../dht/atomic/GridDhtAtomicUpdateRequest.java | 6 +
.../dht/atomic/GridDhtAtomicUpdateResponse.java | 6 +
.../dht/atomic/GridNearAtomicUpdateRequest.java | 6 +
.../atomic/GridNearAtomicUpdateResponse.java | 6 +
.../dht/colocated/GridDhtColocatedCache.java | 10 +
.../colocated/GridDhtColocatedLockFuture.java | 71 +++--
.../GridDhtPartitionsExchangeFuture.java | 3 +
.../near/GridNearOptimisticTxPrepareFuture.java | 33 +++
.../GridNearPessimisticTxPrepareFuture.java | 34 ++-
.../near/GridNearTxFinishFuture.java | 91 +++++-
.../near/GridNearTxPrepareFutureAdapter.java | 7 +-
.../cache/transactions/IgniteTxHandler.java | 283 ++++++++++++++-----
modules/core/src/test/config/log4j-test.xml | 6 +
39 files changed, 1404 insertions(+), 242 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index d3ba9d9..0c22c9d 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -380,6 +380,9 @@ public final class IgniteSystemProperties {
/** If this property is set to {@code true} then Ignite will log thread dump in case of partition exchange timeout. */
public static final String IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT = "IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT";
+ /** Cache operations that take more time than value of this property will be output to log. Set to {@code 0} to disable. */
+ public static final String IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT = "IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT";
+
/** JDBC driver cursor remove delay. */
public static final String IGNITE_JDBC_DRIVER_CURSOR_REMOVE_DELAY = "IGNITE_JDBC_DRIVER_CURSOR_RMV_DELAY";
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index c839375..b85692e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -303,6 +303,10 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
@GridToStringExclude
private GridTimeoutProcessor.CancelableTask metricsLogTask;
+ /** */
+ @GridToStringExclude
+ private GridTimeoutProcessor.CancelableTask longOpDumpTask;
+
/** Indicate error on grid stop. */
@GridToStringExclude
private boolean errOnStop;
@@ -1097,6 +1101,20 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
}, metricsLogFreq, metricsLogFreq);
}
+ final long longOpDumpTimeout =
+ IgniteSystemProperties.getLong(IgniteSystemProperties.IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT, 60_000);
+
+ if (longOpDumpTimeout > 0) {
+ longOpDumpTask = ctx.timeout().schedule(new Runnable() {
+ @Override public void run() {
+ GridKernalContext ctx = IgniteKernal.this.ctx;
+
+ if (ctx != null)
+ ctx.cache().context().exchange().dumpLongRunningOperations(longOpDumpTimeout);
+ }
+ }, longOpDumpTimeout, longOpDumpTimeout);
+ }
+
ctx.performance().logSuggestions(log, gridName);
U.quietAndInfo(log, "To start Console Management & Monitoring run ignitevisorcmd.{sh|bat}");
@@ -1911,6 +1929,9 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
if (metricsLogTask != null)
metricsLogTask.close();
+ if (longOpDumpTask != null)
+ longOpDumpTask.close();
+
boolean interrupted = false;
while (true) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 944a6b0..26730aa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -261,6 +261,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/** Logger. */
protected IgniteLogger log;
+ /** Logger. */
+ protected IgniteLogger txLockMsgLog;
+
/** Affinity impl. */
private Affinity<K> aff;
@@ -323,6 +326,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
this.map = map;
log = ctx.logger(getClass());
+ txLockMsgLog = ctx.shared().txLockMessageLogger();
metrics = new CacheMetricsImpl(ctx);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index aab1bcc..488a22c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -39,6 +39,8 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.CacheGetFutur
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAffinityAssignmentRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFinishRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFinishResponse;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareResponse;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture;
@@ -54,10 +56,13 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridNearLock
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockResponse;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearSingleGetRequest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearSingleGetResponse;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishRequest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishResponse;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareRequest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryRequest;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryResponse;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.F0;
import org.apache.ignite.internal.util.GridLeanSet;
import org.apache.ignite.internal.util.GridSpinReadWriteLock;
@@ -113,7 +118,7 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
/** Message listener. */
private GridMessageListener lsnr = new GridMessageListener() {
- @Override public void onMessage(final UUID nodeId, Object msg) {
+ @Override public void onMessage(final UUID nodeId, final Object msg) {
if (log.isDebugEnabled())
log.debug("Received unordered cache communication message [nodeId=" + nodeId +
", locId=" + cctx.localNodeId() + ", msg=" + msg + ']');
@@ -178,9 +183,19 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
AffinityTopologyVersion rmtAffVer = cacheMsg.topologyVersion();
if (locAffVer.compareTo(rmtAffVer) < 0) {
- if (log.isDebugEnabled())
- log.debug("Received message has higher affinity topology version [msg=" + msg +
- ", locTopVer=" + locAffVer + ", rmtTopVer=" + rmtAffVer + ']');
+ IgniteLogger log = cacheMsg.messageLogger(cctx);
+
+ if (log.isDebugEnabled()) {
+ StringBuilder msg0 = new StringBuilder("Received message has higher affinity topology version [");
+
+ appendMessageInfo(cacheMsg, nodeId, msg0);
+
+ msg0.append(", locTopVer=").append(locAffVer).
+ append(", rmtTopVer=").append(rmtAffVer).
+ append(']');
+
+ log.debug(msg0.toString());
+ }
fut = cctx.exchange().affinityReadyFuture(rmtAffVer);
}
@@ -191,6 +206,17 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
@Override public void apply(IgniteInternalFuture<?> t) {
cctx.kernalContext().closure().runLocalSafe(new Runnable() {
@Override public void run() {
+ IgniteLogger log = cacheMsg.messageLogger(cctx);
+
+ if (log.isDebugEnabled()) {
+ StringBuilder msg0 = new StringBuilder("Process cache message after wait for " +
+ "affinity topology version [");
+
+ appendMessageInfo(cacheMsg, nodeId, msg0).append(']');
+
+ log.debug(msg0.toString());
+ }
+
handleMessage(nodeId, cacheMsg);
}
});
@@ -225,18 +251,23 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
c = clsHandlers.get(new ListenerKey(cacheMsg.cacheId(), cacheMsg.getClass()));
if (c == null) {
+ IgniteLogger log = cacheMsg.messageLogger(cctx);
+
+ StringBuilder msg0 = new StringBuilder("Received message without registered handler (will ignore) [");
+
+ appendMessageInfo(cacheMsg, nodeId, msg0);
+
+ msg0.append(", locTopVer=").append(cctx.exchange().readyAffinityVersion()).
+ append(", msgTopVer=").append(cacheMsg.topologyVersion()).
+ append(", cacheDesc=").append(cctx.cache().cacheDescriptor(cacheMsg.cacheId())).
+ append(']');
+
if (cctx.kernalContext().isStopping()) {
if (log.isDebugEnabled())
- log.debug("Received message without registered handler (will ignore) [msg=" + cacheMsg +
- ", nodeId=" + nodeId + ']');
- }
- else {
- U.warn(log, "Received message without registered handler (will ignore) [msg=" + cacheMsg +
- ", nodeId=" + nodeId +
- ", locTopVer=" + cctx.exchange().readyAffinityVersion() +
- ", msgTopVer=" + cacheMsg.topologyVersion() +
- ", cacheDesc=" + cctx.cache().cacheDescriptor(cacheMsg.cacheId()) + ']');
+ log.debug(msg0.toString());
}
+ else
+ U.warn(log, msg0.toString());
return;
}
@@ -352,6 +383,99 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
}
}
+
+ /**
+ * @param cacheMsg Cache message.
+ * @param nodeId Node ID.
+ * @param builder Message builder.
+ * @return Message builder.
+ */
+ private StringBuilder appendMessageInfo(GridCacheMessage cacheMsg, UUID nodeId, StringBuilder builder) {
+ if (txId(cacheMsg) != null) {
+ builder.append("txId=").append(txId(cacheMsg)).
+ append(", dhtTxId=").append(dhtTxId(cacheMsg)).
+ append(", msg=").append(cacheMsg);
+ }
+ else if (atomicFututeId(cacheMsg) != null) {
+ builder.append("futId=").append(atomicFututeId(cacheMsg)).
+ append(", writeVer=").append(atomicWriteVersion(cacheMsg)).
+ append(", msg=").append(cacheMsg);
+ }
+ else
+ builder.append("msg=").append(cacheMsg);
+
+ builder.append(", node=").append(nodeId);
+
+ return builder;
+ }
+
+ /**
+ * @param cacheMsg Cache message.
+ * @return Transaction ID if applicable for message.
+ */
+ @Nullable private GridCacheVersion txId(GridCacheMessage cacheMsg) {
+ if (cacheMsg instanceof GridDhtTxPrepareRequest)
+ return ((GridDhtTxPrepareRequest)cacheMsg).nearXidVersion();
+ else if (cacheMsg instanceof GridNearTxPrepareRequest)
+ return ((GridNearTxPrepareRequest)cacheMsg).version();
+ else if (cacheMsg instanceof GridNearTxPrepareResponse)
+ return ((GridNearTxPrepareResponse)cacheMsg).version();
+ else if (cacheMsg instanceof GridNearTxFinishRequest)
+ return ((GridNearTxFinishRequest)cacheMsg).version();
+ else if (cacheMsg instanceof GridNearTxFinishResponse)
+ return ((GridNearTxFinishResponse)cacheMsg).xid();
+
+ return null;
+ }
+
+ /**
+ * @param cacheMsg Cache message.
+ * @return Transaction ID if applicable for message.
+ */
+ @Nullable private GridCacheVersion dhtTxId(GridCacheMessage cacheMsg) {
+ if (cacheMsg instanceof GridDhtTxPrepareRequest)
+ return ((GridDhtTxPrepareRequest)cacheMsg).version();
+ else if (cacheMsg instanceof GridDhtTxPrepareResponse)
+ return ((GridDhtTxPrepareResponse)cacheMsg).version();
+ else if (cacheMsg instanceof GridDhtTxFinishRequest)
+ return ((GridDhtTxFinishRequest)cacheMsg).version();
+ else if (cacheMsg instanceof GridDhtTxFinishResponse)
+ return ((GridDhtTxFinishResponse)cacheMsg).xid();
+
+ return null;
+ }
+
+ /**
+ * @param cacheMsg Cache message.
+ * @return Atomic future ID if applicable for message.
+ */
+ @Nullable private GridCacheVersion atomicFututeId(GridCacheMessage cacheMsg) {
+ if (cacheMsg instanceof GridNearAtomicUpdateRequest)
+ return ((GridNearAtomicUpdateRequest)cacheMsg).futureVersion();
+ else if (cacheMsg instanceof GridNearAtomicUpdateResponse)
+ return ((GridNearAtomicUpdateResponse) cacheMsg).futureVersion();
+ else if (cacheMsg instanceof GridDhtAtomicUpdateRequest)
+ return ((GridDhtAtomicUpdateRequest)cacheMsg).futureVersion();
+ else if (cacheMsg instanceof GridDhtAtomicUpdateResponse)
+ return ((GridDhtAtomicUpdateResponse) cacheMsg).futureVersion();
+
+ return null;
+ }
+
+
+ /**
+ * @param cacheMsg Cache message.
+ * @return Atomic future ID if applicable for message.
+ */
+ @Nullable private GridCacheVersion atomicWriteVersion(GridCacheMessage cacheMsg) {
+ if (cacheMsg instanceof GridNearAtomicUpdateRequest)
+ return ((GridNearAtomicUpdateRequest)cacheMsg).updateVersion();
+ else if (cacheMsg instanceof GridDhtAtomicUpdateRequest)
+ return ((GridDhtAtomicUpdateRequest)cacheMsg).writeVersion();
+
+ return null;
+ }
+
/**
* Processes failed messages.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
index 3c2ff13..f99d2cd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
@@ -24,6 +24,7 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import javax.cache.processor.EntryProcessor;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.GridDirectTransient;
import org.apache.ignite.internal.managers.deployment.GridDeployment;
import org.apache.ignite.internal.managers.deployment.GridDeploymentInfo;
@@ -613,6 +614,14 @@ public abstract class GridCacheMessage implements Message {
return col;
}
+ /**
+ * @param ctx Context.
+ * @return Logger.
+ */
+ public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.messageLogger();
+ }
+
/** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
writer.setBuffer(buf);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 260a504..e6ab046 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -17,9 +17,12 @@
package org.apache.ignite.internal.processors.cache;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
+import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -162,6 +165,12 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
/** */
private volatile IgniteCheckedException stopErr;
+ /** */
+ private int longRunningOpsDumpCnt;
+
+ /** */
+ private DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss.SSS");
+
/** Discovery listener. */
private final GridLocalEventListener discoLsnr = new GridLocalEventListener() {
@Override public void onEvent(Event evt) {
@@ -1163,6 +1172,100 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
}
/**
+ * @param timeout Operation timeout.
+ */
+ public void dumpLongRunningOperations(long timeout) {
+ try {
+ GridDhtPartitionsExchangeFuture lastFut = lastInitializedFut;
+
+ // If exchange is in progress it will dump all hanging operations if any.
+ if (lastFut != null && !lastFut.isDone())
+ return;
+
+ long curTime = U.currentTimeMillis();
+
+ boolean found = false;
+
+ IgniteTxManager tm = cctx.tm();
+
+ if (tm != null) {
+ for (IgniteInternalTx tx : tm.activeTransactions()) {
+ if (curTime - tx.startTime() > timeout) {
+ found = true;
+
+ if (longRunningOpsDumpCnt < GridDhtPartitionsExchangeFuture.DUMP_PENDING_OBJECTS_THRESHOLD) {
+ U.warn(log, "Found long running transaction [startTime=" + formatTime(tx.startTime()) +
+ ", curTime=" + formatTime(curTime) + ", tx=" + tx + ']');
+ }
+ else
+ break;
+ }
+ }
+ }
+
+ GridCacheMvccManager mvcc = cctx.mvcc();
+
+ if (mvcc != null) {
+ for (GridCacheFuture<?> fut : mvcc.activeFutures()) {
+ if (curTime - fut.startTime() > timeout) {
+ found = true;
+
+ if (longRunningOpsDumpCnt < GridDhtPartitionsExchangeFuture.DUMP_PENDING_OBJECTS_THRESHOLD) {
+ U.warn(log, "Found long running cache future [startTime=" + formatTime(fut.startTime()) +
+ ", curTime=" + formatTime(curTime) + ", fut=" + fut + ']');
+ }
+ else
+ break;
+ }
+ }
+
+ for (GridCacheFuture<?> fut : mvcc.atomicFutures()) {
+ if (curTime - fut.startTime() > timeout) {
+ found = true;
+
+ if (longRunningOpsDumpCnt < GridDhtPartitionsExchangeFuture.DUMP_PENDING_OBJECTS_THRESHOLD) {
+ U.warn(log, "Found long running cache future [startTime=" + formatTime(fut.startTime()) +
+ ", curTime=" + formatTime(curTime) + ", fut=" + fut + ']');
+ }
+ else
+ break;
+ }
+ }
+ }
+
+ if (found) {
+ if (longRunningOpsDumpCnt < GridDhtPartitionsExchangeFuture.DUMP_PENDING_OBJECTS_THRESHOLD) {
+ longRunningOpsDumpCnt++;
+
+ if (IgniteSystemProperties.getBoolean(IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT, false)) {
+ U.warn(log, "Found long running cache operations, dump threads.");
+
+ U.dumpThreads(log);
+ }
+
+ U.warn(log, "Found long running cache operations, dump IO statistics.");
+
+ // Dump IO manager statistics.
+ cctx.gridIO().dumpStats();
+ }
+ }
+ else
+ longRunningOpsDumpCnt = 0;
+ }
+ catch (Exception e) {
+ U.error(log, "Failed to dump debug information: " + e, e);
+ }
+ }
+
+ /**
+ * @param time Time.
+ * @return Time string.
+ */
+ private String formatTime(long time) {
+ return dateFormat.format(new Date(time));
+ }
+
+ /**
* @param exchTopVer Exchange topology version.
*/
private void dumpPendingObjects(@Nullable AffinityTopologyVersion exchTopVer) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
index f27d114..0cdf0a4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
@@ -51,6 +51,7 @@ import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.marshaller.Marshaller;
import org.jetbrains.annotations.Nullable;
@@ -107,6 +108,24 @@ public class GridCacheSharedContext<K, V> {
/** Indicating whether local store keeps primary only. */
private final boolean locStorePrimaryOnly = IgniteSystemProperties.getBoolean(IGNITE_LOCAL_STORE_KEEPS_PRIMARY_ONLY);
+ /** */
+ private final IgniteLogger msgLog;
+
+ /** */
+ private final IgniteLogger atomicMsgLog;
+
+ /** */
+ private final IgniteLogger txPrepareMsgLog;
+
+ /** */
+ private final IgniteLogger txFinishMsgLog;
+
+ /** */
+ private final IgniteLogger txLockMsgLog;
+
+ /** */
+ private final IgniteLogger txRecoveryMsgLog;
+
/**
* @param kernalCtx Context.
* @param txMgr Transaction manager.
@@ -142,6 +161,55 @@ public class GridCacheSharedContext<K, V> {
ctxMap = new ConcurrentHashMap<>();
locStoreCnt = new AtomicInteger();
+
+ msgLog = kernalCtx.log(CU.CACHE_MSG_LOG_CATEGORY);
+ atomicMsgLog = kernalCtx.log(CU.ATOMIC_MSG_LOG_CATEGORY);
+ txPrepareMsgLog = kernalCtx.log(CU.TX_MSG_PREPARE_LOG_CATEGORY);
+ txFinishMsgLog = kernalCtx.log(CU.TX_MSG_FINISH_LOG_CATEGORY);
+ txLockMsgLog = kernalCtx.log(CU.TX_MSG_LOCK_LOG_CATEGORY);
+ txRecoveryMsgLog = kernalCtx.log(CU.TX_MSG_RECOVERY_LOG_CATEGORY);
+ }
+
+ /**
+ * @return Logger.
+ */
+ public IgniteLogger messageLogger() {
+ return msgLog;
+ }
+
+ /**
+ * @return Logger.
+ */
+ public IgniteLogger atomicMessageLogger() {
+ return atomicMsgLog;
+ }
+
+ /**
+ * @return Logger.
+ */
+ public IgniteLogger txPrepareMessageLogger() {
+ return txPrepareMsgLog;
+ }
+
+ /**
+ * @return Logger.
+ */
+ public IgniteLogger txFinishMessageLogger() {
+ return txFinishMsgLog;
+ }
+
+ /**
+ * @return Logger.
+ */
+ public IgniteLogger txLockMessageLogger() {
+ return txLockMsgLog;
+ }
+
+ /**
+ * @return Logger.
+ */
+ public IgniteLogger txRecoveryMessageLogger() {
+ return txRecoveryMsgLog;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index feaa618..1a4ffd5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -122,6 +122,27 @@ public class GridCacheUtils {
/** Marshaller system cache name. */
public static final String MARSH_CACHE_NAME = "ignite-marshaller-sys-cache";
+ /** */
+ public static final String CACHE_MSG_LOG_CATEGORY = "org.apache.ignite.cache.msg";
+
+ /** */
+ public static final String ATOMIC_MSG_LOG_CATEGORY = CACHE_MSG_LOG_CATEGORY + ".atomic";
+
+ /** */
+ public static final String TX_MSG_LOG_CATEGORY = CACHE_MSG_LOG_CATEGORY + ".tx";
+
+ /** */
+ public static final String TX_MSG_PREPARE_LOG_CATEGORY = TX_MSG_LOG_CATEGORY + ".prepare";
+
+ /** */
+ public static final String TX_MSG_FINISH_LOG_CATEGORY = TX_MSG_LOG_CATEGORY + ".finish";
+
+ /** */
+ public static final String TX_MSG_LOCK_LOG_CATEGORY = TX_MSG_LOG_CATEGORY + ".lock";
+
+ /** */
+ public static final String TX_MSG_RECOVERY_LOG_CATEGORY = TX_MSG_LOG_CATEGORY + ".recovery";
+
/** Default mask name. */
private static final String DEFAULT_MASK_NAME = "<default>";
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryFuture.java
index 01673b8..f7b105e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryFuture.java
@@ -59,6 +59,9 @@ public class GridCacheTxRecoveryFuture extends GridCompoundIdentityFuture<Boolea
/** Logger. */
private static IgniteLogger log;
+ /** Logger. */
+ private static IgniteLogger msgLog;
+
/** Trackable flag. */
private boolean trackable = true;
@@ -103,8 +106,10 @@ public class GridCacheTxRecoveryFuture extends GridCompoundIdentityFuture<Boolea
this.txNodes = txNodes;
this.failedNodeIds = failedNodeIds;
- if (log == null)
+ if (log == null) {
+ msgLog = cctx.txRecoveryMessageLogger();
log = U.logger(cctx.kernalContext(), logRef, GridCacheTxRecoveryFuture.class);
+ }
nodes = new GridLeanMap<>();
@@ -174,11 +179,24 @@ public class GridCacheTxRecoveryFuture extends GridCompoundIdentityFuture<Boolea
try {
cctx.io().send(nearNodeId, req, tx.ioPolicy());
+
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Recovery fut, sent request near tx [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + nearNodeId + ']');
+ }
}
catch (ClusterTopologyCheckedException ignore) {
fut.onNodeLeft(nearNodeId);
}
catch (IgniteCheckedException e) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Recovery fut, failed to send request near tx [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + nearNodeId +
+ ", err=" + e + ']');
+ }
+
fut.onError(e);
}
@@ -280,11 +298,24 @@ public class GridCacheTxRecoveryFuture extends GridCompoundIdentityFuture<Boolea
try {
cctx.io().send(id, req, tx.ioPolicy());
+
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Recovery fut, sent request to backup [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + id + ']');
+ }
}
catch (ClusterTopologyCheckedException ignored) {
fut.onNodeLeft(id);
}
catch (IgniteCheckedException e) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Recovery fut, failed to send request to backup [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + id +
+ ", err=" + e + ']');
+ }
+
fut.onError(e);
break;
@@ -306,11 +337,24 @@ public class GridCacheTxRecoveryFuture extends GridCompoundIdentityFuture<Boolea
try {
cctx.io().send(nodeId, req, tx.ioPolicy());
+
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Recovery fut, sent request to primary [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + nodeId + ']');
+ }
}
catch (ClusterTopologyCheckedException ignored) {
fut.onNodeLeft(nodeId);
}
catch (IgniteCheckedException e) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Recovery fut, failed to send request to primary [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + nodeId +
+ ", err=" + e + ']');
+ }
+
fut.onError(e);
break;
@@ -354,6 +398,22 @@ public class GridCacheTxRecoveryFuture extends GridCompoundIdentityFuture<Boolea
mini.onResult(res);
}
+ else {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Tx recovery fut, failed to find mini future [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + nodeId +
+ ", res=" + res +
+ ", fut=" + this + ']');
+ }
+ }
+ }
+ else {
+ msgLog.debug("Tx recovery fut, response for finished future [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + nodeId +
+ ", res=" + res +
+ ", fut=" + this + ']');
}
}
@@ -522,8 +582,12 @@ public class GridCacheTxRecoveryFuture extends GridCompoundIdentityFuture<Boolea
* @param nodeId Failed node ID.
*/
private void onNodeLeft(UUID nodeId) {
- if (log.isDebugEnabled())
- log.debug("Transaction node left grid (will ignore) [fut=" + this + ']');
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Tx recovery fut, mini future node left [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + nodeId +
+ ", nearTxCheck=" + nearTxCheck + ']');
+ }
if (nearTxCheck) {
if (tx.state() == PREPARED) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryRequest.java
index e5787d7..6fdb30b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryRequest.java
@@ -19,6 +19,9 @@ package org.apache.ignite.internal.processors.cache.distributed;
import java.io.Externalizable;
import java.nio.ByteBuffer;
+
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -127,6 +130,11 @@ public class GridCacheTxRecoveryRequest extends GridDistributedBaseMessage {
}
/** {@inheritDoc} */
+ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.txRecoveryMessageLogger();
+ }
+
+ /** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
writer.setBuffer(buf);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
index 361d381..265d53b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
@@ -19,6 +19,9 @@ package org.apache.ignite.internal.processors.cache.distributed;
import java.io.Externalizable;
import java.nio.ByteBuffer;
+
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.lang.IgniteUuid;
@@ -92,6 +95,11 @@ public class GridCacheTxRecoveryResponse extends GridDistributedBaseMessage {
}
/** {@inheritDoc} */
+ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.txRecoveryMessageLogger();
+ }
+
+ /** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
writer.setBuffer(buf);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
index 20cd52c..9639a9a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.GridDirectCollection;
import org.apache.ignite.internal.GridDirectTransient;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
@@ -316,6 +317,11 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage {
return timeout;
}
+ /** {@inheritDoc} */
+ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.txLockMessageLogger();
+ }
+
/** {@inheritDoc}
* @param ctx*/
@Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
index 84a4094..1763ff9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
@@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.GridDirectCollection;
import org.apache.ignite.internal.GridDirectTransient;
import org.apache.ignite.internal.processors.cache.CacheObject;
@@ -180,6 +181,11 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessage {
return null;
}
+ /** {@inheritDoc} */
+ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.txLockMessageLogger();
+ }
+
/** {@inheritDoc}
* @param ctx*/
@Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
index ad69d14..7254ec7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
@@ -20,6 +20,8 @@ package org.apache.ignite.internal.processors.cache.distributed;
import java.io.Externalizable;
import java.nio.ByteBuffer;
import java.util.Collection;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.tostring.GridToStringBuilder;
import org.apache.ignite.lang.IgniteUuid;
@@ -222,6 +224,11 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMessage {
}
/** {@inheritDoc} */
+ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.txFinishMessageLogger();
+ }
+
+ /** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
writer.setBuffer(buf);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java
index 4e17e79..c08c5b2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java
@@ -19,7 +19,10 @@ package org.apache.ignite.internal.processors.cache.distributed;
import java.io.Externalizable;
import java.nio.ByteBuffer;
+
+import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.tostring.GridToStringBuilder;
import org.apache.ignite.lang.IgniteUuid;
@@ -79,6 +82,11 @@ public class GridDistributedTxFinishResponse extends GridCacheMessage {
}
/** {@inheritDoc} */
+ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.txFinishMessageLogger();
+ }
+
+ /** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
writer.setBuffer(buf);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
index d6f4331..72e68db 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
@@ -26,6 +26,7 @@ import java.util.Iterator;
import java.util.Map;
import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.GridDirectCollection;
import org.apache.ignite.internal.GridDirectMap;
import org.apache.ignite.internal.GridDirectTransient;
@@ -380,6 +381,11 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMessage
}
/** {@inheritDoc} */
+ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.txPrepareMessageLogger();
+ }
+
+ /** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
writer.setBuffer(buf);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
index 83f3724..850c095 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.distributed;
import java.io.Externalizable;
import java.nio.ByteBuffer;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.GridDirectTransient;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -89,8 +90,12 @@ public class GridDistributedTxPrepareResponse extends GridDistributedBaseMessage
return err != null;
}
- /** {@inheritDoc}
- * @param ctx*/
+ /** {@inheritDoc} */
+ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.txPrepareMessageLogger();
+ }
+
+ /** {@inheritDoc} */
@Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
super.prepareMarshal(ctx);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java
index 7854ace..df6acdd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java
@@ -22,6 +22,7 @@ import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.GridDirectCollection;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
@@ -111,6 +112,11 @@ public class GridDistributedUnlockRequest extends GridDistributedBaseMessage {
}
/** {@inheritDoc} */
+ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.txLockMessageLogger();
+ }
+
+ /** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
writer.setBuffer(buf);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
index 38a7e19..64b8745 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
@@ -87,6 +87,9 @@ public final class GridDhtLockFuture extends GridCompoundIdentityFuture<Boolean>
/** Logger. */
private static IgniteLogger log;
+ /** Logger. */
+ private static IgniteLogger msgLog;
+
/** Cache registry. */
@GridToStringExclude
private GridCacheContext<?, ?> cctx;
@@ -235,8 +238,10 @@ public final class GridDhtLockFuture extends GridCompoundIdentityFuture<Boolean>
entries = new ArrayList<>(cnt);
pendingLocks = U.newHashSet(cnt);
- if (log == null)
+ if (log == null) {
+ msgLog = cctx.shared().txLockMessageLogger();
log = U.logger(cctx.kernalContext(), logRef, GridDhtLockFuture.class);
+ }
if (timeout > 0) {
timeoutObj = new LockTimeoutObject();
@@ -304,6 +309,13 @@ public final class GridDhtLockFuture extends GridCompoundIdentityFuture<Boolean>
return futId;
}
+ /**
+ * @return Near lock version.
+ */
+ public GridCacheVersion nearLockVersion() {
+ return nearLockVer;
+ }
+
/** {@inheritDoc} */
@Nullable @Override public GridCacheVersion mappedVersion() {
return tx == null ? nearLockVer : null;
@@ -506,27 +518,21 @@ public final class GridDhtLockFuture extends GridCompoundIdentityFuture<Boolean>
*/
void onResult(UUID nodeId, GridDhtLockResponse res) {
if (!isDone()) {
- if (log.isDebugEnabled())
- log.debug("Received lock response from node [nodeId=" + nodeId + ", res=" + res + ", fut=" + this + ']');
-
MiniFuture mini = miniFuture(res.miniId());
if (mini != null) {
assert mini.node().id().equals(nodeId);
- if (log.isDebugEnabled())
- log.debug("Found mini future for response [mini=" + mini + ", res=" + res + ']');
-
mini.onResult(res);
- if (log.isDebugEnabled())
- log.debug("Futures after processed lock response [fut=" + this + ", mini=" + mini +
- ", res=" + res + ']');
-
return;
}
- U.warn(log, "Failed to find mini future for response (perhaps due to stale message) [res=" + res +
+ U.warn(msgLog, "DHT lock fut, failed to find mini future [txId=" + nearLockVer +
+ ", dhtTxId=" + lockVer +
+ ", inTx=" + inTx() +
+ ", node=" + nodeId +
+ ", res=" + res +
", fut=" + this + ']');
}
}
@@ -929,18 +935,31 @@ public final class GridDhtLockFuture extends GridCompoundIdentityFuture<Boolean>
add(fut); // Append new future.
- if (log.isDebugEnabled())
- log.debug("Sending DHT lock request to DHT node [node=" + n.id() + ", req=" + req + ']');
-
cctx.io().send(n, req, cctx.ioPolicy());
+
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT lock fut, sent request [txId=" + nearLockVer +
+ ", dhtTxId=" + lockVer +
+ ", inTx=" + inTx() +
+ ", nodeId=" + n.id() + ']');
+ }
}
}
catch (IgniteCheckedException e) {
// Fail the whole thing.
if (e instanceof ClusterTopologyCheckedException)
fut.onResult((ClusterTopologyCheckedException)e);
- else
+ else {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT lock fut, failed to send request [txId=" + nearLockVer +
+ ", dhtTxId=" + lockVer +
+ ", inTx=" + inTx() +
+ ", node=" + n.id() +
+ ", err=" + e + ']');
+ }
+
fut.onResult(e);
+ }
}
}
}
@@ -1162,8 +1181,12 @@ public final class GridDhtLockFuture extends GridCompoundIdentityFuture<Boolean>
* @param e Node failure.
*/
void onResult(ClusterTopologyCheckedException e) {
- if (log.isDebugEnabled())
- log.debug("Remote node left grid while sending or waiting for reply (will ignore): " + this);
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT lock fut, mini future node left [txId=" + nearLockVer +
+ ", dhtTxId=" + lockVer +
+ ", inTx=" + inTx() +
+ ", node=" + node.id() + ']');
+ }
if (tx != null)
tx.removeMapping(node.id());
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
index d5927bf..6b437b1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
@@ -376,6 +376,13 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
* @param req Request.
*/
protected final void processDhtLockRequest(final UUID nodeId, final GridDhtLockRequest req) {
+ if (txLockMsgLog.isDebugEnabled()) {
+ txLockMsgLog.debug("Received dht lock request [txId=" + req.nearXidVersion() +
+ ", dhtTxId=" + req.version() +
+ ", inTx=" + req.inTx() +
+ ", node=" + nodeId + ']');
+ }
+
IgniteInternalFuture<Object> keyFut = F.isEmpty(req.keys()) ? null :
ctx.dht().dhtPreloader().request(req.keys(), req.topologyVersion());
@@ -451,10 +458,6 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
assert req != null;
assert !nodeId.equals(locNodeId);
- if (log.isDebugEnabled())
- log.debug("Processing dht lock request [locNodeId=" + locNodeId + ", nodeId=" + nodeId + ", req=" + req +
- ']');
-
int cnt = F.size(req.keys());
GridDhtLockResponse res;
@@ -528,15 +531,30 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
try {
// Reply back to sender.
ctx.io().send(nodeId, res, ctx.ioPolicy());
+
+ if (txLockMsgLog.isDebugEnabled()) {
+ txLockMsgLog.debug("Sent dht lock response [txId=" + req.nearXidVersion() +
+ ", dhtTxId=" + req.version() +
+ ", inTx=" + req.inTx() +
+ ", node=" + nodeId + ']');
+ }
}
catch (ClusterTopologyCheckedException ignored) {
- U.warn(log, "Failed to send lock reply to remote node because it left grid: " + nodeId);
+ U.warn(txLockMsgLog, "Failed to send dht lock response, node failed [" +
+ "txId=" + req.nearXidVersion() +
+ ", dhtTxId=" + req.version() +
+ ", inTx=" + req.inTx() +
+ ", node=" + nodeId + ']');
fail = true;
releaseAll = true;
}
catch (IgniteCheckedException e) {
- U.error(log, "Failed to send lock reply to node (lock will not be acquired): " + nodeId, e);
+ U.error(txLockMsgLog, "Failed to send dht lock response (lock will not be acquired) " +
+ "txId=" + req.nearXidVersion() +
+ ", dhtTxId=" + req.version() +
+ ", inTx=" + req.inTx() +
+ ", node=" + nodeId + ']', e);
fail = true;
}
@@ -601,14 +619,18 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
assert nodeId != null;
assert req != null;
- if (log.isDebugEnabled())
- log.debug("Processing near lock request [locNodeId=" + locNodeId + ", nodeId=" + nodeId + ", req=" + req +
- ']');
+ if (txLockMsgLog.isDebugEnabled()) {
+ txLockMsgLog.debug("Received near lock request [txId=" + req.version() +
+ ", inTx=" + req.inTx() +
+ ", node=" + nodeId + ']');
+ }
ClusterNode nearNode = ctx.discovery().node(nodeId);
if (nearNode == null) {
- U.warn(log, "Received lock request from unknown node (will ignore): " + nodeId);
+ U.warn(txLockMsgLog, "Received near lock request from unknown node (will ignore) [txId=" + req.version() +
+ ", inTx=" + req.inTx() +
+ ", node=" + nodeId + ']');
return;
}
@@ -631,11 +653,18 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
GridDhtLockFuture fut = (GridDhtLockFuture)ctx.mvcc().<Boolean>mvccFuture(res.version(), res.futureId());
if (fut == null) {
- if (log.isDebugEnabled())
- log.debug("Received response for unknown future (will ignore): " + res);
+ if (txLockMsgLog.isDebugEnabled())
+ txLockMsgLog.debug("Received dht lock response for unknown future [txId=null" +
+ ", dhtTxId=" + res.version() +
+ ", node=" + nodeId + ']');
return;
}
+ else if (txLockMsgLog.isDebugEnabled()) {
+ txLockMsgLog.debug("Received dht lock response [txId=" + fut.nearLockVersion() +
+ ", dhtTxId=" + res.version() +
+ ", node=" + nodeId + ']');
+ }
fut.onResult(nodeId, res);
}
@@ -1286,12 +1315,30 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
try {
// Don't send reply message to this node or if lock was cancelled.
- if (!nearNode.id().equals(ctx.nodeId()) && !X.hasCause(err, GridDistributedLockCancelledException.class))
+ if (!nearNode.id().equals(ctx.nodeId()) && !X.hasCause(err, GridDistributedLockCancelledException.class)) {
ctx.io().send(nearNode, res, ctx.ioPolicy());
+
+ if (txLockMsgLog.isDebugEnabled()) {
+ txLockMsgLog.debug("Sent near lock response [txId=" + req.version() +
+ ", inTx=" + req.inTx() +
+ ", node=" + nearNode.id() + ']');
+ }
+ }
+ else {
+ if (txLockMsgLog.isDebugEnabled() && !nearNode.id().equals(ctx.nodeId())) {
+ txLockMsgLog.debug("Skip send near lock response [txId=" + req.version() +
+ ", inTx=" + req.inTx() +
+ ", node=" + nearNode.id() +
+ ", err=" + err + ']');
+ }
+ }
}
catch (IgniteCheckedException e) {
- U.error(log, "Failed to send lock reply to originating node (will rollback transaction) [node=" +
- U.toShortString(nearNode) + ", req=" + req + ']', e);
+ U.error(txLockMsgLog, "Failed to send near lock response (will rollback transaction) [" +
+ "txId=" + req.version() +
+ ", inTx=" + req.inTx() +
+ ", node=" + nearNode.id() +
+ ", res=" + res + ']', e);
if (tx != null)
tx.rollbackAsync();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
index de04782..4ece775 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
@@ -67,6 +67,9 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur
/** Logger. */
private static IgniteLogger log;
+ /** Logger. */
+ private static IgniteLogger msgLog;
+
/** Context. */
private GridCacheSharedContext<K, V> cctx;
@@ -111,8 +114,17 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur
futId = IgniteUuid.randomUuid();
- if (log == null)
+ if (log == null) {
+ msgLog = cctx.txFinishMessageLogger();
log = U.logger(cctx.kernalContext(), logRef, GridDhtTxFinishFuture.class);
+ }
+ }
+
+ /**
+ * @return Transaction.
+ */
+ public GridDhtTxLocalAdapter tx() {
+ return tx;
}
/** {@inheritDoc} */
@@ -187,17 +199,40 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur
*/
public void onResult(UUID nodeId, GridDhtTxFinishResponse res) {
if (!isDone()) {
+ boolean found = false;
+
for (IgniteInternalFuture<IgniteInternalTx> fut : futures()) {
if (isMini(fut)) {
MiniFuture f = (MiniFuture)fut;
if (f.futureId().equals(res.miniId())) {
+ found = true;
+
assert f.node().id().equals(nodeId);
f.onResult(res);
}
}
}
+
+ if (!found) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT finish fut, failed to find mini future [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + nodeId +
+ ", res=" + res +
+ ", fut=" + this + ']');
+ }
+ }
+ }
+ else {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT finish fut, failed to find mini future [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + nodeId +
+ ", res=" + res +
+ ", fut=" + this + ']');
+ }
}
}
@@ -320,6 +355,12 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur
try {
cctx.io().send(n, req, tx.ioPolicy());
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT finish fut, sent request lock tx [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + n.id() + ']');
+ }
+
if (sync)
res = true;
else
@@ -329,8 +370,16 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur
// Fail the whole thing.
if (e instanceof ClusterTopologyCheckedException)
fut.onNodeLeft((ClusterTopologyCheckedException)e);
- else
+ else {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT finish fut, failed to send request lock tx [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + n.id() +
+ ", err=" + e + ']');
+ }
+
fut.onResult(e);
+ }
}
}
@@ -406,6 +455,12 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur
try {
cctx.io().send(n, req, tx.ioPolicy());
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT finish fut, sent request dht [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + n.id() + ']');
+ }
+
if (sync)
res = true;
else
@@ -415,8 +470,16 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur
// Fail the whole thing.
if (e instanceof ClusterTopologyCheckedException)
fut.onNodeLeft((ClusterTopologyCheckedException)e);
- else
+ else {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT finish fut, failed to send request dht [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + n.id() +
+ ", err=" + e + ']');
+ }
+
fut.onResult(e);
+ }
}
}
@@ -460,6 +523,12 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur
try {
cctx.io().send(nearMapping.node(), req, tx.ioPolicy());
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT finish fut, sent request near [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + nearMapping.node().id() + ']');
+ }
+
if (sync)
res = true;
else
@@ -469,8 +538,16 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur
// Fail the whole thing.
if (e instanceof ClusterTopologyCheckedException)
fut.onNodeLeft((ClusterTopologyCheckedException)e);
- else
+ else {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT finish fut, failed to send request near [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + nearMapping.node().id() +
+ ", err=" + e + ']');
+ }
+
fut.onResult(e);
+ }
}
}
}
@@ -573,8 +650,11 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur
* @param discoThread {@code True} if executed from discovery thread.
*/
void onNodeLeft(ClusterTopologyCheckedException e, boolean discoThread) {
- if (log.isDebugEnabled())
- log.debug("Remote node left grid while sending or waiting for reply (will ignore): " + this);
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT finish fut, mini future node left [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + node().id() + ']');
+ }
// If node left, then there is nothing to commit on it.
onDone(tx);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
index d1f88d7..c9d4345 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
@@ -672,23 +672,38 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
try {
cctx.io().send(nearNodeId, res, ioPolicy());
+
+ if (cctx.txFinishMessageLogger().isDebugEnabled()) {
+ cctx.txFinishMessageLogger().debug("Sent near finish response [txId=" + nearXidVersion() +
+ ", dhtTxId=" + xidVersion() +
+ ", node=" + nearNodeId + ']');
+ }
}
catch (ClusterTopologyCheckedException ignored) {
- if (log.isDebugEnabled())
- log.debug("Node left before sending finish response (transaction was committed) [node=" +
- nearNodeId + ", res=" + res + ']');
+ if (cctx.txFinishMessageLogger().isDebugEnabled()) {
+ cctx.txFinishMessageLogger().debug("Failed to send near finish response, node left [txId=" + nearXidVersion() +
+ ", dhtTxId=" + xidVersion() +
+ ", node=" + nearNodeId() + ']');
+ }
}
catch (Throwable ex) {
U.error(log, "Failed to send finish response to node (transaction was " +
- (commit ? "committed" : "rolledback") + ") [node=" + nearNodeId + ", res=" + res + ']', ex);
+ (commit ? "committed" : "rolledback") + ") [txId=" + nearXidVersion() +
+ ", dhtTxId=" + xidVersion() +
+ ", node=" + nearNodeId +
+ ", res=" + res + ']', ex);
if (ex instanceof Error)
throw (Error)ex;
}
}
else {
- if (log.isDebugEnabled())
- log.debug("Will not send finish reply because sender node has not sent finish request yet: " + this);
+ if (cctx.txFinishMessageLogger().isDebugEnabled()) {
+ cctx.txFinishMessageLogger().debug("Will not send finish reply because sender node has not sent finish " +
+ "request yet [txId=" + nearXidVersion() +
+ ", dhtTxId=" + xidVersion() +
+ ", node=" + nearNodeId() + ']');
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index 746dbb9..e9805aa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -130,6 +130,9 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
/** Logger. */
private static IgniteLogger log;
+ /** Logger. */
+ private static IgniteLogger msgLog;
+
/** Context. */
private GridCacheSharedContext<?, ?> cctx;
@@ -228,8 +231,10 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
this.nearMiniId = nearMiniId;
- if (log == null)
+ if (log == null) {
+ msgLog = cctx.txPrepareMessageLogger();
log = U.logger(cctx.kernalContext(), logRef, GridDhtTxPrepareFuture.class);
+ }
dhtMap = tx.dhtMap();
nearMap = tx.nearMap();
@@ -284,7 +289,7 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
/**
* @return Transaction.
*/
- GridDhtTxLocalAdapter tx() {
+ public GridDhtTxLocalAdapter tx() {
return tx;
}
@@ -479,13 +484,36 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
*/
public void onResult(UUID nodeId, GridDhtTxPrepareResponse res) {
if (!isDone()) {
+ boolean found = false;
+
MiniFuture mini = miniFuture(res.miniId());
if (mini != null) {
+ found = true;
+
assert mini.node().id().equals(nodeId);
mini.onResult(res);
}
+
+ if (!found) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT prepare fut, failed to find mini future [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + nodeId +
+ ", res=" + res +
+ ", fut=" + this + ']');
+ }
+ }
+ }
+ else {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT prepare fut, response for finished future [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + nodeId +
+ ", res=" + res +
+ ", fut=" + this + ']');
+ }
}
}
@@ -655,7 +683,12 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
sendPrepareResponse(res);
}
catch (IgniteCheckedException e) {
- U.error(log, "Failed to send prepare response for transaction: " + tx, e);
+ U.error(log, "Failed to send prepare response [txId=" + tx.nearXidVersion() + "," +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + tx.nearNodeId() +
+ ", res=" + res,
+ ", tx=" + tx,
+ e);
}
}
};
@@ -693,7 +726,12 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
sendPrepareResponse(res);
}
catch (IgniteCheckedException e) {
- U.error(log, "Failed to send prepare response for transaction: " + tx, e);
+ U.error(log, "Failed to send prepare response [txId=" + tx.nearXidVersion() + "," +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + tx.nearNodeId() +
+ ", res=" + res,
+ ", tx=" + tx,
+ e);
}
}
@@ -707,7 +745,12 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
sendPrepareResponse(res);
}
catch (IgniteCheckedException e) {
- U.error(log, "Failed to send prepare response for transaction: " + tx, e);
+ U.error(log, "Failed to send prepare response [txId=" + tx.nearXidVersion() + "," +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + tx.nearNodeId() +
+ ", res=" + res,
+ ", tx=" + tx,
+ e);
}
finally {
// Will call super.onDone().
@@ -742,10 +785,26 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
if (!tx.nearNodeId().equals(cctx.localNodeId())) {
Throwable err = this.err;
- if (err != null && err instanceof IgniteFutureCancelledException)
+ if (err != null && err instanceof IgniteFutureCancelledException) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT prepare fut, skip send response [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + tx.nearNodeId() +
+ ", err=" + err +
+ ", res=" + res + ']');
+ }
+
return;
+ }
cctx.io().send(tx.nearNodeId(), res, tx.ioPolicy());
+
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT prepare fut, sent response [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + tx.nearNodeId() +
+ ", res=" + res + ']');
+ }
}
}
@@ -1192,13 +1251,34 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
try {
cctx.io().send(n, req, tx.ioPolicy());
+
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT prepare fut, sent request dht [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + n.id() + ']');
+ }
}
catch (ClusterTopologyCheckedException e) {
fut.onNodeLeft(e);
}
catch (IgniteCheckedException e) {
- if (!cctx.kernalContext().isStopping())
+ if (!cctx.kernalContext().isStopping()) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT prepare fut, failed to send request dht [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + n.id() + ']');
+ }
+
fut.onResult(e);
+ }
+ else {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT prepare fut, failed to send request dht, ignore [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + n.id() +
+ ", err=" + e + ']');
+ }
+ }
}
}
@@ -1249,13 +1329,34 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
try {
cctx.io().send(nearMapping.node(), req, tx.ioPolicy());
+
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT prepare fut, sent request near [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + nearMapping.node().id() + ']');
+ }
}
catch (ClusterTopologyCheckedException e) {
fut.onNodeLeft(e);
}
catch (IgniteCheckedException e) {
- if (!cctx.kernalContext().isStopping())
+ if (!cctx.kernalContext().isStopping()) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT prepare fut, failed to send request near [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + nearMapping.node().id() + ']');
+ }
+
fut.onResult(e);
+ }
+ else {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT prepare fut, failed to send request near, ignore [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + nearMapping.node().id() +
+ ", err=" + e + ']');
+ }
+ }
}
}
}
@@ -1471,8 +1572,11 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
* @param e Node failure.
*/
void onNodeLeft(ClusterTopologyCheckedException e) {
- if (log.isDebugEnabled())
- log.debug("Remote node left grid while sending or waiting for reply (will ignore): " + this);
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DHT prepare fut, mini future node left [txId=" + tx.nearXidVersion() +
+ ", dhtTxId=" + tx.xidVersion() +
+ ", node=" + node().id() + ']');
+ }
if (tx != null)
tx.removeMapping(nodeId);
[34/50] [abbrv] ignite git commit: ignite-3336 Added properties
IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT,
IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT. Refactored cache message logging. (cherry
picked from commit 8ed13e84499a2006baf8df22d897509e2d4e3f7e)
Posted by sb...@apache.org.
ignite-3336 Added properties IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT, IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT. Refactored cache message logging.
(cherry picked from commit 8ed13e84499a2006baf8df22d897509e2d4e3f7e)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6be26ad8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6be26ad8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6be26ad8
Branch: refs/heads/ignite-1232
Commit: 6be26ad8904a7af58944be9a7aacc65dab02b338
Parents: e9a508e
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jul 6 11:18:35 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jul 6 11:18:35 2016 +0300
----------------------------------------------------------------------
.../GridNearAtomicAbstractUpdateFuture.java | 7 ++-
.../GridNearAtomicSingleUpdateFuture.java | 30 ++++++++++---
.../dht/atomic/GridNearAtomicUpdateFuture.java | 45 ++++++++++++++++----
3 files changed, 66 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6be26ad8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
index 7f52299..3e69c02 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
@@ -52,6 +52,9 @@ public abstract class GridNearAtomicAbstractUpdateFuture extends GridFutureAdapt
/** Logger. */
protected static IgniteLogger log;
+ /** Logger. */
+ protected static IgniteLogger msgLog;
+
/** Cache context. */
protected final GridCacheContext cctx;
@@ -166,8 +169,10 @@ public abstract class GridNearAtomicAbstractUpdateFuture extends GridFutureAdapt
int remapCnt,
boolean waitTopFut
) {
- if (log == null)
+ if (log == null) {
+ msgLog = cctx.shared().atomicMessageLogger();
log = U.logger(cctx.kernalContext(), logRef, GridFutureAdapter.class);
+ }
this.cctx = cctx;
this.cache = cache;
http://git-wip-us.apache.org/repos/asf/ignite/blob/6be26ad8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
index abfc5c9..aad4186 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
@@ -127,9 +127,10 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
@Override public boolean onNodeLeft(UUID nodeId) {
GridNearAtomicUpdateResponse res = null;
+ GridNearAtomicUpdateRequest req;
+
synchronized (mux) {
- GridNearAtomicUpdateRequest req = this.req != null && this.req.nodeId().equals(nodeId) ?
- this.req : null;
+ req = this.req != null && this.req.nodeId().equals(nodeId) ? this.req : null;
if (req != null && req.response() == null) {
res = new GridNearAtomicUpdateResponse(cctx.cacheId(),
@@ -146,8 +147,15 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
}
}
- if (res != null)
+ if (res != null) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near update single fut, node left [futId=" + req.futureVersion() +
+ ", writeVer=" + req.updateVersion() +
+ ", node=" + nodeId + ']');
+ }
+
onResult(nodeId, res, true);
+ }
return false;
}
@@ -450,15 +458,25 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
}
else {
try {
- if (log.isDebugEnabled())
- log.debug("Sending near atomic update request [nodeId=" + req.nodeId() + ", req=" + req + ']');
-
cctx.io().send(req.nodeId(), req, cctx.ioPolicy());
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near update single fut, sent request [futId=" + req.futureVersion() +
+ ", writeVer=" + req.updateVersion() +
+ ", node=" + req.nodeId() + ']');
+ }
+
if (syncMode == FULL_ASYNC)
onDone(new GridCacheReturn(cctx, true, true, null, true));
}
catch (IgniteCheckedException e) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near update single fut, failed to send request [futId=" + req.futureVersion() +
+ ", writeVer=" + req.updateVersion() +
+ ", node=" + req.nodeId() +
+ ", err=" + e + ']');
+ }
+
onSendError(req, e);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6be26ad8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
index cc0427c..b2f2704 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
@@ -162,9 +162,9 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
@Override public boolean onNodeLeft(UUID nodeId) {
GridNearAtomicUpdateResponse res = null;
- synchronized (mux) {
- GridNearAtomicUpdateRequest req;
+ GridNearAtomicUpdateRequest req;
+ synchronized (mux) {
if (singleReq != null)
req = singleReq.nodeId().equals(nodeId) ? singleReq : null;
else
@@ -185,8 +185,15 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
}
}
- if (res != null)
+ if (res != null) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near update fut, node left [futId=" + req.futureVersion() +
+ ", writeVer=" + req.updateVersion() +
+ ", node=" + nodeId + ']');
+ }
+
onResult(nodeId, res, true);
+ }
return false;
}
@@ -561,15 +568,25 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
}
else {
try {
- if (log.isDebugEnabled())
- log.debug("Sending near atomic update request [nodeId=" + req.nodeId() + ", req=" + req + ']');
-
cctx.io().send(req.nodeId(), req, cctx.ioPolicy());
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near update fut, sent request [futId=" + req.futureVersion() +
+ ", writeVer=" + req.updateVersion() +
+ ", node=" + req.nodeId() + ']');
+ }
+
if (syncMode == FULL_ASYNC)
onDone(new GridCacheReturn(cctx, true, true, null, true));
}
catch (IgniteCheckedException e) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near update fut, failed to send request [futId=" + req.futureVersion() +
+ ", writeVer=" + req.updateVersion() +
+ ", node=" + req.nodeId() +
+ ", err=" + e + ']');
+ }
+
onSendError(req, e);
}
}
@@ -595,12 +612,22 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
}
else {
try {
- if (log.isDebugEnabled())
- log.debug("Sending near atomic update request [nodeId=" + req.nodeId() + ", req=" + req + ']');
-
cctx.io().send(req.nodeId(), req, cctx.ioPolicy());
+
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near update fut, sent request [futId=" + req.futureVersion() +
+ ", writeVer=" + req.updateVersion() +
+ ", node=" + req.nodeId() + ']');
+ }
}
catch (IgniteCheckedException e) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near update fut, failed to send request [futId=" + req.futureVersion() +
+ ", writeVer=" + req.updateVersion() +
+ ", node=" + req.nodeId() +
+ ", err=" + e + ']');
+ }
+
onSendError(req, e);
}
}
[21/50] [abbrv] ignite git commit: IGNITE-3337 Fixed compilation
under java 8.
Posted by sb...@apache.org.
IGNITE-3337 Fixed compilation under java 8.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/df16a75d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/df16a75d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/df16a75d
Branch: refs/heads/ignite-1232
Commit: df16a75d02be2b73167b17a3150f5c704c24d23f
Parents: d33f4db
Author: Andrey Novikov <an...@apache.org>
Authored: Tue Jul 5 17:55:31 2016 +0700
Committer: Andrey Novikov <an...@apache.org>
Committed: Tue Jul 5 17:55:31 2016 +0700
----------------------------------------------------------------------
.../internal/client/integration/ClientAbstractSelfTest.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/df16a75d/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java
index 3fbd570..2577ae4 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java
@@ -502,8 +502,8 @@ public abstract class ClientAbstractSelfTest extends GridCommonAbstractTest {
GridClientCompute compute = client.compute();
- Assert.assertEquals(17, compute.execute(taskName, taskArg));
- Assert.assertEquals(17, compute.executeAsync(taskName, taskArg).get());
+ assertEquals(Integer.valueOf(17), compute.execute(taskName, taskArg));
+ assertEquals(Integer.valueOf(17), compute.executeAsync(taskName, taskArg).get());
}
/**
[50/50] [abbrv] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-1232
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-1232
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/45ce0fd7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/45ce0fd7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/45ce0fd7
Branch: refs/heads/ignite-1232
Commit: 45ce0fd7da4bfa7d2655f5f837af50f06476e0a5
Parents: 3fd608e 77bcabc
Author: sboikov <sb...@gridgain.com>
Authored: Thu Jul 7 08:59:47 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Jul 7 08:59:47 2016 +0300
----------------------------------------------------------------------
assembly/LICENSE_FABRIC | 8 +-
assembly/LICENSE_HADOOP | 6 -
bin/include/hadoop-classpath.bat | 73 --
bin/include/hadoop-classpath.sh | 65 --
bin/include/setenv.bat | 4 +-
bin/include/setenv.sh | 25 +-
examples/pom-standalone-lgpl.xml | 6 +-
examples/pom-standalone.xml | 6 +-
examples/pom.xml | 6 +-
examples/schema-import/pom-standalone.xml | 6 +-
examples/schema-import/pom.xml | 6 +-
modules/cassandra/pom.xml | 4 +-
.../store/cassandra/common/package-info.java | 21 +
.../cassandra/datasource/package-info.java | 21 +
.../cache/store/cassandra/package-info.java | 21 +
.../cassandra/persistence/package-info.java | 21 +
.../cassandra/serializer/package-info.java | 21 +
.../store/cassandra/session/package-info.java | 21 +
.../cassandra/session/pool/package-info.java | 21 +
.../store/cassandra/utils/package-info.java | 21 +
.../tests/load/cassandra/package-info.java | 21 +
.../ignite/tests/load/ignite/package-info.java | 21 +
.../apache/ignite/tests/load/package-info.java | 21 +
.../org/apache/ignite/tests/package-info.java | 21 +
.../apache/ignite/tests/pojos/package-info.java | 21 +
.../apache/ignite/tests/utils/package-info.java | 21 +
.../integration/ClientAbstractSelfTest.java | 4 +-
modules/core/pom.xml | 6 +-
.../org/apache/ignite/IgniteDataStreamer.java | 5 +-
.../apache/ignite/IgniteSystemProperties.java | 3 +
.../ignite/binary/BinaryObjectBuilder.java | 11 +
.../configuration/HadoopConfiguration.java | 4 +-
.../apache/ignite/internal/IgniteKernal.java | 73 +-
.../ignite/internal/binary/BinaryContext.java | 85 +-
.../internal/binary/BinaryEnumObjectImpl.java | 9 +-
.../ignite/internal/binary/BinaryObjectEx.java | 11 +
.../internal/binary/BinaryObjectExImpl.java | 4 +-
.../internal/binary/BinaryObjectImpl.java | 8 +-
.../binary/BinaryObjectOffheapImpl.java | 8 +-
.../ignite/internal/binary/BinaryTypeProxy.java | 111 ++
.../ignite/internal/binary/BinaryUtils.java | 35 +-
.../processors/cache/GridCacheAdapter.java | 4 +
.../processors/cache/GridCacheIoManager.java | 150 ++-
.../processors/cache/GridCacheMessage.java | 9 +
.../GridCachePartitionExchangeManager.java | 103 ++
.../cache/GridCacheSharedContext.java | 68 ++
.../processors/cache/GridCacheUtils.java | 21 +
.../binary/CacheObjectBinaryProcessorImpl.java | 3 +-
.../distributed/GridCacheTxRecoveryFuture.java | 70 +-
.../distributed/GridCacheTxRecoveryRequest.java | 7 +
.../GridCacheTxRecoveryResponse.java | 7 +
.../distributed/GridDistributedLockRequest.java | 6 +
.../GridDistributedLockResponse.java | 6 +
.../GridDistributedTxFinishRequest.java | 7 +
.../GridDistributedTxFinishResponse.java | 7 +
.../GridDistributedTxPrepareRequest.java | 6 +
.../GridDistributedTxPrepareResponse.java | 7 +
.../GridDistributedUnlockRequest.java | 6 +
.../distributed/dht/GridDhtLockFuture.java | 59 +-
.../dht/GridDhtPartitionTopologyImpl.java | 2 +-
.../dht/GridDhtTransactionalCacheAdapter.java | 77 +-
.../distributed/dht/GridDhtTxFinishFuture.java | 92 +-
.../cache/distributed/dht/GridDhtTxLocal.java | 27 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 122 +-
.../dht/atomic/GridDhtAtomicCache.java | 138 ++-
.../GridDhtAtomicDeferredUpdateResponse.java | 7 +
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 47 +-
.../dht/atomic/GridDhtAtomicUpdateRequest.java | 6 +
.../dht/atomic/GridDhtAtomicUpdateResponse.java | 6 +
.../GridNearAtomicAbstractUpdateFuture.java | 7 +-
.../GridNearAtomicSingleUpdateFuture.java | 30 +-
.../dht/atomic/GridNearAtomicUpdateFuture.java | 45 +-
.../dht/atomic/GridNearAtomicUpdateRequest.java | 6 +
.../atomic/GridNearAtomicUpdateResponse.java | 6 +
.../dht/colocated/GridDhtColocatedCache.java | 10 +
.../colocated/GridDhtColocatedLockFuture.java | 71 +-
.../GridDhtPartitionsExchangeFuture.java | 3 +
.../near/GridNearOptimisticTxPrepareFuture.java | 33 +
.../GridNearPessimisticTxPrepareFuture.java | 34 +-
.../near/GridNearTxFinishFuture.java | 91 +-
.../near/GridNearTxPrepareFutureAdapter.java | 7 +-
.../cache/transactions/IgniteTxHandler.java | 286 +++--
.../processors/hadoop/HadoopNoopProcessor.java | 5 +
.../hadoop/HadoopProcessorAdapter.java | 7 +
.../platform/PlatformAbstractBootstrap.java | 5 +
.../processors/platform/PlatformBootstrap.java | 6 +
.../processors/platform/PlatformIgnition.java | 7 +-
.../affinity/PlatformAffinityFunction.java | 154 ++-
.../PlatformAffinityFunctionTarget.java | 113 ++
.../cache/affinity/PlatformAffinityUtils.java | 113 ++
.../callback/PlatformCallbackGateway.java | 16 +-
.../callback/PlatformCallbackUtils.java | 13 +-
.../dotnet/PlatformDotNetBootstrap.java | 12 +
.../PlatformDotNetConfigurationClosure.java | 8 +-
.../dotnet/PlatformDotNetConsoleStream.java | 54 +
.../utils/PlatformConfigurationUtils.java | 96 +-
.../processors/query/GridQueryProcessor.java | 3 +-
.../service/GridServiceProcessor.java | 2 +-
.../util/nio/GridNioRecoveryDescriptor.java | 19 +-
.../ignite/internal/util/nio/GridNioServer.java | 47 +-
.../util/nio/GridSelectorNioSessionImpl.java | 7 +
.../visor/cache/VisorCachePartitionsTask.java | 2 +-
.../visor/compute/VisorGatewayTask.java | 2 +-
.../ignite/internal/visor/igfs/VisorIgfs.java | 2 +-
.../internal/visor/igfs/VisorIgfsMetrics.java | 11 +-
.../visor/node/VisorNodeDataCollectorTask.java | 26 -
.../dotnet/PlatformDotNetAffinityFunction.java | 89 +-
.../communication/tcp/TcpCommunicationSpi.java | 163 ++-
.../ignite/spi/discovery/tcp/ClientImpl.java | 2 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 109 +-
.../tcp/internal/TcpDiscoveryStatistics.java | 45 +-
.../resources/META-INF/classnames.properties | 165 ++-
modules/core/src/test/config/log4j-test.xml | 6 +
.../IgniteCountDownLatchAbstractSelfTest.java | 2 -
...gniteCacheMessageRecoveryIdleConnection.java | 154 +++
.../service/IgniteServiceReassignmentTest.java | 250 ++++
.../tcp/TcpDiscoveryMultiThreadedTest.java | 222 ++++
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 63 +-
.../ignite/testsuites/IgniteCacheTestSuite.java | 2 +
.../testsuites/IgniteKernalSelfTestSuite.java | 2 +
modules/flume/README.txt | 2 +-
.../IgniteHadoopClientProtocolProvider.java | 1 +
.../processors/hadoop/HadoopAttributes.java | 168 +++
.../processors/hadoop/HadoopClassLoader.java | 73 +-
.../processors/hadoop/HadoopClasspathMain.java | 44 +
.../processors/hadoop/HadoopClasspathUtils.java | 295 +++++
.../processors/hadoop/HadoopLocations.java | 123 ++
.../processors/hadoop/HadoopProcessor.java | 118 +-
modules/kafka/README.txt | 4 +-
.../include/ignite/binary/binary_containers.h | 6 +-
.../include/ignite/binary/binary_raw_reader.h | 6 +-
.../include/ignite/binary/binary_reader.h | 6 +-
.../ignite/impl/binary/binary_reader_impl.h | 11 +-
.../ignite/impl/binary/binary_writer_impl.h | 2 +-
modules/platforms/cpp/common/Makefile.am | 5 +-
.../platforms/cpp/common/include/Makefile.am | 19 +-
.../common/include/ignite/common/big_integer.h | 523 +++++++++
.../cpp/common/include/ignite/common/bits.h | 218 ++++
.../cpp/common/include/ignite/common/decimal.h | 527 +++++++++
.../include/ignite/common/default_allocator.h | 95 ++
.../include/ignite/common/dynamic_size_array.h | 415 +++++++
.../include/ignite/common/fixed_size_array.h | 288 +++++
.../cpp/common/include/ignite/common/utils.h | 81 +-
.../platforms/cpp/common/include/ignite/guid.h | 4 +-
.../cpp/common/os/win/src/common/utils.cpp | 21 -
.../cpp/common/project/vs/common.vcxproj | 17 +-
.../common/project/vs/common.vcxproj.filters | 27 +
.../cpp/common/src/common/big_integer.cpp | 830 +++++++++++++
.../platforms/cpp/common/src/common/bits.cpp | 233 ++++
.../platforms/cpp/common/src/common/decimal.cpp | 275 +++++
modules/platforms/cpp/core-test/Makefile.am | 4 +
.../cpp/core-test/project/vs/core-test.vcxproj | 9 +-
.../project/vs/core-test.vcxproj.filters | 14 +-
.../platforms/cpp/core-test/src/bits_test.cpp | 124 ++
.../cpp/core-test/src/decimal_test.cpp | 1101 ++++++++++++++++++
.../core-test/src/dynamic_size_array_test.cpp | 360 ++++++
.../cpp/core-test/src/fixed_size_array_test.cpp | 208 ++++
.../cpp/core/include/ignite/cache/cache_entry.h | 2 +-
.../cpp/jni/include/ignite/jni/exports.h | 3 +
.../platforms/cpp/jni/include/ignite/jni/java.h | 10 +-
modules/platforms/cpp/jni/project/vs/module.def | 2 +
modules/platforms/cpp/jni/src/exports.cpp | 8 +
modules/platforms/cpp/jni/src/java.cpp | 64 +-
modules/platforms/cpp/odbc-test/Makefile.am | 1 -
.../cpp/odbc-test/project/vs/odbc-test.vcxproj | 1 -
.../project/vs/odbc-test.vcxproj.filters | 3 -
.../src/application_data_buffer_test.cpp | 35 +-
.../platforms/cpp/odbc-test/src/row_test.cpp | 5 +-
modules/platforms/cpp/odbc/Makefile.am | 1 -
modules/platforms/cpp/odbc/include/Makefile.am | 1 -
.../ignite/odbc/app/application_data_buffer.h | 11 +-
.../cpp/odbc/include/ignite/odbc/decimal.h | 137 ---
.../cpp/odbc/include/ignite/odbc/utility.h | 12 +-
.../platforms/cpp/odbc/project/vs/odbc.vcxproj | 2 -
.../cpp/odbc/project/vs/odbc.vcxproj.filters | 6 -
.../odbc/src/app/application_data_buffer.cpp | 165 ++-
.../platforms/cpp/odbc/src/app/parameter.cpp | 6 +-
modules/platforms/cpp/odbc/src/column.cpp | 6 +-
modules/platforms/cpp/odbc/src/connection.cpp | 1 -
modules/platforms/cpp/odbc/src/decimal.cpp | 135 ---
modules/platforms/cpp/odbc/src/odbc.cpp | 3 -
modules/platforms/cpp/odbc/src/utility.cpp | 25 +-
.../Apache.Ignite.Core.Tests.csproj | 1 +
.../Affinity/AffinityFunctionSpringTest.cs | 64 +-
.../Cache/Affinity/AffinityFunctionTest.cs | 209 +++-
.../Config/Cache/Affinity/affinity-function.xml | 40 +
.../ConsoleRedirectTest.cs | 177 +++
.../Apache.Ignite.Core.Tests/DeploymentTest.cs | 4 +-
.../Apache.Ignite.Core.Tests/TestRunner.cs | 23 +-
.../Apache.Ignite.Core.csproj | 3 +
.../Cache/Affinity/AffinityFunctionBase.cs | 126 +-
.../Cache/Affinity/AffinityFunctionContext.cs | 14 +-
.../Cache/Affinity/Fair/FairAffinityFunction.cs | 4 +
.../Rendezvous/RendezvousAffinityFunction.cs | 4 +
.../Cache/Configuration/CacheConfiguration.cs | 5 +-
.../dotnet/Apache.Ignite.Core/Ignition.cs | 6 +-
.../Impl/Binary/BinaryReaderExtensions.cs | 14 +
.../Impl/Binary/Marshaller.cs | 1 +
.../Affinity/AffinityFunctionSerializer.cs | 277 +++++
.../Cache/Affinity/PlatformAffinityFunction.cs | 74 ++
.../Impl/Common/ObjectInfoHolder.cs | 86 ++
.../Apache.Ignite.Core/Impl/IgniteUtils.cs | 21 +
.../Impl/Unmanaged/IgniteJniNativeMethods.cs | 6 +
.../Impl/Unmanaged/UnmanagedCallbacks.cs | 87 +-
.../Impl/Unmanaged/UnmanagedUtils.cs | 16 +
modules/yardstick/pom.xml | 46 +-
.../IgniteCacheRandomOperationBenchmark.java | 147 ++-
.../yardstick/cache/load/model/ModelUtil.java | 6 +-
parent/pom.xml | 1 -
209 files changed, 11239 insertions(+), 1714 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/45ce0fd7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/45ce0fd7/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/45ce0fd7/parent/pom.xml
----------------------------------------------------------------------
[45/50] [abbrv] ignite git commit: Updated classnames.properties to
run Ignite from IDE.
Posted by sb...@apache.org.
Updated classnames.properties to run Ignite from IDE.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d27e7351
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d27e7351
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d27e7351
Branch: refs/heads/ignite-1232
Commit: d27e7351feb3ee2738511696597df34f6fb997a4
Parents: aa49995
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Wed Jul 6 20:35:29 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Jul 6 20:35:29 2016 +0700
----------------------------------------------------------------------
.../resources/META-INF/classnames.properties | 165 +++++++++++++------
1 file changed, 114 insertions(+), 51 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d27e7351/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 9ae74a7..57762c7 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -221,7 +221,7 @@ org.apache.ignite.internal.IgniteFutureTimeoutCheckedException
org.apache.ignite.internal.IgniteInterruptedCheckedException
org.apache.ignite.internal.IgniteKernal
org.apache.ignite.internal.IgniteKernal$1
-org.apache.ignite.internal.IgniteKernal$4
+org.apache.ignite.internal.IgniteKernal$5
org.apache.ignite.internal.IgniteMessagingImpl
org.apache.ignite.internal.IgniteSchedulerImpl
org.apache.ignite.internal.IgniteServicesImpl
@@ -316,6 +316,23 @@ org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion
org.apache.ignite.internal.processors.affinity.GridAffinityAssignment
org.apache.ignite.internal.processors.affinity.GridAffinityMessage
org.apache.ignite.internal.processors.affinity.GridAffinityUtils$AffinityJob
+org.apache.ignite.internal.processors.cache.CacheAffinityChangeMessage
+org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$10
+org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$11
+org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$12
+org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$12$1
+org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$12$2
+org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$13
+org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$14
+org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$15
+org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$16
+org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$2
+org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$3
+org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$5
+org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$6
+org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$7
+org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$8
+org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$9
org.apache.ignite.internal.processors.cache.CacheAtomicUpdateTimeoutCheckedException
org.apache.ignite.internal.processors.cache.CacheDefaultBinaryAffinityKeyMapper
org.apache.ignite.internal.processors.cache.CacheEntryImpl
@@ -337,10 +354,13 @@ org.apache.ignite.internal.processors.cache.CacheObjectAdapter
org.apache.ignite.internal.processors.cache.CacheObjectByteArrayImpl
org.apache.ignite.internal.processors.cache.CacheObjectImpl
org.apache.ignite.internal.processors.cache.CacheOperationContext
+org.apache.ignite.internal.processors.cache.CacheOperationFilter
org.apache.ignite.internal.processors.cache.CachePartialUpdateCheckedException
org.apache.ignite.internal.processors.cache.CacheStorePartialUpdateException
org.apache.ignite.internal.processors.cache.CacheType
+org.apache.ignite.internal.processors.cache.CacheWeakQueryIteratorsHolder$WeakQueryCloseableIterator
org.apache.ignite.internal.processors.cache.CacheWeakQueryIteratorsHolder$WeakQueryFutureIterator
+org.apache.ignite.internal.processors.cache.CacheWeakQueryIteratorsHolder$WeakReferenceCloseableIterator
org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch
org.apache.ignite.internal.processors.cache.DynamicCacheChangeRequest
org.apache.ignite.internal.processors.cache.GridCacheAdapter
@@ -349,30 +369,34 @@ org.apache.ignite.internal.processors.cache.GridCacheAdapter$11
org.apache.ignite.internal.processors.cache.GridCacheAdapter$12
org.apache.ignite.internal.processors.cache.GridCacheAdapter$13
org.apache.ignite.internal.processors.cache.GridCacheAdapter$14
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$15$1
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$16
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$15
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$16$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$17
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$18
org.apache.ignite.internal.processors.cache.GridCacheAdapter$2
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$25$1
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$27
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$28$1
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$29
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$26$1
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$28
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$29$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$3
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$31
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$30
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$32
org.apache.ignite.internal.processors.cache.GridCacheAdapter$4
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$59
org.apache.ignite.internal.processors.cache.GridCacheAdapter$6
org.apache.ignite.internal.processors.cache.GridCacheAdapter$60
org.apache.ignite.internal.processors.cache.GridCacheAdapter$61
org.apache.ignite.internal.processors.cache.GridCacheAdapter$62
org.apache.ignite.internal.processors.cache.GridCacheAdapter$63
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$64
org.apache.ignite.internal.processors.cache.GridCacheAdapter$65
org.apache.ignite.internal.processors.cache.GridCacheAdapter$66
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$66$1
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$67
org.apache.ignite.internal.processors.cache.GridCacheAdapter$68
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$8
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$69
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$69$1
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$70
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$71
org.apache.ignite.internal.processors.cache.GridCacheAdapter$9
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$AsyncOp$1
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$AsyncOp$1$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$AsyncOpRetryFuture$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$AsyncOpRetryFuture$1$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$ClearTask
@@ -382,7 +406,9 @@ org.apache.ignite.internal.processors.cache.GridCacheAdapter$GlobalClearKeySetJo
org.apache.ignite.internal.processors.cache.GridCacheAdapter$GlobalClearKeySetNearJob
org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheClosure
org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheJob
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheJobV2
org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadKeysCallable
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadKeysCallableV2
org.apache.ignite.internal.processors.cache.GridCacheAdapter$SizeJob
org.apache.ignite.internal.processors.cache.GridCacheAdapter$SizeLongJob
org.apache.ignite.internal.processors.cache.GridCacheAdapter$SizeLongTask
@@ -395,18 +421,10 @@ org.apache.ignite.internal.processors.cache.GridCacheAdapter$UpdatePutTimeStatCl
org.apache.ignite.internal.processors.cache.GridCacheAdapter$UpdateRemoveTimeStatClosure
org.apache.ignite.internal.processors.cache.GridCacheAdapter$UpdateTimeStatClosure
org.apache.ignite.internal.processors.cache.GridCacheAttributes
-org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap$1
-org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap$2
-org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap$3
-org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap$EntryIterator
-org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap$EntrySet
-org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap$Iterator0
-org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap$KeyIterator
-org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap$KeySet
-org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap$Segment
-org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap$Set0
-org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap$ValueIterator
-org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap$Values
+org.apache.ignite.internal.processors.cache.GridCacheConcurrentMapImpl$1
+org.apache.ignite.internal.processors.cache.GridCacheConcurrentMapImpl$3
+org.apache.ignite.internal.processors.cache.GridCacheConcurrentMapImpl$4
+org.apache.ignite.internal.processors.cache.GridCacheConcurrentMapImpl$5
org.apache.ignite.internal.processors.cache.GridCacheContext
org.apache.ignite.internal.processors.cache.GridCacheContext$4
org.apache.ignite.internal.processors.cache.GridCacheContext$5
@@ -430,10 +448,10 @@ org.apache.ignite.internal.processors.cache.GridCacheExplicitLockSpan$1
org.apache.ignite.internal.processors.cache.GridCacheFilterFailedException
org.apache.ignite.internal.processors.cache.GridCacheGateway$State
org.apache.ignite.internal.processors.cache.GridCacheIndexUpdateException
+org.apache.ignite.internal.processors.cache.GridCacheIoManager$1$1
org.apache.ignite.internal.processors.cache.GridCacheIoManager$1$2
org.apache.ignite.internal.processors.cache.GridCacheIoManager$2
org.apache.ignite.internal.processors.cache.GridCacheIterator
-org.apache.ignite.internal.processors.cache.GridCacheKeySet
org.apache.ignite.internal.processors.cache.GridCacheLoaderWriterStore
org.apache.ignite.internal.processors.cache.GridCacheLoaderWriterStoreFactory
org.apache.ignite.internal.processors.cache.GridCacheLockTimeoutException
@@ -456,12 +474,13 @@ org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$6
org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$7
org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeFutureSet
org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$MessageHandler
-org.apache.ignite.internal.processors.cache.GridCacheProcessor$1
+org.apache.ignite.internal.processors.cache.GridCacheProcessor$2
org.apache.ignite.internal.processors.cache.GridCacheProcessor$3
org.apache.ignite.internal.processors.cache.GridCacheProcessor$4
org.apache.ignite.internal.processors.cache.GridCacheProcessor$5
-org.apache.ignite.internal.processors.cache.GridCacheProcessor$6
+org.apache.ignite.internal.processors.cache.GridCacheProcessor$7
org.apache.ignite.internal.processors.cache.GridCacheProcessor$8
+org.apache.ignite.internal.processors.cache.GridCacheProcessor$9
org.apache.ignite.internal.processors.cache.GridCacheProcessor$LocalAffinityFunction
org.apache.ignite.internal.processors.cache.GridCacheProxyImpl
org.apache.ignite.internal.processors.cache.GridCacheReturn
@@ -498,8 +517,7 @@ org.apache.ignite.internal.processors.cache.GridCacheUtils$18
org.apache.ignite.internal.processors.cache.GridCacheUtils$19
org.apache.ignite.internal.processors.cache.GridCacheUtils$2
org.apache.ignite.internal.processors.cache.GridCacheUtils$20
-org.apache.ignite.internal.processors.cache.GridCacheUtils$21
-org.apache.ignite.internal.processors.cache.GridCacheUtils$23
+org.apache.ignite.internal.processors.cache.GridCacheUtils$22
org.apache.ignite.internal.processors.cache.GridCacheUtils$3
org.apache.ignite.internal.processors.cache.GridCacheUtils$4
org.apache.ignite.internal.processors.cache.GridCacheUtils$5
@@ -513,6 +531,7 @@ org.apache.ignite.internal.processors.cache.IgniteCacheProxy
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$1
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$10
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$2
+org.apache.ignite.internal.processors.cache.IgniteCacheProxy$2$1
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$3
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$4
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$5
@@ -536,7 +555,7 @@ org.apache.ignite.internal.processors.cache.distributed.GridCacheCommittedTxInfo
org.apache.ignite.internal.processors.cache.distributed.GridCacheTtlUpdateRequest
org.apache.ignite.internal.processors.cache.distributed.GridCacheTxRecoveryFuture$1
org.apache.ignite.internal.processors.cache.distributed.GridCacheTxRecoveryFuture$2
-org.apache.ignite.internal.processors.cache.distributed.GridCacheTxRecoveryFuture$3
+org.apache.ignite.internal.processors.cache.distributed.GridCacheTxRecoveryFuture$4
org.apache.ignite.internal.processors.cache.distributed.GridCacheTxRecoveryRequest
org.apache.ignite.internal.processors.cache.distributed.GridCacheTxRecoveryResponse
org.apache.ignite.internal.processors.cache.distributed.GridDistributedBaseMessage
@@ -561,7 +580,7 @@ org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAffinityAssig
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAffinityAssignmentResponse
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCache
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter
-org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter$2
+org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter$1
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter$3
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter$5
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter$6
@@ -657,10 +676,13 @@ org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomic
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicDeferredUpdateResponse
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture$1
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture$2
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture$3
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$2
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$3
-org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$UpdateState$1
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$4
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache
@@ -675,6 +697,7 @@ org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtCol
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture$2
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture$3
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture$4
+org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture$LockTimeoutObject$1
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture$MiniFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest
@@ -698,11 +721,11 @@ org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPar
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture$2
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture$4
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture$5
+org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture$6
+org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture$ExchangeType
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleRequest
-org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader$1$1
-org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader$10
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader$2
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader$3
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader$4
@@ -710,7 +733,6 @@ org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPre
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader$6
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader$7
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader$8
-org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader$9
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader$MessageHandler
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloaderAssignments
org.apache.ignite.internal.processors.cache.distributed.near.CacheVersionedValue
@@ -719,9 +741,6 @@ org.apache.ignite.internal.processors.cache.distributed.near.GridNearAtomicCache
org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter
org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter$2
org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter$3
-org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter$3$1
-org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter$3$2
-org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter$4
org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter$EntrySet$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetFuture$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetFuture$2
@@ -778,11 +797,12 @@ org.apache.ignite.internal.processors.cache.distributed.near.GridNearUnlockReque
org.apache.ignite.internal.processors.cache.dr.GridCacheDrExpirationInfo
org.apache.ignite.internal.processors.cache.dr.GridCacheDrInfo
org.apache.ignite.internal.processors.cache.local.GridLocalCache
+org.apache.ignite.internal.processors.cache.local.GridLocalLockFuture$LockTimeoutObject$1
org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache
-org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache$10
+org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache$3
org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache$4
org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache$5
-org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache$6
+org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache$8
org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache$9
org.apache.ignite.internal.processors.cache.query.CacheQueryType
org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryFuture$1
@@ -792,21 +812,25 @@ org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManag
org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$4
org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$5
org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$6
+org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$7
org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$1
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$ScanQueryFallbackClosableIterator
org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter$2
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$1$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$1$2
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$10
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$11
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$12
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$13$1
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$13
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$14
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$15$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$2
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$3
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$4
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$5
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$6
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$7
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$8
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$9
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CacheSqlIndexMetadata
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CacheSqlMetadata
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CachedResult$QueueIterator
@@ -831,15 +855,14 @@ org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQuer
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryEvent
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler$1$1
-org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler$1$2
-org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler$2
-org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler$3
+org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler$ContinuousQueryAsyncClosure$1
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler$DeployableObject
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandlerV2
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryManager$1
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryManager$2
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryManager$3
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryManager$4
+org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryManager$CacheEntryEventImpl
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryManager$JCacheQuery$1
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryManager$JCacheQueryRemoteFilter
org.apache.ignite.internal.processors.cache.query.jdbc.GridCacheQueryJdbcMetadataTask
@@ -901,7 +924,6 @@ org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$Po
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$2
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$3
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$4
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$AtomicInt
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$CommitListener
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$CommittedVersion
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$NodeFailureTimeoutObject$1
@@ -911,7 +933,12 @@ org.apache.ignite.internal.processors.cache.transactions.IgniteTxMap$1$1
org.apache.ignite.internal.processors.cache.transactions.TransactionMetricsAdapter
org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl
org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl$1
+org.apache.ignite.internal.processors.cache.transactions.TxDeadlockDetection$UniqueDeque
org.apache.ignite.internal.processors.cache.transactions.TxEntryValueHolder
+org.apache.ignite.internal.processors.cache.transactions.TxLock
+org.apache.ignite.internal.processors.cache.transactions.TxLockList
+org.apache.ignite.internal.processors.cache.transactions.TxLocksRequest
+org.apache.ignite.internal.processors.cache.transactions.TxLocksResponse
org.apache.ignite.internal.processors.cache.version.GridCacheRawVersionedEntry
org.apache.ignite.internal.processors.cache.version.GridCacheVersion
org.apache.ignite.internal.processors.cache.version.GridCacheVersionConflictContext$State
@@ -993,9 +1020,11 @@ org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$17
org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$18
org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$19
org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$2
+org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$20
org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$21
-org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$22
org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$23
+org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$24
+org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$25
org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$3
org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$4
org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$5
@@ -1026,6 +1055,8 @@ org.apache.ignite.internal.processors.datastructures.GridCacheAtomicStampedValue
org.apache.ignite.internal.processors.datastructures.GridCacheCountDownLatchImpl
org.apache.ignite.internal.processors.datastructures.GridCacheCountDownLatchValue
org.apache.ignite.internal.processors.datastructures.GridCacheInternalKeyImpl
+org.apache.ignite.internal.processors.datastructures.GridCacheLockImpl
+org.apache.ignite.internal.processors.datastructures.GridCacheLockState
org.apache.ignite.internal.processors.datastructures.GridCacheQueueAdapter$AddProcessor
org.apache.ignite.internal.processors.datastructures.GridCacheQueueAdapter$ClearProcessor
org.apache.ignite.internal.processors.datastructures.GridCacheQueueAdapter$CollocatedItemKey
@@ -1037,8 +1068,6 @@ org.apache.ignite.internal.processors.datastructures.GridCacheQueueItemKey
org.apache.ignite.internal.processors.datastructures.GridCacheQueueProxy
org.apache.ignite.internal.processors.datastructures.GridCacheSemaphoreImpl
org.apache.ignite.internal.processors.datastructures.GridCacheSemaphoreState
-org.apache.ignite.internal.processors.datastructures.GridCacheLockImpl
-org.apache.ignite.internal.processors.datastructures.GridCacheLockState
org.apache.ignite.internal.processors.datastructures.GridCacheSetHeader
org.apache.ignite.internal.processors.datastructures.GridCacheSetHeaderKey
org.apache.ignite.internal.processors.datastructures.GridCacheSetImpl$CollocatedItemKey
@@ -1068,7 +1097,7 @@ org.apache.ignite.internal.processors.igfs.IgfsCommunicationMessage
org.apache.ignite.internal.processors.igfs.IgfsDataManager$3
org.apache.ignite.internal.processors.igfs.IgfsDataManager$4
org.apache.ignite.internal.processors.igfs.IgfsDataManager$5$1
-org.apache.ignite.internal.processors.igfs.IgfsDataManager$7
+org.apache.ignite.internal.processors.igfs.IgfsDataManager$6
org.apache.ignite.internal.processors.igfs.IgfsDataManager$UpdateProcessor
org.apache.ignite.internal.processors.igfs.IgfsDeleteMessage
org.apache.ignite.internal.processors.igfs.IgfsDirectoryInfo
@@ -1095,6 +1124,7 @@ org.apache.ignite.internal.processors.igfs.IgfsListingEntry
org.apache.ignite.internal.processors.igfs.IgfsMetaManager$2
org.apache.ignite.internal.processors.igfs.IgfsMetaManager$3
org.apache.ignite.internal.processors.igfs.IgfsMetricsAdapter
+org.apache.ignite.internal.processors.igfs.IgfsNodePredicate
org.apache.ignite.internal.processors.igfs.IgfsPaths
org.apache.ignite.internal.processors.igfs.IgfsProcessor$1
org.apache.ignite.internal.processors.igfs.IgfsSamplingKey
@@ -1103,9 +1133,26 @@ org.apache.ignite.internal.processors.igfs.IgfsServerManager$1
org.apache.ignite.internal.processors.igfs.IgfsStatus
org.apache.ignite.internal.processors.igfs.IgfsSyncMessage
org.apache.ignite.internal.processors.igfs.IgfsTaskArgsImpl
+org.apache.ignite.internal.processors.igfs.client.IgfsClientAbstractCallable
+org.apache.ignite.internal.processors.igfs.client.IgfsClientAffinityCallable
+org.apache.ignite.internal.processors.igfs.client.IgfsClientDeleteCallable
+org.apache.ignite.internal.processors.igfs.client.IgfsClientExistsCallable
+org.apache.ignite.internal.processors.igfs.client.IgfsClientInfoCallable
+org.apache.ignite.internal.processors.igfs.client.IgfsClientListFilesCallable
+org.apache.ignite.internal.processors.igfs.client.IgfsClientListPathsCallable
+org.apache.ignite.internal.processors.igfs.client.IgfsClientMkdirsCallable
+org.apache.ignite.internal.processors.igfs.client.IgfsClientRenameCallable
+org.apache.ignite.internal.processors.igfs.client.IgfsClientSetTimesCallable
+org.apache.ignite.internal.processors.igfs.client.IgfsClientSizeCallable
+org.apache.ignite.internal.processors.igfs.client.IgfsClientSummaryCallable
+org.apache.ignite.internal.processors.igfs.client.IgfsClientUpdateCallable
+org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaIdsForPathCallable
+org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaInfoForPathCallable
+org.apache.ignite.internal.processors.igfs.data.IgfsDataPutProcessor
org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryCreateProcessor
org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryListingAddProcessor
org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryListingRemoveProcessor
+org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryListingRenameProcessor
org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryListingReplaceProcessor
org.apache.ignite.internal.processors.igfs.meta.IgfsMetaFileCreateProcessor
org.apache.ignite.internal.processors.igfs.meta.IgfsMetaFileLockProcessor
@@ -1123,6 +1170,7 @@ org.apache.ignite.internal.processors.platform.PlatformAbstractPredicate
org.apache.ignite.internal.processors.platform.PlatformEventFilterListener
org.apache.ignite.internal.processors.platform.PlatformException
org.apache.ignite.internal.processors.platform.PlatformExtendedException
+org.apache.ignite.internal.processors.platform.PlatformJavaObjectFactoryProxy
org.apache.ignite.internal.processors.platform.PlatformNativeException
org.apache.ignite.internal.processors.platform.PlatformNoCallbackException
org.apache.ignite.internal.processors.platform.cache.PlatformCache$1
@@ -1260,6 +1308,7 @@ org.apache.ignite.internal.processors.rest.protocols.tcp.GridMemcachedMessage
org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpMemcachedNioListener$1
org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpMemcachedNioListener$2
org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpRestNioListener$1
+org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpRestNioListener$1$1
org.apache.ignite.internal.processors.rest.request.RestQueryRequest$QueryType
org.apache.ignite.internal.processors.service.GridServiceAssignments
org.apache.ignite.internal.processors.service.GridServiceAssignmentsKey
@@ -1272,11 +1321,13 @@ org.apache.ignite.internal.processors.service.GridServiceProcessor$ServiceDeploy
org.apache.ignite.internal.processors.service.GridServiceProcessor$ServiceTopologyCallable
org.apache.ignite.internal.processors.service.GridServiceProxy
org.apache.ignite.internal.processors.service.GridServiceProxy$ServiceProxyCallable
+org.apache.ignite.internal.processors.service.LazyServiceConfiguration
org.apache.ignite.internal.processors.service.ServiceContextImpl
org.apache.ignite.internal.processors.service.ServiceDescriptorImpl
org.apache.ignite.internal.processors.task.GridTaskProcessor$1
org.apache.ignite.internal.processors.task.GridTaskThreadContextKey
org.apache.ignite.internal.processors.task.GridTaskWorker$3
+org.apache.ignite.internal.processors.task.GridTaskWorker$4
org.apache.ignite.internal.processors.task.GridTaskWorker$State
org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException
org.apache.ignite.internal.transactions.IgniteTxOptimisticCheckedException
@@ -1561,6 +1612,8 @@ org.apache.ignite.internal.visor.VisorOneNodeTask
org.apache.ignite.internal.visor.VisorTaskArgument
org.apache.ignite.internal.visor.cache.VisorCache
org.apache.ignite.internal.visor.cache.VisorCacheAffinityConfiguration
+org.apache.ignite.internal.visor.cache.VisorCacheAffinityNodeTask
+org.apache.ignite.internal.visor.cache.VisorCacheAffinityNodeTask$VisorCacheAffinityNodeJob
org.apache.ignite.internal.visor.cache.VisorCacheAggregatedMetrics
org.apache.ignite.internal.visor.cache.VisorCacheClearTask
org.apache.ignite.internal.visor.cache.VisorCacheClearTask$VisorCacheClearCallable
@@ -1583,6 +1636,10 @@ org.apache.ignite.internal.visor.cache.VisorCacheMetricsV2
org.apache.ignite.internal.visor.cache.VisorCacheNearConfiguration
org.apache.ignite.internal.visor.cache.VisorCacheNodesTask
org.apache.ignite.internal.visor.cache.VisorCacheNodesTask$VisorCacheNodesJob
+org.apache.ignite.internal.visor.cache.VisorCachePartition
+org.apache.ignite.internal.visor.cache.VisorCachePartitions
+org.apache.ignite.internal.visor.cache.VisorCachePartitionsTask
+org.apache.ignite.internal.visor.cache.VisorCachePartitionsTask$VisorCachePartitionsJob
org.apache.ignite.internal.visor.cache.VisorCacheQueryConfiguration
org.apache.ignite.internal.visor.cache.VisorCacheQueryConfigurationV2
org.apache.ignite.internal.visor.cache.VisorCacheQueryMetrics
@@ -1604,12 +1661,15 @@ org.apache.ignite.internal.visor.cache.VisorCacheTypeFieldMetadata
org.apache.ignite.internal.visor.cache.VisorCacheTypeMetadata
org.apache.ignite.internal.visor.cache.VisorCacheV2
org.apache.ignite.internal.visor.cache.VisorCacheV3
+org.apache.ignite.internal.visor.cache.VisorCacheV4
org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionsTask
org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionsTask$VisorComputeCancelSessionsJob
org.apache.ignite.internal.visor.compute.VisorComputeResetMetricsTask
org.apache.ignite.internal.visor.compute.VisorComputeResetMetricsTask$VisorComputeResetMetricsJob
org.apache.ignite.internal.visor.compute.VisorComputeToggleMonitoringTask
org.apache.ignite.internal.visor.compute.VisorComputeToggleMonitoringTask$VisorComputeToggleMonitoringJob
+org.apache.ignite.internal.visor.compute.VisorGatewayTask
+org.apache.ignite.internal.visor.compute.VisorGatewayTask$VisorGatewayJob
org.apache.ignite.internal.visor.debug.VisorThreadDumpTask
org.apache.ignite.internal.visor.debug.VisorThreadDumpTask$VisorDumpThreadJob
org.apache.ignite.internal.visor.debug.VisorThreadInfo
@@ -1702,6 +1762,8 @@ org.apache.ignite.internal.visor.util.VisorClusterGroupEmptyException
org.apache.ignite.internal.visor.util.VisorEventMapper
org.apache.ignite.internal.visor.util.VisorExceptionWrapper
org.apache.ignite.internal.visor.util.VisorTaskUtils$4
+org.apache.ignite.internal.websession.WebSessionAttributeProcessor
+org.apache.ignite.internal.websession.WebSessionEntity
org.apache.ignite.lang.IgniteBiClosure
org.apache.ignite.lang.IgniteBiInClosure
org.apache.ignite.lang.IgniteBiPredicate
@@ -1807,6 +1869,7 @@ org.apache.ignite.stream.StreamTransformer$1
org.apache.ignite.stream.StreamVisitor
org.apache.ignite.stream.StreamVisitor$1
org.apache.ignite.transactions.TransactionConcurrency
+org.apache.ignite.transactions.TransactionDeadlockException
org.apache.ignite.transactions.TransactionHeuristicException
org.apache.ignite.transactions.TransactionIsolation
org.apache.ignite.transactions.TransactionMetrics
[02/50] [abbrv] ignite git commit: IGNITE-2879: ODBC: Added decimal
support.
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/common/src/common/big_integer.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/src/common/big_integer.cpp b/modules/platforms/cpp/common/src/common/big_integer.cpp
new file mode 100644
index 0000000..475ddc6
--- /dev/null
+++ b/modules/platforms/cpp/common/src/common/big_integer.cpp
@@ -0,0 +1,830 @@
+/*
+ * 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.
+ */
+
+#include "ignite/ignite_error.h"
+#include "ignite/common/bits.h"
+#include "ignite/common/big_integer.h"
+
+namespace ignite
+{
+ namespace common
+ {
+ BigInteger::BigInteger() :
+ sign(1),
+ mag()
+ {
+ // No-op.
+ }
+
+ BigInteger::BigInteger(int64_t val) :
+ sign(1),
+ mag()
+ {
+ AssignInt64(val);
+ }
+
+ BigInteger::BigInteger(const char* val, int32_t len) :
+ sign(1),
+ mag()
+ {
+ AssignString(val, len);
+ }
+
+ BigInteger::BigInteger(const BigInteger& other) :
+ sign(other.sign),
+ mag(other.mag)
+ {
+ // No-op.
+ }
+
+ BigInteger::BigInteger(const int8_t* val, int32_t len, int32_t sign, bool bigEndian) :
+ sign(sign),
+ mag()
+ {
+ assert(val != 0);
+ assert(len > 0);
+ assert(sign == 1 || sign == 0 || sign == -1);
+ assert(val[0] != 0);
+
+ if (bigEndian)
+ {
+ int32_t firstNonZero = 0;
+ while (firstNonZero < len && val[firstNonZero] == 0)
+ ++firstNonZero;
+
+ int32_t intLength = (len - firstNonZero + 3) / 4;
+
+ mag.Resize(intLength);
+
+ int32_t b = len - 1;
+
+ for (int32_t i = 0; i < intLength - 1; ++i)
+ {
+ mag[i] = (val[b] & 0xFFUL)
+ | ((val[b - 1] & 0xFFUL) << 8)
+ | ((val[b - 2] & 0xFFUL) << 16)
+ | ((val[b - 3] & 0xFFUL) << 24);
+
+ b -= 4;
+ }
+
+ int32_t bytesRemaining = b - firstNonZero + 1;
+
+ assert(bytesRemaining > 0 && bytesRemaining <= 4);
+
+ switch (bytesRemaining)
+ {
+ case 4:
+ mag[intLength - 1] |= (val[b - 3] & 0xFF) << 24;
+
+ case 3:
+ mag[intLength - 1] |= (val[b - 2] & 0xFF) << 16;
+
+ case 2:
+ mag[intLength - 1] |= (val[b - 1] & 0xFF) << 8;
+
+ case 1:
+ mag[intLength - 1] |= val[b] & 0xFF;
+
+ default:
+ break;
+ }
+ }
+ else
+ {
+ int32_t firstNonZero = len - 1;
+ while (firstNonZero >= 0 && val[firstNonZero] == 0)
+ --firstNonZero;
+
+ int32_t intLength = (firstNonZero + 4) / 4;
+
+ mag.Resize(intLength);
+
+ int32_t b = 0;
+
+ for (int32_t i = 0; i < intLength - 1; ++i)
+ {
+ mag[i] = (val[b] & 0xFFUL)
+ | ((val[b + 1] & 0xFFUL) << 8)
+ | ((val[b + 2] & 0xFFUL) << 16)
+ | ((val[b + 3] & 0xFFUL) << 24);
+
+ b += 4;
+ }
+
+ int32_t bytesRemaining = firstNonZero - b + 1;
+
+ assert(bytesRemaining > 0 && bytesRemaining <= 4);
+
+ switch (bytesRemaining)
+ {
+ case 4:
+ mag[intLength - 1] |= (val[b + 3] & 0xFF) << 24;
+
+ case 3:
+ mag[intLength - 1] |= (val[b + 2] & 0xFF) << 16;
+
+ case 2:
+ mag[intLength - 1] |= (val[b + 1] & 0xFF) << 8;
+
+ case 1:
+ mag[intLength - 1] |= val[b] & 0xFF;
+
+ default:
+ break;
+ }
+ }
+ }
+
+ BigInteger::BigInteger(MagArray &mag, int8_t sign) :
+ sign(sign),
+ mag()
+ {
+ this->mag.Swap(mag);
+ }
+
+ BigInteger& BigInteger::operator=(const BigInteger& other)
+ {
+ Assign(other);
+
+ return *this;
+ }
+
+ void BigInteger::Assign(const BigInteger& val)
+ {
+ if (this != &val)
+ {
+ sign = val.sign;
+ mag = val.mag;
+ }
+ }
+
+ void BigInteger::AssignInt64(int64_t val)
+ {
+ if (val < 0)
+ {
+ AssignUint64(static_cast<uint64_t>(-val));
+
+ sign = -1;
+ }
+ else
+ AssignUint64(static_cast<uint64_t>(val));
+ }
+
+ void BigInteger::AssignString(const char* val, int32_t len)
+ {
+ std::stringstream converter;
+
+ converter.write(val, len);
+
+ converter >> *this;
+ }
+
+ void BigInteger::AssignUint64(uint64_t val)
+ {
+ sign = 1;
+
+ if (val == 0)
+ {
+ mag.Clear();
+
+ return;
+ }
+
+ uint32_t highWord = static_cast<uint32_t>(val >> 32);
+
+ if (highWord == 0)
+ mag.Resize(1);
+ else
+ {
+ mag.Resize(2);
+ mag[1] = highWord;
+ }
+
+ mag[0] = static_cast<uint32_t>(val);
+ }
+
+ int8_t BigInteger::GetSign() const
+ {
+ return sign;
+ }
+
+ void BigInteger::Swap(BigInteger& other)
+ {
+ using std::swap;
+
+ swap(sign, other.sign);
+ mag.Swap(other.mag);
+ }
+
+ const BigInteger::MagArray& BigInteger::GetMagnitude() const
+ {
+ return mag;
+ }
+
+ uint32_t BigInteger::GetBitLength() const
+ {
+ if (mag.IsEmpty())
+ return 0;
+
+ int32_t res = bits::BitLengthU32(mag[mag.GetSize() - 1]);
+
+ if (mag.GetSize() > 1)
+ res += (mag.GetSize() - 1) * 32;
+
+ return res;
+ }
+
+ int32_t BigInteger::GetPrecision() const
+ {
+ // See http://graphics.stanford.edu/~seander/bithacks.html
+ // for the details on the algorithm.
+
+ if (mag.GetSize() == 0)
+ return 1;
+
+ int32_t r = static_cast<uint32_t>(((
+ static_cast<uint64_t>(GetBitLength()) + 1) * 646456993ULL) >> 31);
+
+ BigInteger prec;
+ BigInteger::GetPowerOfTen(r, prec);
+
+ return Compare(prec, true) < 0 ? r : r + 1;
+ }
+
+ void BigInteger::MagnitudeToBytes(common::FixedSizeArray<int8_t>& buffer) const
+ {
+ int32_t bytesNum = static_cast<int32_t>((GetBitLength() + 7) / 8);
+
+ buffer.Reset(bytesNum);
+
+ int32_t i;
+ for (i = 0; i < mag.GetSize() - 1; ++i)
+ {
+ int32_t j = bytesNum - 1 - 4 * i;
+
+ buffer[j] = static_cast<int8_t>(mag[i]);
+ buffer[j - 1] = static_cast<int8_t>(mag[i] >> 8);
+ buffer[j - 2] = static_cast<int8_t>(mag[i] >> 16);
+ buffer[j - 3] = static_cast<int8_t>(mag[i] >> 24);
+ }
+
+ int32_t bytesRemaining = bytesNum - 4 * i;
+
+ assert(bytesRemaining >= 0 && bytesRemaining <= 4);
+
+ i = 0;
+ switch (bytesRemaining)
+ {
+ case 4:
+ buffer[i++] |= static_cast<int8_t>(mag[mag.GetSize() - 1] >> 24);
+
+ case 3:
+ buffer[i++] |= static_cast<int8_t>(mag[mag.GetSize() - 1] >> 16);
+
+ case 2:
+ buffer[i++] |= static_cast<int8_t>(mag[mag.GetSize() - 1] >> 8);
+
+ case 1:
+ buffer[i++] |= static_cast<int8_t>(mag[mag.GetSize() - 1]);
+
+ default:
+ break;
+ }
+ }
+
+ void BigInteger::Pow(int32_t exp)
+ {
+ if (exp < 0)
+ {
+ AssignInt64(0);
+
+ return;
+ }
+
+ uint32_t bitsLen = GetBitLength();
+
+ if (!bitsLen)
+ return;
+
+ if (bitsLen == 1)
+ {
+ if ((exp % 2 == 0) && sign < 0)
+ sign = -sign;
+
+ return;
+ }
+
+ BigInteger multiplicant(*this);
+ AssignInt64(1);
+
+ int32_t mutExp = exp;
+ while (mutExp)
+ {
+ if (mutExp & 1)
+ Multiply(multiplicant, *this);
+
+ mutExp >>= 1;
+
+ if (mutExp)
+ multiplicant.Multiply(multiplicant, multiplicant);
+ }
+ }
+
+ void BigInteger::Multiply(const BigInteger& other, BigInteger& res) const
+ {
+ MagArray resMag(mag.GetSize() + other.mag.GetSize());
+
+ resMag.Resize(mag.GetSize() + other.mag.GetSize());
+
+ for (int32_t i = 0; i < other.mag.GetSize(); ++i)
+ {
+ uint32_t carry = 0;
+
+ for (int32_t j = 0; j < mag.GetSize(); ++j)
+ {
+ uint64_t product = static_cast<uint64_t>(mag[j]) * other.mag[i] +
+ + resMag[i + j] + carry;
+
+ resMag[i + j] = static_cast<uint32_t>(product);
+ carry = static_cast<uint32_t>(product >> 32);
+ }
+
+ resMag[i + mag.GetSize()] = carry;
+ }
+
+ res.mag.Swap(resMag);
+ res.sign = sign * other.sign;
+
+ res.Normalize();
+ }
+
+ /**
+ * Shift magnitude left by the specified number of bits.
+ *
+ * @param in Input magnitude.
+ * @param len Magnitude length.
+ * @param out Output magnitude. Should be not shorter than the input
+ * magnitude.
+ * @param n Number of bits to shift to.
+ */
+ void ShiftLeft(const uint32_t* in, int32_t len, uint32_t* out, unsigned n)
+ {
+ assert(n < 32);
+
+ if (n == 0)
+ {
+ std::copy(in, in + len, out);
+
+ return;
+ }
+
+ for (int32_t i = len - 1; i > 0; --i)
+ out[i] = (in[i] << n) | (in[i - 1] >> (32 - n));
+
+ out[0] = in[0] << n;
+ }
+
+ /**
+ * Shift magnitude right by the specified number of bits.
+ *
+ * @param in Input magnitude.
+ * @param len Magnitude length.
+ * @param out Output magnitude. Should be not shorter than the input
+ * magnitude.
+ * @param n Number of bits to shift to.
+ */
+ void ShiftRight(const uint32_t* in, int32_t len, uint32_t* out, unsigned n)
+ {
+ assert(n < 32);
+
+ if (n == 0)
+ {
+ std::copy(in, in + len, out);
+
+ return;
+ }
+
+ for (int32_t i = 0; i < len - 1; ++i)
+ out[i] = (in[i] >> n) | (in[i + 1] << (32 - n));
+
+ out[len - 1] = in[len - 1] >> n;
+ }
+
+ /**
+ * Part of the division algorithm. Computes q - (a * x).
+ *
+ * @param q Minuend.
+ * @param a Multipliplier of the subtrahend.
+ * @param alen Length of the a.
+ * @param x Multipliplicand of the subtrahend.
+ * @return Carry.
+ */
+ uint32_t MultiplyAndSubstruct(uint32_t* q, const uint32_t* a, int32_t alen, uint32_t x)
+ {
+ uint64_t carry = 0;
+
+ for (int32_t i = 0; i < alen; ++i)
+ {
+ uint64_t product = a[i] * static_cast<uint64_t>(x);
+ int64_t difference = q[i] - carry - (product & 0xFFFFFFFF);
+
+ q[i] = static_cast<uint32_t>(difference);
+
+ // This will add one if difference is negative.
+ carry = (product >> 32) - (difference >> 32);
+ }
+
+ return static_cast<uint32_t>(carry);
+ }
+
+ /**
+ * Add two magnitude arrays and return carry.
+ *
+ * @param res First addend. Result is placed here. Length of this addend
+ * should be equal or greater than len.
+ * @param addend Second addend.
+ * @param len Length of the second addend.
+ * @return Carry.
+ */
+ uint32_t Add(uint32_t* res, const uint32_t* addend, int32_t len)
+ {
+ uint64_t carry = 0;
+
+ for (int32_t i = 0; i < len; ++i)
+ {
+ uint64_t sum = static_cast<uint64_t>(res[i]) + addend[i] + carry;
+ res[i] = static_cast<uint32_t>(sum);
+ carry = sum >> 32;
+ }
+
+ return static_cast<uint32_t>(carry);
+ }
+
+ /**
+ * Add single number to a magnitude array and return carry.
+ *
+ * @param res First addend. Result is placed here. Length of this addend
+ * should be equal or greater than len.
+ * @param len Length of the First addend.
+ * @param addend Second addend.
+ * @return Carry.
+ */
+ uint32_t Add(uint32_t* res, int32_t len, uint32_t addend)
+ {
+ uint64_t carry = addend;
+
+ for (int32_t i = 0; (i < len) && carry; ++i)
+ {
+ uint64_t sum = static_cast<uint64_t>(res[i]) + carry;
+ res[i] = static_cast<uint32_t>(sum);
+ carry = sum >> 32;
+ }
+
+ return static_cast<uint32_t>(carry);
+ }
+
+ void BigInteger::Divide(const BigInteger& divisor, BigInteger& res) const
+ {
+ Divide(divisor, res, 0);
+ }
+
+ void BigInteger::Divide(const BigInteger& divisor, BigInteger& res, BigInteger& rem) const
+ {
+ Divide(divisor, res, &rem);
+ }
+
+ void BigInteger::Add(const uint32_t* addend, int32_t len)
+ {
+ if (mag.GetSize() < len)
+ {
+ mag.Reserve(len + 1);
+
+ mag.Resize(len);
+ }
+ else
+ mag.Reserve(mag.GetSize() + 1);
+
+ uint32_t carry = common::Add(mag.GetData(), addend, len);
+
+ if (carry)
+ {
+ carry = common::Add(mag.GetData() + len, mag.GetSize() - len, carry);
+
+ if (carry)
+ mag.PushBack(carry);
+ }
+ }
+
+ void BigInteger::Add(uint64_t x)
+ {
+ if (x == 0)
+ return;
+
+ if (IsZero())
+ {
+ AssignUint64(x);
+
+ return;
+ }
+
+ uint32_t val[2];
+
+ val[0] = static_cast<uint32_t>(x);
+ val[1] = static_cast<uint32_t>(x >> 32);
+
+ Add(val, val[1] ? 2 : 1);
+ }
+
+ int32_t BigInteger::Compare(const BigInteger& other, bool ignoreSign) const
+ {
+ // What we should return if magnitude is greater.
+ int32_t mgt = 1;
+
+ if (!ignoreSign)
+ {
+ if (sign != other.sign)
+ return sign > other.sign ? 1 : -1;
+ else
+ mgt = sign;
+ }
+
+ if (mag.GetSize() != other.mag.GetSize())
+ return mag.GetSize() > other.mag.GetSize() ? mgt : -mgt;
+
+ for (int32_t i = mag.GetSize() - 1; i >= 0; --i)
+ {
+ if (mag[i] == other.mag[i])
+ continue;
+ else if (mag[i] > other.mag[i])
+ return mgt;
+ else
+ return -mgt;
+ }
+
+ return 0;
+ }
+
+ int64_t BigInteger::ToInt64() const
+ {
+ return (static_cast<uint64_t>(GetMagInt(1)) << 32) | GetMagInt(0);
+ }
+
+ void BigInteger::GetPowerOfTen(int32_t pow, BigInteger& res)
+ {
+ using namespace common;
+
+ assert(pow >= 0);
+
+ if (pow < bits::UINT64_MAX_PRECISION)
+ {
+ res.AssignUint64(bits::TenPowerU64(pow));
+
+ return;
+ }
+
+ res.AssignInt64(10);
+ res.Pow(pow);
+ }
+
+ uint32_t BigInteger::GetMagInt(int32_t n) const
+ {
+ assert(n >= 0);
+
+ if (n >= mag.GetSize())
+ return sign > 0 ? 0 : -1;
+
+ return sign * mag[n];
+ }
+
+ void BigInteger::Divide(const BigInteger& divisor, BigInteger& res, BigInteger* rem) const
+ {
+ // Can't divide by zero.
+ if (divisor.mag.IsEmpty())
+ throw IgniteError(IgniteError::IGNITE_ERR_ILLEGAL_ARGUMENT, "Division by zero.");
+
+ int32_t compRes = Compare(divisor, true);
+
+ int8_t resSign = sign * divisor.sign;
+
+ // The same magnitude. Result is [-]1 and remainder is zero.
+ if (compRes == 0)
+ {
+ res.AssignInt64(resSign);
+
+ if (rem)
+ rem->AssignInt64(0);
+
+ return;
+ }
+
+ // Divisor is greater than this. Result is 0 and remainder is this.
+ if (compRes == -1)
+ {
+ // Order is important here! Copy to rem first to handle the case
+ // when &res == this.
+ if (rem)
+ rem->Assign(*this);
+
+ res.AssignInt64(0);
+
+ return;
+ }
+
+ // If divisor is [-]1 result is [-]this and remainder is zero.
+ if (divisor.GetBitLength() == 1)
+ {
+ // Once again: order is important.
+ res.Assign(*this);
+ res.sign = sign * divisor.sign;
+
+ if (rem)
+ rem->AssignInt64(0);
+
+ return;
+ }
+
+ // Trivial case.
+ if (mag.GetSize() <= 2)
+ {
+ uint64_t u = mag[0];
+ uint64_t v = divisor.mag[0];
+
+ if (mag.GetSize() == 2)
+ u |= static_cast<uint64_t>(mag[1]) << 32;
+
+ if (divisor.mag.GetSize() == 2)
+ v |= static_cast<uint64_t>(divisor.mag[1]) << 32;
+
+ // Divisor can not be 1, or 0.
+ assert(v > 1);
+
+ // It should also be less than dividend.
+ assert(v < u);
+
+ // (u / v) is always fits into int64_t because abs(v) >= 2.
+ res.AssignInt64(resSign * static_cast<int64_t>(u / v));
+
+ // (u % v) is always fits into int64_t because (u > v) ->
+ // (u % v) < (u / 2).
+ if (rem)
+ rem->AssignInt64(resSign * static_cast<int64_t>(u % v));
+
+ return;
+ }
+
+ // Using Knuth division algorithm D for common case.
+
+ // Short aliases.
+ const MagArray& u = mag;
+ const MagArray& v = divisor.mag;
+ MagArray& q = res.mag;
+ int32_t ulen = u.GetSize();
+ int32_t vlen = v.GetSize();
+
+ // First we need to normilize divisor.
+ MagArray nv;
+ nv.Resize(v.GetSize());
+
+ int32_t shift = bits::NumberOfLeadingZerosU32(v.Back());
+ ShiftLeft(v.GetData(), vlen, nv.GetData(), shift);
+
+ // Divisor is normilized. Now we need to normilize divident.
+ MagArray nu;
+
+ // First find out what is the size of it.
+ if (bits::NumberOfLeadingZerosU32(u.Back()) >= shift)
+ {
+ // Everything is the same as with divisor. Just add leading zero.
+ nu.Resize(ulen + 1);
+
+ ShiftLeft(u.GetData(), ulen, nu.GetData(), shift);
+
+ assert((static_cast<uint64_t>(u.Back()) >> (32 - shift)) == 0);
+ }
+ else
+ {
+ // We need one more byte here. Also adding leading zero.
+ nu.Resize(ulen + 2);
+
+ ShiftLeft(u.GetData(), ulen, nu.GetData(), shift);
+
+ nu[ulen] = u[ulen - 1] >> (32 - shift);
+
+ assert(nu[ulen] != 0);
+ }
+
+ assert(nu.Back() == 0);
+
+ // Resizing resulting array.
+ q.Resize(ulen - vlen + 1);
+
+ // Main loop
+ for (int32_t i = ulen - vlen; i >= 0; --i)
+ {
+ uint64_t base = bits::MakeU64(nu[i + vlen], nu[i + vlen - 1]);
+
+ uint64_t qhat = base / nv[vlen - 1]; // Estimated quotient.
+ uint64_t rhat = base % nv[vlen - 1]; // A remainder.
+
+ // Adjusting result if needed.
+ while (qhat > UINT32_MAX ||
+ ((qhat * nv[vlen - 2]) > ((UINT32_MAX + 1ULL) * rhat + nu[i + vlen - 2])))
+ {
+ --qhat;
+ rhat += nv[vlen - 1];
+
+ if (rhat > UINT32_MAX)
+ break;
+ }
+
+ uint32_t qhat32 = static_cast<uint32_t>(qhat);
+
+ // Multiply and subtract.
+ uint32_t carry = MultiplyAndSubstruct(nu.GetData() + i, nv.GetData(), vlen, qhat32);
+
+ int64_t difference = nu[i + vlen] - carry;
+
+ nu[i + vlen] = static_cast<uint32_t>(difference);
+
+ if (difference < 0)
+ {
+ --qhat32;
+ carry = common::Add(nu.GetData() + i, nv.GetData(), vlen);
+
+ assert(carry == 0);
+ }
+
+ q[i] = qhat32;
+ }
+
+ res.sign = resSign;
+ res.Normalize();
+
+ // If remainder is needed unnormolize it.
+ if (rem)
+ {
+ rem->sign = resSign;
+ rem->mag.Resize(vlen);
+
+ ShiftRight(nu.GetData(), rem->mag.GetSize(), rem->mag.GetData(), shift);
+
+ rem->Normalize();
+ }
+ }
+
+ void BigInteger::Normalize()
+ {
+ int32_t lastNonZero = mag.GetSize() - 1;
+ while (lastNonZero >= 0 && mag[lastNonZero] == 0)
+ --lastNonZero;
+
+ mag.Resize(lastNonZero + 1);
+ }
+
+ bool operator==(const BigInteger& val1, const BigInteger& val2)
+ {
+ return val1.Compare(val2) == 0;
+ }
+
+ bool operator!=(const BigInteger& val1, const BigInteger& val2)
+ {
+ return val1.Compare(val2) != 0;
+ }
+
+ bool operator<(const BigInteger& val1, const BigInteger& val2)
+ {
+ return val1.Compare(val2) < 0;
+ }
+
+ bool operator<=(const BigInteger& val1, const BigInteger& val2)
+ {
+ return val1.Compare(val2) <= 0;
+ }
+
+ bool operator>(const BigInteger& val1, const BigInteger& val2)
+ {
+ return val1.Compare(val2) > 0;
+ }
+
+ bool operator>=(const BigInteger& val1, const BigInteger& val2)
+ {
+ return val1.Compare(val2) >= 0;
+ }
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/common/src/common/bits.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/src/common/bits.cpp b/modules/platforms/cpp/common/src/common/bits.cpp
new file mode 100644
index 0000000..93f2221
--- /dev/null
+++ b/modules/platforms/cpp/common/src/common/bits.cpp
@@ -0,0 +1,233 @@
+/*
+ * 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.
+ */
+
+#include <algorithm>
+#include <cassert>
+
+#include "ignite/common/bits.h"
+
+namespace ignite
+{
+ namespace common
+ {
+ namespace bits
+ {
+ int32_t NumberOfTrailingZerosI32(int32_t i)
+ {
+ int32_t y;
+
+ if (i == 0) return 32;
+
+ int32_t n = 31;
+
+ y = i << 16;
+
+ if (y != 0) {
+ n = n - 16;
+ i = y;
+ }
+
+ y = i << 8;
+
+ if (y != 0) {
+ n = n - 8;
+ i = y;
+ }
+
+ y = i << 4;
+
+ if (y != 0) {
+ n = n - 4;
+ i = y;
+ }
+
+ y = i << 2;
+
+ if (y != 0) {
+ n = n - 2;
+ i = y;
+ }
+
+ return n - static_cast<int32_t>(static_cast<uint32_t>(i << 1) >> 31);
+ }
+
+ int32_t NumberOfLeadingZerosI32(int32_t i)
+ {
+ return NumberOfLeadingZerosU32(static_cast<uint32_t>(i));
+ }
+
+ int32_t NumberOfLeadingZerosU32(uint32_t i)
+ {
+ if (i == 0)
+ return 32;
+
+ int32_t n = 1;
+
+ if (i >> 16 == 0) {
+ n += 16;
+ i <<= 16;
+ }
+
+ if (i >> 24 == 0) {
+ n += 8;
+ i <<= 8;
+ }
+
+ if (i >> 28 == 0) {
+ n += 4;
+ i <<= 4;
+ }
+
+ if (i >> 30 == 0) {
+ n += 2;
+ i <<= 2;
+ }
+
+ return n - static_cast<int32_t>(i >> 31);
+ }
+
+ int32_t NumberOfLeadingZerosI64(int64_t i)
+ {
+ return NumberOfLeadingZerosU64(static_cast<uint64_t>(i));
+ }
+
+ int32_t NumberOfLeadingZerosU64(uint64_t i)
+ {
+ if (i == 0)
+ return 64;
+
+ int32_t n = 1;
+
+ uint32_t x = static_cast<uint32_t>(i >> 32);
+
+ if (x == 0) {
+ n += 32;
+ x = static_cast<uint32_t>(i);
+ }
+
+ if (x >> 16 == 0) {
+ n += 16;
+ x <<= 16;
+ }
+
+ if (x >> 24 == 0) {
+ n += 8;
+ x <<= 8;
+ }
+
+ if (x >> 28 == 0) {
+ n += 4;
+ x <<= 4;
+ }
+
+ if (x >> 30 == 0) {
+ n += 2;
+ x <<= 2;
+ }
+
+ n -= x >> 31;
+
+ return n;
+ }
+
+ int32_t BitCountI32(int32_t i)
+ {
+ uint32_t ui = static_cast<uint32_t>(i);
+
+ ui -= (ui >> 1) & 0x55555555;
+ ui = (ui & 0x33333333) + ((ui >> 2) & 0x33333333);
+ ui = (ui + (ui >> 4)) & 0x0f0f0f0f;
+ ui += ui >> 8;
+ ui += ui >> 16;
+
+ return static_cast<int32_t>(ui & 0x3f);
+ }
+
+ int32_t BitLengthI32(int32_t i)
+ {
+ return 32 - NumberOfLeadingZerosI32(i);
+ }
+
+ int32_t BitLengthU32(uint32_t i)
+ {
+ return 32 - NumberOfLeadingZerosU32(i);
+ }
+
+ int32_t GetCapasityForSize(int32_t size)
+ {
+ assert(size > 0);
+
+ if (size <= 8)
+ return 8;
+
+ int32_t bl = BitLengthI32(size);
+
+ if (bl > 30)
+ return INT32_MAX;
+
+ int32_t res = 1 << bl;
+
+ return size > res ? res << 1 : res;
+ }
+
+ int32_t DigitLength(uint64_t x)
+ {
+ // See http://graphics.stanford.edu/~seander/bithacks.html
+ // for the details on the algorithm.
+
+ if (x < 10)
+ return 1;
+
+ int32_t r = ((64 - NumberOfLeadingZerosU64(x) + 1) * 1233) >> 12;
+
+ assert(r <= UINT64_MAX_PRECISION);
+
+ return (r == UINT64_MAX_PRECISION || x < TenPowerU64(r)) ? r : r + 1;
+ }
+
+ uint64_t TenPowerU64(int32_t n)
+ {
+ static const uint64_t TEN_POWERS_TABLE[UINT64_MAX_PRECISION] = {
+ 1ULL, // 0 / 10^0
+ 10ULL, // 1 / 10^1
+ 100ULL, // 2 / 10^2
+ 1000ULL, // 3 / 10^3
+ 10000ULL, // 4 / 10^4
+ 100000ULL, // 5 / 10^5
+ 1000000ULL, // 6 / 10^6
+ 10000000ULL, // 7 / 10^7
+ 100000000ULL, // 8 / 10^8
+ 1000000000ULL, // 9 / 10^9
+ 10000000000ULL, // 10 / 10^10
+ 100000000000ULL, // 11 / 10^11
+ 1000000000000ULL, // 12 / 10^12
+ 10000000000000ULL, // 13 / 10^13
+ 100000000000000ULL, // 14 / 10^14
+ 1000000000000000ULL, // 15 / 10^15
+ 10000000000000000ULL, // 16 / 10^16
+ 100000000000000000ULL, // 17 / 10^17
+ 1000000000000000000ULL, // 18 / 10^18
+ 10000000000000000000ULL // 19 / 10^19
+ };
+
+ assert(n >= 0 && n < UINT64_MAX_PRECISION);
+
+ return TEN_POWERS_TABLE[n];
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/core-test/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/Makefile.am b/modules/platforms/cpp/core-test/Makefile.am
index d1f4ca5..7a62e8e 100644
--- a/modules/platforms/cpp/core-test/Makefile.am
+++ b/modules/platforms/cpp/core-test/Makefile.am
@@ -47,6 +47,7 @@ ignite_tests_LDFLAGS = \
-static-libtool-libs
ignite_tests_SOURCES = \
+ src/bits_test.cpp \
src/cache_test.cpp \
src/cache_query_test.cpp \
src/concurrent_test.cpp \
@@ -58,6 +59,9 @@ ignite_tests_SOURCES = \
src/binary_reader_writer_raw_test.cpp \
src/binary_reader_writer_test.cpp \
src/binary_session_test.cpp \
+ src/decimal_test.cpp \
+ src/dynamic_size_array_test.cpp \
+ src/fixed_size_array_test.cpp \
src/transactions_test.cpp \
src/teamcity_messages.cpp \
src/teamcity_boost.cpp
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj b/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj
index edf87ba..acdfee0 100644
--- a/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj
+++ b/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj
@@ -22,6 +22,9 @@
<ProjectReference Include="..\..\..\binary\project\vs\binary.vcxproj">
<Project>{4f15669b-92eb-49f0-b774-8f19bae0b960}</Project>
</ProjectReference>
+ <ProjectReference Include="..\..\..\common\project\vs\common.vcxproj">
+ <Project>{b63f2e01-5157-4719-8491-0e1c7cd3b701}</Project>
+ </ProjectReference>
<ProjectReference Include="..\..\..\core\project\vs\core.vcxproj">
<Project>{e2dea693-f2ea-43c2-a813-053378f6e4db}</Project>
</ProjectReference>
@@ -36,6 +39,9 @@
<ItemGroup>
<ClCompile Include="..\..\src\cache_test.cpp" />
<ClCompile Include="..\..\src\concurrent_test.cpp" />
+ <ClCompile Include="..\..\src\decimal_test.cpp" />
+ <ClCompile Include="..\..\src\dynamic_size_array_test.cpp" />
+ <ClCompile Include="..\..\src\fixed_size_array_test.cpp" />
<ClCompile Include="..\..\src\ignite_error_test.cpp" />
<ClCompile Include="..\..\src\ignition_test.cpp" />
<ClCompile Include="..\..\src\handle_registry_test.cpp" />
@@ -45,6 +51,7 @@
<ClCompile Include="..\..\src\binary_test_defs.cpp" />
<ClCompile Include="..\..\src\cache_query_test.cpp" />
<ClCompile Include="..\..\src\interop_memory_test.cpp" />
+ <ClCompile Include="..\..\src\bits_test.cpp" />
<ClCompile Include="..\..\src\teamcity_boost.cpp" />
<ClCompile Include="..\..\src\teamcity_messages.cpp" />
<ClCompile Include="..\..\src\transactions_test.cpp" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters b/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters
index 2259f4c..0366374 100644
--- a/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters
+++ b/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters
@@ -43,6 +43,18 @@
<ClCompile Include="..\..\src\transactions_test.cpp">
<Filter>Code</Filter>
</ClCompile>
+ <ClCompile Include="..\..\src\bits_test.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\decimal_test.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\fixed_size_array_test.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\dynamic_size_array_test.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\teamcity_messages.h">
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/core-test/src/bits_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/bits_test.cpp b/modules/platforms/cpp/core-test/src/bits_test.cpp
new file mode 100644
index 0000000..3aadf36
--- /dev/null
+++ b/modules/platforms/cpp/core-test/src/bits_test.cpp
@@ -0,0 +1,124 @@
+/*
+ * 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.
+ */
+
+#ifndef _MSC_VER
+# define BOOST_TEST_DYN_LINK
+#endif
+
+#include <boost/test/unit_test.hpp>
+
+#include <ignite/common/bits.h>
+
+using namespace ignite;
+using namespace ignite::common::bits;
+
+BOOST_AUTO_TEST_SUITE(BitsTestSuite)
+
+BOOST_AUTO_TEST_CASE(TestNumberOfLeadingZeroes)
+{
+ BOOST_CHECK_EQUAL(32, NumberOfLeadingZerosI32(0));
+
+ BOOST_CHECK_EQUAL(31, NumberOfLeadingZerosI32(1));
+
+ BOOST_CHECK_EQUAL(30, NumberOfLeadingZerosI32(2));
+ BOOST_CHECK_EQUAL(30, NumberOfLeadingZerosI32(3));
+
+ BOOST_CHECK_EQUAL(29, NumberOfLeadingZerosI32(4));
+ BOOST_CHECK_EQUAL(29, NumberOfLeadingZerosI32(5));
+ BOOST_CHECK_EQUAL(29, NumberOfLeadingZerosI32(7));
+
+ BOOST_CHECK_EQUAL(28, NumberOfLeadingZerosI32(8));
+ BOOST_CHECK_EQUAL(28, NumberOfLeadingZerosI32(12));
+ BOOST_CHECK_EQUAL(28, NumberOfLeadingZerosI32(15));
+
+ BOOST_CHECK_EQUAL(0, NumberOfLeadingZerosI32(0xFFFFFFFF));
+ BOOST_CHECK_EQUAL(0, NumberOfLeadingZerosI32(0x80000000));
+
+ BOOST_CHECK_EQUAL(1, NumberOfLeadingZerosI32(0x7FFFFFFF));
+ BOOST_CHECK_EQUAL(1, NumberOfLeadingZerosI32(0x40000000));
+
+ BOOST_CHECK_EQUAL(8, NumberOfLeadingZerosI32(0x00FFFFFF));
+ BOOST_CHECK_EQUAL(8, NumberOfLeadingZerosI32(0x00F00000));
+ BOOST_CHECK_EQUAL(8, NumberOfLeadingZerosI32(0x00800000));
+
+ BOOST_CHECK_EQUAL(9, NumberOfLeadingZerosI32(0x00700000));
+ BOOST_CHECK_EQUAL(9, NumberOfLeadingZerosI32(0x00400000));
+ BOOST_CHECK_EQUAL(9, NumberOfLeadingZerosI32(0x006C0395));
+}
+
+BOOST_AUTO_TEST_CASE(TestNumberOfTrailingZeroes)
+{
+ BOOST_CHECK_EQUAL(0, NumberOfTrailingZerosI32(1));
+ BOOST_CHECK_EQUAL(0, NumberOfTrailingZerosI32(3));
+ BOOST_CHECK_EQUAL(0, NumberOfTrailingZerosI32(5));
+ BOOST_CHECK_EQUAL(0, NumberOfTrailingZerosI32(7));
+ BOOST_CHECK_EQUAL(0, NumberOfTrailingZerosI32(15));
+ BOOST_CHECK_EQUAL(0, NumberOfTrailingZerosI32(0xFFFFFFFF));
+ BOOST_CHECK_EQUAL(0, NumberOfTrailingZerosI32(0x7FFFFFFF));
+ BOOST_CHECK_EQUAL(0, NumberOfTrailingZerosI32(0x00FFFFFF));
+ BOOST_CHECK_EQUAL(0, NumberOfTrailingZerosI32(0x006C0395));
+
+ BOOST_CHECK_EQUAL(1, NumberOfTrailingZerosI32(2));
+
+ BOOST_CHECK_EQUAL(2, NumberOfTrailingZerosI32(4));
+ BOOST_CHECK_EQUAL(2, NumberOfTrailingZerosI32(12));
+
+ BOOST_CHECK_EQUAL(3, NumberOfTrailingZerosI32(8));
+
+ BOOST_CHECK_EQUAL(20, NumberOfTrailingZerosI32(0xFFF00000));
+ BOOST_CHECK_EQUAL(20, NumberOfTrailingZerosI32(0x00F00000));
+ BOOST_CHECK_EQUAL(20, NumberOfTrailingZerosI32(0x00700000));
+ BOOST_CHECK_EQUAL(20, NumberOfTrailingZerosI32(0x80700000));
+
+ BOOST_CHECK_EQUAL(22, NumberOfTrailingZerosI32(0x00400000));
+ BOOST_CHECK_EQUAL(22, NumberOfTrailingZerosI32(0x80400000));
+ BOOST_CHECK_EQUAL(22, NumberOfTrailingZerosI32(0x10400000));
+
+ BOOST_CHECK_EQUAL(23, NumberOfTrailingZerosI32(0x00800000));
+ BOOST_CHECK_EQUAL(23, NumberOfTrailingZerosI32(0x80800000));
+ BOOST_CHECK_EQUAL(23, NumberOfTrailingZerosI32(0xFF800000));
+
+ BOOST_CHECK_EQUAL(30, NumberOfTrailingZerosI32(0x40000000));
+ BOOST_CHECK_EQUAL(30, NumberOfTrailingZerosI32(0xC0000000));
+
+ BOOST_CHECK_EQUAL(31, NumberOfTrailingZerosI32(0x80000000));
+
+ BOOST_CHECK_EQUAL(32, NumberOfTrailingZerosI32(0));
+}
+
+BOOST_AUTO_TEST_CASE(TestBitCount)
+{
+ BOOST_CHECK_EQUAL(0, BitCountI32(0));
+
+ for (int j = 0; j < 32; ++j)
+ {
+ const int32_t testNum = 0xFFFFFFFFUL >> (31 - j);
+
+ for (int i = 0; i < (32 - j); ++i)
+ BOOST_CHECK_EQUAL(j + 1, BitCountI32(testNum));
+ }
+
+ for (int j = 0; j < 32; j += 2)
+ {
+ const int32_t testNum = 0xAAAAAAAAUL >> (31 - j);
+
+ for (int i = 0; i < (32 - j); ++i)
+ BOOST_CHECK_EQUAL((j / 2) + 1, BitCountI32(testNum));
+ }
+}
+
+BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/core-test/src/decimal_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/decimal_test.cpp b/modules/platforms/cpp/core-test/src/decimal_test.cpp
new file mode 100644
index 0000000..47fe8fc
--- /dev/null
+++ b/modules/platforms/cpp/core-test/src/decimal_test.cpp
@@ -0,0 +1,1101 @@
+/*
+ * 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.
+ */
+
+#ifndef _MSC_VER
+# define BOOST_TEST_DYN_LINK
+#endif
+
+#include <boost/test/unit_test.hpp>
+
+#include <ignite/common/bits.h>
+#include <ignite/common/decimal.h>
+
+using namespace ignite;
+using namespace ignite::common;
+using namespace ignite::common::bits;
+
+template<typename T>
+void CheckOutputSimple(int64_t val)
+{
+ T dec(val);
+
+ std::stringstream ss1;
+ std::stringstream ss2;
+
+ ss1 << val;
+ ss2 << dec;
+
+ BOOST_CHECK_EQUAL(ss1.str(), ss2.str());
+}
+
+template<typename T>
+void CheckInputOutput(const std::string& val)
+{
+ T dec;
+ std::string res;
+
+ std::stringstream ss1;
+ ss1 << val;
+ ss1 >> dec;
+
+ std::stringstream ss2;
+ ss2 << dec;
+ res = ss2.str();
+
+ BOOST_CHECK_EQUAL(val, res);
+}
+
+template<typename T>
+void CheckOutputInput(const T& val)
+{
+ T dec;
+ std::stringstream ss;
+ ss << val;
+ ss >> dec;
+
+ BOOST_CHECK_EQUAL(val, dec);
+}
+
+void CheckDoubleCast(double val)
+{
+ Decimal dec;
+
+ dec.AssignDouble(val);
+
+ BOOST_CHECK_CLOSE(val, dec.ToDouble(), 1E-10);
+}
+
+BOOST_AUTO_TEST_SUITE(DecimalTestSuite)
+
+BOOST_AUTO_TEST_CASE(TestMultiplyBigIntegerArguments)
+{
+ BigInteger bigInt(12345);
+
+ BigInteger res;
+
+ // 152399025
+ bigInt.Multiply(BigInteger(12345), res);
+
+ {
+ const BigInteger::MagArray &mag = res.GetMagnitude();
+
+ BOOST_CHECK_EQUAL(mag.GetSize(), 1);
+
+ BOOST_CHECK_EQUAL(mag[0], 152399025ULL);
+ }
+
+ // 152399025
+ bigInt.AssignInt64(12345);
+ bigInt.Multiply(bigInt, res);
+
+ {
+ const BigInteger::MagArray &mag = res.GetMagnitude();
+
+ BOOST_CHECK_EQUAL(mag.GetSize(), 1);
+
+ BOOST_CHECK_EQUAL(mag[0], 152399025ULL);
+ }
+
+ // 152399025
+ bigInt.AssignInt64(12345);
+ bigInt.Multiply(BigInteger(12345), bigInt);
+
+ {
+ const BigInteger::MagArray &mag = bigInt.GetMagnitude();
+
+ BOOST_CHECK_EQUAL(mag.GetSize(), 1);
+
+ BOOST_CHECK_EQUAL(mag[0], 152399025ULL);
+ }
+
+ // 152399025
+ bigInt.AssignInt64(12345);
+ bigInt.Multiply(bigInt, bigInt);
+
+ {
+ const BigInteger::MagArray &mag = bigInt.GetMagnitude();
+
+ BOOST_CHECK_EQUAL(mag.GetSize(), 1);
+
+ BOOST_CHECK_EQUAL(mag[0], 152399025ULL);
+ }
+}
+
+BOOST_AUTO_TEST_CASE(TestMultiplyBigIntegerBigger)
+{
+ BigInteger bigInt(12345);
+
+ BigInteger buf;
+
+ // 152399025
+ bigInt.Multiply(bigInt, bigInt);
+
+ buf.Assign(bigInt);
+
+ // 3539537889086624823140625
+ // 0002 ED86 BBC3 30D1 DDC6 6111
+ bigInt.Multiply(buf, bigInt);
+ bigInt.Multiply(buf, bigInt);
+
+ {
+ const BigInteger::MagArray &mag = bigInt.GetMagnitude();
+
+ BOOST_CHECK_EQUAL(mag.GetSize(), 3);
+
+ BOOST_CHECK_EQUAL(mag[0], 0xDDC66111);
+ BOOST_CHECK_EQUAL(mag[1], 0xBBC330D1);
+ BOOST_CHECK_EQUAL(mag[2], 0x0002ED86);
+ }
+
+ // 2698355789040138398691723863616167551412718750 ==
+ // 0078 FF9A F760 4E12 4A1F 3179 D038 D455 630F CC9E
+ bigInt.Multiply(BigInteger(32546826734), bigInt);
+ bigInt.Multiply(BigInteger(23423079641), bigInt);
+
+ {
+ const BigInteger::MagArray &mag = bigInt.GetMagnitude();
+
+ BOOST_CHECK_EQUAL(mag.GetSize(), 5);
+
+ BOOST_CHECK_EQUAL(mag[0], 0x630FCC9E);
+ BOOST_CHECK_EQUAL(mag[1], 0xD038D455);
+ BOOST_CHECK_EQUAL(mag[2], 0x4A1F3179);
+ BOOST_CHECK_EQUAL(mag[3], 0xF7604E12);
+ BOOST_CHECK_EQUAL(mag[4], 0x0078FF9A);
+ }
+}
+
+BOOST_AUTO_TEST_CASE(TestPowBigInteger)
+{
+ BigInteger bigInt(12345);
+
+ {
+ const BigInteger::MagArray &mag = bigInt.GetMagnitude();
+
+ BOOST_CHECK_EQUAL(mag.GetSize(), 1);
+
+ BOOST_CHECK_EQUAL(mag[0], 12345);
+ }
+
+ // 152399025
+ bigInt.Pow(2);
+
+ {
+ const BigInteger::MagArray &mag = bigInt.GetMagnitude();
+
+ BOOST_CHECK_EQUAL(mag.GetSize(), 1);
+
+ BOOST_CHECK_EQUAL(mag[0], 152399025ULL);
+ }
+
+ // 3539537889086624823140625
+ // 0002 ED86 BBC3 30D1 DDC6 6111
+ bigInt.Pow(3);
+
+ {
+ const BigInteger::MagArray &mag = bigInt.GetMagnitude();
+
+ BOOST_CHECK_EQUAL(mag.GetSize(), 3);
+
+ BOOST_CHECK_EQUAL(mag[0], 0xDDC66111);
+ BOOST_CHECK_EQUAL(mag[1], 0xBBC330D1);
+ BOOST_CHECK_EQUAL(mag[2], 0x0002ED86);
+ }
+
+ //3086495556566025694024226933269611093366465997140345415945924110519533775
+ //2241867322136254278528975546698722592953892009291022792452635153187272387
+ //9105398830363346664660724134489229239181447334384883937966927158758068117
+ //094808258116245269775390625
+ //
+ // 0000 B4D0 1355 772E
+ // C174 C5F3 B840 74ED 6A54 B544 48E1 E308 6A80 6050 7D37 A56F
+ // 54E6 FF91 13FF 7B0A 455C F649 F4CD 37D0 C5B0 0507 1BFD 9083
+ // 8F13 08B4 D962 08FC FBC0 B5AB F9F9 06C9 94B3 9715 8C43 C94F
+ // 4891 09E5 57AA 66C9 A4F4 3494 A938 89FE 87AF 9056 7D90 17A1
+ bigInt.Pow(10);
+
+ {
+ const BigInteger::MagArray &mag = bigInt.GetMagnitude();
+
+ BOOST_CHECK_EQUAL(mag.GetSize(), 26);
+
+ BOOST_CHECK_EQUAL(mag[0], 0x7D9017A1);
+ BOOST_CHECK_EQUAL(mag[1], 0x87AF9056);
+ BOOST_CHECK_EQUAL(mag[2], 0xA93889FE);
+ BOOST_CHECK_EQUAL(mag[3], 0xA4F43494);
+ BOOST_CHECK_EQUAL(mag[4], 0x57AA66C9);
+ BOOST_CHECK_EQUAL(mag[5], 0x489109E5);
+ BOOST_CHECK_EQUAL(mag[6], 0x8C43C94F);
+ BOOST_CHECK_EQUAL(mag[7], 0x94B39715);
+ BOOST_CHECK_EQUAL(mag[8], 0xF9F906C9);
+ BOOST_CHECK_EQUAL(mag[9], 0xFBC0B5AB);
+ BOOST_CHECK_EQUAL(mag[10], 0xD96208FC);
+ BOOST_CHECK_EQUAL(mag[11], 0x8F1308B4);
+ BOOST_CHECK_EQUAL(mag[12], 0x1BFD9083);
+ BOOST_CHECK_EQUAL(mag[13], 0xC5B00507);
+ BOOST_CHECK_EQUAL(mag[14], 0xF4CD37D0);
+ BOOST_CHECK_EQUAL(mag[15], 0x455CF649);
+ BOOST_CHECK_EQUAL(mag[16], 0x13FF7B0A);
+ BOOST_CHECK_EQUAL(mag[17], 0x54E6FF91);
+ BOOST_CHECK_EQUAL(mag[18], 0x7D37A56F);
+ BOOST_CHECK_EQUAL(mag[19], 0x6A806050);
+ BOOST_CHECK_EQUAL(mag[20], 0x48E1E308);
+ BOOST_CHECK_EQUAL(mag[21], 0x6A54B544);
+ BOOST_CHECK_EQUAL(mag[22], 0xB84074ED);
+ BOOST_CHECK_EQUAL(mag[23], 0xC174C5F3);
+ BOOST_CHECK_EQUAL(mag[24], 0x1355772E);
+ BOOST_CHECK_EQUAL(mag[25], 0x0000B4D0);
+ }
+
+ bigInt.AssignInt64(-1);
+
+ bigInt.Pow(57298735);
+ BOOST_REQUIRE_EQUAL(bigInt.ToInt64(), -1);
+
+ bigInt.Pow(325347312);
+ BOOST_REQUIRE_EQUAL(bigInt.ToInt64(), 1);
+
+ bigInt.AssignInt64(2);
+
+ bigInt.Pow(10);
+ BOOST_REQUIRE_EQUAL(bigInt.ToInt64(), 1024);
+
+ bigInt.AssignInt64(-2);
+
+ bigInt.Pow(10);
+ BOOST_REQUIRE_EQUAL(bigInt.ToInt64(), 1024);
+
+ bigInt.AssignInt64(2);
+
+ bigInt.Pow(11);
+ BOOST_REQUIRE_EQUAL(bigInt.ToInt64(), 2048);
+
+ bigInt.AssignInt64(-2);
+
+ bigInt.Pow(11);
+ BOOST_REQUIRE_EQUAL(bigInt.ToInt64(), -2048);
+}
+
+BOOST_AUTO_TEST_CASE(TestMultiplyDivideSimple)
+{
+ BigInteger val;
+ BigInteger res;
+ BigInteger rem;
+
+ val.AssignInt64(23225462820950625LL);
+
+ // 23225462820 and 950625
+ BigInteger bi1;
+ BigInteger bi2;
+ val.Divide(BigInteger(1000000), bi1, bi2);
+
+ // 23225 and 462820
+ BigInteger bi3;
+ BigInteger bi4;
+ bi1.Divide(BigInteger(1000000), bi3, bi4);
+
+ BOOST_CHECK_EQUAL(bi2.ToInt64(), 950625LL);
+ BOOST_CHECK_EQUAL(bi3.ToInt64(), 23225LL);
+ BOOST_CHECK_EQUAL(bi4.ToInt64(), 462820LL);
+
+ BigInteger(0).Divide(BigInteger(1), res, rem);
+
+ BOOST_CHECK_EQUAL(res, BigInteger(0));
+ BOOST_CHECK_EQUAL(rem, BigInteger(0));
+
+ BigInteger(0).Divide(BigInteger(100), res, rem);
+
+ BOOST_CHECK_EQUAL(res, BigInteger(0));
+ BOOST_CHECK_EQUAL(rem, BigInteger(0));
+
+ BigInteger(0).Divide(BigInteger(-1), res, rem);
+
+ BOOST_CHECK_EQUAL(res, BigInteger(0));
+ BOOST_CHECK_EQUAL(rem, BigInteger(0));
+
+ BigInteger(0).Divide(BigInteger(-100), res, rem);
+
+ BOOST_CHECK_EQUAL(res, BigInteger(0));
+ BOOST_CHECK_EQUAL(rem, BigInteger(0));
+
+ BigInteger(1).Divide(BigInteger(1), res, rem);
+
+ BOOST_CHECK_EQUAL(res, BigInteger(1));
+ BOOST_CHECK_EQUAL(rem, BigInteger(0));
+
+ BigInteger(10).Divide(BigInteger(1), res, rem);
+
+ BOOST_CHECK_EQUAL(res, BigInteger(10));
+ BOOST_CHECK_EQUAL(rem, BigInteger(0));
+
+ BigInteger(-1).Divide(BigInteger(1), res, rem);
+
+ BOOST_CHECK_EQUAL(res, BigInteger(-1));
+ BOOST_CHECK_EQUAL(rem, BigInteger(0));
+
+ BigInteger(-10).Divide(BigInteger(1), res, rem);
+
+ BOOST_CHECK_EQUAL(res, BigInteger(-10));
+ BOOST_CHECK_EQUAL(rem, BigInteger(0));
+
+ BigInteger(1).Divide(BigInteger(-1), res, rem);
+
+ BOOST_CHECK_EQUAL(res, BigInteger(-1));
+ BOOST_CHECK_EQUAL(rem, BigInteger(0));
+
+ BigInteger(10).Divide(BigInteger(-1), res, rem);
+
+ BOOST_CHECK_EQUAL(res, BigInteger(-10));
+ BOOST_CHECK_EQUAL(rem, BigInteger(0));
+
+ BigInteger(-1).Divide(BigInteger(-1), res, rem);
+
+ BOOST_CHECK_EQUAL(res, BigInteger(1));
+ BOOST_CHECK_EQUAL(rem, BigInteger(0));
+
+ BigInteger(-10).Divide(BigInteger(-1), res, rem);
+
+ BOOST_CHECK_EQUAL(res, BigInteger(10));
+ BOOST_CHECK_EQUAL(rem, BigInteger(0));
+
+ BigInteger(123456789).Divide(BigInteger(1000), res);
+ BOOST_CHECK_EQUAL(res, BigInteger(123456));
+
+ val.AssignInt64(79823695862);
+ val.Divide(val, res);
+
+ BOOST_CHECK_EQUAL(res, BigInteger(1));
+
+ val.AssignInt64(28658345673);
+ val.Divide(val, val);
+
+ BOOST_CHECK_EQUAL(val, BigInteger(1));
+
+ val.AssignInt64(-97598673406);
+ val.Divide(val, res, val);
+
+ BOOST_CHECK_EQUAL(res, BigInteger(1));
+ BOOST_CHECK_EQUAL(val, BigInteger(0));
+
+ val.AssignInt64(1);
+ val.Divide(val, res, val);
+
+ BOOST_CHECK_EQUAL(res, BigInteger(1));
+ BOOST_CHECK_EQUAL(val, BigInteger(0));
+}
+
+BOOST_AUTO_TEST_CASE(TestDivideBigger)
+{
+ BigInteger res;
+ BigInteger rem;
+
+ BigInteger("4790467782742318458842833081").Divide(BigInteger(1000000000000000000LL), res, rem);
+
+ BOOST_CHECK_EQUAL(res.ToInt64(), 4790467782LL);
+ BOOST_CHECK_EQUAL(rem.ToInt64(), 742318458842833081LL);
+
+ BigInteger("4790467782742318458842833081").Divide(BigInteger("10000000000000000000"), res, rem);
+
+ BOOST_CHECK_EQUAL(res.ToInt64(), 479046778LL);
+ BOOST_CHECK_EQUAL(rem.ToInt64(), 2742318458842833081LL);
+
+ BigInteger("328569986734256745892025106351608546013457217305539845689265945043650274304152384502658961485730864386").Divide(
+ BigInteger("759823640567289574925305534862590863490856903465"), res, rem);
+
+ BOOST_CHECK_EQUAL(res, BigInteger("432429275942170114314334535709873138296890293268042448"));
+ BOOST_CHECK_EQUAL(rem, BigInteger("725289323707320757244048053769339286218272582066"));
+
+ BigInteger("5789420569340865906230645903456092386459628364580763804659834658960883465807263084659832648768603645").Divide(
+ BigInteger("-29064503640646565660609983646665763458768340596340586"), res, rem);
+
+ BOOST_CHECK_EQUAL(res, BigInteger("-199192136253942064949205579447876757418653967046"));
+ BOOST_CHECK_EQUAL(rem, BigInteger("-9693519879390725820633207073869515731754969332274689"));
+
+ BigInteger("-107519074510758034695616045096493659264398569023607895679428769875976987594876903458769799098378994985793874569869348579").Divide(
+ BigInteger("197290846190263940610876503491586943095983984894898998999751636576150263056012501"), res, rem);
+
+ BOOST_CHECK_EQUAL(res, BigInteger("-544977512069001243499439196429495600701"));
+ BOOST_CHECK_EQUAL(rem, BigInteger("-66382358009926062210728796777352226675944219851838448875365359123421443108985378"));
+
+ BigInteger("9739565432896546050040656034658762836457836886868678345021405632645902354063045608267340568346582").Divide(
+ BigInteger("8263050146508634250640862503465899340625908694088569038"), res);
+
+ BOOST_CHECK_EQUAL(res, BigInteger("1178688893351540421358600789386475098289416"));
+}
+
+BOOST_AUTO_TEST_CASE(TestOutputSimpleBigInteger)
+{
+ CheckOutputSimple<BigInteger>(0);
+
+ CheckOutputSimple<BigInteger>(1);
+ CheckOutputSimple<BigInteger>(9);
+ CheckOutputSimple<BigInteger>(10);
+ CheckOutputSimple<BigInteger>(11);
+ CheckOutputSimple<BigInteger>(19);
+ CheckOutputSimple<BigInteger>(123);
+ CheckOutputSimple<BigInteger>(1234);
+ CheckOutputSimple<BigInteger>(12345);
+ CheckOutputSimple<BigInteger>(123456);
+ CheckOutputSimple<BigInteger>(1234567);
+ CheckOutputSimple<BigInteger>(12345678);
+ CheckOutputSimple<BigInteger>(123456789);
+ CheckOutputSimple<BigInteger>(1234567890);
+ CheckOutputSimple<BigInteger>(12345678909);
+ CheckOutputSimple<BigInteger>(123456789098);
+ CheckOutputSimple<BigInteger>(1234567890987);
+ CheckOutputSimple<BigInteger>(12345678909876);
+ CheckOutputSimple<BigInteger>(123456789098765);
+ CheckOutputSimple<BigInteger>(1234567890987654);
+ CheckOutputSimple<BigInteger>(12345678909876543);
+ CheckOutputSimple<BigInteger>(123456789098765432);
+ CheckOutputSimple<BigInteger>(1234567890987654321);
+ CheckOutputSimple<BigInteger>(999999999999999999LL);
+ CheckOutputSimple<BigInteger>(999999999099999999LL);
+ CheckOutputSimple<BigInteger>(1000000000000000000LL);
+ CheckOutputSimple<BigInteger>(1000000000000000001LL);
+ CheckOutputSimple<BigInteger>(1000000005000000000LL);
+ CheckOutputSimple<BigInteger>(INT64_MAX);
+
+ CheckOutputSimple<BigInteger>(-1);
+ CheckOutputSimple<BigInteger>(-9);
+ CheckOutputSimple<BigInteger>(-10);
+ CheckOutputSimple<BigInteger>(-11);
+ CheckOutputSimple<BigInteger>(-19);
+ CheckOutputSimple<BigInteger>(-123);
+ CheckOutputSimple<BigInteger>(-1234);
+ CheckOutputSimple<BigInteger>(-12345);
+ CheckOutputSimple<BigInteger>(-123456);
+ CheckOutputSimple<BigInteger>(-1234567);
+ CheckOutputSimple<BigInteger>(-12345678);
+ CheckOutputSimple<BigInteger>(-123456789);
+ CheckOutputSimple<BigInteger>(-1234567890);
+ CheckOutputSimple<BigInteger>(-12345678909);
+ CheckOutputSimple<BigInteger>(-123456789098);
+ CheckOutputSimple<BigInteger>(-1234567890987);
+ CheckOutputSimple<BigInteger>(-12345678909876);
+ CheckOutputSimple<BigInteger>(-123456789098765);
+ CheckOutputSimple<BigInteger>(-1234567890987654);
+ CheckOutputSimple<BigInteger>(-12345678909876543);
+ CheckOutputSimple<BigInteger>(-123456789098765432);
+ CheckOutputSimple<BigInteger>(-1234567890987654321);
+ CheckOutputSimple<BigInteger>(-999999999999999999LL);
+ CheckOutputSimple<BigInteger>(-999999999999999999LL);
+ CheckOutputSimple<BigInteger>(-1000000000000000000LL);
+ CheckOutputSimple<BigInteger>(-1000000000000000001LL);
+ CheckOutputSimple<BigInteger>(-1000000000000000000LL);
+ CheckOutputSimple<BigInteger>(INT64_MIN);
+}
+
+BOOST_AUTO_TEST_CASE(TestOutputSimpleDecimal)
+{
+ CheckOutputSimple<Decimal>(0);
+
+ CheckOutputSimple<Decimal>(1);
+ CheckOutputSimple<Decimal>(9);
+ CheckOutputSimple<Decimal>(10);
+ CheckOutputSimple<Decimal>(11);
+ CheckOutputSimple<Decimal>(19);
+ CheckOutputSimple<Decimal>(123);
+ CheckOutputSimple<Decimal>(1234);
+ CheckOutputSimple<Decimal>(12345);
+ CheckOutputSimple<Decimal>(123456);
+ CheckOutputSimple<Decimal>(1234567);
+ CheckOutputSimple<Decimal>(12345678);
+ CheckOutputSimple<Decimal>(123456789);
+ CheckOutputSimple<Decimal>(1234567890);
+ CheckOutputSimple<Decimal>(12345678909);
+ CheckOutputSimple<Decimal>(123456789098);
+ CheckOutputSimple<Decimal>(1234567890987);
+ CheckOutputSimple<Decimal>(12345678909876);
+ CheckOutputSimple<Decimal>(123456789098765);
+ CheckOutputSimple<Decimal>(1234567890987654);
+ CheckOutputSimple<Decimal>(12345678909876543);
+ CheckOutputSimple<Decimal>(123456789098765432);
+ CheckOutputSimple<Decimal>(1234567890987654321);
+ CheckOutputSimple<Decimal>(999999999999999999LL);
+ CheckOutputSimple<Decimal>(999999999099999999LL);
+ CheckOutputSimple<Decimal>(1000000000000000000LL);
+ CheckOutputSimple<Decimal>(1000000000000000001LL);
+ CheckOutputSimple<Decimal>(1000000005000000000LL);
+ CheckOutputSimple<Decimal>(INT64_MAX);
+
+ CheckOutputSimple<Decimal>(-1);
+ CheckOutputSimple<Decimal>(-9);
+ CheckOutputSimple<Decimal>(-10);
+ CheckOutputSimple<Decimal>(-11);
+ CheckOutputSimple<Decimal>(-19);
+ CheckOutputSimple<Decimal>(-123);
+ CheckOutputSimple<Decimal>(-1234);
+ CheckOutputSimple<Decimal>(-12345);
+ CheckOutputSimple<Decimal>(-123456);
+ CheckOutputSimple<Decimal>(-1234567);
+ CheckOutputSimple<Decimal>(-12345678);
+ CheckOutputSimple<Decimal>(-123456789);
+ CheckOutputSimple<Decimal>(-1234567890);
+ CheckOutputSimple<Decimal>(-12345678909);
+ CheckOutputSimple<Decimal>(-123456789098);
+ CheckOutputSimple<Decimal>(-1234567890987);
+ CheckOutputSimple<Decimal>(-12345678909876);
+ CheckOutputSimple<Decimal>(-123456789098765);
+ CheckOutputSimple<Decimal>(-1234567890987654);
+ CheckOutputSimple<Decimal>(-12345678909876543);
+ CheckOutputSimple<Decimal>(-123456789098765432);
+ CheckOutputSimple<Decimal>(-1234567890987654321);
+ CheckOutputSimple<Decimal>(-999999999999999999LL);
+ CheckOutputSimple<Decimal>(-999999999099999999LL);
+ CheckOutputSimple<Decimal>(-1000000000000000000LL);
+ CheckOutputSimple<Decimal>(-1000000000000000001LL);
+ CheckOutputSimple<Decimal>(-1000000005000000000LL);
+ CheckOutputSimple<Decimal>(INT64_MIN);
+}
+BOOST_AUTO_TEST_CASE(TestInputOutputSimpleBigInteger)
+{
+ CheckInputOutput<BigInteger>("0");
+ CheckInputOutput<BigInteger>("1");
+ CheckInputOutput<BigInteger>("2");
+ CheckInputOutput<BigInteger>("9");
+ CheckInputOutput<BigInteger>("10");
+ CheckInputOutput<BigInteger>("1123");
+ CheckInputOutput<BigInteger>("64539472569345602304");
+ CheckInputOutput<BigInteger>("2376926357280573482539570263854");
+ CheckInputOutput<BigInteger>("407846050973948576230645736487560936425876349857823587643258934569364587268645394725693456023046037490024067294087609279");
+
+ CheckInputOutput<BigInteger>("1000000000000");
+ CheckInputOutput<BigInteger>("1000000000000000000000000000");
+ CheckInputOutput<BigInteger>("100000000000000000000000000000000000000000000000000000000000");
+
+ CheckInputOutput<BigInteger>("99999999999999");
+ CheckInputOutput<BigInteger>("99999999999999999999999999999999");
+ CheckInputOutput<BigInteger>("9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999");
+
+ CheckInputOutput<BigInteger>("-1");
+ CheckInputOutput<BigInteger>("-2");
+ CheckInputOutput<BigInteger>("-9");
+ CheckInputOutput<BigInteger>("-10");
+ CheckInputOutput<BigInteger>("-1123");
+ CheckInputOutput<BigInteger>("-64539472569345602304");
+ CheckInputOutput<BigInteger>("-2376926357280573482539570263854");
+ CheckInputOutput<BigInteger>("-407846050973948576230645736487560936425876349857823587643258934569364587268645394725693456023046037490024067294087609279");
+
+ CheckInputOutput<BigInteger>("-1000000000000");
+ CheckInputOutput<BigInteger>("-1000000000000000000000000000");
+ CheckInputOutput<BigInteger>("-100000000000000000000000000000000000000000000000000000000000");
+
+ CheckInputOutput<BigInteger>("-99999999999999");
+ CheckInputOutput<BigInteger>("-99999999999999999999999999999999");
+ CheckInputOutput<BigInteger>("-9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999");
+}
+
+BOOST_AUTO_TEST_CASE(TestInputOutputSimpleDecimal)
+{
+ CheckInputOutput<Decimal>("0");
+ CheckInputOutput<Decimal>("1");
+ CheckInputOutput<Decimal>("2");
+ CheckInputOutput<Decimal>("9");
+ CheckInputOutput<Decimal>("10");
+ CheckInputOutput<Decimal>("1123");
+ CheckInputOutput<Decimal>("64539472569345602304");
+ CheckInputOutput<Decimal>("2376926357280573482539570263854");
+ CheckInputOutput<Decimal>("407846050973948576230645736487560936425876349857823587643258934569364587268645394725693456023046037490024067294087609279");
+
+ CheckInputOutput<Decimal>("1000000000000");
+ CheckInputOutput<Decimal>("1000000000000000000000000000");
+ CheckInputOutput<Decimal>("100000000000000000000000000000000000000000000000000000000000");
+
+ CheckInputOutput<Decimal>("99999999999999");
+ CheckInputOutput<Decimal>("99999999999999999999999999999999");
+ CheckInputOutput<Decimal>("9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999");
+
+ CheckInputOutput<Decimal>("-1");
+ CheckInputOutput<Decimal>("-2");
+ CheckInputOutput<Decimal>("-9");
+ CheckInputOutput<Decimal>("-10");
+ CheckInputOutput<Decimal>("-1123");
+ CheckInputOutput<Decimal>("-64539472569345602304");
+ CheckInputOutput<Decimal>("-2376926357280573482539570263854");
+ CheckInputOutput<Decimal>("-407846050973948576230645736487560936425876349857823587643258934569364587268645394725693456023046037490024067294087609279");
+
+ CheckInputOutput<Decimal>("-1000000000000");
+ CheckInputOutput<Decimal>("-1000000000000000000000000000");
+ CheckInputOutput<Decimal>("-100000000000000000000000000000000000000000000000000000000000");
+
+ CheckInputOutput<Decimal>("-99999999999999");
+ CheckInputOutput<Decimal>("-99999999999999999999999999999999");
+ CheckInputOutput<Decimal>("-9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999");
+
+ CheckInputOutput<Decimal>("0.1");
+ CheckInputOutput<Decimal>("0.2");
+ CheckInputOutput<Decimal>("0.3");
+ CheckInputOutput<Decimal>("0.4");
+ CheckInputOutput<Decimal>("0.5");
+ CheckInputOutput<Decimal>("0.6");
+ CheckInputOutput<Decimal>("0.7");
+ CheckInputOutput<Decimal>("0.8");
+ CheckInputOutput<Decimal>("0.9");
+ CheckInputOutput<Decimal>("0.01");
+ CheckInputOutput<Decimal>("0.001");
+ CheckInputOutput<Decimal>("0.0001");
+ CheckInputOutput<Decimal>("0.00001");
+ CheckInputOutput<Decimal>("0.000001");
+ CheckInputOutput<Decimal>("0.0000001");
+
+ CheckInputOutput<Decimal>("0.00000000000000000000000000000000001");
+ CheckInputOutput<Decimal>("0.10000000000000000000000000000000001");
+ CheckInputOutput<Decimal>("0.10101010101010101010101010101010101");
+ CheckInputOutput<Decimal>("0.99999999999999999999999999999999999");
+ CheckInputOutput<Decimal>("0.79287502687354897253590684568634528762");
+
+ CheckInputOutput<Decimal>("0.00000000000000000000000000000000000000000000000000000001");
+ CheckInputOutput<Decimal>("0.10000000000000000000000000000000000000000000000000000001");
+ CheckInputOutput<Decimal>("0.1111111111111111111111111111111111111111111111111111111111");
+ CheckInputOutput<Decimal>("0.9999999999999999999999999999999999999999999999999999999999999999999");
+ CheckInputOutput<Decimal>("0.436589746389567836745873648576289634589763845768268457683762864587684635892768346589629");
+
+ CheckInputOutput<Decimal>("0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001");
+ CheckInputOutput<Decimal>("0.10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001");
+ CheckInputOutput<Decimal>("0.111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111");
+ CheckInputOutput<Decimal>("0.999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999");
+ CheckInputOutput<Decimal>("0.436589746389567836745873648576289634589763845768268457683762864587684635892768346549385700256032605603246580726384075680247634627357023645889629");
+
+ CheckInputOutput<Decimal>("-0.1");
+ CheckInputOutput<Decimal>("-0.2");
+ CheckInputOutput<Decimal>("-0.3");
+ CheckInputOutput<Decimal>("-0.4");
+ CheckInputOutput<Decimal>("-0.5");
+ CheckInputOutput<Decimal>("-0.6");
+ CheckInputOutput<Decimal>("-0.7");
+ CheckInputOutput<Decimal>("-0.8");
+ CheckInputOutput<Decimal>("-0.9");
+ CheckInputOutput<Decimal>("-0.01");
+ CheckInputOutput<Decimal>("-0.001");
+ CheckInputOutput<Decimal>("-0.0001");
+ CheckInputOutput<Decimal>("-0.00001");
+ CheckInputOutput<Decimal>("-0.000001");
+ CheckInputOutput<Decimal>("-0.0000001");
+
+ CheckInputOutput<Decimal>("-0.00000000000000000000000000000000001");
+ CheckInputOutput<Decimal>("-0.10000000000000000000000000000000001");
+ CheckInputOutput<Decimal>("-0.10101010101010101010101010101010101");
+ CheckInputOutput<Decimal>("-0.99999999999999999999999999999999999");
+ CheckInputOutput<Decimal>("-0.79287502687354897253590684568634528762");
+
+ CheckInputOutput<Decimal>("-0.00000000000000000000000000000000000000000000000000000001");
+ CheckInputOutput<Decimal>("-0.10000000000000000000000000000000000000000000000000000001");
+ CheckInputOutput<Decimal>("-0.1111111111111111111111111111111111111111111111111111111111");
+ CheckInputOutput<Decimal>("-0.9999999999999999999999999999999999999999999999999999999999999999999");
+ CheckInputOutput<Decimal>("-0.436589746389567836745873648576289634589763845768268457683762864587684635892768346589629");
+
+ CheckInputOutput<Decimal>("-0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001");
+ CheckInputOutput<Decimal>("-0.10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001");
+ CheckInputOutput<Decimal>("-0.111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111");
+ CheckInputOutput<Decimal>("-0.999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999");
+ CheckInputOutput<Decimal>("-0.436589746389567836745873648576289634589763845768268457683762864587684635892768346549385700256032605603246580726384075680247634627357023645889629");
+
+ CheckInputOutput<Decimal>("1.1");
+ CheckInputOutput<Decimal>("12.21");
+ CheckInputOutput<Decimal>("123.321");
+ CheckInputOutput<Decimal>("1234.4321");
+ CheckInputOutput<Decimal>("12345.54321");
+ CheckInputOutput<Decimal>("123456.654321");
+ CheckInputOutput<Decimal>("1234567.7654321");
+ CheckInputOutput<Decimal>("12345678.87654321");
+ CheckInputOutput<Decimal>("123456789.987654321");
+ CheckInputOutput<Decimal>("1234567890.0987654321");
+ CheckInputOutput<Decimal>("12345678909.90987654321");
+ CheckInputOutput<Decimal>("123456789098.890987654321");
+ CheckInputOutput<Decimal>("1234567890987.7890987654321");
+ CheckInputOutput<Decimal>("12345678909876.67890987654321");
+ CheckInputOutput<Decimal>("123456789098765.567890987654321");
+ CheckInputOutput<Decimal>("1234567890987654.4567890987654321");
+ CheckInputOutput<Decimal>("12345678909876543.34567890987654321");
+ CheckInputOutput<Decimal>("123456789098765432.234567890987654321");
+ CheckInputOutput<Decimal>("1234567890987654321.1234567890987654321");
+ CheckInputOutput<Decimal>("12345678909876543210.01234567890987654321");
+ CheckInputOutput<Decimal>("10000000000000000000000000000000000000000000000000000000000000.000000000000000000000000000000000000000000000000000000000000001");
+ CheckInputOutput<Decimal>("111111111111111111111111111111111111111111111111111111111111111111111.11111111111111111111111111111111111111111111111111111111111111");
+ CheckInputOutput<Decimal>("99999999999999999999999999999999999999999999999999999999999999999999.99999999999999999999999999999999999999999999999999999999999999999999");
+ CheckInputOutput<Decimal>("458796987658934265896483756892638456782376482605002747502306790283640563.12017054126750641065780784583204650763485718064875683468568360506340563042567");
+
+ CheckInputOutput<Decimal>("-1.1");
+ CheckInputOutput<Decimal>("-12.21");
+ CheckInputOutput<Decimal>("-123.321");
+ CheckInputOutput<Decimal>("-1234.4321");
+ CheckInputOutput<Decimal>("-12345.54321");
+ CheckInputOutput<Decimal>("-123456.654321");
+ CheckInputOutput<Decimal>("-1234567.7654321");
+ CheckInputOutput<Decimal>("-12345678.87654321");
+ CheckInputOutput<Decimal>("-123456789.987654321");
+ CheckInputOutput<Decimal>("-1234567890.0987654321");
+ CheckInputOutput<Decimal>("-12345678909.90987654321");
+ CheckInputOutput<Decimal>("-123456789098.890987654321");
+ CheckInputOutput<Decimal>("-1234567890987.7890987654321");
+ CheckInputOutput<Decimal>("-12345678909876.67890987654321");
+ CheckInputOutput<Decimal>("-123456789098765.567890987654321");
+ CheckInputOutput<Decimal>("-1234567890987654.4567890987654321");
+ CheckInputOutput<Decimal>("-12345678909876543.34567890987654321");
+ CheckInputOutput<Decimal>("-123456789098765432.234567890987654321");
+ CheckInputOutput<Decimal>("-1234567890987654321.1234567890987654321");
+ CheckInputOutput<Decimal>("-12345678909876543210.01234567890987654321");
+ CheckInputOutput<Decimal>("-10000000000000000000000000000000000000000000000000000000000000.000000000000000000000000000000000000000000000000000000000000001");
+ CheckInputOutput<Decimal>("-111111111111111111111111111111111111111111111111111111111111111111111.11111111111111111111111111111111111111111111111111111111111111");
+ CheckInputOutput<Decimal>("-99999999999999999999999999999999999999999999999999999999999999999999.99999999999999999999999999999999999999999999999999999999999999999999");
+ CheckInputOutput<Decimal>("-458796987658934265896483756892638456782376482605002747502306790283640563.12017054126750641065780784583204650763485718064875683468568360506340563042567");
+}
+
+BOOST_AUTO_TEST_CASE(TestInputSimpleDecimal)
+{
+ CheckOutputInput(Decimal(0));
+
+ CheckOutputInput(Decimal(1));
+ CheckOutputInput(Decimal(9));
+ CheckOutputInput(Decimal(10));
+ CheckOutputInput(Decimal(11));
+ CheckOutputInput(Decimal(19));
+ CheckOutputInput(Decimal(123));
+ CheckOutputInput(Decimal(1234));
+ CheckOutputInput(Decimal(12345));
+ CheckOutputInput(Decimal(123456));
+ CheckOutputInput(Decimal(1234567));
+ CheckOutputInput(Decimal(12345678));
+ CheckOutputInput(Decimal(123456789));
+ CheckOutputInput(Decimal(1234567890));
+ CheckOutputInput(Decimal(12345678909));
+ CheckOutputInput(Decimal(123456789098));
+ CheckOutputInput(Decimal(1234567890987));
+ CheckOutputInput(Decimal(12345678909876));
+ CheckOutputInput(Decimal(123456789098765));
+ CheckOutputInput(Decimal(1234567890987654));
+ CheckOutputInput(Decimal(12345678909876543));
+ CheckOutputInput(Decimal(123456789098765432));
+ CheckOutputInput(Decimal(1234567890987654321));
+ CheckOutputInput(Decimal(999999999999999999LL));
+ CheckOutputInput(Decimal(999999999099999999LL));
+ CheckOutputInput(Decimal(1000000000000000000LL));
+ CheckOutputInput(Decimal(1000000000000000001LL));
+ CheckOutputInput(Decimal(1000000005000000000LL));
+ CheckOutputInput(Decimal(INT64_MAX));
+
+ CheckOutputInput(Decimal(-1));
+ CheckOutputInput(Decimal(-9));
+ CheckOutputInput(Decimal(-10));
+ CheckOutputInput(Decimal(-11));
+ CheckOutputInput(Decimal(-19));
+ CheckOutputInput(Decimal(-123));
+ CheckOutputInput(Decimal(-1234));
+ CheckOutputInput(Decimal(-12345));
+ CheckOutputInput(Decimal(-123456));
+ CheckOutputInput(Decimal(-1234567));
+ CheckOutputInput(Decimal(-12345678));
+ CheckOutputInput(Decimal(-123456789));
+ CheckOutputInput(Decimal(-1234567890));
+ CheckOutputInput(Decimal(-12345678909));
+ CheckOutputInput(Decimal(-123456789098));
+ CheckOutputInput(Decimal(-1234567890987));
+ CheckOutputInput(Decimal(-12345678909876));
+ CheckOutputInput(Decimal(-123456789098765));
+ CheckOutputInput(Decimal(-1234567890987654));
+ CheckOutputInput(Decimal(-12345678909876543));
+ CheckOutputInput(Decimal(-123456789098765432));
+ CheckOutputInput(Decimal(-1234567890987654321));
+ CheckOutputInput(Decimal(-999999999999999999LL));
+ CheckOutputInput(Decimal(-999999999099999999LL));
+ CheckOutputInput(Decimal(-1000000000000000000LL));
+ CheckOutputInput(Decimal(-1000000000000000001LL));
+ CheckOutputInput(Decimal(-1000000005000000000LL));
+ CheckOutputInput(Decimal(INT64_MIN));
+}
+
+BOOST_AUTO_TEST_CASE(TestScalingSmall)
+{
+ Decimal decimal(12345, 2);
+ BOOST_CHECK_EQUAL(decimal.GetPrecision(), 5);
+
+ decimal.SetScale(0, decimal);
+
+ BOOST_CHECK_EQUAL(decimal.GetPrecision(), 3);
+
+ BOOST_CHECK_EQUAL(decimal.ToInt64(), 123);
+}
+
+BOOST_AUTO_TEST_CASE(TestScalingBig)
+{
+ BigInteger bigInt(69213205262741);
+
+ Decimal decimal;
+ BOOST_CHECK_EQUAL(decimal.GetPrecision(), 1);
+
+ // 4790467782742318458842833081
+ bigInt.Multiply(bigInt, bigInt);
+
+ decimal = Decimal(bigInt, 0);
+ BOOST_CHECK_EQUAL(decimal.GetPrecision(), 28);
+
+ // 22948581577492104846692006446607391554788985798427952561
+ bigInt.Multiply(bigInt, bigInt);
+
+ decimal = Decimal(bigInt, 0);
+ BOOST_CHECK_EQUAL(decimal.GetPrecision(), 56);
+
+ // 22948581577492104846692006446607391554.788985798427952561
+ decimal = Decimal(bigInt, 18);
+
+ // 22948581577492104846692006446607391554
+ decimal.SetScale(0, decimal);
+
+ BOOST_CHECK_EQUAL(decimal.GetPrecision(), 38);
+
+ // 22948581.577492104846692006446607391554788985798427952561
+ decimal = Decimal(bigInt, 48);
+
+ // 22948581
+ decimal.SetScale(0, decimal);
+
+ BOOST_CHECK_EQUAL(decimal.GetPrecision(), 8);
+ BOOST_CHECK_EQUAL(decimal.ToInt64(), 22948581);
+
+ // 636471904553811060306806140254026286906087997856914463925431295610150712
+ // 436301540552945788827650832722026963914694916372255230793492080431332686
+ // 268324254350022490844698008329270553114204362445999680199136593689695140
+ // 0874934591063287320666899465891248127072522251998904759858801
+ bigInt.Pow(5);
+
+ // 63647190455381106.030680614025402628690608799785691446392543129561015071
+ // 243630154055294578882765083272202696391469491637225523079349208043133268
+ // 626832425435002249084469800832927055311420436244599968019913659368969514
+ // 00874934591063287320666899465891248127072522251998904759858801
+ decimal = Decimal(bigInt, 260);
+ BOOST_CHECK_EQUAL(decimal.GetPrecision(), 277);
+
+ // 63647190455381106
+ decimal.SetScale(0, decimal);
+
+ BOOST_CHECK_EQUAL(decimal.GetPrecision(), 17);
+ BOOST_CHECK_EQUAL(decimal.ToInt64(), 63647190455381106LL);
+}
+
+BOOST_AUTO_TEST_CASE(TestPrecisionSimple)
+{
+ Decimal test(1);
+
+ BOOST_CHECK_EQUAL(Decimal(-9).GetPrecision(), 1);
+ BOOST_CHECK_EQUAL(Decimal(-8).GetPrecision(), 1);
+ BOOST_CHECK_EQUAL(Decimal(-7).GetPrecision(), 1);
+ BOOST_CHECK_EQUAL(Decimal(-6).GetPrecision(), 1);
+ BOOST_CHECK_EQUAL(Decimal(-5).GetPrecision(), 1);
+ BOOST_CHECK_EQUAL(Decimal(-4).GetPrecision(), 1);
+ BOOST_CHECK_EQUAL(Decimal(-3).GetPrecision(), 1);
+ BOOST_CHECK_EQUAL(Decimal(-2).GetPrecision(), 1);
+ BOOST_CHECK_EQUAL(Decimal(-1).GetPrecision(), 1);
+ BOOST_CHECK_EQUAL(Decimal(0).GetPrecision(), 1);
+ BOOST_CHECK_EQUAL(Decimal(1).GetPrecision(), 1);
+ BOOST_CHECK_EQUAL(Decimal(2).GetPrecision(), 1);
+ BOOST_CHECK_EQUAL(Decimal(3).GetPrecision(), 1);
+ BOOST_CHECK_EQUAL(Decimal(4).GetPrecision(), 1);
+ BOOST_CHECK_EQUAL(Decimal(5).GetPrecision(), 1);
+ BOOST_CHECK_EQUAL(Decimal(6).GetPrecision(), 1);
+ BOOST_CHECK_EQUAL(Decimal(7).GetPrecision(), 1);
+ BOOST_CHECK_EQUAL(Decimal(8).GetPrecision(), 1);
+ BOOST_CHECK_EQUAL(Decimal(9).GetPrecision(), 1);
+
+ BOOST_CHECK_EQUAL(Decimal(2147483648LL).GetPrecision(), 10); // 2^31: 10 digits
+ BOOST_CHECK_EQUAL(Decimal(-2147483648LL).GetPrecision(), 10); // -2^31: 10 digits
+ BOOST_CHECK_EQUAL(Decimal(98893745455LL).GetPrecision(), 11); // random: 11 digits
+ BOOST_CHECK_EQUAL(Decimal(3455436789887LL).GetPrecision(), 13); // random: 13 digits
+ BOOST_CHECK_EQUAL(Decimal(140737488355328LL).GetPrecision(), 15); // 2^47: 15 digits
+ BOOST_CHECK_EQUAL(Decimal(-140737488355328LL).GetPrecision(), 15); // -2^47: 15 digits
+ BOOST_CHECK_EQUAL(Decimal(7564232235739573LL).GetPrecision(), 16); // random: 16 digits
+ BOOST_CHECK_EQUAL(Decimal(25335434990002322LL).GetPrecision(), 17); // random: 17 digits
+ BOOST_CHECK_EQUAL(Decimal(9223372036854775807LL).GetPrecision(), 19); // 2^63 - 1: 19 digits
+ BOOST_CHECK_EQUAL(Decimal(-9223372036854775807LL).GetPrecision(), 19); // -2^63 + 1: 19 digits
+}
+
+BOOST_AUTO_TEST_CASE(TestPrecisionChange)
+{
+ BigInteger bigInt(32421);
+
+ //75946938183
+ bigInt.Multiply(BigInteger(2342523), bigInt);
+
+ //4244836901495581620
+ bigInt.Multiply(BigInteger(55892140), bigInt);
+
+ //1361610054778960404282184020
+ bigInt.Multiply(BigInteger(320768521), bigInt);
+
+ //1454144449122723409814375680476734820
+ bigInt.Multiply(BigInteger(1067959541), bigInt);
+
+ //117386322514277938455905731466723946155156640
+ bigInt.Multiply(BigInteger(80725352), bigInt);
+
+ //1173863225142779384559.05731466723946155156640
+ Decimal decimal(bigInt, 23);
+
+ BOOST_CHECK_EQUAL(decimal.GetPrecision(), 45);
+ BOOST_CHECK_EQUAL(decimal.GetScale(), 23);
+
+ for (int32_t i = 0; i < decimal.GetScale(); ++i)
+ {
+ decimal.SetScale(i, decimal);
+
+ BOOST_CHECK_EQUAL(decimal.GetPrecision(), decimal.GetPrecision() - decimal.GetScale() + i);
+ }
+}
+
+BOOST_AUTO_TEST_CASE(TestDoubleCast)
+{
+ CheckDoubleCast(100000000000000.0);
+ CheckDoubleCast(10000000000000.0);
+ CheckDoubleCast(1000000000000.0);
+ CheckDoubleCast(100000000000.0);
+ CheckDoubleCast(10000000000.0);
+ CheckDoubleCast(1000000000.0);
+ CheckDoubleCast(100000000.0);
+ CheckDoubleCast(10000000.0);
+ CheckDoubleCast(1000000.0);
+ CheckDoubleCast(100000.0);
+ CheckDoubleCast(10000.0);
+ CheckDoubleCast(1000.0);
+ CheckDoubleCast(100.0);
+ CheckDoubleCast(10.0);
+ CheckDoubleCast(1.0);
+ CheckDoubleCast(0.1);
+ CheckDoubleCast(0.01);
+ CheckDoubleCast(0.001);
+ CheckDoubleCast(0.0001);
+ CheckDoubleCast(0.00001);
+ CheckDoubleCast(0.000001);
+ CheckDoubleCast(0.0000001);
+ CheckDoubleCast(0.00000001);
+ CheckDoubleCast(0.000000001);
+ CheckDoubleCast(0.0000000001);
+ CheckDoubleCast(0.00000000001);
+ CheckDoubleCast(0.000000000001);
+ CheckDoubleCast(0.00000000000001);
+ CheckDoubleCast(0.000000000000001);
+
+ CheckDoubleCast(2379506093465806.);
+ CheckDoubleCast(172650963870256.3);
+ CheckDoubleCast(63506206502638.57);
+ CheckDoubleCast(8946589364589.763);
+ CheckDoubleCast(896258976348.9568);
+ CheckDoubleCast(28967349256.39428);
+ CheckDoubleCast(2806348972.689369);
+ CheckDoubleCast(975962354.2835845);
+ CheckDoubleCast(96342568.93542342);
+ CheckDoubleCast(6875825.934892387);
+ CheckDoubleCast(314969.6543969458);
+ CheckDoubleCast(32906.02476506344);
+ CheckDoubleCast(9869.643965396453);
+ CheckDoubleCast(779.6932689452953);
+ CheckDoubleCast(75.93592963492326);
+ CheckDoubleCast(8.719654293587452);
+ CheckDoubleCast(.90001236587463439);
+
+ CheckDoubleCast(-235235E-100);
+ CheckDoubleCast(-235235E-90);
+ CheckDoubleCast(-235235E-80);
+ CheckDoubleCast(-235235E-70);
+ CheckDoubleCast(-235235E-60);
+ CheckDoubleCast(-235235E-50);
+ CheckDoubleCast(-235235E-40);
+ CheckDoubleCast(-235235E-30);
+ CheckDoubleCast(-235235E-25);
+ CheckDoubleCast(-235235E-20);
+ CheckDoubleCast(-235235E-15);
+ CheckDoubleCast(-235235E-10);
+ CheckDoubleCast(-235235E-9);
+ CheckDoubleCast(-235235E-8);
+ CheckDoubleCast(-235235E-7);
+ CheckDoubleCast(-235235E-6);
+ CheckDoubleCast(-235235E-5);
+ CheckDoubleCast(-235235E-4);
+ CheckDoubleCast(-235235E-2);
+ CheckDoubleCast(-235235E-1);
+ CheckDoubleCast(-235235);
+ CheckDoubleCast(-235235E+1);
+ CheckDoubleCast(-235235E+2);
+ CheckDoubleCast(-235235E+3);
+ CheckDoubleCast(-235235E+4);
+ CheckDoubleCast(-235235E+5);
+ CheckDoubleCast(-235235E+6);
+ CheckDoubleCast(-235235E+7);
+ CheckDoubleCast(-235235E+8);
+ CheckDoubleCast(-235235E+9);
+ CheckDoubleCast(-235235E+10);
+ CheckDoubleCast(-235235E+15);
+ CheckDoubleCast(-235235E+20);
+ CheckDoubleCast(-235235E+25);
+ CheckDoubleCast(-235235E+30);
+ CheckDoubleCast(-235235E+40);
+ CheckDoubleCast(-235235E+50);
+ CheckDoubleCast(-235235E+60);
+ CheckDoubleCast(-235235E+70);
+ CheckDoubleCast(-235235E+80);
+ CheckDoubleCast(-235235E+90);
+ CheckDoubleCast(-235235E+100);
+
+ CheckDoubleCast(-2379506093465806.);
+ CheckDoubleCast(-172650963870256.3);
+ CheckDoubleCast(-63506206502638.57);
+ CheckDoubleCast(-8946589364589.763);
+ CheckDoubleCast(-896258976348.9568);
+ CheckDoubleCast(-28967349256.39428);
+ CheckDoubleCast(-2806348972.689369);
+ CheckDoubleCast(-975962354.2835845);
+ CheckDoubleCast(-96342568.93542342);
+ CheckDoubleCast(-6875825.934892387);
+ CheckDoubleCast(-314969.6543969458);
+ CheckDoubleCast(-32906.02476506344);
+ CheckDoubleCast(-9869.643965396453);
+ CheckDoubleCast(-779.6932689452953);
+ CheckDoubleCast(-75.93592963492326);
+ CheckDoubleCast(-8.719654293587452);
+ CheckDoubleCast(-.90001236587463439);
+
+ CheckDoubleCast(-100000000000000.0);
+ CheckDoubleCast(-10000000000000.0);
+ CheckDoubleCast(-1000000000000.0);
+ CheckDoubleCast(-100000000000.0);
+ CheckDoubleCast(-10000000000.0);
+ CheckDoubleCast(-1000000000.0);
+ CheckDoubleCast(-100000000.0);
+ CheckDoubleCast(-10000000.0);
+ CheckDoubleCast(-1000000.0);
+ CheckDoubleCast(-100000.0);
+ CheckDoubleCast(-10000.0);
+ CheckDoubleCast(-1000.0);
+ CheckDoubleCast(-100.0);
+ CheckDoubleCast(-10.0);
+ CheckDoubleCast(-1.0);
+ CheckDoubleCast(-0.1);
+ CheckDoubleCast(-0.01);
+ CheckDoubleCast(-0.001);
+ CheckDoubleCast(-0.0001);
+ CheckDoubleCast(-0.00001);
+ CheckDoubleCast(-0.000001);
+ CheckDoubleCast(-0.0000001);
+ CheckDoubleCast(-0.00000001);
+ CheckDoubleCast(-0.000000001);
+ CheckDoubleCast(-0.0000000001);
+ CheckDoubleCast(-0.00000000001);
+ CheckDoubleCast(-0.000000000001);
+ CheckDoubleCast(-0.00000000000001);
+ CheckDoubleCast(-0.000000000000001);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
[37/50] [abbrv] ignite git commit: Merge remote-tracking branch
'remotes/community/gridgain-7.6.2'
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/community/gridgain-7.6.2'
# Conflicts:
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6611d0c2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6611d0c2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6611d0c2
Branch: refs/heads/ignite-1232
Commit: 6611d0c2ccb9ea81fe5306d8c4e0a2881410eeda
Parents: c44ee63 ad76dda
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jul 6 11:30:54 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jul 6 11:30:54 2016 +0300
----------------------------------------------------------------------
.../apache/ignite/IgniteSystemProperties.java | 3 +
.../apache/ignite/internal/IgniteKernal.java | 21 ++
.../ignite/internal/binary/BinaryContext.java | 85 ++++--
.../internal/binary/BinaryEnumObjectImpl.java | 9 +-
.../ignite/internal/binary/BinaryObjectEx.java | 11 +
.../internal/binary/BinaryObjectExImpl.java | 4 +-
.../internal/binary/BinaryObjectImpl.java | 8 +-
.../binary/BinaryObjectOffheapImpl.java | 8 +-
.../ignite/internal/binary/BinaryTypeProxy.java | 111 +++++++
.../ignite/internal/binary/BinaryUtils.java | 35 ++-
.../processors/cache/GridCacheAdapter.java | 4 +
.../processors/cache/GridCacheIoManager.java | 150 +++++++++-
.../processors/cache/GridCacheMessage.java | 9 +
.../GridCachePartitionExchangeManager.java | 103 +++++++
.../cache/GridCacheSharedContext.java | 68 +++++
.../processors/cache/GridCacheUtils.java | 21 ++
.../binary/CacheObjectBinaryProcessorImpl.java | 3 +-
.../distributed/GridCacheTxRecoveryFuture.java | 70 ++++-
.../distributed/GridCacheTxRecoveryRequest.java | 8 +
.../GridCacheTxRecoveryResponse.java | 8 +
.../distributed/GridDistributedLockRequest.java | 6 +
.../GridDistributedLockResponse.java | 6 +
.../GridDistributedTxFinishRequest.java | 7 +
.../GridDistributedTxFinishResponse.java | 8 +
.../GridDistributedTxPrepareRequest.java | 6 +
.../GridDistributedTxPrepareResponse.java | 7 +
.../GridDistributedUnlockRequest.java | 6 +
.../distributed/dht/GridDhtLockFuture.java | 59 ++--
.../dht/GridDhtTransactionalCacheAdapter.java | 77 ++++-
.../distributed/dht/GridDhtTxFinishFuture.java | 92 +++++-
.../cache/distributed/dht/GridDhtTxLocal.java | 27 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 122 +++++++-
.../dht/atomic/GridDhtAtomicCache.java | 138 ++++++---
.../GridDhtAtomicDeferredUpdateResponse.java | 7 +
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 47 ++-
.../dht/atomic/GridDhtAtomicUpdateRequest.java | 6 +
.../dht/atomic/GridDhtAtomicUpdateResponse.java | 6 +
.../GridNearAtomicAbstractUpdateFuture.java | 7 +-
.../GridNearAtomicSingleUpdateFuture.java | 30 +-
.../dht/atomic/GridNearAtomicUpdateFuture.java | 45 ++-
.../dht/atomic/GridNearAtomicUpdateRequest.java | 6 +
.../atomic/GridNearAtomicUpdateResponse.java | 6 +
.../dht/colocated/GridDhtColocatedCache.java | 10 +
.../colocated/GridDhtColocatedLockFuture.java | 71 +++--
.../GridDhtPartitionsExchangeFuture.java | 3 +
.../near/GridNearOptimisticTxPrepareFuture.java | 33 +++
.../GridNearPessimisticTxPrepareFuture.java | 34 ++-
.../near/GridNearTxFinishFuture.java | 91 +++++-
.../near/GridNearTxPrepareFutureAdapter.java | 7 +-
.../cache/transactions/IgniteTxHandler.java | 286 ++++++++++++++-----
.../processors/query/GridQueryProcessor.java | 3 +-
.../util/nio/GridNioRecoveryDescriptor.java | 19 +-
.../ignite/internal/util/nio/GridNioServer.java | 47 ++-
.../util/nio/GridSelectorNioSessionImpl.java | 7 +
.../communication/tcp/TcpCommunicationSpi.java | 163 +++++++----
.../ignite/spi/discovery/tcp/ClientImpl.java | 2 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 109 ++++---
.../tcp/internal/TcpDiscoveryStatistics.java | 45 ++-
modules/core/src/test/config/log4j-test.xml | 6 +
...gniteCacheMessageRecoveryIdleConnection.java | 154 ++++++++++
.../tcp/TcpDiscoveryMultiThreadedTest.java | 222 ++++++++++++++
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 63 +++-
.../ignite/testsuites/IgniteCacheTestSuite.java | 2 +
.../processors/hadoop/HadoopAttributes.java | 168 +++++++++++
.../processors/hadoop/HadoopClasspathUtils.java | 160 +++++++----
.../processors/hadoop/HadoopLocations.java | 79 +++--
.../processors/hadoop/HadoopProcessor.java | 61 ++--
67 files changed, 2797 insertions(+), 508 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6611d0c2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index ba7dabd,488a22c..8879651
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@@ -58,8 -62,7 +62,9 @@@ import org.apache.ignite.internal.proce
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryRequest;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryResponse;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteTxState;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteTxStateAware;
+ import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.F0;
import org.apache.ignite.internal.util.GridLeanSet;
import org.apache.ignite.internal.util.GridSpinReadWriteLock;
http://git-wip-us.apache.org/repos/asf/ignite/blob/6611d0c2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryFuture.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6611d0c2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
index 527a89f,265d53b..dae19a3
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
@@@ -19,9 -19,9 +19,12 @@@ package org.apache.ignite.internal.proc
import java.io.Externalizable;
import java.nio.ByteBuffer;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteTxState;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteTxStateAware;
+
+ import org.apache.ignite.IgniteLogger;
+ import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.lang.IgniteUuid;
@@@ -98,16 -95,11 +101,21 @@@ public class GridCacheTxRecoveryRespons
}
/** {@inheritDoc} */
+ @Override public IgniteTxState txState() {
+ return txState;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void txState(IgniteTxState txState) {
+ this.txState = txState;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.txRecoveryMessageLogger();
+ }
+
+ /** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
writer.setBuffer(buf);
http://git-wip-us.apache.org/repos/asf/ignite/blob/6611d0c2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
index b5f34dd,7254ec7..3e47cc9
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
@@@ -20,9 -20,8 +20,11 @@@ package org.apache.ignite.internal.proc
import java.io.Externalizable;
import java.nio.ByteBuffer;
import java.util.Collection;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteTxState;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteTxStateAware;
+ import org.apache.ignite.IgniteLogger;
+ import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.tostring.GridToStringBuilder;
import org.apache.ignite.lang.IgniteUuid;
@@@ -229,16 -224,11 +231,21 @@@ public class GridDistributedTxFinishReq
}
/** {@inheritDoc} */
+ @Override public IgniteTxState txState() {
+ return txState;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void txState(IgniteTxState txState) {
+ this.txState = txState;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.txFinishMessageLogger();
+ }
+
+ /** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
writer.setBuffer(buf);
http://git-wip-us.apache.org/repos/asf/ignite/blob/6611d0c2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6611d0c2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
index 53f6659,850c095..9f34cd2
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
@@@ -20,10 -20,9 +20,11 @@@ package org.apache.ignite.internal.proc
import java.io.Externalizable;
import java.nio.ByteBuffer;
import org.apache.ignite.IgniteCheckedException;
+ import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.GridDirectTransient;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteTxState;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteTxStateAware;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.tostring.GridToStringBuilder;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
@@@ -96,17 -91,11 +97,23 @@@ public class GridDistributedTxPrepareRe
}
/** {@inheritDoc} */
+ @Override public IgniteTxState txState() {
+ return txState;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void txState(IgniteTxState txState) {
+ this.txState = txState;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
++ /** {@inheritDoc} */
+ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.txPrepareMessageLogger();
+ }
+
+ /** {@inheritDoc} */
@Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
super.prepareMarshal(ctx);
http://git-wip-us.apache.org/repos/asf/ignite/blob/6611d0c2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6611d0c2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
index f70f8e8,ba30e10..b5391a9
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
@@@ -105,12 -114,12 +114,17 @@@ public class IgniteTxHandler
*/
public IgniteInternalFuture<?> processNearTxPrepareRequest(final UUID nearNodeId,
final GridNearTxPrepareRequest req) {
+ if (txPrepareMsgLog.isDebugEnabled()) {
+ txPrepareMsgLog.debug("Received near prepare request [txId=" + req.version() +
+ ", node=" + nearNodeId + ']');
+ }
+
- return prepareTx(nearNodeId, null, req);
+ IgniteInternalFuture<GridNearTxPrepareResponse> fut = prepareTx(nearNodeId, null, req);
+
+ assert req.txState() != null || fut.error() != null ||
+ (ctx.tm().tx(req.version()) == null && ctx.tm().nearTx(req.version()) == null);
+
+ return fut;
}
/**
@@@ -556,13 -585,9 +603,15 @@@
return;
}
+ else if (txPrepareMsgLog.isDebugEnabled())
+ txPrepareMsgLog.debug("Received dht prepare response [txId=" + fut.tx().nearXidVersion() + ", node=" + nodeId + ']');
+ IgniteInternalTx tx = fut.tx();
+
+ assert tx != null;
+
+ res.txState(tx.txState());
+
fut.onResult(nodeId, res);
}
@@@ -607,12 -651,10 +675,15 @@@
*/
@Nullable public IgniteInternalFuture<IgniteInternalTx> processNearTxFinishRequest(UUID nodeId,
GridNearTxFinishRequest req) {
+ if (txFinishMsgLog.isDebugEnabled())
+ txFinishMsgLog.debug("Received near finish request [txId=" + req.version() + ", node=" + nodeId + ']');
+
- return finish(nodeId, null, req);
+ IgniteInternalFuture<IgniteInternalTx> fut = finish(nodeId, null, req);
+
+ assert req.txState() != null || fut.error() != null ||
+ (ctx.tm().tx(req.version()) == null && ctx.tm().nearTx(req.version()) == null);
+
+ return fut;
}
/**
@@@ -996,12 -1060,10 +1103,12 @@@
});
}
else
- sendReply(nodeId, req, true);
+ sendReply(nodeId, req, true, nearTxId);
}
else
- sendReply(nodeId, req, true);
+ sendReply(nodeId, req, true, null);
+
+ assert req.txState() != null || (ctx.tm().tx(req.version()) == null && ctx.tm().nearTx(req.version()) == null);
}
/**
[41/50] [abbrv] ignite git commit: gg-11253: load tests based on SB
cases
Posted by sb...@apache.org.
gg-11253: load tests based on SB cases
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f267a304
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f267a304
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f267a304
Branch: refs/heads/ignite-1232
Commit: f267a3042d79969405f957301bfb4ad462c7344f
Parents: aabe815
Author: Denis Magda <dm...@gridgain.com>
Authored: Wed Jul 6 13:05:14 2016 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Jul 6 13:05:14 2016 +0300
----------------------------------------------------------------------
modules/yardstick/pom.xml | 46 +++---
.../IgniteCacheRandomOperationBenchmark.java | 147 ++++++++++++-------
.../yardstick/cache/load/model/ModelUtil.java | 6 +-
3 files changed, 124 insertions(+), 75 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f267a304/modules/yardstick/pom.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/pom.xml b/modules/yardstick/pom.xml
index a0f7de5..51d714e 100644
--- a/modules/yardstick/pom.xml
+++ b/modules/yardstick/pom.xml
@@ -137,7 +137,7 @@
<goal>copy-dependencies</goal>
</goals>
<configuration>
- <outputDirectory>${basedir}/libs</outputDirectory>
+ <outputDirectory>${basedir}/target/assembly/libs</outputDirectory>
<excludeTypes>pom</excludeTypes>
</configuration>
</execution>
@@ -155,7 +155,7 @@
<version>${yardstick.version}</version>
<type>zip</type>
<classifier>resources</classifier>
- <outputDirectory>${basedir}</outputDirectory>
+ <outputDirectory>${basedir}/target/assembly</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
@@ -168,36 +168,40 @@
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
- <outputDirectory>${basedir}/libs</outputDirectory>
+ <outputDirectory>${basedir}/target/assembly/libs</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-clean-plugin</artifactId>
- <version>2.5</version>
- <configuration>
- <filesets>
- <fileset>
- <directory>${basedir}/bin</directory>
- </fileset>
- <fileset>
- <directory>${basedir}/libs</directory>
- <includes>
- <include>**/*.jar</include>
- </includes>
- </fileset>
- </filesets>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.7</version>
+ <executions>
+ <execution>
+ <id>copy-yardstick-cfg-ignite</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+ <target>
+ <copy todir="${basedir}/target/assembly/config">
+ <fileset dir="${basedir}/config" />
+ </copy>
+ </target>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
</project>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f267a304/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java
index e676b38..c2947ba 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java
@@ -141,7 +141,7 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
/** {@inheritDoc} */
@Override public void onException(Throwable e) {
- BenchmarkUtils.errorHelp(cfg, "The benchmark of random operation failed.");
+ BenchmarkUtils.error("The benchmark of random operation failed.", e);
super.onException(e);
}
@@ -217,26 +217,34 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
Collection<QueryEntity> entries = configuration.getQueryEntities();
for (QueryEntity queryEntity : entries) {
- if (queryEntity.getKeyType() != null) {
- Class keyCls = Class.forName(queryEntity.getKeyType());
-
- if (ModelUtil.canCreateInstance(keyCls))
- keys.add(keyCls);
- else
- throw new IgniteException("Class is unknown for the load test. Make sure you " +
- "specified its full name [clsName=" + queryEntity.getKeyType() + ']');
- }
-
- if (queryEntity.getValueType() != null) {
- Class valCls = Class.forName(queryEntity.getValueType());
-
- if (ModelUtil.canCreateInstance(valCls))
- values.add(valCls);
- else
- throw new IgniteException("Class is unknown for the load test. Make sure you " +
- "specified its full name [clsName=" + queryEntity.getKeyType() + ']');
-
- cofigureCacheSqlDescriptor(cacheName, queryEntity, valCls);
+ try {
+ if (queryEntity.getKeyType() != null) {
+ Class keyCls = Class.forName(queryEntity.getKeyType());
+
+ if (ModelUtil.canCreateInstance(keyCls))
+ keys.add(keyCls);
+ else
+ throw new IgniteException("Class is unknown for the load test. Make sure you " +
+ "specified its full name [clsName=" + queryEntity.getKeyType() + ']');
+ }
+
+ if (queryEntity.getValueType() != null) {
+ Class valCls = Class.forName(queryEntity.getValueType());
+
+ if (ModelUtil.canCreateInstance(valCls))
+ values.add(valCls);
+ else
+ throw new IgniteException("Class is unknown for the load test. Make sure you " +
+ "specified its full name [clsName=" + queryEntity.getKeyType() + ']');
+
+ cofigureCacheSqlDescriptor(cacheName, queryEntity, valCls);
+ }
+ } catch (ClassNotFoundException e) {
+ BenchmarkUtils.println(e.getMessage());
+ BenchmarkUtils.println("This can be a BinaryObject. Ignoring exception.");
+
+ if (!cacheSqlDescriptors.containsKey(cacheName))
+ cacheSqlDescriptors.put(cacheName, new ArrayList<SqlCacheDescriptor>());
}
}
}
@@ -245,31 +253,36 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
Collection<CacheTypeMetadata> entries = configuration.getTypeMetadata();
for (CacheTypeMetadata cacheTypeMetadata : entries) {
- if (cacheTypeMetadata.getKeyType() != null) {
- Class keyCls = Class.forName(cacheTypeMetadata.getKeyType());
-
- if (ModelUtil.canCreateInstance(keyCls))
- keys.add(keyCls);
- else
- throw new IgniteException("Class is unknown for the load test. Make sure you " +
- "specified its full name [clsName=" + cacheTypeMetadata.getKeyType() + ']');
- }
-
- if (cacheTypeMetadata.getValueType() != null) {
- Class valCls = Class.forName(cacheTypeMetadata.getValueType());
-
- if (ModelUtil.canCreateInstance(valCls))
- values.add(valCls);
- else
- throw new IgniteException("Class is unknown for the load test. Make sure you " +
- "specified its full name [clsName=" + cacheTypeMetadata.getKeyType() + ']');
+ try {
+ if (cacheTypeMetadata.getKeyType() != null) {
+ Class keyCls = Class.forName(cacheTypeMetadata.getKeyType());
+
+ if (ModelUtil.canCreateInstance(keyCls))
+ keys.add(keyCls);
+ else
+ throw new IgniteException("Class is unknown for the load test. Make sure you " +
+ "specified its full name [clsName=" + cacheTypeMetadata.getKeyType() + ']');
+ }
+
+ if (cacheTypeMetadata.getValueType() != null) {
+ Class valCls = Class.forName(cacheTypeMetadata.getValueType());
+
+ if (ModelUtil.canCreateInstance(valCls))
+ values.add(valCls);
+ else
+ throw new IgniteException("Class is unknown for the load test. Make sure you " +
+ "specified its full name [clsName=" + cacheTypeMetadata.getKeyType() + ']');
+ }
+ } catch (ClassNotFoundException e) {
+ BenchmarkUtils.println(e.getMessage());
+ BenchmarkUtils.println("This can be a BinaryObject. Ignoring exception.");
+
+ if (!cacheSqlDescriptors.containsKey(cacheName))
+ cacheSqlDescriptors.put(cacheName, new ArrayList<SqlCacheDescriptor>());
}
}
}
- if (keys.isEmpty() || values.isEmpty())
- continue;
-
keysCacheClasses.put(cacheName, keys.toArray(new Class[] {}));
valuesCacheClasses.put(cacheName, values.toArray(new Class[] {}));
@@ -857,26 +870,54 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
private void doSqlQuery(IgniteCache<Object, Object> cache) throws Exception {
List<SqlCacheDescriptor> descriptors = cacheSqlDescriptors.get(cache.getName());
- if (descriptors != null && !descriptors.isEmpty()) {
- SqlCacheDescriptor randomDesc = descriptors.get(nextRandom(descriptors.size()));
+ if (descriptors != null) {
+ Query sq = null;
- int id = nextRandom(args.range());
+ if (queries.isEmpty()) {
+ if (!descriptors.isEmpty()) {
+ SqlCacheDescriptor randomDesc = descriptors.get(nextRandom(descriptors.size()));
- Query sq;
- if (queries.isEmpty())
- sq = nextBoolean() ? randomDesc.getSqlQuery(id) : randomDesc.getSqlFieldsQuery(id);
- else
- sq = new SqlFieldsQuery(queries.get(nextRandom(queries.size())));
+ int id = nextRandom(args.range());
- try (QueryCursor cursor = cache.query(sq)) {
- for (Object obj : cursor) {
- // No-op.
+ sq = nextBoolean() ? randomDesc.getSqlQuery(id) : randomDesc.getSqlFieldsQuery(id);
}
}
+ else {
+ String sql = rendomizeSql();
+
+ BenchmarkUtils.println(sql);
+
+ sq = new SqlFieldsQuery(sql);
+ }
+
+ if (sq != null)
+ try (QueryCursor cursor = cache.query(sq)) {
+ for (Object obj : cursor) {
+ // No-op.
+ }
+ }
}
}
/**
+ * @return SQL string.
+ */
+ private String rendomizeSql() {
+ String sql = queries.get(nextRandom(queries.size()));
+
+ int count = StringUtils.countOccurrencesOf(sql, "%s");
+
+ Integer[] sub = new Integer[count];
+
+ for (int i=0; i<count; i++)
+ sub[i] = nextRandom(args.range());
+
+ sql = String.format(sql, sub);
+
+ return sql;
+ }
+
+ /**
* @param cache Ignite cache.
* @param map Parameters map.
* @throws Exception If failed.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f267a304/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java
index e21e6b4..9268cdd 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java
@@ -42,7 +42,8 @@ public class ModelUtil {
Identifier.class,
Mark.class,
Integer.class,
- UUID.class
+ UUID.class,
+ String.class
};
/**
@@ -146,6 +147,9 @@ public class ModelUtil {
break;
case "Person8":
res = new Person8(id);
+ break;
+ case "String":
+ res = String.valueOf(id);
}
return res;
[08/50] [abbrv] ignite git commit: IGNITE-3366: Hadoop: better
configuration defaults.
Posted by sb...@apache.org.
IGNITE-3366: Hadoop: better configuration defaults.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1af9052c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1af9052c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1af9052c
Branch: refs/heads/ignite-1232
Commit: 1af9052c73759939978fe256b7c9f3f4f57916c0
Parents: 5cc1f07
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Jun 24 17:32:19 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Jun 30 10:12:13 2016 +0300
----------------------------------------------------------------------
.../org/apache/ignite/configuration/HadoopConfiguration.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1af9052c/modules/core/src/main/java/org/apache/ignite/configuration/HadoopConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/HadoopConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/HadoopConfiguration.java
index 5f68c84..84014d6 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/HadoopConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/HadoopConfiguration.java
@@ -33,10 +33,10 @@ public class HadoopConfiguration {
public static final boolean DFLT_EXTERNAL_EXECUTION = false;
/** Default value for the max parallel tasks. */
- public static final int DFLT_MAX_PARALLEL_TASKS = Runtime.getRuntime().availableProcessors();
+ public static final int DFLT_MAX_PARALLEL_TASKS = Runtime.getRuntime().availableProcessors() * 2;
/** Default value for the max task queue size. */
- public static final int DFLT_MAX_TASK_QUEUE_SIZE = 1000;
+ public static final int DFLT_MAX_TASK_QUEUE_SIZE = 8192;
/** Map reduce planner. */
private HadoopMapReducePlanner planner;
[44/50] [abbrv] ignite git commit: Merge branch 'gridgain-7.6.2' of
https://github.com/gridgain/apache-ignite
Posted by sb...@apache.org.
Merge branch 'gridgain-7.6.2' of https://github.com/gridgain/apache-ignite
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1e8757b7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1e8757b7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1e8757b7
Branch: refs/heads/ignite-1232
Commit: 1e8757b7f168e49f6e94c716ecbe3e3a900437e3
Parents: 9e4d550 aa49995
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Wed Jul 6 18:47:16 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Jul 6 18:47:16 2016 +0700
----------------------------------------------------------------------
.../visor/compute/VisorGatewayTask.java | 2 +-
.../visor/node/VisorNodeDataCollectorTask.java | 26 --------------------
2 files changed, 1 insertion(+), 27 deletions(-)
----------------------------------------------------------------------
[22/50] [abbrv] ignite git commit: IGNITE-3398 .NET: Allow extending
predefined Affinity Functions
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionSerializer.cs
new file mode 100644
index 0000000..888445a
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionSerializer.cs
@@ -0,0 +1,277 @@
+\ufeff/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Impl.Cache.Affinity
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Diagnostics;
+ using System.IO;
+ using System.Linq;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Cache.Affinity;
+ using Apache.Ignite.Core.Cache.Affinity.Fair;
+ using Apache.Ignite.Core.Cache.Affinity.Rendezvous;
+ using Apache.Ignite.Core.Cluster;
+ using Apache.Ignite.Core.Common;
+ using Apache.Ignite.Core.Impl.Binary;
+ using Apache.Ignite.Core.Impl.Binary.IO;
+ using Apache.Ignite.Core.Impl.Memory;
+
+ /// <summary>
+ /// Affinity function read/write methods.
+ /// </summary>
+ internal static class AffinityFunctionSerializer
+ {
+ /** */
+ private const byte TypeCodeNull = 0;
+
+ /** */
+ private const byte TypeCodeFair = 1;
+
+ /** */
+ private const byte TypeCodeRendezvous = 2;
+
+ /** */
+ private const byte TypeCodeUser = 3;
+
+ /// <summary>
+ /// Writes the instance.
+ /// </summary>
+ internal static void Write(IBinaryRawWriter writer, IAffinityFunction fun, object userFuncOverride = null)
+ {
+ Debug.Assert(writer != null);
+
+ if (fun == null)
+ {
+ writer.WriteByte(TypeCodeNull);
+ return;
+ }
+
+ // 1) Type code
+ // 2) Partitions
+ // 3) ExcludeNeighbors
+ // 4) Override flags
+ // 5) User object
+
+ var p = fun as AffinityFunctionBase;
+
+ if (p != null)
+ {
+ writer.WriteByte(p is FairAffinityFunction ? TypeCodeFair : TypeCodeRendezvous);
+ writer.WriteInt(p.Partitions);
+ writer.WriteBoolean(p.ExcludeNeighbors);
+
+ var overrideFlags = GetOverrideFlags(p.GetType());
+ writer.WriteByte((byte) overrideFlags);
+
+ // Do not write user func if there is nothing overridden
+ WriteUserFunc(writer, overrideFlags != UserOverrides.None ? fun : null, userFuncOverride);
+ }
+ else
+ {
+ writer.WriteByte(TypeCodeUser);
+ writer.WriteInt(fun.Partitions);
+ writer.WriteBoolean(false); // Exclude neighbors
+ writer.WriteByte((byte) UserOverrides.All);
+ WriteUserFunc(writer, fun, userFuncOverride);
+ }
+ }
+
+ /// <summary>
+ /// Reads the instance.
+ /// </summary>
+ internal static IAffinityFunction Read(IBinaryRawReader reader)
+ {
+ Debug.Assert(reader != null);
+
+ var typeCode = reader.ReadByte();
+
+ if (typeCode == TypeCodeNull)
+ return null;
+
+ var partitions = reader.ReadInt();
+ var exclNeighbors = reader.ReadBoolean();
+ var overrideFlags = (UserOverrides)reader.ReadByte();
+ var userFunc = reader.ReadObjectEx<IAffinityFunction>();
+
+ if (userFunc != null)
+ {
+ Debug.Assert(overrideFlags != UserOverrides.None);
+
+ var fair = userFunc as FairAffinityFunction;
+ if (fair != null)
+ {
+ fair.Partitions = partitions;
+ fair.ExcludeNeighbors = exclNeighbors;
+ }
+
+ var rendezvous = userFunc as RendezvousAffinityFunction;
+ if (rendezvous != null)
+ {
+ rendezvous.Partitions = partitions;
+ rendezvous.ExcludeNeighbors = exclNeighbors;
+ }
+
+ return userFunc;
+ }
+
+ Debug.Assert(overrideFlags == UserOverrides.None);
+ AffinityFunctionBase fun;
+
+ switch (typeCode)
+ {
+ case TypeCodeFair:
+ fun = new FairAffinityFunction();
+ break;
+ case TypeCodeRendezvous:
+ fun = new RendezvousAffinityFunction();
+ break;
+ default:
+ throw new InvalidOperationException("Invalid AffinityFunction type code: " + typeCode);
+ }
+
+ fun.Partitions = partitions;
+ fun.ExcludeNeighbors = exclNeighbors;
+
+ return fun;
+ }
+
+
+ /// <summary>
+ /// Writes the partitions assignment to a stream.
+ /// </summary>
+ /// <param name="parts">The parts.</param>
+ /// <param name="stream">The stream.</param>
+ /// <param name="marsh">The marshaller.</param>
+ internal static void WritePartitions(IEnumerable<IEnumerable<IClusterNode>> parts,
+ PlatformMemoryStream stream, Marshaller marsh)
+ {
+ Debug.Assert(parts != null);
+ Debug.Assert(stream != null);
+ Debug.Assert(marsh != null);
+
+ IBinaryRawWriter writer = marsh.StartMarshal(stream);
+
+ var partCnt = 0;
+ writer.WriteInt(partCnt); // reserve size
+
+ foreach (var part in parts)
+ {
+ if (part == null)
+ throw new IgniteException("IAffinityFunction.AssignPartitions() returned invalid partition: null");
+
+ partCnt++;
+
+ var nodeCnt = 0;
+ var cntPos = stream.Position;
+ writer.WriteInt(nodeCnt); // reserve size
+
+ foreach (var node in part)
+ {
+ nodeCnt++;
+ writer.WriteGuid(node.Id);
+ }
+
+ var endPos = stream.Position;
+ stream.Seek(cntPos, SeekOrigin.Begin);
+ stream.WriteInt(nodeCnt);
+ stream.Seek(endPos, SeekOrigin.Begin);
+ }
+
+ stream.SynchronizeOutput();
+ stream.Seek(0, SeekOrigin.Begin);
+ writer.WriteInt(partCnt);
+ }
+
+ /// <summary>
+ /// Reads the partitions assignment from a stream.
+ /// </summary>
+ /// <param name="stream">The stream.</param>
+ /// <param name="marsh">The marshaller.</param>
+ /// <returns>Partitions assignment.</returns>
+ internal static IEnumerable<IEnumerable<IClusterNode>> ReadPartitions(IBinaryStream stream, Marshaller marsh)
+ {
+ Debug.Assert(stream != null);
+ Debug.Assert(marsh != null);
+
+ IBinaryRawReader reader = marsh.StartUnmarshal(stream);
+
+ var partCnt = reader.ReadInt();
+
+ var res = new List<IEnumerable<IClusterNode>>(partCnt);
+
+ for (var i = 0; i < partCnt; i++)
+ res.Add(IgniteUtils.ReadNodes(reader));
+
+ return res;
+ }
+
+ /// <summary>
+ /// Gets the override flags.
+ /// </summary>
+ private static UserOverrides GetOverrideFlags(Type funcType)
+ {
+ var res = UserOverrides.None;
+
+ var methods = new[] {UserOverrides.GetPartition, UserOverrides.AssignPartitions, UserOverrides.RemoveNode};
+
+ var map = funcType.GetInterfaceMap(typeof(IAffinityFunction));
+
+ foreach (var method in methods)
+ {
+ // Find whether user type overrides IAffinityFunction method from AffinityFunctionBase.
+ var methodName = method.ToString();
+
+ if (map.TargetMethods.Single(x => x.Name == methodName).DeclaringType != typeof(AffinityFunctionBase))
+ res |= method;
+ }
+
+ return res;
+ }
+
+ /// <summary>
+ /// Writes the user function.
+ /// </summary>
+ private static void WriteUserFunc(IBinaryRawWriter writer, IAffinityFunction func, object funcOverride)
+ {
+ if (funcOverride != null)
+ {
+ writer.WriteObject(funcOverride);
+ return;
+ }
+
+ if (func != null && !func.GetType().IsSerializable)
+ throw new IgniteException("AffinityFunction should be serializable.");
+
+ writer.WriteObject(func);
+ }
+
+ /// <summary>
+ /// Overridden function flags.
+ /// </summary>
+ [Flags]
+ private enum UserOverrides : byte
+ {
+ None = 0,
+ GetPartition = 1,
+ RemoveNode = 1 << 1,
+ AssignPartitions = 1 << 2,
+ All = GetPartition | RemoveNode | AssignPartitions
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/PlatformAffinityFunction.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/PlatformAffinityFunction.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/PlatformAffinityFunction.cs
new file mode 100644
index 0000000..d335804
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/PlatformAffinityFunction.cs
@@ -0,0 +1,74 @@
+\ufeff/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Impl.Cache.Affinity
+{
+ using System;
+ using System.Collections.Generic;
+ using Apache.Ignite.Core.Cache.Affinity;
+ using Apache.Ignite.Core.Cluster;
+ using Apache.Ignite.Core.Impl.Binary;
+ using Apache.Ignite.Core.Impl.Unmanaged;
+
+ /// <summary>
+ /// Affinity function that delegates to Java.
+ /// </summary>
+ internal class PlatformAffinityFunction : PlatformTarget, IAffinityFunction
+ {
+ /** Opcodes. */
+ private enum Op
+ {
+ Partition = 1,
+ RemoveNode = 2,
+ AssignPartitions = 3
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="PlatformAffinityFunction"/> class.
+ /// </summary>
+ /// <param name="target">Target.</param>
+ /// <param name="marsh">Marshaller.</param>
+ public PlatformAffinityFunction(IUnmanagedTarget target, Marshaller marsh) : base(target, marsh)
+ {
+ // No-op.
+ }
+
+ /** <inheritdoc /> */
+ public int Partitions
+ {
+ get { throw new NotSupportedException("PlatformAffinityFunction.Partitions is not supported."); }
+ }
+
+ /** <inheritdoc /> */
+ public int GetPartition(object key)
+ {
+ return (int) DoOutOp((int) Op.Partition, w => w.WriteObject(key));
+ }
+
+ /** <inheritdoc /> */
+ public void RemoveNode(Guid nodeId)
+ {
+ DoOutOp((int) Op.RemoveNode, w => w.WriteGuid(nodeId));
+ }
+
+ /** <inheritdoc /> */
+ public IEnumerable<IEnumerable<IClusterNode>> AssignPartitions(AffinityFunctionContext context)
+ {
+ return DoInOp((int) Op.AssignPartitions, s => AffinityFunctionSerializer.ReadPartitions(s, Marshaller));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/ObjectInfoHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/ObjectInfoHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/ObjectInfoHolder.cs
new file mode 100644
index 0000000..407fe0c
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/ObjectInfoHolder.cs
@@ -0,0 +1,86 @@
+\ufeff/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Impl.Common
+{
+ using System.Collections.Generic;
+ using System.Diagnostics;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Impl.Binary;
+
+ /// <summary>
+ /// Holds the information to instantiate an object and set its properties.
+ /// Typically used for .NET objects defined in Spring XML.
+ /// </summary>
+ internal class ObjectInfoHolder : IBinaryWriteAware
+ {
+ /** Type name. */
+ private readonly string _typeName;
+
+ /** Properties. */
+ private readonly Dictionary<string, object> _properties;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ObjectInfoHolder"/> class.
+ /// </summary>
+ /// <param name="reader">The reader.</param>
+ public ObjectInfoHolder(IBinaryRawReader reader)
+ {
+ Debug.Assert(reader != null);
+
+ _typeName = reader.ReadString();
+ _properties = reader.ReadDictionaryAsGeneric<string, object>();
+
+ Debug.Assert(!string.IsNullOrEmpty(_typeName));
+ }
+
+ /// <summary>
+ /// Gets the name of the type.
+ /// </summary>
+ public string TypeName
+ {
+ get { return _typeName; }
+ }
+
+ /// <summary>
+ /// Gets the properties.
+ /// </summary>
+ public Dictionary<string, object> Properties
+ {
+ get { return _properties; }
+ }
+
+ /// <summary>
+ /// Creates an instance according to type name and properties.
+ /// </summary>
+ public T CreateInstance<T>()
+ {
+ return IgniteUtils.CreateInstance<T>(TypeName, Properties);
+ }
+
+ /** <inheritdoc /> */
+ public void WriteBinary(IBinaryWriter writer)
+ {
+ Debug.Assert(writer != null);
+
+ var w = writer.GetRawWriter();
+
+ w.WriteString(_typeName);
+ w.WriteDictionary(_properties);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs
index 94f6166..fdadb1c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs
@@ -20,6 +20,7 @@ namespace Apache.Ignite.Core.Impl
using System;
using System.Collections.Generic;
using System.ComponentModel;
+ using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
@@ -478,5 +479,25 @@ namespace Apache.Ignite.Core.Impl
return res;
}
+
+ /// <summary>
+ /// Writes the node collection to a stream.
+ /// </summary>
+ /// <param name="writer">The writer.</param>
+ /// <param name="nodes">The nodes.</param>
+ public static void WriteNodes(IBinaryRawWriter writer, ICollection<IClusterNode> nodes)
+ {
+ Debug.Assert(writer != null);
+
+ if (nodes != null)
+ {
+ writer.WriteInt(nodes.Count);
+
+ foreach (var node in nodes)
+ writer.WriteGuid(node.Id);
+ }
+ else
+ writer.WriteInt(-1);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
index 176d3b4..ef901cb 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
@@ -21,7 +21,6 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
- using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using Apache.Ignite.Core.Cache.Affinity;
@@ -30,6 +29,7 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
using Apache.Ignite.Core.Impl.Binary;
using Apache.Ignite.Core.Impl.Binary.IO;
using Apache.Ignite.Core.Impl.Cache;
+ using Apache.Ignite.Core.Impl.Cache.Affinity;
using Apache.Ignite.Core.Impl.Cache.Query.Continuous;
using Apache.Ignite.Core.Impl.Cache.Store;
using Apache.Ignite.Core.Impl.Common;
@@ -166,7 +166,7 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
private delegate void OnClientDisconnectedDelegate(void* target);
private delegate void OnClientReconnectedDelegate(void* target, bool clusterRestarted);
- private delegate long AffinityFunctionInitDelegate(void* target, long memPtr);
+ private delegate long AffinityFunctionInitDelegate(void* target, long memPtr, void* baseFunc);
private delegate int AffinityFunctionPartitionDelegate(void* target, long ptr, long memPtr);
private delegate void AffinityFunctionAssignPartitionsDelegate(void* target, long ptr, long inMemPtr, long outMemPtr);
private delegate void AffinityFunctionRemoveNodeDelegate(void* target, long ptr, long memPtr);
@@ -1109,21 +1109,23 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
#region AffinityFunction
- private long AffinityFunctionInit(void* target, long memPtr)
+ private long AffinityFunctionInit(void* target, long memPtr, void* baseFunc)
{
return SafeCall(() =>
{
using (var stream = IgniteManager.Memory.Get(memPtr).GetStream())
{
var reader = _ignite.Marshaller.StartUnmarshal(stream);
+
+ var func = reader.ReadObjectEx<IAffinityFunction>();
- var funcOrTypeName = reader.ReadObject<object>();
+ ResourceProcessor.Inject(func, _ignite);
- var func = funcOrTypeName as IAffinityFunction
- ?? IgniteUtils.CreateInstance<IAffinityFunction>((string) funcOrTypeName,
- reader.ReadDictionaryAsGeneric<string, object>());
+ var affBase = func as AffinityFunctionBase;
- ResourceProcessor.Inject(func, _ignite);
+ if (affBase != null)
+ affBase.SetBaseFunction(new PlatformAffinityFunction(
+ _ignite.InteropProcessor.ChangeTarget(baseFunc), _ignite.Marshaller));
return _handleRegistry.Allocate(func);
}
@@ -1158,38 +1160,7 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
using (var outStream = IgniteManager.Memory.Get(outMemPtr).GetStream())
{
- var writer = _ignite.Marshaller.StartMarshal(outStream);
-
- var partCnt = 0;
- writer.WriteInt(partCnt); // reserve size
-
- foreach (var part in parts)
- {
- if (part == null)
- throw new IgniteException(func.GetType() +
- ".AssignPartitions() returned invalid partition: null");
-
- partCnt++;
-
- var nodeCnt = 0;
- var cntPos = outStream.Position;
- writer.WriteInt(nodeCnt); // reserve size
-
- foreach (var node in part)
- {
- nodeCnt++;
- writer.WriteGuid(node.Id);
- }
-
- var endPos = outStream.Position;
- outStream.Seek(cntPos, SeekOrigin.Begin);
- outStream.WriteInt(nodeCnt);
- outStream.Seek(endPos, SeekOrigin.Begin);
- }
-
- outStream.SynchronizeOutput();
- outStream.Seek(0, SeekOrigin.Begin);
- writer.WriteInt(partCnt);
+ AffinityFunctionSerializer.WritePartitions(parts, outStream, _ignite.Marshaller);
}
}
});
[26/50] [abbrv] ignite git commit: IGNITE-2949 - Replaced JCache
dependency with Geronimo
Posted by sb...@apache.org.
IGNITE-2949 - Replaced JCache dependency with Geronimo
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3b22e83f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3b22e83f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3b22e83f
Branch: refs/heads/ignite-1232
Commit: 3b22e83fd7684d93bfa9c58059206c07820df506
Parents: 2d40ae6
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Tue Jul 5 18:41:38 2016 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Tue Jul 5 18:41:38 2016 -0700
----------------------------------------------------------------------
modules/kafka/README.txt | 4 ++--
.../platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3b22e83f/modules/kafka/README.txt
----------------------------------------------------------------------
diff --git a/modules/kafka/README.txt b/modules/kafka/README.txt
index 259a4f6..80103a6 100644
--- a/modules/kafka/README.txt
+++ b/modules/kafka/README.txt
@@ -47,7 +47,7 @@ as described in the following subsection.
- ignite-kafka-connect-x.x.x-SNAPSHOT.jar
- ignite-core-x.x.x-SNAPSHOT.jar
- ignite-spring-x.x.x-SNAPSHOT.jar
-- cache-api-1.0.0.jar
+- geronimo-jcache_1.0_spec-1.0-alpha-1.jar
- spring-aop-4.1.0.RELEASE.jar
- spring-beans-4.1.0.RELEASE.jar
- spring-context-4.1.0.RELEASE.jar
@@ -140,7 +140,7 @@ as described in the following subsection.
1. Put the following jar files on Kafka's classpath
- ignite-kafka-connect-x.x.x-SNAPSHOT.jar
- ignite-core-x.x.x-SNAPSHOT.jar
-- cache-api-1.0.0.jar
+- geronimo-jcache_1.0_spec-1.0-alpha-1.jar
- ignite-spring-x.x.x-SNAPSHOT.jar
- spring-aop-4.1.0.RELEASE.jar
- spring-beans-4.1.0.RELEASE.jar
http://git-wip-us.apache.org/repos/asf/ignite/blob/3b22e83f/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs
index cd23724..e890dc8 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs
@@ -45,7 +45,7 @@ namespace Apache.Ignite.Core.Tests
// Copy jars
var home = IgniteHome.Resolve(null);
- var jarNames = new[] {@"\ignite-core-", @"\cache-api-1.0.0.jar", @"\modules\spring\" };
+ var jarNames = new[] {@"\ignite-core-", @"\geronimo-jcache_1.0_spec-1.0-alpha-1.jar", @"\modules\spring\" };
var jars = Directory.GetFiles(home, "*.jar", SearchOption.AllDirectories)
.Where(jarPath => jarNames.Any(jarPath.Contains)).ToArray();
@@ -87,7 +87,7 @@ namespace Apache.Ignite.Core.Tests
{
VerifyNodeStarted(exePath);
}
- finally
+ finally
{
proc.Kill();
[43/50] [abbrv] ignite git commit: VisorNodeDataCollectorTask should
be aware of passed nodes IDs.
Posted by sb...@apache.org.
VisorNodeDataCollectorTask should be aware of passed nodes IDs.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/aa499959
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/aa499959
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/aa499959
Branch: refs/heads/ignite-1232
Commit: aa499959d5551967ee6d4aba321e98a3415094ba
Parents: f267a30
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Wed Jul 6 18:17:52 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Jul 6 18:17:52 2016 +0700
----------------------------------------------------------------------
.../visor/compute/VisorGatewayTask.java | 2 +-
.../visor/node/VisorNodeDataCollectorTask.java | 26 --------------------
2 files changed, 1 insertion(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aa499959/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
index f1b22ff..2539a26 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
@@ -175,7 +175,7 @@ public class VisorGatewayTask implements ComputeTask<Object[], Object> {
assert values.length >= 1;
res.put(toSimpleObject(keyCls, values[0]),
- values.length > 1 ? toSimpleObject(valCls, values[1]) : null);
+ values.length > 1 ? toSimpleObject(valCls, values[1]) : null);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/aa499959/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java
index 494f902..746583d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java
@@ -18,22 +18,15 @@
package org.apache.ignite.internal.visor.node;
import java.util.List;
-import java.util.Map;
import java.util.UUID;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cluster.ClusterGroupEmptyException;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.compute.ComputeJob;
import org.apache.ignite.compute.ComputeJobResult;
import org.apache.ignite.internal.processors.task.GridInternal;
-import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.visor.VisorMultiNodeTask;
-import org.apache.ignite.internal.visor.VisorTaskArgument;
import org.apache.ignite.internal.visor.util.VisorExceptionWrapper;
import org.jetbrains.annotations.Nullable;
-import static org.apache.ignite.internal.visor.util.VisorTaskUtils.logMapped;
-
/**
* Collects current Grid state mostly topology and metrics.
*/
@@ -44,25 +37,6 @@ public class VisorNodeDataCollectorTask extends VisorMultiNodeTask<VisorNodeData
private static final long serialVersionUID = 0L;
/** {@inheritDoc} */
- @Override protected Map<? extends ComputeJob, ClusterNode> map0(List<ClusterNode> subgrid,
- VisorTaskArgument<VisorNodeDataCollectorTaskArg> arg) {
- assert arg != null;
-
- Map<ComputeJob, ClusterNode> map = U.newHashMap(subgrid.size());
-
- try {
- for (ClusterNode node : subgrid)
- map.put(job(taskArg), node);
-
- return map;
- }
- finally {
- if (debug)
- logMapped(ignite.log(), getClass(), map.values());
- }
- }
-
- /** {@inheritDoc} */
@Override protected VisorNodeDataCollectorJob job(VisorNodeDataCollectorTaskArg arg) {
return new VisorNodeDataCollectorJob(arg, debug);
}
[20/50] [abbrv] ignite git commit: Merge to master.
Posted by sb...@apache.org.
Merge to master.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b3af61f7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b3af61f7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b3af61f7
Branch: refs/heads/ignite-1232
Commit: b3af61f76b373210a8902a3335e922a3fd173524
Parents: d31a476 d33f4db
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Tue Jul 5 17:26:25 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Tue Jul 5 17:26:25 2016 +0700
----------------------------------------------------------------------
bin/include/hadoop-classpath.bat | 73 --
bin/include/hadoop-classpath.sh | 65 --
bin/include/setenv.bat | 4 +-
bin/include/setenv.sh | 25 +-
.../org/apache/ignite/IgniteDataStreamer.java | 5 +-
.../ignite/binary/BinaryObjectBuilder.java | 11 +
.../configuration/HadoopConfiguration.java | 4 +-
.../apache/ignite/internal/IgniteKernal.java | 52 +-
.../dht/GridDhtPartitionTopologyImpl.java | 2 +-
.../processors/hadoop/HadoopNoopProcessor.java | 5 +
.../hadoop/HadoopProcessorAdapter.java | 7 +
.../service/GridServiceProcessor.java | 2 +-
.../visor/cache/VisorCachePartitionsTask.java | 2 +-
.../ignite/internal/visor/igfs/VisorIgfs.java | 2 +-
.../internal/visor/igfs/VisorIgfsMetrics.java | 11 +-
.../service/IgniteServiceReassignmentTest.java | 250 ++++
.../testsuites/IgniteKernalSelfTestSuite.java | 2 +
.../IgniteHadoopClientProtocolProvider.java | 1 +
.../processors/hadoop/HadoopClassLoader.java | 73 +-
.../processors/hadoop/HadoopClasspathMain.java | 44 +
.../processors/hadoop/HadoopClasspathUtils.java | 233 ++++
.../processors/hadoop/HadoopLocations.java | 78 ++
.../processors/hadoop/HadoopProcessor.java | 79 +-
.../include/ignite/binary/binary_containers.h | 6 +-
.../include/ignite/binary/binary_raw_reader.h | 6 +-
.../include/ignite/binary/binary_reader.h | 6 +-
.../ignite/impl/binary/binary_reader_impl.h | 11 +-
.../ignite/impl/binary/binary_writer_impl.h | 2 +-
modules/platforms/cpp/common/Makefile.am | 5 +-
.../platforms/cpp/common/include/Makefile.am | 19 +-
.../common/include/ignite/common/big_integer.h | 523 +++++++++
.../cpp/common/include/ignite/common/bits.h | 218 ++++
.../cpp/common/include/ignite/common/decimal.h | 527 +++++++++
.../include/ignite/common/default_allocator.h | 95 ++
.../include/ignite/common/dynamic_size_array.h | 415 +++++++
.../include/ignite/common/fixed_size_array.h | 288 +++++
.../cpp/common/include/ignite/common/utils.h | 81 +-
.../platforms/cpp/common/include/ignite/guid.h | 4 +-
.../cpp/common/os/win/src/common/utils.cpp | 21 -
.../cpp/common/project/vs/common.vcxproj | 17 +-
.../common/project/vs/common.vcxproj.filters | 27 +
.../cpp/common/src/common/big_integer.cpp | 830 +++++++++++++
.../platforms/cpp/common/src/common/bits.cpp | 233 ++++
.../platforms/cpp/common/src/common/decimal.cpp | 275 +++++
modules/platforms/cpp/core-test/Makefile.am | 4 +
.../cpp/core-test/project/vs/core-test.vcxproj | 9 +-
.../project/vs/core-test.vcxproj.filters | 14 +-
.../platforms/cpp/core-test/src/bits_test.cpp | 124 ++
.../cpp/core-test/src/decimal_test.cpp | 1101 ++++++++++++++++++
.../core-test/src/dynamic_size_array_test.cpp | 360 ++++++
.../cpp/core-test/src/fixed_size_array_test.cpp | 208 ++++
.../cpp/core/include/ignite/cache/cache_entry.h | 2 +-
modules/platforms/cpp/odbc-test/Makefile.am | 1 -
.../cpp/odbc-test/project/vs/odbc-test.vcxproj | 1 -
.../project/vs/odbc-test.vcxproj.filters | 3 -
.../src/application_data_buffer_test.cpp | 35 +-
.../platforms/cpp/odbc-test/src/row_test.cpp | 5 +-
modules/platforms/cpp/odbc/Makefile.am | 1 -
modules/platforms/cpp/odbc/include/Makefile.am | 1 -
.../ignite/odbc/app/application_data_buffer.h | 11 +-
.../cpp/odbc/include/ignite/odbc/decimal.h | 137 ---
.../cpp/odbc/include/ignite/odbc/utility.h | 12 +-
.../platforms/cpp/odbc/project/vs/odbc.vcxproj | 2 -
.../cpp/odbc/project/vs/odbc.vcxproj.filters | 6 -
.../odbc/src/app/application_data_buffer.cpp | 165 ++-
.../platforms/cpp/odbc/src/app/parameter.cpp | 6 +-
modules/platforms/cpp/odbc/src/column.cpp | 6 +-
modules/platforms/cpp/odbc/src/connection.cpp | 1 -
modules/platforms/cpp/odbc/src/decimal.cpp | 135 ---
modules/platforms/cpp/odbc/src/odbc.cpp | 3 -
modules/platforms/cpp/odbc/src/utility.cpp | 25 +-
71 files changed, 6265 insertions(+), 752 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b3af61f7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b3af61f7/modules/platforms/cpp/core-test/Makefile.am
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b3af61f7/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj
----------------------------------------------------------------------
diff --cc modules/platforms/cpp/core-test/project/vs/core-test.vcxproj
index a7ffad8,acdfee0..c18b1c3
--- a/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj
+++ b/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj
@@@ -45,7 -51,7 +51,8 @@@
<ClCompile Include="..\..\src\binary_test_defs.cpp" />
<ClCompile Include="..\..\src\cache_query_test.cpp" />
<ClCompile Include="..\..\src\interop_memory_test.cpp" />
+ <ClCompile Include="..\..\src\interop_test.cpp" />
+ <ClCompile Include="..\..\src\bits_test.cpp" />
<ClCompile Include="..\..\src\teamcity_boost.cpp" />
<ClCompile Include="..\..\src\teamcity_messages.cpp" />
<ClCompile Include="..\..\src\transactions_test.cpp" />
@@@ -178,4 -184,4 +185,4 @@@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
--</Project>
++</Project>
http://git-wip-us.apache.org/repos/asf/ignite/blob/b3af61f7/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters
----------------------------------------------------------------------
diff --cc modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters
index 39e2aee,0366374..0059364
--- a/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters
+++ b/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters
@@@ -43,9 -43,18 +43,21 @@@
<ClCompile Include="..\..\src\transactions_test.cpp">
<Filter>Code</Filter>
</ClCompile>
+ <ClCompile Include="..\..\src\bits_test.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\decimal_test.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\fixed_size_array_test.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\dynamic_size_array_test.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\interop_test.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\teamcity_messages.h">
@@@ -77,4 -86,4 +89,4 @@@
<Filter>Configs</Filter>
</None>
</ItemGroup>
--</Project>
++</Project>
[03/50] [abbrv] ignite git commit: IGNITE-2879: ODBC: Added decimal
support.
Posted by sb...@apache.org.
IGNITE-2879: ODBC: Added decimal support.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5cc1f074
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5cc1f074
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5cc1f074
Branch: refs/heads/ignite-1232
Commit: 5cc1f074d038b1883ff8a5fd08729e1ce8dcf9f8
Parents: 7d4b159
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Mon Jun 27 15:23:31 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Jun 27 15:23:31 2016 +0300
----------------------------------------------------------------------
.../include/ignite/binary/binary_containers.h | 6 +-
.../include/ignite/binary/binary_raw_reader.h | 6 +-
.../include/ignite/binary/binary_reader.h | 6 +-
.../ignite/impl/binary/binary_reader_impl.h | 11 +-
.../ignite/impl/binary/binary_writer_impl.h | 2 +-
modules/platforms/cpp/common/Makefile.am | 5 +-
.../platforms/cpp/common/include/Makefile.am | 19 +-
.../common/include/ignite/common/big_integer.h | 523 +++++++++
.../cpp/common/include/ignite/common/bits.h | 218 ++++
.../include/ignite/common/default_allocator.h | 95 ++
.../include/ignite/common/dynamic_size_array.h | 415 +++++++
.../include/ignite/common/fixed_size_array.h | 288 +++++
.../cpp/common/include/ignite/common/utils.h | 81 +-
.../platforms/cpp/common/include/ignite/guid.h | 4 +-
.../cpp/common/os/win/src/common/utils.cpp | 21 -
.../cpp/common/project/vs/common.vcxproj | 17 +-
.../common/project/vs/common.vcxproj.filters | 27 +
.../cpp/common/src/common/big_integer.cpp | 830 +++++++++++++
.../platforms/cpp/common/src/common/bits.cpp | 233 ++++
modules/platforms/cpp/core-test/Makefile.am | 4 +
.../cpp/core-test/project/vs/core-test.vcxproj | 7 +
.../project/vs/core-test.vcxproj.filters | 12 +
.../platforms/cpp/core-test/src/bits_test.cpp | 124 ++
.../cpp/core-test/src/decimal_test.cpp | 1101 ++++++++++++++++++
.../core-test/src/dynamic_size_array_test.cpp | 360 ++++++
.../cpp/core-test/src/fixed_size_array_test.cpp | 208 ++++
.../cpp/core/include/ignite/cache/cache_entry.h | 2 +-
modules/platforms/cpp/odbc-test/Makefile.am | 1 -
.../cpp/odbc-test/project/vs/odbc-test.vcxproj | 1 -
.../project/vs/odbc-test.vcxproj.filters | 3 -
.../src/application_data_buffer_test.cpp | 35 +-
.../platforms/cpp/odbc-test/src/row_test.cpp | 5 +-
modules/platforms/cpp/odbc/Makefile.am | 1 -
modules/platforms/cpp/odbc/include/Makefile.am | 1 -
.../ignite/odbc/app/application_data_buffer.h | 11 +-
.../cpp/odbc/include/ignite/odbc/decimal.h | 137 ---
.../cpp/odbc/include/ignite/odbc/utility.h | 12 +-
.../platforms/cpp/odbc/project/vs/odbc.vcxproj | 2 -
.../cpp/odbc/project/vs/odbc.vcxproj.filters | 6 -
.../odbc/src/app/application_data_buffer.cpp | 210 +++-
.../platforms/cpp/odbc/src/app/parameter.cpp | 6 +-
modules/platforms/cpp/odbc/src/column.cpp | 6 +-
modules/platforms/cpp/odbc/src/connection.cpp | 1 -
modules/platforms/cpp/odbc/src/decimal.cpp | 135 ---
modules/platforms/cpp/odbc/src/odbc.cpp | 3 -
modules/platforms/cpp/odbc/src/utility.cpp | 25 +-
46 files changed, 4759 insertions(+), 467 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/binary/include/ignite/binary/binary_containers.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_containers.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_containers.h
index 8f26416..9938dd5 100644
--- a/modules/platforms/cpp/binary/include/ignite/binary/binary_containers.h
+++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_containers.h
@@ -342,11 +342,11 @@ namespace ignite
if (len != -1)
{
- common::SafeArray<char> arr(len + 1);
+ ignite::common::FixedSizeArray<char> arr(len + 1);
- GetNext(arr.target, len + 1);
+ GetNext(arr.GetData(), static_cast<int32_t>(arr.GetSize()));
- return std::string(arr.target);
+ return std::string(arr.GetData());
}
else
return std::string();
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_reader.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_reader.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_reader.h
index 3104437..72aab55 100644
--- a/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_reader.h
+++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_reader.h
@@ -298,11 +298,11 @@ namespace ignite
if (len != -1)
{
- ignite::common::SafeArray<char> arr(len + 1);
+ ignite::common::FixedSizeArray<char> arr(len + 1);
- ReadString(arr.target, len + 1);
+ ReadString(arr.GetData(), static_cast<int32_t>(arr.GetSize()));
- return std::string(arr.target);
+ return std::string(arr.GetData());
}
else
return std::string();
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/binary/include/ignite/binary/binary_reader.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_reader.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_reader.h
index ac70f39..e4eb690 100644
--- a/modules/platforms/cpp/binary/include/ignite/binary/binary_reader.h
+++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_reader.h
@@ -321,11 +321,11 @@ namespace ignite
if (len != -1)
{
- ignite::common::SafeArray<char> arr(len + 1);
+ ignite::common::FixedSizeArray<char> arr(len + 1);
- ReadString(fieldName, arr.target, len + 1);
+ ReadString(fieldName, arr.GetData(), static_cast<int32_t>(arr.GetSize()));
- return std::string(arr.target);
+ return std::string(arr.GetData());
}
else
return std::string();
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_reader_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_reader_impl.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_reader_impl.h
index d2a4e24..71b4e61 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_reader_impl.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_reader_impl.h
@@ -21,6 +21,7 @@
#include <stdint.h>
#include <ignite/common/common.h>
+#include <ignite/common/fixed_size_array.h>
#include "ignite/impl/interop/interop_input_stream.h"
#include "ignite/impl/binary/binary_common.h"
@@ -1397,14 +1398,14 @@ namespace ignite
{
int32_t realLen = stream->ReadInt32();
- ignite::common::SafeArray<char> arr(realLen + 1);
+ ignite::common::FixedSizeArray<char> arr(realLen + 1);
- for (int i = 0; i < realLen; i++)
- *(arr.target + i) = static_cast<char>(stream->ReadInt8());
+ for (int32_t i = 0; i < realLen; i++)
+ arr[i] = static_cast<char>(stream->ReadInt8());
- *(arr.target + realLen) = 0;
+ arr[realLen] = 0;
- return std::string(arr.target);
+ return std::string(arr.GetData());
}
else if (typeId == IGNITE_HDR_NULL)
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h
index fda507f..6ee088d 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h
@@ -972,7 +972,7 @@ namespace ignite
{
const char* obj0 = obj.c_str();
- int32_t len = static_cast<int32_t>(strlen(obj0));
+ int32_t len = static_cast<int32_t>(obj.size());
stream->WriteInt8(IGNITE_TYPE_STRING);
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/common/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/Makefile.am b/modules/platforms/cpp/common/Makefile.am
index 6956627..c230384 100644
--- a/modules/platforms/cpp/common/Makefile.am
+++ b/modules/platforms/cpp/common/Makefile.am
@@ -42,9 +42,12 @@ libignite_common_la_LDFLAGS = \
libignite_common_la_SOURCES = \
os/linux/src/common/concurrent_os.cpp \
os/linux/src/common/utils.cpp \
+ src/common/big_integer.cpp \
src/common/concurrent.cpp \
- src/ignite_error.cpp \
+ src/common/decimal.cpp \
+ src/common/bits.cpp \
src/date.cpp \
+ src/ignite_error.cpp \
src/guid.cpp \
src/timestamp.cpp
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/common/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/Makefile.am b/modules/platforms/cpp/common/include/Makefile.am
index b18d6f8..2e53608 100644
--- a/modules/platforms/cpp/common/include/Makefile.am
+++ b/modules/platforms/cpp/common/include/Makefile.am
@@ -18,12 +18,19 @@
ACLOCAL_AMFLAGS =-I m4
nobase_include_HEADERS = \
- ignite/common/concurrent.h \
- ignite/common/utils.h \
- ignite/ignite_error.h \
- ignite/date.h \
- ignite/guid.h \
- ignite/timestamp.h
+ ignite/common/big_integer.h \
+ ignite/common/bits.h \
+ ignite/common/concurrent.h \
+ ignite/common/decimal.h \
+ ignite/common/default_allocator.h \
+ ignite/common/dynamic_size_array.h \
+ ignite/common/fixed_size_array.h \
+ ignite/common/utils.h \
+ ignite/date.h \
+ ignite/guid.h \
+ ignite/ignite_error.h \
+ ignite/timestamp.h
+ ignite/timestamp.h
uninstall-hook:
if [ -d ${includedir}/ignite ]; then find ${includedir}/ignite -type d -empty -delete; fi
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/common/include/ignite/common/big_integer.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/common/big_integer.h b/modules/platforms/cpp/common/include/ignite/common/big_integer.h
new file mode 100644
index 0000000..ceddd8f
--- /dev/null
+++ b/modules/platforms/cpp/common/include/ignite/common/big_integer.h
@@ -0,0 +1,523 @@
+/*
+ * 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.
+ */
+
+#ifndef _IGNITE_COMMON_BIG_INTEGER
+#define _IGNITE_COMMON_BIG_INTEGER
+
+#include <stdint.h>
+
+#include <iostream>
+#include <vector>
+
+#include <ignite/common/dynamic_size_array.h>
+
+namespace ignite
+{
+ namespace common
+ {
+ /**
+ * Big integer number implementation.
+ */
+ class BigInteger
+ {
+ friend class Decimal;
+ public:
+ // Magnitude array type.
+ typedef DynamicSizeArray<uint32_t> MagArray;
+
+ /**
+ * Default constructor. Constructs zero-value big integer.
+ */
+ BigInteger();
+
+ /**
+ * Constructs big integer with the specified integer value.
+ *
+ * @param val Value.
+ */
+ explicit BigInteger(int64_t val);
+
+ /**
+ * String constructor.
+ *
+ * @param val String to assign.
+ * @param len String length.
+ */
+ BigInteger(const char* val, int32_t len);
+
+ /**
+ * String constructor.
+ *
+ * @param val String to assign.
+ */
+ explicit BigInteger(const std::string& val) :
+ sign(1),
+ mag()
+ {
+ AssignString(val);
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param other Other value.
+ */
+ BigInteger(const BigInteger& other);
+
+ /**
+ * Constructs big integer from the byte array.
+ *
+ * @param val Bytes of the integer. Byte order is big-endian.
+ * @param len Array length.
+ * @param sign Signum. Can be -1 (negative) or 1 (positive or zero).
+ * @param bigEndian If true then magnitude is in big-endian. Otherwise
+ * the byte order of the magnitude considered to be little-endian.
+ */
+ BigInteger(const int8_t* val, int32_t len, int32_t sign, bool bigEndian = true);
+
+ /**
+ * Constructs big integer with the specified magnitude.
+ * @warning Magnitude is moved. This mean mag left empty after the call.
+ *
+ * @param mag Magnitude. Moved.
+ * @param sign Sign. Can be 1 or -1.
+ */
+ BigInteger(MagArray& mag, int8_t sign);
+
+ /**
+ * Assigment operator.
+ *
+ * @param other Other value.
+ * @return *this.
+ */
+ BigInteger& operator=(const BigInteger& other);
+
+ /**
+ * Assign specified value to this BigInteger.
+ *
+ * @param val Value to assign.
+ */
+ void Assign(const BigInteger& val);
+
+ /**
+ * Assign specified value to this BigInteger.
+ *
+ * @param val Value to assign.
+ */
+ void AssignInt64(int64_t val);
+
+ /**
+ * Assign specified value to this Decimal.
+ *
+ * @param val String to assign.
+ */
+ void AssignString(const std::string& val)
+ {
+ AssignString(val.data(), static_cast<int32_t>(val.size()));
+ }
+
+ /**
+ * Assign specified value to this Decimal.
+ *
+ * @param val String to assign.
+ * @param len String length.
+ */
+ void AssignString(const char* val, int32_t len);
+
+ /**
+ * Assign specified value to this BigInteger.
+ *
+ * @param val Value to assign.
+ */
+ void AssignUint64(uint64_t val);
+
+ /**
+ * Get number sign. Returns -1 if negative and 1 otherwise.
+ *
+ * @return Sign of the number.
+ */
+ int8_t GetSign() const;
+
+ /**
+ * Swap function for the BigInteger type.
+ *
+ * @param other Other instance.
+ */
+ void Swap(BigInteger& other);
+
+ /**
+ * Get magnitude array.
+ *
+ * @return magnitude array.
+ */
+ const MagArray& GetMagnitude() const;
+
+ /**
+ * Get this number length in bits as if it was positive.
+ *
+ * @return Number length in bits.
+ */
+ uint32_t GetBitLength() const;
+
+ /**
+ * Get precision of the BigInteger.
+ *
+ * @return Number of the decimal digits in the decimal representation
+ * of the value.
+ */
+ int32_t GetPrecision() const;
+
+ /**
+ * Fills specified buffer with data of this BigInteger converted to
+ * bytes in big-endian byte order. Sign is not considered when this
+ * operation is performed.
+ *
+ * @param buffer Buffer to fill.
+ */
+ void MagnitudeToBytes(common::FixedSizeArray<int8_t>& buffer) const;
+
+ /**
+ * Mutates this BigInteger so its value becomes exp power of this.
+ *
+ * @param exp Exponent.
+ */
+ void Pow(int32_t exp);
+
+ /**
+ * Muitiply this to another big integer.
+ *
+ * @param other Another instance. Can be *this.
+ * @param res Result placed there. Can be *this.
+ */
+ void Multiply(const BigInteger& other, BigInteger& res) const;
+
+ /**
+ * Divide this to another big integer.
+ *
+ * @param divisor Divisor. Can be *this.
+ * @param res Result placed there. Can be *this.
+ */
+ void Divide(const BigInteger& divisor, BigInteger& res) const;
+
+ /**
+ * Divide this to another big integer.
+ *
+ * @param divisor Divisor. Can be *this.
+ * @param res Result placed there. Can be *this.
+ * @param rem Remainder placed there. Can be *this.
+ */
+ void Divide(const BigInteger& divisor, BigInteger& res, BigInteger& rem) const;
+
+ /**
+ * Add unsigned integer number to this BigInteger.
+ *
+ * @param x Number to add.
+ */
+ void Add(uint64_t x);
+
+ /**
+ * Compare this instance to another.
+ *
+ * @param other Another instance.
+ * @param ignoreSign If set to true than only magnitudes are compared.
+ * @return Comparasion result - 0 if equal, 1 if this is greater, -1 if
+ * this is less.
+ */
+ int32_t Compare(const BigInteger& other, bool ignoreSign = false) const;
+
+ /**
+ * Convert to int64_t.
+ *
+ * @return int64_t value.
+ */
+ int64_t ToInt64() const;
+
+ /**
+ * Check whether this value is negative.
+ *
+ * @return True if this value is negative and false otherwise.
+ */
+ bool IsNegative() const
+ {
+ return sign < 0;
+ }
+
+ /**
+ * Check whether this value is zero.
+ *
+ * @return True if this value is negative and false otherwise.
+ */
+ bool IsZero() const
+ {
+ return mag.GetSize() == 0;
+ }
+
+ /**
+ * Check whether this value is positive.
+ *
+ * @return True if this value is positive and false otherwise.
+ */
+ bool IsPositive() const
+ {
+ return sign > 0 && !IsZero();
+ }
+
+ /**
+ * Rverses sign of this value.
+ */
+ void Negate()
+ {
+ if (!IsZero())
+ sign = -sign;
+ }
+
+ /**
+ * Output operator.
+ *
+ * @param os Output stream.
+ * @param val Value to output.
+ * @return Reference to the first param.
+ */
+ friend std::ostream& operator<<(std::ostream& os, const BigInteger& val)
+ {
+ if (val.IsZero())
+ return os << '0';
+
+ if (val.sign < 0)
+ os << '-';
+
+ const int32_t maxResultDigits = 19;
+ BigInteger maxUintTenPower;
+ BigInteger res;
+ BigInteger left;
+
+ maxUintTenPower.AssignUint64(10000000000000000000ULL);
+
+ std::vector<uint64_t> vals;
+
+ val.Divide(maxUintTenPower, left, res);
+
+ if (res.sign < 0)
+ res.sign = -res.sign;
+
+ if (left.sign < 0)
+ left.sign = -left.sign;
+
+ vals.push_back(static_cast<uint64_t>(res.ToInt64()));
+
+ while (!left.IsZero())
+ {
+ left.Divide(maxUintTenPower, left, res);
+
+ vals.push_back(static_cast<uint64_t>(res.ToInt64()));
+ }
+
+ os << vals.back();
+
+ for (int32_t i = static_cast<int32_t>(vals.size()) - 2; i >= 0; --i)
+ {
+ os.fill('0');
+ os.width(maxResultDigits);
+
+ os << vals[i];
+ }
+
+ return os;
+ }
+
+ /**
+ * Input operator.
+ *
+ * @param is Input stream.
+ * @param val Value to input.
+ * @return Reference to the first param.
+ */
+ friend std::istream& operator>>(std::istream& is, BigInteger& val)
+ {
+ std::istream::sentry sentry(is);
+
+ // Return zero if input failed.
+ val.AssignInt64(0);
+
+ if (!is)
+ return is;
+
+ // Current value parts.
+ uint64_t part = 0;
+ int32_t partDigits = 0;
+ int32_t sign = 1;
+
+ BigInteger pow;
+ BigInteger bigPart;
+
+ // Current char.
+ int c = is.peek();
+
+ if (!is)
+ return is;
+
+ // Checking sign.
+ if (c == '-' || c == '+')
+ {
+ if (c == '-')
+ sign = -1;
+
+ is.ignore();
+ c = is.peek();
+ }
+
+ // Reading number itself.
+ while (is && isdigit(c))
+ {
+ part = part * 10 + (c - '0');
+ ++partDigits;
+
+ if (part >= 1000000000000000000ULL)
+ {
+ BigInteger::GetPowerOfTen(partDigits, pow);
+ val.Multiply(pow, val);
+
+ val.Add(part);
+
+ part = 0;
+ partDigits = 0;
+ }
+
+ is.ignore();
+ c = is.peek();
+ }
+
+ // Adding last part of the number.
+ if (partDigits)
+ {
+ BigInteger::GetPowerOfTen(partDigits, pow);
+
+ val.Multiply(pow, val);
+
+ val.Add(part);
+ }
+
+ if (sign < 0)
+ val.Negate();
+
+ return is;
+ }
+
+ /**
+ * Get BigInteger which value is the ten of the specified power.
+ *
+ * @param pow Tenth power.
+ * @param res Result is placed here.
+ */
+ static void GetPowerOfTen(int32_t pow, BigInteger& res);
+
+ private:
+ /**
+ * Add magnitude array to current.
+ *
+ * @param addend Addend.
+ * @param len Length of the addend.
+ */
+ void Add(const uint32_t* addend, int32_t len);
+
+ /**
+ * Get n-th integer of the magnitude.
+ *
+ * @param n Index.
+ * @return Value of the n-th int of the magnitude.
+ */
+ uint32_t GetMagInt(int32_t n) const;
+
+ /**
+ * Divide this to another big integer.
+ *
+ * @param divisor Divisor. Can be *this.
+ * @param res Result placed there. Can be *this.
+ * @param rem Remainder placed there if requested. Can be *this.
+ * Can be null if the remainder is not needed.
+ */
+ void Divide(const BigInteger& divisor, BigInteger& res, BigInteger* rem) const;
+
+ /**
+ * Normalizes current value removing trailing zeroes from the magnitude.
+ */
+ void Normalize();
+
+ /** The sign of this BigInteger: -1 for negative and 1 for non-negative. */
+ int8_t sign;
+
+ /** The magnitude of this BigInteger. Byte order is little-endian. */
+ MagArray mag;
+ };
+
+ /**
+ * Comparison operator.
+ *
+ * @param val1 First value.
+ * @param val2 Second value.
+ * @return True if equal.
+ */
+ bool IGNITE_IMPORT_EXPORT operator==(const BigInteger& val1, const BigInteger& val2);
+
+ /**
+ * Comparison operator.
+ *
+ * @param val1 First value.
+ * @param val2 Second value.
+ * @return True if not equal.
+ */
+ bool IGNITE_IMPORT_EXPORT operator!=(const BigInteger& val1, const BigInteger& val2);
+
+ /**
+ * Comparison operator.
+ *
+ * @param val1 First value.
+ * @param val2 Second value.
+ * @return True if less.
+ */
+ bool IGNITE_IMPORT_EXPORT operator<(const BigInteger& val1, const BigInteger& val2);
+
+ /**
+ * Comparison operator.
+ *
+ * @param val1 First value.
+ * @param val2 Second value.
+ * @return True if less or equal.
+ */
+ bool IGNITE_IMPORT_EXPORT operator<=(const BigInteger& val1, const BigInteger& val2);
+
+ /**
+ * Comparison operator.
+ *
+ * @param val1 First value.
+ * @param val2 Second value.
+ * @return True if gretter.
+ */
+ bool IGNITE_IMPORT_EXPORT operator>(const BigInteger& val1, const BigInteger& val2);
+
+ /**
+ * Comparison operator.
+ *
+ * @param val1 First value.
+ * @param val2 Second value.
+ * @return True if gretter or equal.
+ */
+ bool IGNITE_IMPORT_EXPORT operator>=(const BigInteger& val1, const BigInteger& val2);
+ }
+}
+
+#endif //_IGNITE_COMMON_BIG_INTEGER
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/common/include/ignite/common/bits.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/common/bits.h b/modules/platforms/cpp/common/include/ignite/common/bits.h
new file mode 100644
index 0000000..5722215
--- /dev/null
+++ b/modules/platforms/cpp/common/include/ignite/common/bits.h
@@ -0,0 +1,218 @@
+/*
+ * 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.
+ */
+#ifndef _IGNITE_COMMON_BITS
+#define _IGNITE_COMMON_BITS
+
+#include <stdint.h>
+
+#include <ignite/common/common.h>
+#include <ignite/common/fixed_size_array.h>
+
+namespace ignite
+{
+ namespace common
+ {
+ namespace bits
+ {
+ /**
+ * Maximum number of digits in uint64_t number.
+ */
+ const int32_t UINT64_MAX_PRECISION = 20;
+
+ /**
+ * Get number of trailing zero bits in the two's complement binary
+ * representation of the specified 32-bit int value.
+ *
+ * @param i The value whose bits are to be counted.
+ * @return The number of trailing zero bits in the two's complement
+ * binary representation of the specified 32-bit int value.
+ */
+ IGNITE_IMPORT_EXPORT int32_t NumberOfTrailingZerosI32(int32_t i);
+
+ /**
+ * Get number of leading zero bits in the two's complement binary
+ * representation of the specified 32-bit int value.
+ *
+ * @param i The value whose bits are to be counted.
+ * @return The number of leading zero bits in the two's complement
+ * binary representation of the specified 32-bit int value.
+ */
+ IGNITE_IMPORT_EXPORT int32_t NumberOfLeadingZerosI32(int32_t i);
+
+ /**
+ * Get number of leading zero bits in the two's complement binary
+ * representation of the specified 32-bit int value.
+ *
+ * @param i The value whose bits are to be counted.
+ * @return The number of leading zero bits in the two's complement
+ * binary representation of the specified 32-bit int value.
+ */
+ IGNITE_IMPORT_EXPORT int32_t NumberOfLeadingZerosU32(uint32_t i);
+
+ /**
+ * Get number of leading zero bits in the two's complement binary
+ * representation of the specified 64-bit int value.
+ *
+ * @param i The value whose bits are to be counted.
+ * @return The number of leading zero bits in the two's complement
+ * binary representation of the specified 64-bit int value.
+ */
+ IGNITE_IMPORT_EXPORT int32_t NumberOfLeadingZerosI64(int64_t i);
+
+ /**
+ * Get number of leading zero bits in the two's complement binary
+ * representation of the specified 64-bit int value.
+ *
+ * @param i The value whose bits are to be counted.
+ * @return The number of leading zero bits in the two's complement
+ * binary representation of the specified 64-bit int value.
+ */
+ IGNITE_IMPORT_EXPORT int32_t NumberOfLeadingZerosU64(uint64_t i);
+
+ /**
+ * Get the number of one-bits in the two's complement binary
+ * representation of the specified 32-bit int value.
+ *
+ * @param i The value whose bits are to be counted.
+ * @return The number of one-bits in the two's complement binary
+ * representation of the specified 32-bit int value.
+ */
+ IGNITE_IMPORT_EXPORT int32_t BitCountI32(int32_t i);
+
+ /**
+ * Get bit length for the specified signed 32-bit int value.
+ *
+ * @param i The value to get bit length for.
+ * @return The number of significant bits in the two's complement binary
+ * representation of the specified 32-bit int value.
+ */
+ IGNITE_IMPORT_EXPORT int32_t BitLengthI32(int32_t i);
+
+ /**
+ * Get bit length for the specified unsigned 32-bit int value.
+ *
+ * @param i The value to get bit length for.
+ * @return The number of significant bits in the two's complement binary
+ * representation of the specified 32-bit int value.
+ */
+ IGNITE_IMPORT_EXPORT int32_t BitLengthU32(uint32_t i);
+
+ /**
+ * Calcutale capasity for required size.
+ * Rounds up to the nearest power of two.
+ *
+ * @param size Needed capasity.
+ * @return Recomended capasity to allocate.
+ */
+ IGNITE_IMPORT_EXPORT int32_t GetCapasityForSize(int32_t size);
+
+ /**
+ * Get the number of decimal digits of the integer value.
+ *
+ * @param x The value.
+ * @return The number of decimal digits of the integer value.
+ */
+ IGNITE_IMPORT_EXPORT int32_t DigitLength(uint64_t x);
+
+ /**
+ * Get n-th power of ten.
+ *
+ * @param n Power. Should be in range [0, UINT64_MAX_PRECISION]
+ * @return 10 pow n, if n is in range [0, UINT64_MAX_PRECISION].
+ * Otherwise, behaviour is undefined.
+ */
+ IGNITE_IMPORT_EXPORT uint64_t TenPowerU64(int32_t n);
+
+ /**
+ * Get the signum function of the specified 64-bit integer value.
+ * The return value is -1 if the specified value is negative; 0 if the
+ * specified value is zero; and 1 if the specified value is positive.
+ *
+ * @param i the value whose signum is to be computed
+ * @return The signum function of the specified value.
+ */
+ inline int32_t Signum64(int64_t i)
+ {
+ return (static_cast<uint64_t>(-i) >> 63) | (i >> 63);
+ }
+
+ /**
+ * Makes single 64-bit integer number out of two 32-bit numbers.
+ *
+ * @param higher Higher bits part.
+ * @param lower Lower bits part.
+ * @return New 64-bit integer.
+ */
+ inline uint64_t MakeU64(uint32_t higher, uint32_t lower)
+ {
+ return (static_cast<uint64_t>(higher) << 32) | lower;
+ }
+
+ /**
+ * Makes single 64-bit integer number out of two 32-bit numbers.
+ *
+ * @param higher Higher bits part.
+ * @param lower Lower bits part.
+ * @return New 64-bit integer.
+ */
+ inline int64_t MakeI64(uint32_t higher, uint32_t lower)
+ {
+ return static_cast<int64_t>(MakeU64(higher, lower));
+ }
+
+ /**
+ * Makes single 32-bit integer number out of two 32-bit numbers,
+ * shifted by specified number of bits. First number x is shifted
+ * to the left.
+ * x y
+ * [........][........]
+ * ^[........]
+ * n res
+ *
+ * @param x First part.
+ * @param y Second part.
+ * @param n Number of bits to shift.
+ * @return New 32-bit integer.
+ */
+ inline uint32_t MakeU32(uint32_t x, uint32_t y, int32_t n)
+ {
+ return (x << n) | (y >> (32 - n));
+ }
+
+ /**
+ * Makes single 32-bit integer number out of two 32-bit numbers,
+ * shifted by specified number of bits. First number x is shifted
+ * to the left.
+ * x y
+ * [........][........]
+ * ^[........]
+ * n res
+ *
+ * @param x First part.
+ * @param y Second part.
+ * @param n Number of bits to shift.
+ * @return New 32-bit integer.
+ */
+ inline int32_t MakeI32(uint32_t x, uint32_t y, int32_t n)
+ {
+ return static_cast<int32_t>(MakeU32(x, y, n));
+ }
+ }
+ }
+}
+
+#endif //_IGNITE_COMMON_BITS
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/common/include/ignite/common/default_allocator.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/common/default_allocator.h b/modules/platforms/cpp/common/include/ignite/common/default_allocator.h
new file mode 100644
index 0000000..4350987
--- /dev/null
+++ b/modules/platforms/cpp/common/include/ignite/common/default_allocator.h
@@ -0,0 +1,95 @@
+/*
+ * 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.
+ */
+#ifndef _IGNITE_COMMON_DEFAULT_ALLOCATOR
+#define _IGNITE_COMMON_DEFAULT_ALLOCATOR
+
+#include <stdint.h>
+#include <cstring>
+#include <cassert>
+
+#include <utility>
+
+#include <ignite/common/common.h>
+#include <ignite/common/fixed_size_array.h>
+
+namespace ignite
+{
+ namespace common
+ {
+ /**
+ * Allocator. Manages objects construction and destruction as well
+ * as a memory allocation.
+ */
+ template<typename T>
+ class IGNITE_IMPORT_EXPORT DefaultAllocator
+ {
+ public:
+ typedef T ValueType;
+ typedef T* PointerType;
+ typedef T& ReferenceType;
+ typedef const T* ConstPointerType;
+ typedef const T& ConstReferenceType;
+ typedef int32_t SizeType;
+ typedef int32_t DifferenceType;
+
+ template <class T2> struct Rebind
+ {
+ typedef DefaultAllocator<T2> other;
+ };
+
+ /**
+ * Default constructor.
+ */
+ DefaultAllocator()
+ {
+ // No-op.
+ }
+
+ /**
+ * Destructor.
+ */
+ ~DefaultAllocator()
+ {
+ // No-op.
+ }
+
+ PointerType Allocate(SizeType len, void* hint = 0)
+ {
+ return static_cast<PointerType>(::operator new(len * sizeof(ValueType)));
+ }
+
+ void Deallocate(PointerType ptr, SizeType len)
+ {
+ ::operator delete(ptr);
+ }
+
+ void Construct(PointerType p, ConstReferenceType val)
+ {
+ new (p) ValueType(val);
+ }
+
+ void Destruct(PointerType p)
+ {
+ p->~ValueType();
+ }
+
+ private:
+ };
+ }
+}
+
+#endif // _IGNITE_COMMON_DEFAULT_ALLOCATOR
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/common/include/ignite/common/dynamic_size_array.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/common/dynamic_size_array.h b/modules/platforms/cpp/common/include/ignite/common/dynamic_size_array.h
new file mode 100644
index 0000000..a6bcc13
--- /dev/null
+++ b/modules/platforms/cpp/common/include/ignite/common/dynamic_size_array.h
@@ -0,0 +1,415 @@
+/*
+ * 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.
+ */
+#ifndef _IGNITE_COMMON_DYNAMIC_SIZE_ARRAY
+#define _IGNITE_COMMON_DYNAMIC_SIZE_ARRAY
+
+#include <stdint.h>
+#include <cstring>
+#include <cassert>
+
+#include <utility>
+
+#include <ignite/common/common.h>
+#include <ignite/common/default_allocator.h>
+#include <ignite/common/bits.h>
+
+namespace ignite
+{
+ namespace common
+ {
+ /**
+ * Dynamic size array is safe container abstraction with a dynamic size.
+ * This is the analogue of the standard vector. It is needed to be used
+ * in exported classes as we can't export standard library classes.
+ */
+ template<typename T, typename A = DefaultAllocator<T>>
+ class IGNITE_IMPORT_EXPORT DynamicSizeArray
+ {
+ public:
+ typedef T ValueType;
+ typedef A AllocatorType;
+ typedef typename AllocatorType::SizeType SizeType;
+ typedef typename AllocatorType::PointerType PointerType;
+ typedef typename AllocatorType::ConstPointerType ConstPointerType;
+ typedef typename AllocatorType::ReferenceType ReferenceType;
+ typedef typename AllocatorType::ConstReferenceType ConstReferenceType;
+
+ /**
+ * Default constructor.
+ *
+ * Constructs zero-size and zero-capasity array.
+ */
+ DynamicSizeArray(const AllocatorType& allocator = AllocatorType()) :
+ alloc(allocator),
+ size(0),
+ capasity(0),
+ data(0)
+ {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ * Constructs empty array with the specified capacity.
+ *
+ * @param len Array length.
+ * @param alloc Allocator.
+ */
+ DynamicSizeArray(SizeType len, const AllocatorType& allocator = AllocatorType()) :
+ alloc(allocator),
+ size(0),
+ capasity(bits::GetCapasityForSize(len)),
+ data(alloc.Allocate(capasity))
+ {
+ // No-op.
+ }
+
+ /**
+ * Raw array constructor.
+ *
+ * @param arr Raw array.
+ * @param len Array length in elements.
+ */
+ DynamicSizeArray(ConstPointerType arr, SizeType len,
+ const AllocatorType& allocator = AllocatorType()) :
+ alloc(allocator),
+ size(0),
+ capasity(0),
+ data(0)
+ {
+ Assign(arr, len);
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param other Other instance.
+ */
+ DynamicSizeArray(const DynamicSizeArray<T>& other) :
+ alloc(),
+ size(0),
+ capasity(0),
+ data(0)
+ {
+ Assign(other);
+ }
+
+ /**
+ * Destructor.
+ */
+ ~DynamicSizeArray()
+ {
+ for (PointerType it = data; it != data + size; ++it)
+ alloc.Destruct(it);
+
+ alloc.Deallocate(data, capasity);
+ }
+
+ /**
+ * Assignment operator.
+ *
+ * @param other Other instance.
+ * @return Reference to this instance.
+ */
+ DynamicSizeArray<T>& operator=(const DynamicSizeArray<T>& other)
+ {
+ Assign(other);
+
+ return *this;
+ }
+
+ /**
+ * Assign new value to the array.
+ *
+ * @param other Another array instance.
+ */
+ void Assign(const DynamicSizeArray<T>& other)
+ {
+ if (this != &other)
+ {
+ alloc = other.alloc;
+
+ Assign(other.GetData(), other.GetSize());
+ }
+ }
+
+ /**
+ * Assign new value to the array.
+ *
+ * @param src Raw array.
+ * @param len Array length in elements.
+ */
+ void Assign(ConstPointerType src, SizeType len)
+ {
+ for (PointerType it = data; it != data + size; ++it)
+ alloc.Destruct(it);
+
+ if (capasity < len)
+ {
+ alloc.Deallocate(data, capasity);
+
+ capasity = bits::GetCapasityForSize(len);
+ data = alloc.Allocate(capasity);
+ }
+
+ size = len;
+
+ for (SizeType i = 0; i < size; ++i)
+ alloc.Construct(data + i, src[i]);
+ }
+
+ /**
+ * Append several values to the array.
+ *
+ * @param src Raw array.
+ * @param len Array length in elements.
+ */
+ void Append(ConstPointerType src, SizeType len)
+ {
+ Reserve(size + len);
+
+ for (SizeType i = 0; i < len; ++i)
+ alloc.Construct(data + size + i, src[i]);
+
+ size += len;
+ }
+
+ /**
+ * Swap contents of the array with another instance.
+ *
+ * @param other Instance to swap with.
+ */
+ void Swap(DynamicSizeArray<T>& other)
+ {
+ if (this != &other)
+ {
+ std::swap(alloc, other.alloc);
+ std::swap(size, other.size);
+ std::swap(capasity, other.capasity);
+ std::swap(data, other.data);
+ }
+ }
+
+ /**
+ * Get data pointer.
+ *
+ * @return Data pointer.
+ */
+ PointerType GetData()
+ {
+ return data;
+ }
+
+ /**
+ * Get data pointer.
+ *
+ * @return Data pointer.
+ */
+ ConstPointerType GetData() const
+ {
+ return data;
+ }
+
+ /**
+ * Get array size.
+ *
+ * @return Array size.
+ */
+ SizeType GetSize() const
+ {
+ return size;
+ }
+
+ /**
+ * Get capasity.
+ *
+ * @return Array capasity.
+ */
+ SizeType GetCapasity() const
+ {
+ return capasity;
+ }
+
+ /**
+ * Element access operator.
+ *
+ * @param idx Element index.
+ * @return Element reference.
+ */
+ ReferenceType operator[](SizeType idx)
+ {
+ assert(idx < size);
+
+ return data[idx];
+ }
+
+ /**
+ * Element access operator.
+ *
+ * @param idx Element index.
+ * @return Element reference.
+ */
+ ConstReferenceType operator[](SizeType idx) const
+ {
+ assert(idx < size);
+
+ return data[idx];
+ }
+
+ /**
+ * Check if the array is empty.
+ *
+ * @return True if the array is empty.
+ */
+ bool IsEmpty() const
+ {
+ return size == 0;
+ }
+
+ /**
+ * Clears the array.
+ */
+ void Clear()
+ {
+ for (PointerType it = data; it != data + size; ++it)
+ alloc.Destruct(it);
+
+ size = 0;
+ }
+
+ /**
+ * Reserves not less than specified elements number so array is not
+ * going to grow on append.
+ *
+ * @param newCapacity Desired capasity.
+ */
+ void Reserve(SizeType newCapacity)
+ {
+ if (capasity < newCapacity)
+ {
+ DynamicSizeArray<T> tmp(newCapacity);
+
+ tmp.Assign(*this);
+
+ Swap(tmp);
+ }
+ }
+
+ /**
+ * Resizes array. Destructs elements if the specified size is less
+ * than the array's size. Default-constructs elements if the
+ * specified size is more than the array's size.
+ *
+ * @param newSize Desired size.
+ */
+ void Resize(SizeType newSize)
+ {
+ if (capasity < newSize)
+ Reserve(newSize);
+
+ if (newSize > size)
+ {
+ for (PointerType it = data + size; it < data + newSize; ++it)
+ alloc.Construct(it, ValueType());
+ }
+ else
+ {
+ for (PointerType it = data + newSize; it < data + size; ++it)
+ alloc.Destruct(it);
+ }
+
+ size = newSize;
+ }
+
+ /**
+ * Get last element.
+ *
+ * @return Last element reference.
+ */
+ const ValueType& Back() const
+ {
+ assert(size > 0);
+
+ return data[size - 1];
+ }
+
+ /**
+ * Get last element.
+ *
+ * @return Last element reference.
+ */
+ ValueType& Back()
+ {
+ assert(size > 0);
+
+ return data[size - 1];
+ }
+
+ /**
+ * Get first element.
+ *
+ * @return First element reference.
+ */
+ const ValueType& Front() const
+ {
+ assert(size > 0);
+
+ return data[0];
+ }
+
+ /**
+ * Get first element.
+ *
+ * @return First element reference.
+ */
+ ValueType& Front()
+ {
+ assert(size > 0);
+
+ return data[0];
+ }
+
+ /**
+ * Pushes new value to the back of the array, effectively increasing
+ * array size by one.
+ *
+ * @param val Value to push.
+ */
+ void PushBack(ConstReferenceType val)
+ {
+ Resize(size + 1);
+
+ Back() = val;
+ }
+
+ private:
+ /** Allocator */
+ AllocatorType alloc;
+
+ /** Array size. */
+ SizeType size;
+
+ /** Array capasity. */
+ SizeType capasity;
+
+ /** Data. */
+ PointerType data;
+ };
+ }
+}
+
+#endif // _IGNITE_COMMON_DYNAMIC_SIZE_ARRAY
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/common/include/ignite/common/fixed_size_array.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/common/fixed_size_array.h b/modules/platforms/cpp/common/include/ignite/common/fixed_size_array.h
new file mode 100644
index 0000000..4e102e6
--- /dev/null
+++ b/modules/platforms/cpp/common/include/ignite/common/fixed_size_array.h
@@ -0,0 +1,288 @@
+/*
+ * 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.
+ */
+#ifndef _IGNITE_COMMON_FIXED_SIZE_ARRAY
+#define _IGNITE_COMMON_FIXED_SIZE_ARRAY
+
+#include <stdint.h>
+#include <cstring>
+#include <cassert>
+
+#include <utility>
+#include <algorithm>
+
+#include <ignite/common/common.h>
+
+namespace ignite
+{
+ namespace common
+ {
+ /**
+ * Fixed size array is safe array abstraction with a fixed size.
+ * The size can be set during runtime though once array is created
+ * its size can not be changed without resetting arrays content.
+ */
+ template<typename T>
+ class IGNITE_IMPORT_EXPORT FixedSizeArray
+ {
+ public:
+ typedef int32_t SizeType;
+
+ /**
+ * Default constructor.
+ *
+ * Constructs zero-size array.
+ */
+ FixedSizeArray() :
+ size(0),
+ data(0)
+ {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ * Constructs default-initialized array of the specified length.
+ * Array zeroed if T is a POD type.
+ *
+ * @param len Array length.
+ */
+ FixedSizeArray(SizeType len) :
+ size(len),
+ // Brackets are here for a purpose - this way allocated
+ // array is zeroed if T is POD type.
+ data(new T[size]())
+ {
+ // No-op.
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param other Other instance.
+ */
+ FixedSizeArray(const FixedSizeArray<T>& other) :
+ size(other.size),
+ data(new T[size])
+ {
+ Assign(other);
+ }
+
+ /**
+ * Raw array constructor.
+ *
+ * @param arr Raw array.
+ * @param len Array length in elements.
+ */
+ FixedSizeArray(const T* arr, SizeType len) :
+ size(len),
+ data(new T[size])
+ {
+ Assign(arr, len);
+ }
+
+ /**
+ * Assignment operator.
+ *
+ * @param other Other instance.
+ * @return Reference to this instance.
+ */
+ FixedSizeArray<T>& operator=(const FixedSizeArray<T>& other)
+ {
+ Assign(other);
+
+ return *this;
+ }
+
+ /**
+ * Assign new value to the array.
+ *
+ * @param other Another array instance.
+ */
+ void Assign(const FixedSizeArray<T>& other)
+ {
+ if (this != &other)
+ Assign(other.GetData(), other.GetSize());
+ }
+
+ /**
+ * Assign new value to the array.
+ *
+ * @param src Raw array.
+ * @param len Array length in elements.
+ */
+ void Assign(const T* src, SizeType len)
+ {
+ // In case we would not need to clean anything
+ // its okay to call delete[] on 0.
+ T* toClean = 0;
+
+ if (len != size)
+ {
+ // Do not clean just yet in case the part of the
+ // array is being assigned to the array.
+ toClean = data;
+
+ size = len;
+ data = new T[size];
+ }
+
+ for (SizeType i = 0; i < len; ++i)
+ data[i] = src[i];
+
+ delete[] toClean;
+ }
+
+ /**
+ * Swap contents of the array with another instance.
+ *
+ * @param other Instance to swap with.
+ */
+ void Swap(FixedSizeArray<T>& other)
+ {
+ if (this != &other)
+ {
+ std::swap(size, other.size);
+ std::swap(data, other.data);
+ }
+ }
+
+ /**
+ * Destructor.
+ */
+ ~FixedSizeArray()
+ {
+ // Not a bug. Delete works just fine on null pointers.
+ delete[] data;
+ }
+
+ /**
+ * Get data pointer.
+ *
+ * @return Data pointer.
+ */
+ T* GetData()
+ {
+ return data;
+ }
+
+ /**
+ * Get data pointer.
+ *
+ * @return Data pointer.
+ */
+ const T* GetData() const
+ {
+ return data;
+ }
+
+ /**
+ * Get array size.
+ *
+ * @return Array size.
+ */
+ SizeType GetSize() const
+ {
+ return size;
+ }
+
+ /**
+ * Copy part of the array and place in another array.
+ * Contents of the provided array gets swapped with the copy of the
+ * specified array part.
+ *
+ * @param pos Start position.
+ * @param n Number of elements to copy.
+ * @param result Instance of an array where result should be placed.
+ */
+ void CopyPart(SizeType pos, SizeType n, FixedSizeArray<T>& result) const
+ {
+ assert(pos < size);
+ assert(pos + n <= size);
+
+ result.Assign(data + pos, n);
+ }
+
+ /**
+ * Element access operator.
+ *
+ * @param idx Element index.
+ * @return Element reference.
+ */
+ T& operator[](SizeType idx)
+ {
+ assert(idx < size);
+
+ return data[idx];
+ }
+
+ /**
+ * Element access operator.
+ *
+ * @param idx Element index.
+ * @return Element reference.
+ */
+ const T& operator[](SizeType idx) const
+ {
+ assert(idx < size);
+
+ return data[idx];
+ }
+
+ /**
+ * Check if the array is empty.
+ *
+ * @return True if the array is empty.
+ */
+ bool IsEmpty() const
+ {
+ return size == 0;
+ }
+
+ /**
+ * Resets the state of the array setting it to the specified size
+ * and erasing its content.
+ *
+ * @param newSize New array size.
+ */
+ void Reset(SizeType newSize = 0)
+ {
+ if (size != newSize)
+ {
+ delete[] data;
+
+ if (newSize)
+ data = new T[newSize]();
+ else
+ data = 0;
+
+ size = newSize;
+ }
+ else
+ std::fill(data, data + size, T());
+ }
+
+ private:
+ /** Array size. */
+ SizeType size;
+
+ /** Target array. */
+ T* data;
+ };
+ }
+}
+
+#endif // _IGNITE_COMMON_FIXED_SIZE_ARRAY
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/common/include/ignite/common/utils.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/common/utils.h b/modules/platforms/cpp/common/include/ignite/common/utils.h
index ff6905d..c1046e2 100644
--- a/modules/platforms/cpp/common/include/ignite/common/utils.h
+++ b/modules/platforms/cpp/common/include/ignite/common/utils.h
@@ -118,36 +118,6 @@ namespace ignite
IGNITE_IMPORT_EXPORT bool IgniteLocalTime(time_t in, tm& out);
/**
- * Get number of leading zeroes in octet.
- *
- * @param octet Octet.
- * @return Number of leading zero-bits.
- */
- IGNITE_IMPORT_EXPORT int LeadingZeroesForOctet(int8_t octet);
-
- /**
- * Get number of significant bits in octet.
- *
- * @param octet Octet.
- * @return Number of significant bits.
- */
- inline int BitLengthForOctet(int8_t octet)
- {
- return 8 - LeadingZeroesForOctet(octet);
- }
-
- /**
- * Check if the number is power of two.
- *
- * @param num Integer number.
- * @return True if the number is power of two.
- */
- inline bool PowerOfTwo(int num)
- {
- return (num & (num - 1)) == 0;
- }
-
- /**
* Copy characters.
*
* @param val Value.
@@ -180,32 +150,35 @@ namespace ignite
IGNITE_IMPORT_EXPORT bool FileExists(const std::string& path);
/**
- * Safe array which automatically reclaims occupied memory when out of scope.
+ * Casts value of one type to another type, using stringstream.
+ *
+ * @param val Input value.
+ * @param res Resulted value.
+ */
+ template<typename T1, typename T2>
+ void LexicalCast(const T2& val, T1& res)
+ {
+ std::stringstream converter;
+
+ converter << val;
+ converter >> res;
+ }
+
+ /**
+ * Casts value of one type to another type, using stringstream.
+ *
+ * @param val Input value.
+ * @return Resulted value.
*/
- template<typename T>
- struct IGNITE_IMPORT_EXPORT SafeArray
+ template<typename T1, typename T2>
+ T1 LexicalCast(const T2& val)
{
- /** Target array. */
- T* target;
-
- /**
- * Constructor.
- */
- SafeArray(int cap)
- {
- target = new T[cap];
- }
-
- /**
- * Destructor.
- */
- ~SafeArray()
- {
- delete[] target;
- }
-
- IGNITE_NO_COPY_ASSIGNMENT(SafeArray);
- };
+ T1 res;
+
+ LexicalCast<T1, T2>(val, res);
+
+ return res;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/common/include/ignite/guid.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/guid.h b/modules/platforms/cpp/common/include/ignite/guid.h
index 9a045e6..fbafd5c 100644
--- a/modules/platforms/cpp/common/include/ignite/guid.h
+++ b/modules/platforms/cpp/common/include/ignite/guid.h
@@ -122,7 +122,7 @@ namespace ignite
* @return Reference to the first param.
*/
template<typename C>
- std::basic_ostream<C>& operator<<(std::basic_ostream<C>& os, const Guid& guid)
+ ::std::basic_ostream<C>& operator<<(std::basic_ostream<C>& os, const Guid& guid)
{
uint32_t part1 = static_cast<uint32_t>(guid.GetMostSignificantBits() >> 32);
uint16_t part2 = static_cast<uint16_t>(guid.GetMostSignificantBits() >> 16);
@@ -147,7 +147,7 @@ namespace ignite
* @return Reference to the first param.
*/
template<typename C>
- std::basic_istream<C>& operator>>(std::basic_istream<C>& is, Guid& guid)
+ ::std::basic_istream<C>& operator>>(std::basic_istream<C>& is, Guid& guid)
{
uint64_t parts[5];
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/common/os/win/src/common/utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/os/win/src/common/utils.cpp b/modules/platforms/cpp/common/os/win/src/common/utils.cpp
index 65236d2..47d7f43 100644
--- a/modules/platforms/cpp/common/os/win/src/common/utils.cpp
+++ b/modules/platforms/cpp/common/os/win/src/common/utils.cpp
@@ -64,27 +64,6 @@ namespace ignite
return localtime_s(&out, &in) == 0;
}
- int LeadingZeroesForOctet(int8_t octet) {
- if (octet == 0)
- return 8;
-
- int zeroes = 1;
-
- if (octet >> 4 == 0) {
- zeroes += 4;
- octet <<= 4;
- }
-
- if (octet >> 6 == 0) {
- zeroes += 2;
- octet <<= 2;
- }
-
- zeroes -= octet >> 7;
-
- return zeroes;
- }
-
char* CopyChars(const char* val)
{
if (val) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/common/project/vs/common.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/project/vs/common.vcxproj b/modules/platforms/cpp/common/project/vs/common.vcxproj
index 67f01ff..e0abed2 100644
--- a/modules/platforms/cpp/common/project/vs/common.vcxproj
+++ b/modules/platforms/cpp/common/project/vs/common.vcxproj
@@ -95,7 +95,7 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;IGNITEJVM_EXPORTS;_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;IGNITEJVM_EXPORTS;_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
@@ -111,7 +111,7 @@
<WarningLevel>Level3</WarningLevel>
<SDLCheck>false</SDLCheck>
<AdditionalIncludeDirectories>$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;IGNITEJVM_EXPORTS;_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;IGNITEJVM_EXPORTS;_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
@@ -128,7 +128,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;IGNITEJVM_EXPORTS;_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;_USRDLL;IGNITEJVM_EXPORTS;_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
@@ -156,7 +156,7 @@
<OmitFramePointers>true</OmitFramePointers>
<StringPooling>true</StringPooling>
<BufferSecurityCheck>false</BufferSecurityCheck>
- <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -165,7 +165,13 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
+ <ClInclude Include="..\..\include\ignite\common\big_integer.h" />
<ClInclude Include="..\..\include\ignite\common\concurrent.h" />
+ <ClInclude Include="..\..\include\ignite\common\decimal.h" />
+ <ClInclude Include="..\..\include\ignite\common\default_allocator.h" />
+ <ClInclude Include="..\..\include\ignite\common\dynamic_size_array.h" />
+ <ClInclude Include="..\..\include\ignite\common\fixed_size_array.h" />
+ <ClInclude Include="..\..\include\ignite\common\bits.h" />
<ClInclude Include="..\..\include\ignite\common\utils.h" />
<ClInclude Include="..\..\include\ignite\date.h" />
<ClInclude Include="..\..\include\ignite\guid.h" />
@@ -178,7 +184,10 @@
<ItemGroup>
<ClCompile Include="..\..\os\win\src\common\concurrent_os.cpp" />
<ClCompile Include="..\..\os\win\src\common\utils.cpp" />
+ <ClCompile Include="..\..\src\common\big_integer.cpp" />
+ <ClCompile Include="..\..\src\common\bits.cpp" />
<ClCompile Include="..\..\src\common\concurrent.cpp" />
+ <ClCompile Include="..\..\src\common\decimal.cpp" />
<ClCompile Include="..\..\src\date.cpp" />
<ClCompile Include="..\..\src\guid.cpp" />
<ClCompile Include="..\..\src\ignite_error.cpp" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cc1f074/modules/platforms/cpp/common/project/vs/common.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/project/vs/common.vcxproj.filters b/modules/platforms/cpp/common/project/vs/common.vcxproj.filters
index 1a6f069..ae17daf 100644
--- a/modules/platforms/cpp/common/project/vs/common.vcxproj.filters
+++ b/modules/platforms/cpp/common/project/vs/common.vcxproj.filters
@@ -40,6 +40,24 @@
<ClInclude Include="..\..\include\ignite\ignite_error.h">
<Filter>Code</Filter>
</ClInclude>
+ <ClInclude Include="..\..\include\ignite\common\fixed_size_array.h">
+ <Filter>Code\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\common\big_integer.h">
+ <Filter>Code\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\common\dynamic_size_array.h">
+ <Filter>Code\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\common\default_allocator.h">
+ <Filter>Code\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\common\bits.h">
+ <Filter>Code\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\common\decimal.h">
+ <Filter>Code\common</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\date.cpp">
@@ -63,5 +81,14 @@
<ClCompile Include="..\..\src\ignite_error.cpp">
<Filter>Code</Filter>
</ClCompile>
+ <ClCompile Include="..\..\src\common\big_integer.cpp">
+ <Filter>Code\common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\common\decimal.cpp">
+ <Filter>Code\common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\common\bits.cpp">
+ <Filter>Code\common</Filter>
+ </ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
[24/50] [abbrv] ignite git commit: Merge to master.
Posted by sb...@apache.org.
Merge to master.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2fdc3218
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2fdc3218
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2fdc3218
Branch: refs/heads/ignite-1232
Commit: 2fdc32180abf6496b1f35b104d49d8d67b608fce
Parents: 11d97f1 df16a75
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Tue Jul 5 22:42:21 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Tue Jul 5 22:42:21 2016 +0700
----------------------------------------------------------------------
.../internal/client/integration/ClientAbstractSelfTest.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[16/50] [abbrv] ignite git commit: IGNITE-2879: Fix for merge.
Posted by sb...@apache.org.
IGNITE-2879: Fix for merge.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/474b00e6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/474b00e6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/474b00e6
Branch: refs/heads/ignite-1232
Commit: 474b00e61ce95cac25baf308854363ebc915ba08
Parents: 6814410
Author: isapego <is...@gridgain.com>
Authored: Thu Jun 30 17:26:34 2016 +0300
Committer: isapego <is...@gridgain.com>
Committed: Thu Jun 30 17:26:34 2016 +0300
----------------------------------------------------------------------
.../odbc/src/app/application_data_buffer.cpp | 45 ++------------------
1 file changed, 4 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/474b00e6/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp b/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
index eab6750..2190c00 100644
--- a/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
+++ b/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
@@ -360,8 +360,6 @@ namespace ignite
converter << value;
- converter << value;
-
int64_t numValue;
converter >> numValue;
@@ -380,8 +378,6 @@ namespace ignite
converter << value;
- converter << value;
-
double numValue;
converter >> numValue;
@@ -559,10 +555,6 @@ namespace ignite
{
PutNum<int64_t>(value.ToInt64());
- converter << value;
-
- PutString(converter.str());
-
break;
}
@@ -583,25 +575,6 @@ namespace ignite
PutString(converter.str());
- common::FixedSizeArray<int8_t> bytesBuffer;
-
- const common::BigInteger& unscaled = zeroScaled.GetUnscaledValue();
-
- unscaled.MagnitudeToBytes(bytesBuffer);
-
- for (int32_t i = 0; i < SQL_MAX_NUMERIC_LEN; ++i)
- {
- int32_t bufIdx = bytesBuffer.GetSize() - 1 - i;
- if (bufIdx >= 0)
- numeric->val[i] = bytesBuffer[bufIdx];
- else
- numeric->val[i] = 0;
- }
-
- numeric->scale = 0;
- numeric->sign = unscaled.GetSign() < 0 ? 0 : 1;
- numeric->precision = unscaled.GetPrecision();
-
break;
}
@@ -727,11 +700,11 @@ namespace ignite
case IGNITE_ODBC_C_TYPE_BINARY:
case IGNITE_ODBC_C_TYPE_DEFAULT:
{
- SQL_NUMERIC_STRUCT* numeric =
- reinterpret_cast<SQL_NUMERIC_STRUCT*>(GetData());
+ if (GetData())
+ memcpy(GetData(), &value, std::min(static_cast<size_t>(buflen), sizeof(value)));
- common::Decimal zeroScaled;
- value.SetScale(0, zeroScaled);
+ if (GetResLen())
+ *GetResLen() = sizeof(value);
break;
}
@@ -745,12 +718,6 @@ namespace ignite
case IGNITE_ODBC_C_TYPE_UNSIGNED_LONG:
case IGNITE_ODBC_C_TYPE_SIGNED_BIGINT:
case IGNITE_ODBC_C_TYPE_UNSIGNED_BIGINT:
- {
- PutNum<int64_t>(value.ToInt64());
-
- break;
- }
-
case IGNITE_ODBC_C_TYPE_FLOAT:
case IGNITE_ODBC_C_TYPE_DOUBLE:
case IGNITE_ODBC_C_TYPE_NUMERIC:
@@ -992,8 +959,6 @@ namespace ignite
converter << str;
- converter << str;
-
converter >> res;
break;
@@ -1061,8 +1026,6 @@ namespace ignite
converter << str;
- converter << str;
-
// Workaround for char types which are recognised as
// symbolyc types and not numeric types.
if (sizeof(T) == 1)
[25/50] [abbrv] ignite git commit: IGNITE-2949 - Replaced JCache
dependency with Geronimo
Posted by sb...@apache.org.
IGNITE-2949 - Replaced JCache dependency with Geronimo
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2d40ae67
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2d40ae67
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2d40ae67
Branch: refs/heads/ignite-1232
Commit: 2d40ae67248fbb626bda59073d9dc649d93e650a
Parents: df16a75
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Tue Jul 5 18:09:10 2016 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Tue Jul 5 18:33:01 2016 -0700
----------------------------------------------------------------------
assembly/LICENSE_FABRIC | 8 +-------
assembly/LICENSE_HADOOP | 6 ------
examples/pom-standalone-lgpl.xml | 6 +++---
examples/pom-standalone.xml | 6 +++---
examples/pom.xml | 6 +++---
examples/schema-import/pom-standalone.xml | 6 +++---
examples/schema-import/pom.xml | 6 +++---
modules/cassandra/pom.xml | 4 ++--
modules/core/pom.xml | 6 +++---
modules/flume/README.txt | 2 +-
parent/pom.xml | 1 -
11 files changed, 22 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2d40ae67/assembly/LICENSE_FABRIC
----------------------------------------------------------------------
diff --git a/assembly/LICENSE_FABRIC b/assembly/LICENSE_FABRIC
index 3f92502..8cb5730 100644
--- a/assembly/LICENSE_FABRIC
+++ b/assembly/LICENSE_FABRIC
@@ -227,12 +227,6 @@ For details, see CC0 1.0 Universal (1.0), Public Domain Dedication,
http://creativecommons.org/publicdomain/zero/1.0/
==============================================================================
-For JSR107 API and SPI (https://github.com/jsr107/jsr107spec) javax.cache:cache-api:jar:1.0.0
-==============================================================================
-This product bundles JSR107 API and SPI which is available under a:
-JSR-000107 JCACHE 2.9 Public Review - Updated Specification License. For details, see https://raw.github.com/jsr107/jsr107spec/master/LICENSE.txt.
-
-==============================================================================
For JSch (http://www.jcraft.com/jsch/) com.jcraft:jsch:jar:0.1.50
==============================================================================
This product bundles JSch which is available under a:
@@ -303,4 +297,4 @@ Eclipse Public License - Version 1.0. For details, see http://www.eclipse.org/or
For SLF4J API Module (http://www.slf4j.org) org.slf4j:slf4j-api:jar:1.6.4
==============================================================================
This product bundles SLF4J API Module which is available under a:
-MIT License. For details, see http://www.opensource.org/licenses/mit-license.php.
\ No newline at end of file
+MIT License. For details, see http://www.opensource.org/licenses/mit-license.php.
http://git-wip-us.apache.org/repos/asf/ignite/blob/2d40ae67/assembly/LICENSE_HADOOP
----------------------------------------------------------------------
diff --git a/assembly/LICENSE_HADOOP b/assembly/LICENSE_HADOOP
index 8d4cc62..0d05d52 100644
--- a/assembly/LICENSE_HADOOP
+++ b/assembly/LICENSE_HADOOP
@@ -227,12 +227,6 @@ For details, see CC0 1.0 Universal (1.0), Public Domain Dedication,
http://creativecommons.org/publicdomain/zero/1.0/
==============================================================================
-For JSR107 API and SPI (https://github.com/jsr107/jsr107spec) javax.cache:cache-api:jar:1.0.0
-==============================================================================
-This product bundles JSR107 API and SPI which is available under a:
-JSR-000107 JCACHE 2.9 Public Review - Updated Specification License. For details, see https://raw.github.com/jsr107/jsr107spec/master/LICENSE.txt.
-
-==============================================================================
For JSch (http://www.jcraft.com/jsch/) com.jcraft:jsch:jar:0.1.50
==============================================================================
This product bundles JSch which is available under a:
http://git-wip-us.apache.org/repos/asf/ignite/blob/2d40ae67/examples/pom-standalone-lgpl.xml
----------------------------------------------------------------------
diff --git a/examples/pom-standalone-lgpl.xml b/examples/pom-standalone-lgpl.xml
index 7e7ccc2..951fab6 100644
--- a/examples/pom-standalone-lgpl.xml
+++ b/examples/pom-standalone-lgpl.xml
@@ -41,9 +41,9 @@
<dependencies>
<dependency>
- <groupId>javax.cache</groupId>
- <artifactId>cache-api</artifactId>
- <version>1.0.0</version>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcache_1.0_spec</artifactId>
+ <version>1.0-alpha-1</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/ignite/blob/2d40ae67/examples/pom-standalone.xml
----------------------------------------------------------------------
diff --git a/examples/pom-standalone.xml b/examples/pom-standalone.xml
index 6247ced..20399ee 100644
--- a/examples/pom-standalone.xml
+++ b/examples/pom-standalone.xml
@@ -41,9 +41,9 @@
<dependencies>
<dependency>
- <groupId>javax.cache</groupId>
- <artifactId>cache-api</artifactId>
- <version>1.0.0</version>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcache_1.0_spec</artifactId>
+ <version>1.0-alpha-1</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/ignite/blob/2d40ae67/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index 979a46f..cba056d 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -32,9 +32,9 @@
<dependencies>
<dependency>
- <groupId>javax.cache</groupId>
- <artifactId>cache-api</artifactId>
- <version>${javax.cache.version}</version>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcache_1.0_spec</artifactId>
+ <version>1.0-alpha-1</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/ignite/blob/2d40ae67/examples/schema-import/pom-standalone.xml
----------------------------------------------------------------------
diff --git a/examples/schema-import/pom-standalone.xml b/examples/schema-import/pom-standalone.xml
index e443728..43b76d8 100644
--- a/examples/schema-import/pom-standalone.xml
+++ b/examples/schema-import/pom-standalone.xml
@@ -36,9 +36,9 @@
<dependencies>
<dependency>
- <groupId>javax.cache</groupId>
- <artifactId>cache-api</artifactId>
- <version>1.0.0</version>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcache_1.0_spec</artifactId>
+ <version>1.0-alpha-1</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/ignite/blob/2d40ae67/examples/schema-import/pom.xml
----------------------------------------------------------------------
diff --git a/examples/schema-import/pom.xml b/examples/schema-import/pom.xml
index b6e36ef..f5ccac0 100644
--- a/examples/schema-import/pom.xml
+++ b/examples/schema-import/pom.xml
@@ -39,9 +39,9 @@
<dependencies>
<dependency>
- <groupId>javax.cache</groupId>
- <artifactId>cache-api</artifactId>
- <version>${javax.cache.version}</version>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcache_1.0_spec</artifactId>
+ <version>1.0-alpha-1</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/ignite/blob/2d40ae67/modules/cassandra/pom.xml
----------------------------------------------------------------------
diff --git a/modules/cassandra/pom.xml b/modules/cassandra/pom.xml
index e8e46b4..c9ff87d 100644
--- a/modules/cassandra/pom.xml
+++ b/modules/cassandra/pom.xml
@@ -236,7 +236,7 @@
org.apache.ignite,org.springframework,org.gridgain
</excludeGroupIds>
<excludeArtifactIds>
- commons-logging,slf4j-api,cache-api,slf4j-api,aopalliance
+ commons-logging,slf4j-api,geronimo-jcache_1.0_spec,slf4j-api,aopalliance
</excludeArtifactIds>
<includeScope>runtime</includeScope>
</configuration>
@@ -334,4 +334,4 @@
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
http://git-wip-us.apache.org/repos/asf/ignite/blob/2d40ae67/modules/core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index 5e32caf..7529b0b 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -63,9 +63,9 @@
<dependencies>
<dependency>
- <groupId>javax.cache</groupId>
- <artifactId>cache-api</artifactId>
- <version>${javax.cache.version}</version>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcache_1.0_spec</artifactId>
+ <version>1.0-alpha-1</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/ignite/blob/2d40ae67/modules/flume/README.txt
----------------------------------------------------------------------
diff --git a/modules/flume/README.txt b/modules/flume/README.txt
index bf7e0ff..97d8cac 100644
--- a/modules/flume/README.txt
+++ b/modules/flume/README.txt
@@ -20,7 +20,7 @@ plugins.d/
|-- lib
| `-- ignite-flume-transformer-x.x.x.jar <-- your jar
`-- libext
- |-- cache-api-1.0.0.jar
+ |-- geronimo-jcache_1.0_spec-1.0-alpha-1.jar
|-- ignite-core-x.x.x.jar
|-- ignite-flume-x.x.x.jar <-- IgniteSink
|-- ignite-spring-x.x.x.jar
http://git-wip-us.apache.org/repos/asf/ignite/blob/2d40ae67/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index d78deac..9fbc78d 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -76,7 +76,6 @@
<jackson.version>1.9.13</jackson.version>
<jackson2.version>2.7.5</jackson2.version>
<javax.cache.bundle.version>1.0.0_1</javax.cache.bundle.version>
- <javax.cache.version>1.0.0</javax.cache.version>
<jetty.version>9.2.11.v20150529</jetty.version>
<jms.spec.version>1.1.1</jms.spec.version>
<jsch.bundle.version>0.1.53_1</jsch.bundle.version>
[49/50] [abbrv] ignite git commit: Merge remote-tracking branch
'remotes/community/gridgain-7.6.2'
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/community/gridgain-7.6.2'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/77bcabca
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/77bcabca
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/77bcabca
Branch: refs/heads/ignite-1232
Commit: 77bcabcaedf442dc14e60c0f82452393b8c22d65
Parents: 4e468a8 b2fd2aa
Author: Denis Magda <dm...@gridgain.com>
Authored: Wed Jul 6 19:38:54 2016 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Jul 6 19:38:54 2016 +0300
----------------------------------------------------------------------
.../store/cassandra/common/package-info.java | 21 ++++++++++++++++++++
.../cassandra/datasource/package-info.java | 21 ++++++++++++++++++++
.../cache/store/cassandra/package-info.java | 21 ++++++++++++++++++++
.../cassandra/persistence/package-info.java | 21 ++++++++++++++++++++
.../cassandra/serializer/package-info.java | 21 ++++++++++++++++++++
.../store/cassandra/session/package-info.java | 21 ++++++++++++++++++++
.../cassandra/session/pool/package-info.java | 21 ++++++++++++++++++++
.../store/cassandra/utils/package-info.java | 21 ++++++++++++++++++++
.../tests/load/cassandra/package-info.java | 21 ++++++++++++++++++++
.../ignite/tests/load/ignite/package-info.java | 21 ++++++++++++++++++++
.../apache/ignite/tests/load/package-info.java | 21 ++++++++++++++++++++
.../org/apache/ignite/tests/package-info.java | 21 ++++++++++++++++++++
.../apache/ignite/tests/pojos/package-info.java | 21 ++++++++++++++++++++
.../apache/ignite/tests/utils/package-info.java | 21 ++++++++++++++++++++
14 files changed, 294 insertions(+)
----------------------------------------------------------------------
[07/50] [abbrv] ignite git commit: ignite-3372: IgniteDataStreamer:
pre-loading starvation if multiple streamers preload the same cache (cherry
picked from commit ac092f4)
Posted by sb...@apache.org.
ignite-3372: IgniteDataStreamer: pre-loading starvation if multiple streamers preload the same cache
(cherry picked from commit ac092f4)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/58716064
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/58716064
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/58716064
Branch: refs/heads/ignite-1232
Commit: 587160645d8f9209a7ac42b75d79e30669939133
Parents: 16ffe6e
Author: Denis Magda <dm...@gridgain.com>
Authored: Tue Jun 28 09:52:13 2016 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Jun 29 14:41:26 2016 +0300
----------------------------------------------------------------------
.../cache/distributed/dht/GridDhtPartitionTopologyImpl.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/58716064/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index 4be0acb..868e9db 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
@@ -770,7 +770,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
* ===================================================
*/
- GridDhtLocalPartition loc = localPartition(cctx.affinity().partition(e.key()), topologyVersion(), false);
+ GridDhtLocalPartition loc = localPartition(e.partition(), topologyVersion(), false);
if (loc != null)
loc.onRemoved(e);
[14/50] [abbrv] ignite git commit: IGNITE-2879: ODBC: Added missing
files.
Posted by sb...@apache.org.
IGNITE-2879: ODBC: Added missing files.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b5e6a70a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b5e6a70a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b5e6a70a
Branch: refs/heads/ignite-1232
Commit: b5e6a70ae39451c06864f1796945634d1b2dcd6f
Parents: 94df427
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Jun 30 12:52:31 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Jun 30 12:52:31 2016 +0300
----------------------------------------------------------------------
.../cpp/common/include/ignite/common/decimal.h | 527 +++++++++++++++++++
.../platforms/cpp/common/src/common/decimal.cpp | 275 ++++++++++
2 files changed, 802 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b5e6a70a/modules/platforms/cpp/common/include/ignite/common/decimal.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/common/decimal.h b/modules/platforms/cpp/common/include/ignite/common/decimal.h
new file mode 100644
index 0000000..cd3bbde
--- /dev/null
+++ b/modules/platforms/cpp/common/include/ignite/common/decimal.h
@@ -0,0 +1,527 @@
+/*
+ * 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.
+ */
+
+#ifndef _IGNITE_COMMON_DECIMAL
+#define _IGNITE_COMMON_DECIMAL
+
+#include <stdint.h>
+#include <cctype>
+
+#include <sstream>
+#include <iostream>
+
+#include <ignite/common/big_integer.h>
+
+namespace ignite
+{
+ namespace common
+ {
+ /**
+ * Big decimal number implementation.
+ */
+ class Decimal
+ {
+ public:
+ /**
+ * Default constructor.
+ */
+ Decimal();
+
+ /**
+ * Constructor.
+ *
+ * @param mag Bytes of the magnitude. Should be positive, sign is
+ * passed using separate argument.
+ * @param len Magnitude length in bytes.
+ * @param scale Scale.
+ * @param sign Sign of the decimal. Should be -1 for negative numbers
+ * and 1 otherwise.
+ * @param bigEndian If true then magnitude is in big-endian. Otherwise
+ * the byte order of the magnitude considered to be little-endian.
+ */
+ Decimal(const int8_t* mag, int32_t len, int32_t scale, int32_t sign, bool bigEndian = true);
+
+ /**
+ * Copy constructor.
+ *
+ * @param other Other instance.
+ */
+ Decimal(const Decimal& other);
+
+ /**
+ * Integer constructor.
+ *
+ * @param val Integer value.
+ */
+ explicit Decimal(int64_t val);
+
+ /**
+ * Integer constructor with scale.
+ *
+ * @param val Integer value.
+ * @param scale Scale.
+ */
+ Decimal(int64_t val, int32_t scale);
+
+ /**
+ * BigInteger constructor with scale.
+ *
+ * @param val BigInteger value.
+ * @param scale Scale.
+ */
+ Decimal(const common::BigInteger& val, int32_t scale);
+
+ /**
+ * String constructor.
+ *
+ * @param val String to assign.
+ * @param len String length.
+ */
+ Decimal(const char* val, int32_t len);
+
+ /**
+ * String constructor.
+ *
+ * @param val String to assign.
+ */
+ explicit Decimal(const std::string& val) :
+ scale(0),
+ magnitude(0)
+ {
+ AssignString(val);
+ }
+
+ /**
+ * Destructor.
+ */
+ ~Decimal();
+
+ /**
+ * Copy operator.
+ *
+ * @param other Other instance.
+ * @return This.
+ */
+ Decimal& operator=(const Decimal& other);
+
+ /**
+ * Convert to double.
+ */
+ operator double() const;
+
+ /**
+ * Convert to int64_t.
+ */
+ operator int64_t() const;
+
+ /**
+ * Convert to double.
+ *
+ * @return Double value.
+ */
+ double ToDouble() const;
+
+ /**
+ * Convert to int64_t.
+ *
+ * @return int64_t value.
+ */
+ int64_t ToInt64() const;
+
+ /**
+ * Get scale.
+ *
+ * @return Scale.
+ */
+ int32_t GetScale() const;
+
+ /**
+ * Set scale.
+ *
+ * @param scale Scale to set.
+ * @param res Result is placed here. Can be *this.
+ */
+ void SetScale(int32_t scale, Decimal& res) const;
+
+ /**
+ * Get precision of the Decimal.
+ *
+ * @return Number of the decimal digits in the decimal representation
+ * of the value.
+ */
+ int32_t GetPrecision() const;
+
+ /**
+ * Get unscaled value.
+ *
+ * @return Unscaled value.
+ */
+ const common::BigInteger& GetUnscaledValue() const;
+
+ /**
+ * Swap function for the Decimal type.
+ *
+ * @param other Other instance.
+ */
+ void Swap(Decimal& second);
+
+ /**
+ * Get length of the magnitude.
+ *
+ * @return Length of the magnitude.
+ */
+ int32_t GetMagnitudeLength() const;
+
+ /**
+ * Assign specified value to this Decimal.
+ *
+ * @param val String to assign.
+ */
+ void AssignString(const std::string& val)
+ {
+ AssignString(val.data(), static_cast<int32_t>(val.size()));
+ }
+
+ /**
+ * Assign specified value to this Decimal.
+ *
+ * @param val String to assign.
+ * @param len String length.
+ */
+ void AssignString(const char* val, int32_t len);
+
+ /**
+ * Assign specified value to this Decimal.
+ *
+ * @param val Value to assign.
+ */
+ void AssignInt64(int64_t val);
+
+ /**
+ * Assign specified value to this Decimal.
+ *
+ * @param val Value to assign.
+ */
+ void AssignDouble(double val);
+
+ /**
+ * Assign specified value to this Decimal.
+ *
+ * @param val Value to assign.
+ */
+ void AssignUint64(uint64_t val);
+
+ /**
+ * Compare this instance to another.
+ *
+ * @param other Another instance.
+ * @return Comparasion result - 0 if equal, 1 if this is greater, -1 if
+ * this is less.
+ */
+ int32_t Compare(const Decimal& other) const;
+
+ /**
+ * Check whether this value is negative.
+ *
+ * @return True if this value is negative and false otherwise.
+ */
+ bool IsNegative() const;
+
+ /**
+ * Check whether this value is zero.
+ *
+ * @return True if this value is negative and false otherwise.
+ */
+ bool IsZero() const;
+
+ /**
+ * Check whether this value is positive.
+ *
+ * @return True if this value is positive and false otherwise.
+ */
+ bool IsPositive() const;
+
+ /**
+ * Output operator.
+ *
+ * @param os Output stream.
+ * @param val Value to output.
+ * @return Reference to the first param.
+ */
+ friend std::ostream& operator<<(std::ostream& os, const Decimal& val)
+ {
+ const common::BigInteger& unscaled = val.GetUnscaledValue();
+
+ // Zero magnitude case. Scale does not matter.
+ if (unscaled.GetMagnitude().IsEmpty())
+ return os << '0';
+
+ // Scale is zero or negative. No decimal point here.
+ if (val.scale <= 0)
+ {
+ os << unscaled;
+
+ // Adding zeroes if needed.
+ for (int32_t i = 0; i < -val.scale; ++i)
+ os << '0';
+
+ return os;
+ }
+
+ // Getting magnitude as a string.
+ std::stringstream converter;
+
+ converter << unscaled;
+
+ std::string magStr = converter.str();
+
+ int32_t magLen = static_cast<int32_t>(magStr.size());
+
+ int32_t magBegin = 0;
+
+ // If value is negative passing minus sign.
+ if (magStr[magBegin] == '-')
+ {
+ os << magStr[magBegin];
+
+ ++magBegin;
+ --magLen;
+ }
+
+ // Finding last non-zero char. There is no sense in trailing zeroes
+ // beyond the decimal point.
+ int32_t lastNonZero = static_cast<int32_t>(magStr.size()) - 1;
+
+ while (lastNonZero >= magBegin && magStr[lastNonZero] == '0')
+ --lastNonZero;
+
+ // This is expected as we already covered zero number case.
+ assert(lastNonZero >= magBegin);
+
+ int32_t dotPos = magLen - val.scale;
+
+ if (dotPos <= 0)
+ {
+ // Means we need to add leading zeroes.
+ os << '0' << '.';
+
+ while (dotPos < 0)
+ {
+ ++dotPos;
+
+ os << '0';
+ }
+
+ os.write(&magStr[magBegin], lastNonZero - magBegin + 1);
+ }
+ else
+ {
+ // Decimal point is in the middle of the number.
+ // Just output everything before the decimal point.
+ os.write(&magStr[magBegin], dotPos);
+
+ int32_t afterDot = lastNonZero - dotPos - magBegin + 1;
+
+ if (afterDot > 0)
+ {
+ os << '.';
+
+ os.write(&magStr[magBegin + dotPos], afterDot);
+ }
+ }
+
+ return os;
+ }
+
+ /**
+ * Input operator.
+ *
+ * @param is Input stream.
+ * @param val Value to input.
+ * @return Reference to the first param.
+ */
+ friend std::istream& operator>>(std::istream& is, Decimal& val)
+ {
+ std::istream::sentry sentry(is);
+
+ // Return zero if input failed.
+ val.AssignInt64(0);
+
+ if (!is)
+ return is;
+
+ // Current char.
+ int c = is.peek();
+
+ // Current value parts.
+ uint64_t part = 0;
+ int32_t partDigits = 0;
+ int32_t scale = -1;
+ int32_t sign = 1;
+
+ common::BigInteger& mag = val.magnitude;
+ common::BigInteger pow;
+ common::BigInteger bigPart;
+
+ if (!is)
+ return is;
+
+ // Checking sign.
+ if (c == '-' || c == '+')
+ {
+ if (c == '-')
+ sign = -1;
+
+ is.ignore();
+ c = is.peek();
+ }
+
+ // Reading number itself.
+ while (is)
+ {
+ if (isdigit(c))
+ {
+ part = part * 10 + (c - '0');
+ ++partDigits;
+ }
+ else if (c == '.' && scale < 0)
+ {
+ // We have found decimal point. Starting counting scale.
+ scale = 0;
+ }
+ else
+ break;
+
+ is.ignore();
+ c = is.peek();
+
+ if (part >= 1000000000000000000ULL)
+ {
+ common::BigInteger::GetPowerOfTen(partDigits, pow);
+ mag.Multiply(pow, mag);
+
+ mag.Add(part);
+
+ part = 0;
+ partDigits = 0;
+ }
+
+ // Counting scale if the decimal point have been encountered.
+ if (scale >= 0)
+ ++scale;
+ }
+
+ // Adding last part of the number.
+ if (partDigits)
+ {
+ common::BigInteger::GetPowerOfTen(partDigits, pow);
+
+ mag.Multiply(pow, mag);
+
+ mag.Add(part);
+ }
+
+ // Adjusting scale.
+ if (scale < 0)
+ scale = 0;
+ else
+ --scale;
+
+ // Reading exponent.
+ if (c == 'e' || c == 'E')
+ {
+ is.ignore();
+
+ int32_t exp = 0;
+ is >> exp;
+
+ scale -= exp;
+ }
+
+ val.scale = scale;
+
+ if (sign < 0)
+ mag.Negate();
+
+ return is;
+ }
+
+ private:
+ /** Scale. */
+ int32_t scale;
+
+ /** Magnitude. */
+ common::BigInteger magnitude;
+ };
+
+ /**
+ * Comparison operator.
+ *
+ * @param val1 First value.
+ * @param val2 Second value.
+ * @return True if equal.
+ */
+ bool IGNITE_IMPORT_EXPORT operator==(const Decimal& val1, const Decimal& val2);
+
+ /**
+ * Comparison operator.
+ *
+ * @param val1 First value.
+ * @param val2 Second value.
+ * @return True if not equal.
+ */
+ bool IGNITE_IMPORT_EXPORT operator!=(const Decimal& val1, const Decimal& val2);
+
+ /**
+ * Comparison operator.
+ *
+ * @param val1 First value.
+ * @param val2 Second value.
+ * @return True if less.
+ */
+ bool IGNITE_IMPORT_EXPORT operator<(const Decimal& val1, const Decimal& val2);
+
+ /**
+ * Comparison operator.
+ *
+ * @param val1 First value.
+ * @param val2 Second value.
+ * @return True if less or equal.
+ */
+ bool IGNITE_IMPORT_EXPORT operator<=(const Decimal& val1, const Decimal& val2);
+
+ /**
+ * Comparison operator.
+ *
+ * @param val1 First value.
+ * @param val2 Second value.
+ * @return True if gretter.
+ */
+ bool IGNITE_IMPORT_EXPORT operator>(const Decimal& val1, const Decimal& val2);
+
+ /**
+ * Comparison operator.
+ *
+ * @param val1 First value.
+ * @param val2 Second value.
+ * @return True if gretter or equal.
+ */
+ bool IGNITE_IMPORT_EXPORT operator>=(const Decimal& val1, const Decimal& val2);
+ }
+}
+
+#endif //_IGNITE_COMMON_DECIMAL
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b5e6a70a/modules/platforms/cpp/common/src/common/decimal.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/src/common/decimal.cpp b/modules/platforms/cpp/common/src/common/decimal.cpp
new file mode 100644
index 0000000..178faa8
--- /dev/null
+++ b/modules/platforms/cpp/common/src/common/decimal.cpp
@@ -0,0 +1,275 @@
+/*
+ * 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.
+ */
+
+#include <cstring>
+#include <utility>
+
+#include "ignite/common/utils.h"
+#include "ignite/common/decimal.h"
+
+using ignite::common::BigInteger;
+
+namespace ignite
+{
+ namespace common
+ {
+ Decimal::Decimal() :
+ scale(0),
+ magnitude(0)
+ {
+ // No-op.
+ }
+
+ Decimal::Decimal(const int8_t* mag, int32_t len, int32_t scale, int32_t sign, bool bigEndian) :
+ scale(scale & 0x7FFFFFFF),
+ magnitude(mag, len, sign, bigEndian)
+ {
+ // No-op.
+ }
+
+ Decimal::Decimal(const Decimal& other) :
+ scale(other.scale),
+ magnitude(other.magnitude)
+ {
+ // No-op.
+ }
+
+ Decimal::Decimal(int64_t val) :
+ scale(0),
+ magnitude(val)
+ {
+ // No-op.
+ }
+
+ Decimal::Decimal(int64_t val, int32_t scale) :
+ scale(scale),
+ magnitude(val)
+ {
+ // No-op.
+ }
+
+ Decimal::Decimal(const BigInteger& val, int32_t scale) :
+ scale(scale),
+ magnitude(val)
+ {
+ // No-op.
+ }
+
+ Decimal::Decimal(const char* val, int32_t len) :
+ scale(0),
+ magnitude(0)
+ {
+ AssignString(val, len);
+ }
+
+ Decimal::~Decimal()
+ {
+ // No-op.
+ }
+
+ Decimal& Decimal::operator=(const Decimal& other)
+ {
+ scale = other.scale;
+ magnitude = other.magnitude;
+
+ return *this;
+ }
+
+ Decimal::operator double() const
+ {
+ return ToDouble();
+ }
+
+ Decimal::operator int64_t() const
+ {
+ return ToInt64();
+ }
+
+ double Decimal::ToDouble() const
+ {
+ return common::LexicalCast<double>(*this);
+ }
+
+ int64_t Decimal::ToInt64() const
+ {
+ if (scale == 0)
+ return magnitude.ToInt64();
+
+ Decimal zeroScaled;
+
+ SetScale(0, zeroScaled);
+
+ return zeroScaled.magnitude.ToInt64();
+ }
+
+ int32_t Decimal::GetScale() const
+ {
+ return scale;
+ }
+
+ void Decimal::SetScale(int32_t newScale, Decimal& res) const
+ {
+ if (scale == newScale)
+ return;
+
+ int32_t diff = scale - newScale;
+
+ BigInteger adjustment;
+
+ if (diff > 0)
+ {
+ BigInteger::GetPowerOfTen(diff, adjustment);
+
+ magnitude.Divide(adjustment, res.magnitude);
+ }
+ else
+ {
+ BigInteger::GetPowerOfTen(-diff, adjustment);
+
+ magnitude.Multiply(adjustment, res.magnitude);
+ }
+
+ res.scale = newScale;
+ }
+
+ int32_t Decimal::GetPrecision() const
+ {
+ return magnitude.GetPrecision();
+ }
+
+ const BigInteger& Decimal::GetUnscaledValue() const
+ {
+ return magnitude;
+ }
+
+ void Decimal::Swap(Decimal& second)
+ {
+ using std::swap;
+
+ swap(scale, second.scale);
+ magnitude.Swap(second.magnitude);
+ }
+
+ int32_t Decimal::GetMagnitudeLength() const
+ {
+ return magnitude.mag.GetSize();
+ }
+
+ void Decimal::AssignString(const char* val, int32_t len)
+ {
+ std::stringstream converter;
+
+ converter.write(val, len);
+
+ converter >> *this;
+ }
+
+ void Decimal::AssignInt64(int64_t val)
+ {
+ magnitude.AssignInt64(val);
+
+ scale = 0;
+ }
+
+ void Decimal::AssignDouble(double val)
+ {
+ std::stringstream converter;
+
+ converter.precision(16);
+
+ converter << val;
+ converter >> *this;
+ }
+
+ void Decimal::AssignUint64(uint64_t val)
+ {
+ magnitude.AssignUint64(val);
+
+ scale = 0;
+ }
+
+ int32_t Decimal::Compare(const Decimal& other) const
+ {
+ if (IsZero() && other.IsZero())
+ return 0;
+
+ if (scale == other.scale)
+ return magnitude.Compare(other.magnitude);
+ else if (scale > other.scale)
+ {
+ Decimal scaled;
+
+ other.SetScale(scale, scaled);
+
+ return magnitude.Compare(scaled.magnitude);
+ }
+ else
+ {
+ Decimal scaled;
+
+ SetScale(other.scale, scaled);
+
+ return scaled.magnitude.Compare(other.magnitude);
+ }
+ }
+
+ bool Decimal::IsNegative() const
+ {
+ return magnitude.IsNegative();
+ }
+
+ bool Decimal::IsZero() const
+ {
+ return magnitude.IsZero();
+ }
+
+ bool Decimal::IsPositive() const
+ {
+ return magnitude.IsPositive();
+ }
+
+ bool operator==(const Decimal& val1, const Decimal& val2)
+ {
+ return val1.Compare(val2) == 0;
+ }
+
+ bool operator!=(const Decimal& val1, const Decimal& val2)
+ {
+ return val1.Compare(val2) != 0;
+ }
+
+ bool operator<(const Decimal& val1, const Decimal& val2)
+ {
+ return val1.Compare(val2) < 0;
+ }
+
+ bool operator<=(const Decimal& val1, const Decimal& val2)
+ {
+ return val1.Compare(val2) <= 0;
+ }
+
+ bool operator>(const Decimal& val1, const Decimal& val2)
+ {
+ return val1.Compare(val2) > 0;
+ }
+
+ bool operator>=(const Decimal& val1, const Decimal& val2)
+ {
+ return val1.Compare(val2) >= 0;
+ }
+ }
+}
\ No newline at end of file
[11/50] [abbrv] ignite git commit: IGNITE-3383: Hadoop: Improved
Hadoop component start logic.
Posted by sb...@apache.org.
IGNITE-3383: Hadoop: Improved Hadoop component start logic.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/00ce2097
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/00ce2097
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/00ce2097
Branch: refs/heads/ignite-1232
Commit: 00ce2097f57b7f3def04da9449c68b17135cbeaa
Parents: 26eec3a
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Jun 28 16:33:09 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Jun 30 10:19:10 2016 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/IgniteKernal.java | 48 ++++++++++++------
.../processors/hadoop/HadoopNoopProcessor.java | 5 ++
.../hadoop/HadoopProcessorAdapter.java | 7 +++
.../processors/hadoop/HadoopClassLoader.java | 2 +-
.../processors/hadoop/HadoopProcessor.java | 52 +++++++++-----------
5 files changed, 68 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/00ce2097/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index e77875e..0c1bd93 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -115,7 +115,7 @@ import org.apache.ignite.internal.processors.continuous.GridContinuousProcessor;
import org.apache.ignite.internal.processors.datastreamer.DataStreamProcessor;
import org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor;
import org.apache.ignite.internal.processors.hadoop.Hadoop;
-import org.apache.ignite.internal.processors.hadoop.HadoopNoopProcessor;
+import org.apache.ignite.internal.processors.hadoop.HadoopProcessorAdapter;
import org.apache.ignite.internal.processors.job.GridJobProcessor;
import org.apache.ignite.internal.processors.jobmetrics.GridJobMetricsProcessor;
import org.apache.ignite.internal.processors.nodevalidation.DiscoveryNodeValidationProcessor;
@@ -1111,26 +1111,44 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
* Create Hadoop component.
*
* @return Non-null Hadoop component: workable or no-op.
- * @throws IgniteCheckedException if the component is mandatory and cannot be initialized.
+ * @throws IgniteCheckedException If the component is mandatory and cannot be initialized.
*/
- private GridComponent createHadoopComponent() throws IgniteCheckedException {
- GridComponent cmp;
+ private HadoopProcessorAdapter createHadoopComponent() throws IgniteCheckedException {
+ boolean mandatory = cfg.getHadoopConfiguration() != null;
- if (cfg.isPeerClassLoadingEnabled()) {
- cmp = IgniteComponentType.HADOOP.createIfInClassPath(ctx, false);
+ if (mandatory) {
+ if (cfg.isPeerClassLoadingEnabled())
+ throw new IgniteCheckedException("Hadoop module cannot be used with peer class loading enabled " +
+ "(set IgniteConfiguration.peerClassLoadingEnabled to \"false\").");
- if (!(cmp instanceof HadoopNoopProcessor)) {
- U.warn(log, "Hadoop module is found in classpath, but it will not be started because peer class " +
- "loading is enabled (set IgniteConfiguration.peerClassLoadingEnabled to \"false\" to start " +
- "Hadoop module).");
+ return IgniteComponentType.HADOOP.createIfInClassPath(ctx, true);
+ }
+ else {
+ HadoopProcessorAdapter cmp = null;
- cmp = IgniteComponentType.HADOOP.create(ctx, true/*no-op*/);
+ if (IgniteComponentType.HADOOP.inClassPath() && cfg.isPeerClassLoadingEnabled()) {
+ U.warn(log, "Hadoop module is found in classpath, but will not be started because peer class " +
+ "loading is enabled (set IgniteConfiguration.peerClassLoadingEnabled to \"false\" if you want " +
+ "to use Hadoop module).");
}
- }
- else
- cmp = IgniteComponentType.HADOOP.createIfInClassPath(ctx, cfg.getHadoopConfiguration() != null);
+ else {
+ cmp = IgniteComponentType.HADOOP.createIfInClassPath(ctx, false);
+
+ try {
+ cmp.validateEnvironment();
+ }
+ catch (IgniteException | IgniteCheckedException e) {
+ U.quietAndWarn(log, "Hadoop module will not start due to exception: " + e.getMessage());
+
+ cmp = null;
+ }
+ }
+
+ if (cmp == null)
+ cmp = IgniteComponentType.HADOOP.create(ctx, true);
- return cmp;
+ return cmp;
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/00ce2097/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopNoopProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopNoopProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopNoopProcessor.java
index e772787..501870a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopNoopProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopNoopProcessor.java
@@ -82,4 +82,9 @@ public class HadoopNoopProcessor extends HadoopProcessorAdapter {
return new IllegalStateException("Hadoop module is not loaded (please ensure that ignite-hadoop.jar is in " +
"classpath and IgniteConfiguration.peerClassLoadingEnabled is set to false).");
}
+
+ /** {@inheritDoc} */
+ @Override public void validateEnvironment() throws IgniteCheckedException {
+ // No-oop.
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/00ce2097/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessorAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessorAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessorAdapter.java
index 3d381c3..f914639 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessorAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessorAdapter.java
@@ -94,4 +94,11 @@ public abstract class HadoopProcessorAdapter extends GridProcessorAdapter {
* @throws IgniteCheckedException If failed.
*/
public abstract boolean kill(HadoopJobId jobId) throws IgniteCheckedException;
+
+ /**
+ * Validate Hadoop environment.
+ *
+ * @throws IgniteCheckedException If failed.
+ */
+ public abstract void validateEnvironment() throws IgniteCheckedException;
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/00ce2097/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java
index 1c844c4..389de8c 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java
@@ -501,7 +501,7 @@ public class HadoopClassLoader extends URLClassLoader implements ClassCache {
hadoopUrls = HadoopClasspathUtils.classpathUrls();
}
catch (IOException e) {
- throw new IgniteCheckedException("Failed to resolve Hadoop JAR locations.", e);
+ throw new IgniteCheckedException("Failed to resolve Hadoop JAR locations: " + e.getMessage(), e);
}
hadoopJars = hadoopUrls;
http://git-wip-us.apache.org/repos/asf/ignite/blob/00ce2097/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
index c45953e..7fc7499 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
@@ -50,6 +50,8 @@ public class HadoopProcessor extends HadoopProcessorAdapter {
private Hadoop hadoop;
/**
+ * Constructor.
+ *
* @param ctx Kernal context.
*/
public HadoopProcessor(GridKernalContext ctx) {
@@ -70,24 +72,6 @@ public class HadoopProcessor extends HadoopProcessorAdapter {
initializeDefaults(cfg);
- validate(cfg);
-
- try {
- HadoopLocations loc = HadoopClasspathUtils.hadoopLocations();
-
- if (loc.home() != null)
- U.quietAndInfo(log, "HADOOP_HOME is set to " + loc.home());
-
- U.quietAndInfo(log, "HADOOP_COMMON_HOME is set to " + loc.commonHome());
- U.quietAndInfo(log, "HADOOP_HDFS_HOME is set to " + loc.hdfsHome());
- U.quietAndInfo(log, "HADOOP_MAPRED_HOME is set to " + loc.mapredHome());
- }
- catch (IOException ioe) {
- throw new IgniteCheckedException(ioe);
- }
-
- HadoopClassLoader.hadoopUrls();
-
hctx = new HadoopContext(
ctx,
cfg,
@@ -204,6 +188,26 @@ public class HadoopProcessor extends HadoopProcessorAdapter {
return hctx.jobTracker().killJob(jobId);
}
+ /** {@inheritDoc} */
+ @Override public void validateEnvironment() throws IgniteCheckedException {
+ // Perform some static checks as early as possible, so that any recoverable exceptions are thrown here.
+ try {
+ HadoopLocations loc = HadoopClasspathUtils.hadoopLocations();
+
+ if (loc.home() != null)
+ U.quietAndInfo(log, "HADOOP_HOME is set to " + loc.home());
+
+ U.quietAndInfo(log, "HADOOP_COMMON_HOME is set to " + loc.commonHome());
+ U.quietAndInfo(log, "HADOOP_HDFS_HOME is set to " + loc.hdfsHome());
+ U.quietAndInfo(log, "HADOOP_MAPRED_HOME is set to " + loc.mapredHome());
+ }
+ catch (IOException ioe) {
+ throw new IgniteCheckedException(ioe.getMessage(), ioe);
+ }
+
+ HadoopClassLoader.hadoopUrls();
+ }
+
/**
* Initializes default hadoop configuration.
*
@@ -213,16 +217,4 @@ public class HadoopProcessor extends HadoopProcessorAdapter {
if (cfg.getMapReducePlanner() == null)
cfg.setMapReducePlanner(new IgniteHadoopMapReducePlanner());
}
-
- /**
- * Validates Grid and Hadoop configuration for correctness.
- *
- * @param hadoopCfg Hadoop configuration.
- * @throws IgniteCheckedException If failed.
- */
- private void validate(HadoopConfiguration hadoopCfg) throws IgniteCheckedException {
- if (ctx.config().isPeerClassLoadingEnabled())
- throw new IgniteCheckedException("Peer class loading cannot be used with Hadoop (disable it using " +
- "IgniteConfiguration.setPeerClassLoadingEnabled()).");
- }
}
\ No newline at end of file
[23/50] [abbrv] ignite git commit: IGNITE-3398 .NET: Allow extending
predefined Affinity Functions
Posted by sb...@apache.org.
IGNITE-3398 .NET: Allow extending predefined Affinity Functions
This closes #848
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/11d97f17
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/11d97f17
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/11d97f17
Branch: refs/heads/ignite-1232
Commit: 11d97f174db9253cf7cd1c62d3d6f86f582c2a21
Parents: b3af61f
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Tue Jul 5 15:30:41 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Jul 5 15:30:41 2016 +0300
----------------------------------------------------------------------
.../affinity/PlatformAffinityFunction.java | 154 +++++++----
.../PlatformAffinityFunctionTarget.java | 113 ++++++++
.../cache/affinity/PlatformAffinityUtils.java | 113 ++++++++
.../callback/PlatformCallbackGateway.java | 6 +-
.../callback/PlatformCallbackUtils.java | 5 +-
.../PlatformDotNetConfigurationClosure.java | 8 +-
.../utils/PlatformConfigurationUtils.java | 96 ++++---
.../dotnet/PlatformDotNetAffinityFunction.java | 89 +++---
.../platforms/cpp/jni/include/ignite/jni/java.h | 4 +-
modules/platforms/cpp/jni/src/java.cpp | 7 +-
.../Affinity/AffinityFunctionSpringTest.cs | 64 ++++-
.../Cache/Affinity/AffinityFunctionTest.cs | 209 ++++++++++++--
.../Config/Cache/Affinity/affinity-function.xml | 40 +++
.../Apache.Ignite.Core.Tests/TestRunner.cs | 4 +-
.../Apache.Ignite.Core.csproj | 3 +
.../Cache/Affinity/AffinityFunctionBase.cs | 126 +++------
.../Cache/Affinity/AffinityFunctionContext.cs | 14 +-
.../Cache/Affinity/Fair/FairAffinityFunction.cs | 4 +
.../Rendezvous/RendezvousAffinityFunction.cs | 4 +
.../Cache/Configuration/CacheConfiguration.cs | 5 +-
.../dotnet/Apache.Ignite.Core/Ignition.cs | 6 +-
.../Impl/Binary/BinaryReaderExtensions.cs | 14 +
.../Impl/Binary/Marshaller.cs | 1 +
.../Affinity/AffinityFunctionSerializer.cs | 277 +++++++++++++++++++
.../Cache/Affinity/PlatformAffinityFunction.cs | 74 +++++
.../Impl/Common/ObjectInfoHolder.cs | 86 ++++++
.../Apache.Ignite.Core/Impl/IgniteUtils.cs | 21 ++
.../Impl/Unmanaged/UnmanagedCallbacks.cs | 51 +---
28 files changed, 1271 insertions(+), 327 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunction.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunction.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunction.java
index fc2496c..1e844e7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunction.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunction.java
@@ -22,12 +22,8 @@ import org.apache.ignite.IgniteException;
import org.apache.ignite.cache.affinity.AffinityFunction;
import org.apache.ignite.cache.affinity.AffinityFunctionContext;
import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.internal.binary.BinaryRawReaderEx;
import org.apache.ignite.internal.binary.BinaryRawWriterEx;
-import org.apache.ignite.internal.cluster.IgniteClusterEx;
-import org.apache.ignite.internal.processors.affinity.GridAffinityFunctionContextImpl;
import org.apache.ignite.internal.processors.platform.PlatformContext;
-import org.apache.ignite.internal.processors.platform.memory.PlatformInputStream;
import org.apache.ignite.internal.processors.platform.memory.PlatformMemory;
import org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream;
import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
@@ -38,7 +34,6 @@ import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@@ -50,6 +45,15 @@ public class PlatformAffinityFunction implements AffinityFunction, Externalizabl
private static final long serialVersionUID = 0L;
/** */
+ private static final byte FLAG_PARTITION = 1;
+
+ /** */
+ private static final byte FLAG_REMOVE_NODE = 1 << 1;
+
+ /** */
+ private static final byte FLAG_ASSIGN_PARTITIONS = 1 << 2;
+
+ /** */
private Object userFunc;
/**
@@ -62,6 +66,12 @@ public class PlatformAffinityFunction implements AffinityFunction, Externalizabl
private int partitions;
/** */
+ private AffinityFunction baseFunc;
+
+ /** */
+ private byte overrideFlags;
+
+ /** */
private transient Ignite ignite;
/** */
@@ -70,6 +80,10 @@ public class PlatformAffinityFunction implements AffinityFunction, Externalizabl
/** */
private transient long ptr;
+ /** */
+ private transient PlatformAffinityFunctionTarget baseTarget;
+
+
/**
* Ctor for serialization.
*
@@ -84,33 +98,45 @@ public class PlatformAffinityFunction implements AffinityFunction, Externalizabl
* @param func User fun object.
* @param partitions Number of partitions.
*/
- public PlatformAffinityFunction(Object func, int partitions) {
+ public PlatformAffinityFunction(Object func, int partitions, byte overrideFlags, AffinityFunction baseFunc) {
userFunc = func;
this.partitions = partitions;
+ this.overrideFlags = overrideFlags;
+ this.baseFunc = baseFunc;
}
/**
- * Ctor.
+ * Gets the user func object.
*
- * @param ptr User func ptr.
- * @param partitions Number of partitions.
+ * @return User func object.
*/
- public PlatformAffinityFunction(PlatformContext ctx, long ptr, int partitions) {
- this.ctx = ctx;
- this.ptr = ptr;
- this.partitions = partitions;
+ public Object getUserFunc() {
+ return userFunc;
+ }
- ignite = ctx.kernalContext().grid();
+ /**
+ * Gets the base func.
+ *
+ * @return Base func.
+ */
+ public AffinityFunction getBaseFunc() {
+ return baseFunc;
}
- /** {@inheritDoc} */
- public Object getUserFunc() {
- return userFunc;
+ /**
+ * Gets the override flags.
+ *
+ * @return The override flags
+ */
+ public byte getOverrideFlags() {
+ return overrideFlags;
}
/** {@inheritDoc} */
@Override public void reset() {
- // No-op: userFunc is always in initial state (it is serialized only once on start).
+ // userFunc is always in initial state (it is serialized only once on start).
+ if (baseFunc != null)
+ baseFunc.reset();
}
/** {@inheritDoc} */
@@ -124,6 +150,12 @@ public class PlatformAffinityFunction implements AffinityFunction, Externalizabl
/** {@inheritDoc} */
@Override public int partition(Object key) {
+ if ((overrideFlags & FLAG_PARTITION) == 0) {
+ assert baseFunc != null;
+
+ return baseFunc.partition(key);
+ }
+
assert ctx != null;
assert ptr != 0;
@@ -141,6 +173,12 @@ public class PlatformAffinityFunction implements AffinityFunction, Externalizabl
/** {@inheritDoc} */
@Override public List<List<ClusterNode>> assignPartitions(AffinityFunctionContext affCtx) {
+ if ((overrideFlags & FLAG_ASSIGN_PARTITIONS) == 0) {
+ assert baseFunc != null;
+
+ return baseFunc.assignPartitions(affCtx);
+ }
+
assert ctx != null;
assert ptr != 0;
assert affCtx != null;
@@ -151,53 +189,41 @@ public class PlatformAffinityFunction implements AffinityFunction, Externalizabl
BinaryRawWriterEx writer = ctx.writer(out);
// Write previous assignment
- List<List<ClusterNode>> prevAssignment = ((GridAffinityFunctionContextImpl)affCtx).prevAssignment();
+ PlatformAffinityUtils.writeAffinityFunctionContext(affCtx, writer, ctx);
- if (prevAssignment == null)
- writer.writeInt(-1);
- else {
- writer.writeInt(prevAssignment.size());
-
- for (List<ClusterNode> part : prevAssignment)
- ctx.writeNodes(writer, part);
- }
-
- // Write other props
- writer.writeInt(affCtx.backups());
- ctx.writeNodes(writer, affCtx.currentTopologySnapshot());
- writer.writeLong(affCtx.currentTopologyVersion().topologyVersion());
- writer.writeInt(affCtx.currentTopologyVersion().minorTopologyVersion());
- ctx.writeEvent(writer, affCtx.discoveryEvent());
-
- // Call platform
out.synchronize();
- ctx.gateway().affinityFunctionAssignPartitions(ptr, outMem.pointer(), inMem.pointer());
-
- PlatformInputStream in = inMem.input();
- BinaryRawReaderEx reader = ctx.reader(in);
- // Read result
- int partCnt = in.readInt();
- List<List<ClusterNode>> res = new ArrayList<>(partCnt);
- IgniteClusterEx cluster = ctx.kernalContext().grid().cluster();
-
- for (int i = 0; i < partCnt; i++) {
- int partSize = in.readInt();
- List<ClusterNode> part = new ArrayList<>(partSize);
-
- for (int j = 0; j < partSize; j++)
- part.add(cluster.node(reader.readUuid()));
-
- res.add(part);
+ // Call platform
+ // We can not restore original AffinityFunctionContext after the call to platform,
+ // due to DiscoveryEvent (when node leaves, we can't get it by id anymore).
+ // Secondly, AffinityFunctionContext can't be changed by the user.
+ if (baseTarget != null)
+ baseTarget.setCurrentAffinityFunctionContext(affCtx);
+
+ try {
+ ctx.gateway().affinityFunctionAssignPartitions(ptr, outMem.pointer(), inMem.pointer());
+ }
+ finally {
+ if (baseTarget != null)
+ baseTarget.setCurrentAffinityFunctionContext(null);
}
- return res;
+ // Read result
+ return PlatformAffinityUtils.readPartitionAssignment(ctx.reader(inMem), ctx);
}
}
}
/** {@inheritDoc} */
@Override public void removeNode(UUID nodeId) {
+ if ((overrideFlags & FLAG_REMOVE_NODE) == 0) {
+ assert baseFunc != null;
+
+ baseFunc.removeNode(nodeId);
+
+ return;
+ }
+
assert ctx != null;
assert ptr != 0;
@@ -217,16 +243,24 @@ public class PlatformAffinityFunction implements AffinityFunction, Externalizabl
@Override public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(userFunc);
out.writeInt(partitions);
+ out.writeByte(overrideFlags);
+ out.writeObject(baseFunc);
}
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
userFunc = in.readObject();
partitions = in.readInt();
+ overrideFlags = in.readByte();
+ baseFunc = (AffinityFunction)in.readObject();
}
/** {@inheritDoc} */
@Override public void start() throws IgniteException {
+ // userFunc is null when there is nothing overridden
+ if (userFunc == null)
+ return;
+
assert ignite != null;
ctx = PlatformUtils.platformContext(ignite);
assert ctx != null;
@@ -239,12 +273,19 @@ public class PlatformAffinityFunction implements AffinityFunction, Externalizabl
out.synchronize();
- ptr = ctx.gateway().affinityFunctionInit(mem.pointer());
+ baseTarget = baseFunc != null
+ ? new PlatformAffinityFunctionTarget(ctx, baseFunc)
+ : null;
+
+ ptr = ctx.gateway().affinityFunctionInit(mem.pointer(), baseTarget);
}
}
/** {@inheritDoc} */
@Override public void stop() throws IgniteException {
+ if (ptr == 0)
+ return;
+
assert ctx != null;
ctx.gateway().affinityFunctionDestroy(ptr);
@@ -255,8 +296,9 @@ public class PlatformAffinityFunction implements AffinityFunction, Externalizabl
*
* @param ignite Ignite.
*/
+ @SuppressWarnings("unused")
@IgniteInstanceResource
- private void setIgnite(Ignite ignite) {
+ public void setIgnite(Ignite ignite) {
this.ignite = ignite;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunctionTarget.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunctionTarget.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunctionTarget.java
new file mode 100644
index 0000000..d83dd08
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunctionTarget.java
@@ -0,0 +1,113 @@
+/*
+ * 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.processors.platform.cache.affinity;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.affinity.AffinityFunction;
+import org.apache.ignite.cache.affinity.AffinityFunctionContext;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.binary.BinaryRawReaderEx;
+import org.apache.ignite.internal.binary.BinaryRawWriterEx;
+import org.apache.ignite.internal.processors.platform.PlatformAbstractTarget;
+import org.apache.ignite.internal.processors.platform.PlatformContext;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+import java.util.List;
+
+/**
+ * Platform affinity function target:
+ * to be invoked when Platform function calls base implementation of one of the AffinityFunction methods.
+ */
+public class PlatformAffinityFunctionTarget extends PlatformAbstractTarget {
+ /** */
+ private static final int OP_PARTITION = 1;
+
+ /** */
+ private static final int OP_REMOVE_NODE = 2;
+
+ /** */
+ private static final int OP_ASSIGN_PARTITIONS = 3;
+
+ /** Inner function to delegate calls to. */
+ private final AffinityFunction baseFunc;
+
+ /** Thread local to hold the current affinity function context. */
+ private static final ThreadLocal<AffinityFunctionContext> currentAffCtx = new ThreadLocal<>();
+
+ /**
+ * Constructor.
+ *
+ * @param platformCtx Context.
+ * @param baseFunc Function to wrap.
+ */
+ protected PlatformAffinityFunctionTarget(PlatformContext platformCtx, AffinityFunction baseFunc) {
+ super(platformCtx);
+
+ assert baseFunc != null;
+ this.baseFunc = baseFunc;
+
+ try {
+ platformCtx.kernalContext().resource().injectGeneric(baseFunc);
+ } catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected long processInStreamOutLong(int type, BinaryRawReaderEx reader) throws IgniteCheckedException {
+ if (type == OP_PARTITION)
+ return baseFunc.partition(reader.readObjectDetached());
+ else if (type == OP_REMOVE_NODE) {
+ baseFunc.removeNode(reader.readUuid());
+ return 0;
+ }
+
+ return super.processInStreamOutLong(type, reader);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void processOutStream(int type, BinaryRawWriterEx writer) throws IgniteCheckedException {
+ if (type == OP_ASSIGN_PARTITIONS) {
+ AffinityFunctionContext affCtx = currentAffCtx.get();
+
+ if (affCtx == null)
+ throw new IgniteException("Thread-local AffinityFunctionContext is null. " +
+ "This may indicate an unsupported call to the base AffinityFunction");
+
+ final List<List<ClusterNode>> partitions = baseFunc.assignPartitions(affCtx);
+
+ PlatformAffinityUtils.writePartitionAssignment(partitions, writer, platformContext());
+
+ return;
+ }
+
+ super.processOutStream(type, writer);
+ }
+
+
+
+ /**
+ * Sets the context for current operation.
+ *
+ * @param ctx Context.
+ */
+ void setCurrentAffinityFunctionContext(AffinityFunctionContext ctx) {
+ currentAffCtx.set(ctx);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityUtils.java
new file mode 100644
index 0000000..6d14cab
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityUtils.java
@@ -0,0 +1,113 @@
+/*
+ * 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.processors.platform.cache.affinity;
+
+import org.apache.ignite.binary.BinaryRawReader;
+import org.apache.ignite.cache.affinity.AffinityFunctionContext;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.binary.BinaryRawWriterEx;
+import org.apache.ignite.internal.cluster.IgniteClusterEx;
+import org.apache.ignite.internal.processors.affinity.GridAffinityFunctionContextImpl;
+import org.apache.ignite.internal.processors.platform.PlatformContext;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Affinity serialization functions.
+ */
+public class PlatformAffinityUtils {
+ /**
+ * Writes the affinity function context.
+ * @param affCtx Affinity context.
+ * @param writer Writer.
+ * @param ctx Platform context.
+ */
+ public static void writeAffinityFunctionContext(AffinityFunctionContext affCtx, BinaryRawWriterEx writer,
+ PlatformContext ctx) {
+ assert affCtx != null;
+ assert writer != null;
+ assert ctx != null;
+
+ ctx.writeNodes(writer, affCtx.currentTopologySnapshot());
+ writer.writeInt(affCtx.backups());
+ writer.writeLong(affCtx.currentTopologyVersion().topologyVersion());
+ writer.writeInt(affCtx.currentTopologyVersion().minorTopologyVersion());
+ ctx.writeEvent(writer, affCtx.discoveryEvent());
+
+ // Write previous assignment
+ List<List<ClusterNode>> prevAssignment = ((GridAffinityFunctionContextImpl)affCtx).prevAssignment();
+
+ if (prevAssignment == null)
+ writer.writeInt(-1);
+ else {
+ writer.writeInt(prevAssignment.size());
+
+ for (List<ClusterNode> part : prevAssignment)
+ ctx.writeNodes(writer, part);
+ }
+ }
+
+ /**
+ * Writes the partition assignment to a stream.
+ *
+ * @param partitions Partitions.
+ * @param writer Writer.
+ */
+ public static void writePartitionAssignment(Collection<List<ClusterNode>> partitions, BinaryRawWriterEx writer,
+ PlatformContext ctx) {
+ assert partitions != null;
+ assert writer != null;
+
+ writer.writeInt(partitions.size());
+
+ for (List<ClusterNode> part : partitions)
+ ctx.writeNodes(writer, part);
+ }
+
+ /**
+ * Reads the partition assignment.
+ *
+ * @param reader Reader.
+ * @param ctx Platform context.
+ * @return Partitions.
+ */
+ @NotNull
+ public static List<List<ClusterNode>> readPartitionAssignment(BinaryRawReader reader, PlatformContext ctx) {
+ assert reader != null;
+ assert ctx != null;
+
+ int partCnt = reader.readInt();
+ List<List<ClusterNode>> res = new ArrayList<>(partCnt);
+ IgniteClusterEx cluster = ctx.kernalContext().grid().cluster();
+
+ for (int i = 0; i < partCnt; i++) {
+ int partSize = reader.readInt();
+ List<ClusterNode> part = new ArrayList<>(partSize);
+
+ for (int j = 0; j < partSize; j++)
+ part.add(cluster.node(reader.readUuid()));
+
+ res.add(part);
+ }
+
+ return res;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java
index 3708e8f..88532fc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.platform.callback;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinityFunctionTarget;
import org.apache.ignite.internal.util.GridStripedSpinBusyLock;
/**
@@ -954,13 +955,14 @@ public class PlatformCallbackGateway {
* Initializes affinity function.
*
* @param memPtr Pointer to a stream with serialized affinity function.
+ * @param baseFunc Optional func for base calls.
* @return Affinity function pointer.
*/
- public long affinityFunctionInit(long memPtr) {
+ public long affinityFunctionInit(long memPtr, PlatformAffinityFunctionTarget baseFunc) {
enter();
try {
- return PlatformCallbackUtils.affinityFunctionInit(envPtr, memPtr);
+ return PlatformCallbackUtils.affinityFunctionInit(envPtr, memPtr, baseFunc);
}
finally {
leave();
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils.java
index d19782d..7b36e5e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils.java
@@ -17,6 +17,8 @@
package org.apache.ignite.internal.processors.platform.callback;
+import org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinityFunctionTarget;
+
/**
* Platform callback utility methods. Implemented in target platform. All methods in this class must be
* package-visible and invoked only through {@link PlatformCallbackGateway}.
@@ -500,9 +502,10 @@ public class PlatformCallbackUtils {
*
* @param envPtr Environment pointer.
* @param memPtr Pointer to a stream with serialized affinity function.
+ * @param baseFunc Optional func for base calls.
* @return Affinity function pointer.
*/
- static native long affinityFunctionInit(long envPtr, long memPtr);
+ static native long affinityFunctionInit(long envPtr, long memPtr, PlatformAffinityFunctionTarget baseFunc);
/**
* Gets the partition from affinity function.
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
index 0a267fb..cb9696c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
@@ -197,8 +197,10 @@ public class PlatformDotNetConfigurationClosure extends PlatformAbstractConfigur
writer.writeInt(affFuncs.size());
- for (PlatformDotNetAffinityFunction func : affFuncs)
- func.write(writer);
+ for (PlatformDotNetAffinityFunction func : affFuncs) {
+ writer.writeString(func.getTypeName());
+ writer.writeMap(func.getProperties());
+ }
out.synchronize();
@@ -258,7 +260,7 @@ public class PlatformDotNetConfigurationClosure extends PlatformAbstractConfigur
if (!affFuncs.isEmpty()) {
for (PlatformDotNetAffinityFunction aff : affFuncs)
- aff.initPartitions(in.readInt());
+ aff.init(PlatformConfigurationUtils.readAffinityFunction(in));
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
index 7353f08..1d2baf2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
@@ -42,10 +42,7 @@ import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.configuration.TransactionConfiguration;
import org.apache.ignite.internal.binary.*;
import org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinityFunction;
-import org.apache.ignite.platform.dotnet.PlatformDotNetBinaryConfiguration;
-import org.apache.ignite.platform.dotnet.PlatformDotNetBinaryTypeConfiguration;
-import org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactoryNative;
-import org.apache.ignite.platform.dotnet.PlatformDotNetConfiguration;
+import org.apache.ignite.platform.dotnet.*;
import org.apache.ignite.spi.communication.CommunicationSpi;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpiMBean;
@@ -238,32 +235,39 @@ public class PlatformConfigurationUtils {
* @param in Stream.
* @return Affinity function.
*/
- private static AffinityFunction readAffinityFunction(BinaryRawReaderEx in) {
+ public static PlatformAffinityFunction readAffinityFunction(BinaryRawReaderEx in) {
byte plcTyp = in.readByte();
+ if (plcTyp == 0)
+ return null;
+
+ int partitions = in.readInt();
+ boolean exclNeighbours = in.readBoolean();
+ byte overrideFlags = in.readByte();
+ Object userFunc = in.readObjectDetached();
+
+ AffinityFunction baseFunc = null;
+
switch (plcTyp) {
- case 0:
- break;
case 1: {
FairAffinityFunction f = new FairAffinityFunction();
- f.setPartitions(in.readInt());
- f.setExcludeNeighbors(in.readBoolean());
- return f;
+ f.setPartitions(partitions);
+ f.setExcludeNeighbors(exclNeighbours);
+ baseFunc = f;
+ break;
}
case 2: {
RendezvousAffinityFunction f = new RendezvousAffinityFunction();
- f.setPartitions(in.readInt());
- f.setExcludeNeighbors(in.readBoolean());
- return f;
- }
- case 3: {
- return new PlatformAffinityFunction(in.readObjectDetached(), in.readInt());
+ f.setPartitions(partitions);
+ f.setExcludeNeighbors(exclNeighbours);
+ baseFunc = f;
+ break;
}
default:
- assert false;
+ assert plcTyp == 3;
}
- return null;
+ return new PlatformAffinityFunction(userFunc, partitions, overrideFlags, baseFunc);
}
/**
@@ -281,34 +285,56 @@ public class PlatformConfigurationUtils {
}
/**
- * Writes the eviction policy.
+ * Writes the affinity functions.
+ *
* @param out Stream.
* @param f Affinity.
*/
private static void writeAffinityFunction(BinaryRawWriter out, AffinityFunction f) {
+ if (f instanceof PlatformDotNetAffinityFunction)
+ f = ((PlatformDotNetAffinityFunction)f).getFunc();
+
if (f instanceof FairAffinityFunction) {
- out.writeByte((byte)1);
+ out.writeByte((byte) 1);
- FairAffinityFunction f0 = (FairAffinityFunction)f;
+ FairAffinityFunction f0 = (FairAffinityFunction) f;
out.writeInt(f0.getPartitions());
out.writeBoolean(f0.isExcludeNeighbors());
- }
- else if (f instanceof RendezvousAffinityFunction) {
- out.writeByte((byte)2);
+ out.writeByte((byte) 0); // override flags
+ out.writeObject(null); // user func
+ } else if (f instanceof RendezvousAffinityFunction) {
+ out.writeByte((byte) 2);
- RendezvousAffinityFunction f0 = (RendezvousAffinityFunction)f;
+ RendezvousAffinityFunction f0 = (RendezvousAffinityFunction) f;
out.writeInt(f0.getPartitions());
out.writeBoolean(f0.isExcludeNeighbors());
- }
- else if (f instanceof PlatformAffinityFunction) {
- out.writeByte((byte)3);
-
- PlatformAffinityFunction f0 = (PlatformAffinityFunction)f;
- out.writeObject(f0.getUserFunc());
- out.writeInt(f.partitions());
- }
- else {
- out.writeByte((byte)0);
+ out.writeByte((byte) 0); // override flags
+ out.writeObject(null); // user func
+ } else if (f instanceof PlatformAffinityFunction) {
+ PlatformAffinityFunction f0 = (PlatformAffinityFunction) f;
+ AffinityFunction baseFunc = f0.getBaseFunc();
+
+ if (baseFunc instanceof FairAffinityFunction) {
+ out.writeByte((byte) 1);
+ out.writeInt(f0.partitions());
+ out.writeBoolean(((FairAffinityFunction) baseFunc).isExcludeNeighbors());
+ out.writeByte(f0.getOverrideFlags());
+ out.writeObject(f0.getUserFunc());
+ } else if (baseFunc instanceof RendezvousAffinityFunction) {
+ out.writeByte((byte) 2);
+ out.writeInt(f0.partitions());
+ out.writeBoolean(((RendezvousAffinityFunction) baseFunc).isExcludeNeighbors());
+ out.writeByte(f0.getOverrideFlags());
+ out.writeObject(f0.getUserFunc());
+ } else {
+ out.writeByte((byte) 3);
+ out.writeInt(f0.partitions());
+ out.writeBoolean(false); // exclude neighbors
+ out.writeByte(f0.getOverrideFlags());
+ out.writeObject(f0.getUserFunc());
+ }
+ } else {
+ out.writeByte((byte) 0);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetAffinityFunction.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetAffinityFunction.java b/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetAffinityFunction.java
index 6642693..483fd22 100644
--- a/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetAffinityFunction.java
+++ b/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetAffinityFunction.java
@@ -48,25 +48,13 @@ public class PlatformDotNetAffinityFunction implements AffinityFunction, Externa
private static final long serialVersionUID = 0L;
/** .NET type name. */
- private String typName;
+ private transient String typName;
/** Properties. */
- private Map<String, ?> props;
-
- /**
- * Partition count.
- *
- * 1) Java calls partitions() method very early (before LifecycleAware.start) during CacheConfiguration validation.
- * 2) Partition count never changes.
- * Therefore, we get the value on .NET side once, and pass it along with PlatformAffinity.
- */
- private int partitions;
+ private transient Map<String, ?> props;
/** Inner function. */
- private transient PlatformAffinityFunction func;
-
- /** Ignite. */
- private transient Ignite ignite;
+ private PlatformAffinityFunction func;
/**
* Gets .NET type name.
@@ -113,7 +101,9 @@ public class PlatformDotNetAffinityFunction implements AffinityFunction, Externa
/** {@inheritDoc} */
@Override public int partitions() {
- return partitions;
+ assert func != null;
+
+ return func.partitions();
}
/** {@inheritDoc} */
@@ -137,66 +127,48 @@ public class PlatformDotNetAffinityFunction implements AffinityFunction, Externa
func.removeNode(nodeId);
}
- /**
- * Writes this func to the writer.
- *
- * @param writer Writer.
- */
- public void write(BinaryRawWriter writer) {
- assert writer != null;
-
- writer.writeObject(typName);
- writer.writeMap(props);
- }
-
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
- out.writeObject(typName);
- out.writeObject(props);
- out.writeInt(partitions);
+ out.writeObject(func);
}
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- typName = (String)in.readObject();
- props = (Map<String, ?>)in.readObject();
- partitions = in.readInt();
+ func = (PlatformAffinityFunction) in.readObject();
}
/**
- * Initializes the partitions count.
+ * Initializes this instance.
*
- * @param partitions Number of partitions.
+ * @param func Underlying func.
*/
- public void initPartitions(int partitions) {
- this.partitions = partitions;
+ public void init(PlatformAffinityFunction func) {
+ assert func != null;
+
+ this.func = func;
}
/** {@inheritDoc} */
@Override public void start() throws IgniteException {
- assert ignite != null;
-
- PlatformContext ctx = PlatformUtils.platformContext(ignite);
- assert ctx != null;
-
- try (PlatformMemory mem = ctx.memory().allocate()) {
- PlatformOutputStream out = mem.output();
- BinaryRawWriterEx writer = ctx.writer(out);
-
- write(writer);
-
- out.synchronize();
-
- long ptr = ctx.gateway().affinityFunctionInit(mem.pointer());
+ assert func != null;
- func = new PlatformAffinityFunction(ctx, ptr, partitions);
- }
+ func.start();
}
/** {@inheritDoc} */
@Override public void stop() throws IgniteException {
- if (func != null)
- func.stop();
+ assert func != null;
+
+ func.stop();
+ }
+
+ /**
+ * Gets the inner func.
+ *
+ * @return The inner func.
+ */
+ public PlatformAffinityFunction getFunc() {
+ return func;
}
/**
@@ -204,8 +176,11 @@ public class PlatformDotNetAffinityFunction implements AffinityFunction, Externa
*
* @param ignite Ignite.
*/
+ @SuppressWarnings("unused")
@IgniteInstanceResource
private void setIgnite(Ignite ignite) {
- this.ignite = ignite;
+ assert func != null;
+
+ func.setIgnite(ignite);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/platforms/cpp/jni/include/ignite/jni/java.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/include/ignite/jni/java.h b/modules/platforms/cpp/jni/include/ignite/jni/java.h
index 98779c4..13e6e8d 100644
--- a/modules/platforms/cpp/jni/include/ignite/jni/java.h
+++ b/modules/platforms/cpp/jni/include/ignite/jni/java.h
@@ -100,7 +100,7 @@ namespace ignite
typedef void(JNICALL *OnClientDisconnectedHandler)(void* target);
typedef void(JNICALL *OnClientReconnectedHandler)(void* target, unsigned char clusterRestarted);
- typedef long long(JNICALL *AffinityFunctionInitHandler)(void* target, long long memPtr);
+ typedef long long(JNICALL *AffinityFunctionInitHandler)(void* target, long long memPtr, void* baseFunc);
typedef int(JNICALL *AffinityFunctionPartitionHandler)(void* target, long long ptr, long long memPtr);
typedef void(JNICALL *AffinityFunctionAssignPartitionsHandler)(void* target, long long ptr, long long inMemPtr, long long outMemPtr);
typedef void(JNICALL *AffinityFunctionRemoveNodeHandler)(void* target, long long ptr, long long memPtr);
@@ -752,7 +752,7 @@ namespace ignite
JNIEXPORT void JNICALL JniOnClientDisconnected(JNIEnv *env, jclass cls, jlong envPtr);
JNIEXPORT void JNICALL JniOnClientReconnected(JNIEnv *env, jclass cls, jlong envPtr, jboolean clusterRestarted);
- JNIEXPORT jlong JNICALL JniAffinityFunctionInit(JNIEnv *env, jclass cls, jlong envPtr, jlong memPtr);
+ JNIEXPORT jlong JNICALL JniAffinityFunctionInit(JNIEnv *env, jclass cls, jlong envPtr, jlong memPtr, jobject baseFunc);
JNIEXPORT jint JNICALL JniAffinityFunctionPartition(JNIEnv *env, jclass cls, jlong envPtr, jlong ptr, jlong memPtr);
JNIEXPORT void JNICALL JniAffinityFunctionAssignPartitions(JNIEnv *env, jclass cls, jlong envPtr, jlong ptr, jlong inMemPtr, jlong outMemPtr);
JNIEXPORT void JNICALL JniAffinityFunctionRemoveNode(JNIEnv *env, jclass cls, jlong envPtr, jlong ptr, jlong memPtr);
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/platforms/cpp/jni/src/java.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/src/java.cpp b/modules/platforms/cpp/jni/src/java.cpp
index 577ee26..87f1e03 100644
--- a/modules/platforms/cpp/jni/src/java.cpp
+++ b/modules/platforms/cpp/jni/src/java.cpp
@@ -363,7 +363,7 @@ namespace ignite
JniMethod M_PLATFORM_CALLBACK_UTILS_ON_CLIENT_DISCONNECTED = JniMethod("onClientDisconnected", "(J)V", true);
JniMethod M_PLATFORM_CALLBACK_UTILS_ON_CLIENT_RECONNECTED = JniMethod("onClientReconnected", "(JZ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_INIT = JniMethod("affinityFunctionInit", "(JJ)J", true);
+ JniMethod M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_INIT = JniMethod("affinityFunctionInit", "(JJLorg/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunctionTarget;)J", true);
JniMethod M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_PARTITION = JniMethod("affinityFunctionPartition", "(JJJ)I", true);
JniMethod M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_ASSIGN_PARTITIONS = JniMethod("affinityFunctionAssignPartitions", "(JJJJ)V", true);
JniMethod M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_REMOVE_NODE = JniMethod("affinityFunctionRemoveNode", "(JJJ)V", true);
@@ -2847,8 +2847,9 @@ namespace ignite
IGNITE_SAFE_PROC(env, envPtr, OnClientReconnectedHandler, onClientReconnected, clusterRestarted);
}
- JNIEXPORT jlong JNICALL JniAffinityFunctionInit(JNIEnv *env, jclass cls, jlong envPtr, jlong memPtr) {
- IGNITE_SAFE_FUNC(env, envPtr, AffinityFunctionInitHandler, affinityFunctionInit, memPtr);
+ JNIEXPORT jlong JNICALL JniAffinityFunctionInit(JNIEnv *env, jclass cls, jlong envPtr, jlong memPtr, jobject baseFunc) {
+ void* baseFuncRef = baseFunc ? env->NewGlobalRef(baseFunc) : nullptr;
+ IGNITE_SAFE_FUNC(env, envPtr, AffinityFunctionInitHandler, affinityFunctionInit, memPtr, baseFuncRef);
}
JNIEXPORT jint JNICALL JniAffinityFunctionPartition(JNIEnv *env, jclass cls, jlong envPtr, jlong ptr, jlong memPtr) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionSpringTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionSpringTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionSpringTest.cs
index 33c0ce1..a1e2ad8 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionSpringTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionSpringTest.cs
@@ -24,6 +24,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
using System.Linq;
using Apache.Ignite.Core.Cache;
using Apache.Ignite.Core.Cache.Affinity;
+ using Apache.Ignite.Core.Cache.Affinity.Fair;
using Apache.Ignite.Core.Cluster;
using Apache.Ignite.Core.Resource;
using NUnit.Framework;
@@ -39,7 +40,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
/// <summary>
/// Initializes a new instance of the <see cref="AffinityFunctionSpringTest"/> class.
/// </summary>
- public AffinityFunctionSpringTest() : base(3, "config\\cache\\affinity\\affinity-function.xml")
+ public AffinityFunctionSpringTest() : base(6, "config\\cache\\affinity\\affinity-function.xml")
{
// No-op.
}
@@ -65,6 +66,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
{
ValidateAffinityFunction(Grid.GetCache<int, int>("cache1"));
ValidateAffinityFunction(_ignite.GetCache<int, int>("cache1"));
+ ValidateAffinityFunction(Grid.GetCache<int, int>("cache2"));
+ ValidateAffinityFunction(_ignite.GetCache<int, int>("cache2"));
}
/// <summary>
@@ -78,6 +81,12 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
ValidateAffinityFunction(_ignite.CreateCache<int, int>("dyn-cache-2"));
ValidateAffinityFunction(Grid.GetCache<int, int>("dyn-cache-2"));
+
+ ValidateAffinityFunction(Grid.CreateCache<int, int>("dyn-cache2-1"));
+ ValidateAffinityFunction(_ignite.GetCache<int, int>("dyn-cache2-1"));
+
+ ValidateAffinityFunction(_ignite.CreateCache<int, int>("dyn-cache2-2"));
+ ValidateAffinityFunction(Grid.GetCache<int, int>("dyn-cache2-2"));
}
/// <summary>
@@ -86,23 +95,32 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
/// <param name="cache">The cache.</param>
private static void ValidateAffinityFunction(ICache<int, int> cache)
{
- Assert.IsNull(cache.GetConfiguration().AffinityFunction);
-
var aff = cache.Ignite.GetAffinity(cache.Name);
Assert.AreEqual(5, aff.Partitions);
Assert.AreEqual(4, aff.GetPartition(2));
Assert.AreEqual(3, aff.GetPartition(4));
+
+ var func = (ITestFunc) cache.GetConfiguration().AffinityFunction;
+ Assert.AreEqual(5, func.Partitions);
+ Assert.AreEqual(1, func.Property1);
+ Assert.AreEqual("1", func.Property2);
+ }
+
+ private interface ITestFunc : IAffinityFunction
+ {
+ int Property1 { get; set; }
+
+ string Property2 { get; set; }
}
- [Serializable]
- private class TestFunc : IAffinityFunction
+ private class TestFunc : ITestFunc // [Serializable] is not necessary
{
[InstanceResource]
private readonly IIgnite _ignite = null;
- private int Property1 { get; set; }
+ public int Property1 { get; set; }
- private string Property2 { get; set; }
+ public string Property2 { get; set; }
public int Partitions
{
@@ -128,5 +146,37 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
return Enumerable.Range(0, Partitions).Select(x => context.CurrentTopologySnapshot);
}
}
+
+ private class TestFairFunc : FairAffinityFunction, ITestFunc // [Serializable] is not necessary
+ {
+ [InstanceResource]
+ private readonly IIgnite _ignite = null;
+
+ public int Property1 { get; set; }
+
+ public string Property2 { get; set; }
+
+ public override int GetPartition(object key)
+ {
+ Assert.IsNotNull(_ignite);
+ Assert.AreEqual(1, Property1);
+ Assert.AreEqual("1", Property2);
+
+ var basePart = base.GetPartition(key);
+ Assert.Greater(basePart, -1);
+ Assert.Less(basePart, Partitions);
+
+ return (int) key * 2 % 5;
+ }
+
+ public override IEnumerable<IEnumerable<IClusterNode>> AssignPartitions(AffinityFunctionContext context)
+ {
+ var baseRes = base.AssignPartitions(context).ToList(); // test base call
+
+ Assert.AreEqual(Partitions, baseRes.Count);
+
+ return baseRes;
+ }
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs
index ed0a95b..f38cb3e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs
@@ -21,9 +21,11 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
+ using System.Threading;
using Apache.Ignite.Core.Cache;
using Apache.Ignite.Core.Cache.Affinity;
using Apache.Ignite.Core.Cache.Affinity.Fair;
+ using Apache.Ignite.Core.Cache.Affinity.Rendezvous;
using Apache.Ignite.Core.Cache.Configuration;
using Apache.Ignite.Core.Cluster;
using Apache.Ignite.Core.Common;
@@ -45,6 +47,12 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
private const string CacheName = "cache";
/** */
+ private const string CacheNameFair = "cacheFair";
+
+ /** */
+ private const string CacheNameRendezvous = "cacheRendezvous";
+
+ /** */
private const int PartitionCount = 10;
/** */
@@ -68,6 +76,14 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
{
AffinityFunction = new SimpleAffinityFunction(),
Backups = 7
+ },
+ new CacheConfiguration(CacheNameFair)
+ {
+ AffinityFunction = new FairAffinityFunctionEx {Foo = 25}
+ },
+ new CacheConfiguration(CacheNameRendezvous)
+ {
+ AffinityFunction = new RendezvousAffinityFunctionEx {Bar = "test"}
}
}
};
@@ -84,8 +100,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
public void FixtureTearDown()
{
// Check that affinity handles are present
- TestUtils.AssertHandleRegistryHasItems(_ignite, _ignite.GetCacheNames().Count, 0);
- TestUtils.AssertHandleRegistryHasItems(_ignite2, _ignite.GetCacheNames().Count, 0);
+ TestUtils.AssertHandleRegistryHasItems(_ignite, _ignite.GetCacheNames().Count - 1, 0);
+ TestUtils.AssertHandleRegistryHasItems(_ignite2, _ignite.GetCacheNames().Count - 1, 0);
// Destroy all caches
_ignite.GetCacheNames().ToList().ForEach(_ignite.DestroyCache);
@@ -184,6 +200,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
// Called on both nodes
TestUtils.WaitForCondition(() => RemovedNodes.Count > 0, 3000);
+ Assert.GreaterOrEqual(RemovedNodes.Count, 6);
Assert.AreEqual(expectedNodeId, RemovedNodes.Distinct().Single());
}
@@ -218,22 +235,94 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
}
/// <summary>
- /// Tests user-defined function that inherits predefined function.
+ /// Tests customized fair affinity.
/// </summary>
[Test]
- public void TestInheritPredefinedFunction()
+ public void TestInheritFairAffinity()
{
- var ex = Assert.Throws<IgniteException>(() =>
- _ignite.CreateCache<int, int>(
- new CacheConfiguration("failCache3")
- {
- AffinityFunction = new FairAffinityFunctionInheritor()
- }));
+ Assert.Greater(FairAffinityFunctionEx.AssignCount, 2);
+
+ var caches = new[]
+ {
+ _ignite.GetCache<int, int>(CacheNameFair),
+ _ignite.CreateCache<int, int>(new CacheConfiguration(CacheNameFair + "2")
+ {
+ AffinityFunction = new FairAffinityFunctionEx {Foo = 25}
+ })
+ };
+
+ foreach (var cache in caches)
+ {
+ var aff = _ignite.GetAffinity(cache.Name);
+
+ Assert.AreEqual(PartitionCount, aff.Partitions);
+
+ // Test from map
+ Assert.AreEqual(2, aff.GetPartition(1));
+ Assert.AreEqual(3, aff.GetPartition(2));
+
+ // Test from base func
+ Assert.AreEqual(6, aff.GetPartition(33));
+
+ // Check config
+ var func = (FairAffinityFunctionEx) cache.GetConfiguration().AffinityFunction;
+ Assert.AreEqual(25, func.Foo);
+ }
+ }
+
+ /// <summary>
+ /// Tests customized rendezvous affinity.
+ /// </summary>
+ [Test]
+ public void TestInheritRendezvousAffinity()
+ {
+ Assert.Greater(RendezvousAffinityFunctionEx.AssignCount, 2);
- Assert.AreEqual("User-defined AffinityFunction can not inherit from " +
- "Apache.Ignite.Core.Cache.Affinity.AffinityFunctionBase: " +
- "Apache.Ignite.Core.Tests.Cache.Affinity.AffinityFunctionTest" +
- "+FairAffinityFunctionInheritor", ex.Message);
+ var caches = new[]
+ {
+ _ignite.GetCache<int, int>(CacheNameRendezvous),
+ _ignite.CreateCache<int, int>(new CacheConfiguration(CacheNameRendezvous + "2")
+ {
+ AffinityFunction = new RendezvousAffinityFunctionEx {Bar = "test"}
+ })
+ };
+
+ foreach (var cache in caches)
+ {
+ var aff = _ignite.GetAffinity(cache.Name);
+
+ Assert.AreEqual(PartitionCount, aff.Partitions);
+
+ // Test from map
+ Assert.AreEqual(3, aff.GetPartition(1));
+ Assert.AreEqual(4, aff.GetPartition(2));
+
+ // Test from base func
+ Assert.AreEqual(2, aff.GetPartition(42));
+
+ // Check config
+ var func = (RendezvousAffinityFunctionEx)cache.GetConfiguration().AffinityFunction;
+ Assert.AreEqual("test", func.Bar);
+ }
+ }
+
+ /// <summary>
+ /// Tests the AffinityFunction with simple inheritance: none of the methods are overridden,
+ /// so there are no callbacks, and user object is not passed over the wire.
+ /// </summary>
+ [Test]
+ public void TestSimpleInheritance()
+ {
+ var cache = _ignite.CreateCache<int, int>(new CacheConfiguration("simpleInherit")
+ {
+ AffinityFunction = new SimpleOverride()
+ });
+
+ var aff = _ignite.GetAffinity(cache.Name);
+
+ Assert.AreEqual(PartitionCount, aff.Partitions);
+ Assert.AreEqual(6, aff.GetPartition(33));
+ Assert.AreEqual(4, aff.GetPartition(34));
}
[Serializable]
@@ -300,9 +389,97 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
}
[Serializable]
- private class FairAffinityFunctionInheritor : FairAffinityFunction
+ private class FairAffinityFunctionEx : FairAffinityFunction
{
- // No-op.
+ public static int AssignCount;
+
+ private static readonly Dictionary<int, int> PartitionMap = new Dictionary<int, int> {{1, 2}, {2, 3}};
+
+ public override int Partitions
+ {
+ get { return PartitionCount; }
+ set { Assert.AreEqual(Partitions, value); }
+ }
+
+ public int Foo { get; set; }
+
+ public override int GetPartition(object key)
+ {
+ int res;
+
+ if (PartitionMap.TryGetValue((int)key, out res))
+ return res;
+
+ return base.GetPartition(key);
+ }
+
+ public override void RemoveNode(Guid nodeId)
+ {
+ RemovedNodes.Add(nodeId);
+ }
+
+ public override IEnumerable<IEnumerable<IClusterNode>> AssignPartitions(AffinityFunctionContext context)
+ {
+ var res = base.AssignPartitions(context).Reverse();
+
+ Interlocked.Increment(ref AssignCount);
+
+ return res;
+ }
+ }
+
+ [Serializable]
+ private class RendezvousAffinityFunctionEx : RendezvousAffinityFunction
+ {
+ public static int AssignCount;
+
+ private static readonly Dictionary<int, int> PartitionMap = new Dictionary<int, int> {{1, 3}, {2, 4}};
+
+ public override int Partitions
+ {
+ get { return PartitionCount; }
+ set { Assert.AreEqual(Partitions, value); }
+ }
+
+ public string Bar { get; set; }
+
+ public override int GetPartition(object key)
+ {
+ int res;
+
+ if (PartitionMap.TryGetValue((int)key, out res))
+ return res;
+
+ return base.GetPartition(key);
+ }
+
+ public override void RemoveNode(Guid nodeId)
+ {
+ RemovedNodes.Add(nodeId);
+ }
+
+ public override IEnumerable<IEnumerable<IClusterNode>> AssignPartitions(AffinityFunctionContext context)
+ {
+ var res = base.AssignPartitions(context).Reverse();
+
+ Interlocked.Increment(ref AssignCount);
+
+ return res;
+ }
+ }
+
+ /// <summary>
+ /// Override only properties, so this func won't be passed over the wire.
+ /// </summary>
+ private class SimpleOverride : FairAffinityFunction
+ {
+ public override int Partitions
+ {
+ get { return PartitionCount; }
+ set { throw new NotSupportedException(); }
+ }
+
+ public override bool ExcludeNeighbors { get; set; }
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Cache/Affinity/affinity-function.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Cache/Affinity/affinity-function.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Cache/Affinity/affinity-function.xml
index e7fc516..0be07f6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Cache/Affinity/affinity-function.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Cache/Affinity/affinity-function.xml
@@ -64,6 +64,46 @@
</property>
</bean>
</property>
+ </bean>
+ <bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="cache2"/>
+
+ <property name="affinity">
+ <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetAffinityFunction">
+ <property name="typeName" value="Apache.Ignite.Core.Tests.Cache.Affinity.AffinityFunctionSpringTest+TestFairFunc, Apache.Ignite.Core.Tests"/>
+ <property name="properties">
+ <map>
+ <entry key="Property1">
+ <value type="java.lang.Integer">1</value>
+ </entry>
+ <entry key="Property2" value="1"/>
+ <entry key="Partitions">
+ <value type="java.lang.Integer">5</value>
+ </entry>
+ </map>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ <bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="dyn-cache2-*"/>
+
+ <property name="affinity">
+ <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetAffinityFunction">
+ <property name="typeName" value="Apache.Ignite.Core.Tests.Cache.Affinity.AffinityFunctionSpringTest+TestFairFunc, Apache.Ignite.Core.Tests"/>
+ <property name="properties">
+ <map>
+ <entry key="Property1">
+ <value type="java.lang.Integer">1</value>
+ </entry>
+ <entry key="Property2" value="1"/>
+ <entry key="Partitions">
+ <value type="java.lang.Integer">5</value>
+ </entry>
+ </map>
+ </property>
+ </bean>
+ </property>
</bean>
</list>
</property>
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs
index 8f11122..149fa35 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs
@@ -48,9 +48,9 @@ namespace Apache.Ignite.Core.Tests
return;
}
- //TestOne(typeof(BinaryStringTest), "Test");
+ TestOne(typeof(AffinityFunctionTest), "TestSimpleInheritance");
- TestAll(typeof (AffinityFunctionSpringTest));
+ //TestAll(typeof (AffinityFunctionTest));
//TestAllInAssembly();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index e7f772f..57f89a6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -164,6 +164,9 @@
<Compile Include="Impl\Binary\DateTimeSerializer.cs" />
<Compile Include="Impl\Binary\SerializableSerializer.cs" />
<Compile Include="Impl\Binary\BinaryWriterExtensions.cs" />
+ <Compile Include="Impl\Cache\Affinity\AffinityFunctionSerializer.cs" />
+ <Compile Include="Impl\Cache\Affinity\PlatformAffinityFunction.cs" />
+ <Compile Include="Impl\Common\ObjectInfoHolder.cs" />
<Compile Include="Impl\Common\Platform.cs" />
<Compile Include="Impl\Cache\Event\JavaCacheEntryEventFilter.cs" />
<Compile Include="Impl\Common\PlatformJavaObjectFactoryProxy.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionBase.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionBase.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionBase.cs
index 3434384..ce2e5e1 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionBase.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionBase.cs
@@ -20,37 +20,34 @@ namespace Apache.Ignite.Core.Cache.Affinity
using System;
using System.Collections.Generic;
using System.ComponentModel;
- using Apache.Ignite.Core.Binary;
- using Apache.Ignite.Core.Cache.Affinity.Fair;
- using Apache.Ignite.Core.Cache.Affinity.Rendezvous;
using Apache.Ignite.Core.Cluster;
using Apache.Ignite.Core.Common;
/// <summary>
/// Base class for predefined affinity functions.
/// </summary>
+ [Serializable]
public abstract class AffinityFunctionBase : IAffinityFunction
{
- /** */
- private const byte TypeCodeNull = 0;
-
- /** */
- private const byte TypeCodeFair = 1;
+ /// <summary> The default value for <see cref="Partitions"/> property. </summary>
+ public const int DefaultPartitions = 1024;
/** */
- private const byte TypeCodeRendezvous = 2;
+ private int _partitions = DefaultPartitions;
/** */
- private const byte TypeCodeUser = 3;
+ private IAffinityFunction _baseFunction;
- /// <summary> The default value for <see cref="Partitions"/> property. </summary>
- public const int DefaultPartitions = 1024;
/// <summary>
/// Gets or sets the total number of partitions.
/// </summary>
[DefaultValue(DefaultPartitions)]
- public int Partitions { get; set; }
+ public virtual int Partitions
+ {
+ get { return _partitions; }
+ set { _partitions = value; }
+ }
/// <summary>
/// Gets partition number for a given key starting from 0. Partitioned caches
@@ -67,9 +64,11 @@ namespace Apache.Ignite.Core.Cache.Affinity
/// <returns>
/// Partition number for a given key.
/// </returns>
- public int GetPartition(object key)
+ public virtual int GetPartition(object key)
{
- throw GetDirectUsageError();
+ ThrowIfUninitialized();
+
+ return _baseFunction.GetPartition(key);
}
/// <summary>
@@ -77,9 +76,11 @@ namespace Apache.Ignite.Core.Cache.Affinity
/// disconnected node from affinity mapping.
/// </summary>
/// <param name="nodeId">The node identifier.</param>
- public void RemoveNode(Guid nodeId)
+ public virtual void RemoveNode(Guid nodeId)
{
- throw GetDirectUsageError();
+ ThrowIfUninitialized();
+
+ _baseFunction.RemoveNode(nodeId);
}
/// <summary>
@@ -97,107 +98,42 @@ namespace Apache.Ignite.Core.Cache.Affinity
/// A collection of partitions, where each partition is a collection of nodes,
/// where first node is a primary node, and other nodes are backup nodes.
/// </returns>
- public IEnumerable<IEnumerable<IClusterNode>> AssignPartitions(AffinityFunctionContext context)
+ public virtual IEnumerable<IEnumerable<IClusterNode>> AssignPartitions(AffinityFunctionContext context)
{
- throw GetDirectUsageError();
+ ThrowIfUninitialized();
+
+ return _baseFunction.AssignPartitions(context);
}
/// <summary>
/// Gets or sets a value indicating whether to exclude same-host-neighbors from being backups of each other.
/// </summary>
- public bool ExcludeNeighbors { get; set; }
+ public virtual bool ExcludeNeighbors { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="AffinityFunctionBase"/> class.
/// </summary>
internal AffinityFunctionBase()
{
- Partitions = DefaultPartitions;
+ // No-op.
}
/// <summary>
- /// Reads the instance.
+ /// Sets the base function.
/// </summary>
- internal static IAffinityFunction Read(IBinaryRawReader reader)
+ /// <param name="baseFunc">The base function.</param>
+ internal void SetBaseFunction(IAffinityFunction baseFunc)
{
- AffinityFunctionBase fun;
-
- var typeCode = reader.ReadByte();
- switch (typeCode)
- {
- case TypeCodeNull:
- return null;
- case TypeCodeFair:
- fun = new FairAffinityFunction();
- break;
- case TypeCodeRendezvous:
- fun = new RendezvousAffinityFunction();
- break;
- case TypeCodeUser:
- var f = reader.ReadObject<IAffinityFunction>();
- reader.ReadInt(); // skip partition count
-
- return f;
- default:
- throw new InvalidOperationException("Invalid AffinityFunction type code: " + typeCode);
- }
-
- fun.Partitions = reader.ReadInt();
- fun.ExcludeNeighbors = reader.ReadBoolean();
-
- return fun;
- }
-
- /// <summary>
- /// Writes the instance.
- /// </summary>
- internal static void Write(IBinaryRawWriter writer, IAffinityFunction fun)
- {
- if (fun == null)
- {
- writer.WriteByte(TypeCodeNull);
- return;
- }
-
- var p = fun as AffinityFunctionBase;
-
- if (p != null)
- {
- ValidateAffinityFunctionType(p.GetType());
- writer.WriteByte(p is FairAffinityFunction ? TypeCodeFair : TypeCodeRendezvous);
- writer.WriteInt(p.Partitions);
- writer.WriteBoolean(p.ExcludeNeighbors);
- }
- else
- {
- writer.WriteByte(TypeCodeUser);
-
- if (!fun.GetType().IsSerializable)
- throw new IgniteException("AffinityFunction should be serializable.");
-
- writer.WriteObject(fun);
- writer.WriteInt(fun.Partitions); // partition count is written once and can not be changed.
- }
- }
-
- /// <summary>
- /// Validates the type of the affinity function.
- /// </summary>
- private static void ValidateAffinityFunctionType(Type funcType)
- {
- if (funcType == typeof(FairAffinityFunction) || funcType == typeof(RendezvousAffinityFunction))
- return;
-
- throw new IgniteException(string.Format("User-defined AffinityFunction can not inherit from {0}: {1}",
- typeof(AffinityFunctionBase), funcType));
+ _baseFunction = baseFunc;
}
/// <summary>
/// Gets the direct usage error.
/// </summary>
- private Exception GetDirectUsageError()
+ private void ThrowIfUninitialized()
{
- return new IgniteException(GetType() + " can not be used directly.");
+ if (_baseFunction == null)
+ throw new IgniteException(GetType() + " has not yet been initialized.");
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionContext.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionContext.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionContext.cs
index 1f44d8c..6067af4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionContext.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionContext.cs
@@ -18,6 +18,7 @@
namespace Apache.Ignite.Core.Cache.Affinity
{
using System.Collections.Generic;
+ using System.Diagnostics;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Cluster;
using Apache.Ignite.Core.Events;
@@ -49,6 +50,14 @@ namespace Apache.Ignite.Core.Cache.Affinity
/// <param name="reader">The reader.</param>
internal AffinityFunctionContext(IBinaryRawReader reader)
{
+ Debug.Assert(reader != null);
+
+ _currentTopologySnapshot = IgniteUtils.ReadNodes(reader);
+ _backups = reader.ReadInt();
+ _currentTopologyVersion = new AffinityTopologyVersion(reader.ReadLong(), reader.ReadInt());
+ _discoveryEvent = EventReader.Read<DiscoveryEvent>(reader);
+
+ // Prev assignment
var cnt = reader.ReadInt();
if (cnt > 0)
@@ -58,11 +67,6 @@ namespace Apache.Ignite.Core.Cache.Affinity
for (var i = 0; i < cnt; i++)
_previousAssignment.Add(IgniteUtils.ReadNodes(reader));
}
-
- _backups = reader.ReadInt();
- _currentTopologySnapshot = IgniteUtils.ReadNodes(reader);
- _currentTopologyVersion = new AffinityTopologyVersion(reader.ReadLong(), reader.ReadInt());
- _discoveryEvent = EventReader.Read<DiscoveryEvent>(reader);
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/FairAffinityFunction.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/FairAffinityFunction.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/FairAffinityFunction.cs
index 66fb4bc..4a3885f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/FairAffinityFunction.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/FairAffinityFunction.cs
@@ -17,12 +17,16 @@
namespace Apache.Ignite.Core.Cache.Affinity.Fair
{
+ using System;
+
/// <summary>
/// Fair affinity function which tries to ensure that all nodes get equal number of partitions with
/// minimum amount of reassignments between existing nodes.
/// </summary>
+ [Serializable]
public class FairAffinityFunction : AffinityFunctionBase
{
// No-op.
+ // Actual implementation is in Java, see AffinityFunctionSerializer.Write method.
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/RendezvousAffinityFunction.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/RendezvousAffinityFunction.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/RendezvousAffinityFunction.cs
index edc6af0..98ec364 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/RendezvousAffinityFunction.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/RendezvousAffinityFunction.cs
@@ -17,11 +17,15 @@
namespace Apache.Ignite.Core.Cache.Affinity.Rendezvous
{
+ using System;
+
/// <summary>
/// Affinity function for partitioned cache based on Highest Random Weight algorithm.
/// </summary>
+ [Serializable]
public class RendezvousAffinityFunction : AffinityFunctionBase
{
// No-op.
+ // Actual implementation is in Java, see AffinityFunctionSerializer.Write method.
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
index 54f4753..e5e79cd 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
@@ -34,6 +34,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
using Apache.Ignite.Core.Cache.Store;
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Impl.Binary;
+ using Apache.Ignite.Core.Impl.Cache.Affinity;
/// <summary>
/// Defines grid cache configuration.
@@ -275,7 +276,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
NearConfiguration = reader.ReadBoolean() ? new NearCacheConfiguration(reader) : null;
EvictionPolicy = EvictionPolicyBase.Read(reader);
- AffinityFunction = AffinityFunctionBase.Read(reader);
+ AffinityFunction = AffinityFunctionSerializer.Read(reader);
}
/// <summary>
@@ -348,7 +349,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
writer.WriteBoolean(false);
EvictionPolicyBase.Write(writer, EvictionPolicy);
- AffinityFunctionBase.Write(writer, AffinityFunction);
+ AffinityFunctionSerializer.Write(writer, AffinityFunction);
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
index 48eeec2..c7e7eff 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
@@ -32,6 +32,7 @@ namespace Apache.Ignite.Core
using Apache.Ignite.Core.Impl;
using Apache.Ignite.Core.Impl.Binary;
using Apache.Ignite.Core.Impl.Binary.IO;
+ using Apache.Ignite.Core.Impl.Cache.Affinity;
using Apache.Ignite.Core.Impl.Common;
using Apache.Ignite.Core.Impl.Handle;
using Apache.Ignite.Core.Impl.Memory;
@@ -354,7 +355,10 @@ namespace Apache.Ignite.Core
var writer = reader.Marshaller.StartMarshal(outStream);
for (var i = 0; i < cnt; i++)
- writer.WriteInt(CreateObject<IAffinityFunction>(reader).Partitions);
+ {
+ var objHolder = new ObjectInfoHolder(reader);
+ AffinityFunctionSerializer.Write(writer, objHolder.CreateInstance<IAffinityFunction>(), objHolder);
+ }
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReaderExtensions.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReaderExtensions.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReaderExtensions.cs
index 87de0eb..7f949d0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReaderExtensions.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReaderExtensions.cs
@@ -20,6 +20,7 @@ namespace Apache.Ignite.Core.Impl.Binary
using System;
using System.Collections.Generic;
using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Impl.Common;
/// <summary>
/// Reader extensions.
@@ -91,5 +92,18 @@ namespace Apache.Ignite.Core.Impl.Binary
{
return reader.ReadBoolean() ? reader.ReadBoolean() : (bool?) null;
}
+
+ /// <summary>
+ /// Reads the object either as a normal object or as a [typeName+props] wrapper.
+ /// </summary>
+ public static T ReadObjectEx<T>(this IBinaryRawReader reader)
+ {
+ var obj = reader.ReadObject<object>();
+
+ if (obj == null)
+ return default(T);
+
+ return obj is T ? (T) obj : ((ObjectInfoHolder) obj).CreateInstance<T>();
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11d97f17/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
index 5836b48..d222c2e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
@@ -575,6 +575,7 @@ namespace Apache.Ignite.Core.Impl.Binary
AddSystemType(BinaryUtils.TypeStreamReceiverHolder, w => new StreamReceiverHolder(w));
AddSystemType(0, w => new AffinityKey(w), "affKey");
AddSystemType(BinaryUtils.TypePlatformJavaObjectFactoryProxy, w => new PlatformJavaObjectFactoryProxy());
+ AddSystemType(0, w => new ObjectInfoHolder(w));
}
}
}
[13/50] [abbrv] ignite git commit: Merge remote-tracking branch
'upstream/gridgain-7.6.1' into gridgain-7.6.1
Posted by sb...@apache.org.
Merge remote-tracking branch 'upstream/gridgain-7.6.1' into gridgain-7.6.1
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/94df4279
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/94df4279
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/94df4279
Branch: refs/heads/ignite-1232
Commit: 94df427900b03ffc695e44f8a02db025b90a2079
Parents: fb87690 5871606
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Jun 30 10:30:21 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Jun 30 10:30:21 2016 +0300
----------------------------------------------------------------------
.../ignite/binary/BinaryObjectBuilder.java | 11 +
.../dht/GridDhtPartitionTopologyImpl.java | 2 +-
.../service/GridServiceProcessor.java | 2 +-
.../service/IgniteServiceReassignmentTest.java | 250 +++++++++++++++++++
.../testsuites/IgniteKernalSelfTestSuite.java | 2 +
5 files changed, 265 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[29/50] [abbrv] ignite git commit: IGNITE-3411: Hadoop: Implemented
Hadoop attributes.
Posted by sb...@apache.org.
IGNITE-3411: Hadoop: Implemented Hadoop attributes.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9d033e54
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9d033e54
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9d033e54
Branch: refs/heads/ignite-1232
Commit: 9d033e54a69785860759e6994fd3e403b5ed6049
Parents: 58f3d0f
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Jul 1 15:22:39 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Jul 6 09:53:57 2016 +0300
----------------------------------------------------------------------
.../processors/hadoop/HadoopAttributes.java | 168 +++++++++++++++++++
.../processors/hadoop/HadoopProcessor.java | 49 +++---
2 files changed, 194 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9d033e54/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopAttributes.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopAttributes.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopAttributes.java
new file mode 100644
index 0000000..23eaa18
--- /dev/null
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopAttributes.java
@@ -0,0 +1,168 @@
+/*
+ * 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.processors.hadoop;
+
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.HadoopConfiguration;
+import org.apache.ignite.internal.IgniteNodeAttributes;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Arrays;
+
+/**
+ * Hadoop attributes.
+ */
+public class HadoopAttributes implements Externalizable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Attribute name. */
+ public static final String NAME = IgniteNodeAttributes.ATTR_PREFIX + ".hadoop";
+
+ /** Map-reduce planner class name. */
+ private String plannerCls;
+
+ /** External executor flag. */
+ private boolean extExec;
+
+ /** Maximum parallel tasks. */
+ private int maxParallelTasks;
+
+ /** Maximum task queue size. */
+ private int maxTaskQueueSize;
+
+ /** Library names. */
+ @GridToStringExclude
+ private String[] libNames;
+
+ /** Number of cores. */
+ private int cores;
+
+ /**
+ * Get attributes for node (if any).
+ *
+ * @param node Node.
+ * @return Attributes or {@code null} if Hadoop Accelerator is not enabled for node.
+ */
+ @Nullable public static HadoopAttributes forNode(ClusterNode node) {
+ return node.attribute(NAME);
+ }
+
+ /**
+ * {@link Externalizable} support.
+ */
+ public HadoopAttributes() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param cfg Configuration.
+ */
+ public HadoopAttributes(HadoopConfiguration cfg) {
+ assert cfg != null;
+ assert cfg.getMapReducePlanner() != null;
+
+ plannerCls = cfg.getMapReducePlanner().getClass().getName();
+
+ // TODO: IGNITE-404: Get from configuration when fixed.
+ extExec = false;
+
+ maxParallelTasks = cfg.getMaxParallelTasks();
+ maxTaskQueueSize = cfg.getMaxTaskQueueSize();
+ libNames = cfg.getNativeLibraryNames();
+
+ // Cores count already passed in other attributes, we add it here for convenience.
+ cores = Runtime.getRuntime().availableProcessors();
+ }
+
+ /**
+ * @return Map reduce planner class name.
+ */
+ public String plannerClassName() {
+ return plannerCls;
+ }
+
+ /**
+ * @return External execution flag.
+ */
+ public boolean externalExecution() {
+ return extExec;
+ }
+
+ /**
+ * @return Maximum parallel tasks.
+ */
+ public int maxParallelTasks() {
+ return maxParallelTasks;
+ }
+
+ /**
+ * @return Maximum task queue size.
+ */
+ public int maxTaskQueueSize() {
+ return maxTaskQueueSize;
+ }
+
+
+ /**
+ * @return Native library names.
+ */
+ public String[] nativeLibraryNames() {
+ return libNames;
+ }
+
+ /**
+ * @return Number of cores on machine.
+ */
+ public int cores() {
+ return cores;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject(plannerCls);
+ out.writeBoolean(extExec);
+ out.writeInt(maxParallelTasks);
+ out.writeInt(maxTaskQueueSize);
+ out.writeObject(libNames);
+ out.writeInt(cores);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ plannerCls = (String)in.readObject();
+ extExec = in.readBoolean();
+ maxParallelTasks = in.readInt();
+ maxTaskQueueSize = in.readInt();
+ libNames = (String[])in.readObject();
+ cores = in.readInt();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(HadoopAttributes.class, this, "libNames", Arrays.toString(libNames));
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9d033e54/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
index 7fc7499..bb10565 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
@@ -17,10 +17,6 @@
package org.apache.ignite.internal.processors.hadoop;
-import java.io.IOException;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.configuration.HadoopConfiguration;
import org.apache.ignite.hadoop.mapreduce.IgniteHadoopMapReducePlanner;
@@ -34,6 +30,11 @@ import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
+import java.io.IOException;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.concurrent.atomic.AtomicInteger;
+
/**
* Hadoop processor.
*/
@@ -85,16 +86,24 @@ public class HadoopProcessor extends HadoopProcessorAdapter {
c.start(hctx);
hadoop = new HadoopImpl(this);
+
+ ctx.addNodeAttribute(HadoopAttributes.NAME, new HadoopAttributes(cfg));
}
/** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(HadoopProcessor.class, this);
+ @Override public void onKernalStart() throws IgniteCheckedException {
+ super.onKernalStart();
+
+ if (hctx == null)
+ return;
+
+ for (HadoopComponent c : hctx.components())
+ c.onKernalStart();
}
/** {@inheritDoc} */
- @Override public void stop(boolean cancel) throws IgniteCheckedException {
- super.stop(cancel);
+ @Override public void onKernalStop(boolean cancel) {
+ super.onKernalStop(cancel);
if (hctx == null)
return;
@@ -104,24 +113,13 @@ public class HadoopProcessor extends HadoopProcessorAdapter {
for (ListIterator<HadoopComponent> it = components.listIterator(components.size()); it.hasPrevious();) {
HadoopComponent c = it.previous();
- c.stop(cancel);
+ c.onKernalStop(cancel);
}
}
/** {@inheritDoc} */
- @Override public void onKernalStart() throws IgniteCheckedException {
- super.onKernalStart();
-
- if (hctx == null)
- return;
-
- for (HadoopComponent c : hctx.components())
- c.onKernalStart();
- }
-
- /** {@inheritDoc} */
- @Override public void onKernalStop(boolean cancel) {
- super.onKernalStop(cancel);
+ @Override public void stop(boolean cancel) throws IgniteCheckedException {
+ super.stop(cancel);
if (hctx == null)
return;
@@ -131,7 +129,7 @@ public class HadoopProcessor extends HadoopProcessorAdapter {
for (ListIterator<HadoopComponent> it = components.listIterator(components.size()); it.hasPrevious();) {
HadoopComponent c = it.previous();
- c.onKernalStop(cancel);
+ c.stop(cancel);
}
}
@@ -217,4 +215,9 @@ public class HadoopProcessor extends HadoopProcessorAdapter {
if (cfg.getMapReducePlanner() == null)
cfg.setMapReducePlanner(new IgniteHadoopMapReducePlanner());
}
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(HadoopProcessor.class, this);
+ }
}
\ No newline at end of file
[10/50] [abbrv] ignite git commit: IGNITE-3184: Hadoop: HADOOP_HOME
is no longer required is all HADOOP_*_HOME environment variables are set.
Posted by sb...@apache.org.
IGNITE-3184: Hadoop: HADOOP_HOME is no longer required is all HADOOP_*_HOME environment variables are set.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/26eec3a0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/26eec3a0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/26eec3a0
Branch: refs/heads/ignite-1232
Commit: 26eec3a00171418391dcf9db1ac3299aaf003ee4
Parents: 00c3383
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Mon Jun 27 13:44:38 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Jun 30 10:18:48 2016 +0300
----------------------------------------------------------------------
bin/include/hadoop-classpath.bat | 73 ------
bin/include/hadoop-classpath.sh | 65 ------
bin/include/setenv.bat | 6 +-
bin/include/setenv.sh | 25 +-
.../processors/hadoop/HadoopClassLoader.java | 73 +-----
.../processors/hadoop/HadoopClasspathMain.java | 44 ++++
.../processors/hadoop/HadoopClasspathUtils.java | 233 +++++++++++++++++++
.../processors/hadoop/HadoopLocations.java | 78 +++++++
.../processors/hadoop/HadoopProcessor.java | 47 ++--
9 files changed, 404 insertions(+), 240 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/26eec3a0/bin/include/hadoop-classpath.bat
----------------------------------------------------------------------
diff --git a/bin/include/hadoop-classpath.bat b/bin/include/hadoop-classpath.bat
deleted file mode 100644
index dd293a7..0000000
--- a/bin/include/hadoop-classpath.bat
+++ /dev/null
@@ -1,73 +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.
-::
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: Hadoop class path resolver.
-:: Requires environment variables 'HADOOP_PREFIX' or 'HADOOP_HOME'
-:: to be set.
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-:: Turn off script echoing.
-@echo off
-
-:: Check if environment passes deprecated HADOOP_HOME.
-if not defined HADOOP_PREFIX set HADOOP_PREFIX=%HADOOP_HOME%
-
-:: Exit if we cannot find Hadoop installation directory.
-if not defined HADOOP_PREFIX goto :eof
-
-:: Trim quotes.
-set HADOOP_PREFIX=%HADOOP_PREFIX:"=%
-
-:: Trim slashes.
-if %HADOOP_PREFIX:~-1,1% == \ (
- set HADOOP_PREFIX=%HADOOP_PREFIX:~0,-1%
-)
-
-::
-:: Setting the rest of Hadoop environment variables.
-::
-
-if not defined HADOOP_COMMON_HOME set HADOOP_COMMON_HOME=%HADOOP_PREFIX%\share\hadoop\common
-if not defined HADOOP_HDFS_HOME set HADOOP_HDFS_HOME=%HADOOP_PREFIX%\share\hadoop\hdfs
-if not defined HADOOP_MAPRED_HOME set HADOOP_MAPRED_HOME=%HADOOP_PREFIX%\share\hadoop\mapreduce
-
-::
-:: Libraries included in classpath.
-::
-
-set CP=%HADOOP_COMMON_HOME%\lib\*;%HADOOP_MAPRED_HOME%\lib\*;%HADOOP_MAPRED_HOME%\lib\*
-
-:: hadoop-auth-* jar can be located either in home or in home/lib directory, depending on the hadoop version.
-for /f %%f in ('dir /B %HADOOP_COMMON_HOME%\hadoop-auth-* ^>nul 2^>^&1') do call :concat %HADOOP_COMMON_HOME%\%%f
-for /f %%f in ('dir /B %HADOOP_COMMON_HOME%\lib\hadoop-auth-* ^>nul 2^>^&1') do call :concat %HADOOP_COMMON_HOME%\%%f
-for /f %%f in ('dir /B %HADOOP_COMMON_HOME%\hadoop-common-*') do call :concat %HADOOP_COMMON_HOME%\%%f
-for /f %%f in ('dir /B %HADOOP_HDFS_HOME%\hadoop-hdfs-*') do call :concat %HADOOP_HDFS_HOME%\%%f
-for /f %%f in ('dir /B %HADOOP_MAPRED_HOME%\hadoop-mapreduce-client-common-*') do call :concat %HADOOP_MAPRED_HOME%\%%f
-for /f %%f in ('dir /B %HADOOP_MAPRED_HOME%\hadoop-mapreduce-client-core-*') do call :concat %HADOOP_MAPRED_HOME%\%%f
-
-:: Export result.
-set IGNITE_HADOOP_CLASSPATH=%CP%
-
-:: Exit.
-goto :eof
-
-:: Function that adds jar dependency into classpath.
-:concat
- set file=%1
- if %file:~-9,9% neq tests.jar set CP=%CP%;%1
-goto :eof
http://git-wip-us.apache.org/repos/asf/ignite/blob/26eec3a0/bin/include/hadoop-classpath.sh
----------------------------------------------------------------------
diff --git a/bin/include/hadoop-classpath.sh b/bin/include/hadoop-classpath.sh
deleted file mode 100755
index 3a0aeb1..0000000
--- a/bin/include/hadoop-classpath.sh
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-
-####################################################################
-# Hadoop class path resolver.
-# Requires environment variables 'HADOOP_PREFIX' or 'HADOOP_HOME'
-# to be set. If they are both undefined , tries to read them from
-# from '/etc/default/hadoop' file. The final results are printed
-# into standard output.
-####################################################################
-
-# Resolve constants.
-HADOOP_DEFAULTS="/etc/default/hadoop"
-HADOOP_PREFIX=${HADOOP_PREFIX:-$HADOOP_HOME}
-
-# Try get all variables from Hadoop default environment config
-# if they have not been passed into the script.
-if [[ -z "$HADOOP_PREFIX" && -f "$HADOOP_DEFAULTS" ]]; then
- source "$HADOOP_DEFAULTS"
-fi
-
-# Return if Hadoop couldn't be found.
-[ -z "$HADOOP_PREFIX" ] && return
-
-#
-# Resolve the rest of Hadoop environment variables.
-#
-
-HADOOP_COMMON_HOME=${HADOOP_COMMON_HOME-"${HADOOP_PREFIX}/share/hadoop/common"}
-HADOOP_HDFS_HOME=${HADOOP_HDFS_HOME-"${HADOOP_PREFIX}/share/hadoop/hdfs"}
-HADOOP_MAPRED_HOME=${HADOOP_MAPRED_HOME-"${HADOOP_PREFIX}/share/hadoop/mapreduce"}
-
-#
-# Calculate classpath string with required Hadoop libraries.
-#
-
-# Add all Hadoop libs.
-IGNITE_HADOOP_CLASSPATH="${HADOOP_COMMON_HOME}/lib/*${SEP}${HADOOP_MAPRED_HOME}/lib/*${SEP}${HADOOP_MAPRED_HOME}/lib/*"
-
-# Skip globbing pattern if it cannot be resolved.
-shopt -s nullglob
-
-# Add jars to classpath excluding tests.
-# hadoop-auth-* jar can be located either in home or in home/lib directory, depending on the hadoop version.
-for file in ${HADOOP_HDFS_HOME}/hadoop-hdfs-* \
- ${HADOOP_COMMON_HOME}/hadoop-{common,auth}-* \
- ${HADOOP_COMMON_HOME}/lib/hadoop-auth-* \
- ${HADOOP_MAPRED_HOME}/hadoop-mapreduce-client-{common,core}-*; do
- [[ "$file" != *-tests.jar ]] && IGNITE_HADOOP_CLASSPATH=${IGNITE_HADOOP_CLASSPATH}${SEP}${file}
-done
http://git-wip-us.apache.org/repos/asf/ignite/blob/26eec3a0/bin/include/setenv.bat
----------------------------------------------------------------------
diff --git a/bin/include/setenv.bat b/bin/include/setenv.bat
index 811bc95..dec1ee5 100644
--- a/bin/include/setenv.bat
+++ b/bin/include/setenv.bat
@@ -47,11 +47,9 @@ if exist %IGNITE_HOME%\libs\ignite-hadoop set HADOOP_EDITION=1
if defined USER_LIBS set IGNITE_LIBS=%USER_LIBS%;%IGNITE_LIBS%
-if "%HADOOP_EDITION%" == "1" call "%SCRIPTS_HOME%\include\hadoop-classpath.bat"
+FOR /F "delims=" %%i IN ('%JAVA_HOME%\bin\java.exe -cp %IGNITE_HOME%\libs\ignite-hadoop\* org.apache.ignite.internal.processors.hadoop.HadoopClasspathMain ";"' ) DO set IGNITE_HADOOP_CLASSPATH=%%i
-set COMMON_HOME_LIB=%HADOOP_COMMON_HOME%\lib
-
-if "%IGNITE_HADOOP_CLASSPATH%" == "" goto :eof
+if "[%IGNITE_HADOOP_CLASSPATH%]" == "[]" exit 1
set IGNITE_LIBS=%IGNITE_LIBS%;%IGNITE_HADOOP_CLASSPATH%
http://git-wip-us.apache.org/repos/asf/ignite/blob/26eec3a0/bin/include/setenv.sh
----------------------------------------------------------------------
diff --git a/bin/include/setenv.sh b/bin/include/setenv.sh
index 74b6608..a85cba3 100755
--- a/bin/include/setenv.sh
+++ b/bin/include/setenv.sh
@@ -72,9 +72,28 @@ if [ "${USER_LIBS}" != "" ]; then
fi
if [ "${HADOOP_EDITION}" == "1" ]; then
- . "${SCRIPTS_HOME}"/include/hadoop-classpath.sh
+ # Resolve constants.
+ HADOOP_DEFAULTS="/etc/default/hadoop"
- if [ "${IGNITE_HADOOP_CLASSPATH}" != "" ]; then
- IGNITE_LIBS=${IGNITE_LIBS}${SEP}$IGNITE_HADOOP_CLASSPATH
+ #
+ # Resolve the rest of Hadoop environment variables.
+ #
+ if [[ -z "${HADOOP_COMMON_HOME}" || -z "${HADOOP_HDFS_HOME}" || -z "${HADOOP_MAPRED_HOME}" ]]; then
+ if [ -f "$HADOOP_DEFAULTS" ]; then
+ source "$HADOOP_DEFAULTS"
+ fi
fi
+
+ IGNITE_HADOOP_CLASSPATH=$( "$JAVA" -cp "${IGNITE_HOME}"/libs/ignite-hadoop/'*' \
+ org.apache.ignite.internal.processors.hadoop.HadoopClasspathMain ":" )
+
+ statusCode=${?}
+
+ if [ "${statusCode}" -ne 0 ]; then
+ exit ${statusCode}
+ fi
+
+ unset statusCode
+
+ IGNITE_LIBS=${IGNITE_LIBS}${SEP}${IGNITE_HADOOP_CLASSPATH}
fi
http://git-wip-us.apache.org/repos/asf/ignite/blob/26eec3a0/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java
index 340b35b..1c844c4 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java
@@ -17,11 +17,8 @@
package org.apache.ignite.internal.processors.hadoop;
-import java.io.File;
-import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
-import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
@@ -460,40 +457,6 @@ public class HadoopClassLoader extends URLClassLoader implements ClassCache {
}
/**
- * @param name Variable name.
- * @param dflt Default.
- * @return Value.
- */
- private static String getEnv(String name, String dflt) {
- String res = System.getProperty(name);
-
- if (F.isEmpty(res))
- res = System.getenv(name);
-
- return F.isEmpty(res) ? dflt : res;
- }
-
- /**
- * @param res Result.
- * @param dir Directory.
- * @param startsWith Starts with prefix.
- * @throws MalformedURLException If failed.
- */
- private static void addUrls(Collection<URL> res, File dir, final String startsWith) throws Exception {
- File[] files = dir.listFiles(new FilenameFilter() {
- @Override public boolean accept(File dir, String name) {
- return startsWith == null || name.startsWith(startsWith);
- }
- });
-
- if (files == null)
- throw new IOException("Path is not a directory: " + dir);
-
- for (File file : files)
- res.add(file.toURI().toURL());
- }
-
- /**
* @param urls URLs.
* @return URLs.
*/
@@ -519,13 +482,6 @@ public class HadoopClassLoader extends URLClassLoader implements ClassCache {
}
/**
- * @return HADOOP_HOME Variable.
- */
- @Nullable public static String hadoopHome() {
- return getEnv("HADOOP_PREFIX", getEnv("HADOOP_HOME", null));
- }
-
- /**
* @return Collection of jar URLs.
* @throws IgniteCheckedException If failed.
*/
@@ -541,34 +497,11 @@ public class HadoopClassLoader extends URLClassLoader implements ClassCache {
if (hadoopUrls != null)
return hadoopUrls;
- hadoopUrls = new ArrayList<>();
-
- String hadoopPrefix = hadoopHome();
-
- if (F.isEmpty(hadoopPrefix))
- throw new IgniteCheckedException("Failed resolve Hadoop installation location. Either HADOOP_PREFIX or " +
- "HADOOP_HOME environment variables must be set.");
-
- String commonHome = getEnv("HADOOP_COMMON_HOME", hadoopPrefix + "/share/hadoop/common");
- String hdfsHome = getEnv("HADOOP_HDFS_HOME", hadoopPrefix + "/share/hadoop/hdfs");
- String mapredHome = getEnv("HADOOP_MAPRED_HOME", hadoopPrefix + "/share/hadoop/mapreduce");
-
try {
- addUrls(hadoopUrls, new File(commonHome + "/lib"), null);
- addUrls(hadoopUrls, new File(hdfsHome + "/lib"), null);
- addUrls(hadoopUrls, new File(mapredHome + "/lib"), null);
-
- addUrls(hadoopUrls, new File(hdfsHome), "hadoop-hdfs-");
-
- addUrls(hadoopUrls, new File(commonHome), "hadoop-common-");
- addUrls(hadoopUrls, new File(commonHome), "hadoop-auth-");
- addUrls(hadoopUrls, new File(commonHome + "/lib"), "hadoop-auth-");
-
- addUrls(hadoopUrls, new File(mapredHome), "hadoop-mapreduce-client-common");
- addUrls(hadoopUrls, new File(mapredHome), "hadoop-mapreduce-client-core");
+ hadoopUrls = HadoopClasspathUtils.classpathUrls();
}
- catch (Exception e) {
- throw new IgniteCheckedException(e);
+ catch (IOException e) {
+ throw new IgniteCheckedException("Failed to resolve Hadoop JAR locations.", e);
}
hadoopJars = hadoopUrls;
http://git-wip-us.apache.org/repos/asf/ignite/blob/26eec3a0/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClasspathMain.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClasspathMain.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClasspathMain.java
new file mode 100644
index 0000000..5279b7d
--- /dev/null
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClasspathMain.java
@@ -0,0 +1,44 @@
+/*
+ * 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.processors.hadoop;
+
+/**
+ * Main class to compose Hadoop classpath depending on the environment.
+ * This class is designed to be independent on any Ignite classes as possible.
+ * Please make sure to pass the path separator character as the 1st parameter to the main method.
+ */
+public class HadoopClasspathMain {
+ /**
+ * Main method to be executed from scripts. It prints the classpath to the standard output.
+ *
+ * @param args The 1st argument should be the path separator character (":" on Linux, ";" on Windows).
+ */
+ public static void main(String[] args) throws Exception {
+ if (args.length < 1)
+ throw new IllegalArgumentException("Path separator must be passed as the first argument.");
+
+ String separator = args[0];
+
+ StringBuilder sb = new StringBuilder();
+
+ for (String path : HadoopClasspathUtils.classpathForJavaProcess())
+ sb.append(path).append(separator);
+
+ System.out.println(sb);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/26eec3a0/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClasspathUtils.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClasspathUtils.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClasspathUtils.java
new file mode 100644
index 0000000..986b23e
--- /dev/null
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClasspathUtils.java
@@ -0,0 +1,233 @@
+/*
+ * 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.processors.hadoop;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Hadoop classpath utilities.
+ */
+public class HadoopClasspathUtils {
+ /**
+ * Gets Hadoop class path as list of classpath elements for process.
+ *
+ * @return List of the class path elements.
+ * @throws IOException If failed.
+ */
+ public static List<String> classpathForJavaProcess() throws IOException {
+ List<String> res = new ArrayList<>();
+
+ for (final SearchDirectory dir : classpathDirectories()) {
+ if (dir.hasFilter()) {
+ for (File file : dir.files())
+ res.add(file.getAbsolutePath());
+ }
+ else
+ res.add(dir.absolutePath() + File.separator + '*');
+ }
+
+ return res;
+ }
+
+ /**
+ * Gets Hadoop class path as a list of URLs (for in-process class loader usage).
+ *
+ * @return List of class path URLs.
+ * @throws IOException If failed.
+ */
+ public static List<URL> classpathUrls() throws IOException {
+ List<URL> res = new ArrayList<>();
+
+ for (SearchDirectory dir : classpathDirectories()) {
+ for (File file : dir.files()) {
+ try {
+ res.add(file.toURI().toURL());
+ }
+ catch (MalformedURLException e) {
+ throw new IOException("Failed to convert file path to URL: " + file.getPath());
+ }
+ }
+ }
+
+ return res;
+ }
+
+ /**
+ * Gets Hadoop locations.
+ *
+ * @return The Hadoop locations, never null.
+ */
+ public static HadoopLocations hadoopLocations() throws IOException {
+ final String hadoopHome = systemOrEnv("HADOOP_HOME", systemOrEnv("HADOOP_PREFIX", null));
+
+ String commonHome = resolveLocation("HADOOP_COMMON_HOME", hadoopHome, "/share/hadoop/common");
+ String hdfsHome = resolveLocation("HADOOP_HDFS_HOME", hadoopHome, "/share/hadoop/hdfs");
+ String mapredHome = resolveLocation("HADOOP_MAPRED_HOME", hadoopHome, "/share/hadoop/mapreduce");
+
+ return new HadoopLocations(hadoopHome, commonHome, hdfsHome, mapredHome);
+ }
+
+ /**
+ * Gets base directories to discover classpath elements in.
+ *
+ * @return Collection of directory and mask pairs.
+ * @throws IOException if a mandatory classpath location is not found.
+ */
+ private static Collection<SearchDirectory> classpathDirectories() throws IOException {
+ HadoopLocations loc = hadoopLocations();
+
+ Collection<SearchDirectory> res = new ArrayList<>();
+
+ res.add(new SearchDirectory(new File(loc.commonHome(), "lib"), null));
+ res.add(new SearchDirectory(new File(loc.hdfsHome(), "lib"), null));
+ res.add(new SearchDirectory(new File(loc.mapredHome(), "lib"), null));
+
+ res.add(new SearchDirectory(new File(loc.commonHome()), "hadoop-common-"));
+ res.add(new SearchDirectory(new File(loc.commonHome()), "hadoop-auth-"));
+
+ res.add(new SearchDirectory(new File(loc.hdfsHome()), "hadoop-hdfs-"));
+
+ res.add(new SearchDirectory(new File(loc.mapredHome()), "hadoop-mapreduce-client-common"));
+ res.add(new SearchDirectory(new File(loc.mapredHome()), "hadoop-mapreduce-client-core"));
+
+ return res;
+ }
+
+ /**
+ * Resolves a Hadoop location directory.
+ *
+ * @param envVarName Environment variable name. The value denotes the location path.
+ * @param hadoopHome Hadoop home location, may be null.
+ * @param expHadoopHomeRelativePath The path relative to Hadoop home, expected to start with path separator.
+ * @throws IOException If the value cannot be resolved to an existing directory.
+ */
+ private static String resolveLocation(String envVarName, String hadoopHome, String expHadoopHomeRelativePath)
+ throws IOException {
+ String val = systemOrEnv(envVarName, null);
+
+ if (val == null) {
+ // The env. variable is not set. Try to resolve the location relative HADOOP_HOME:
+ if (!directoryExists(hadoopHome))
+ throw new IOException("Failed to resolve Hadoop installation location. " +
+ envVarName + " or HADOOP_HOME environment variable should be set.");
+
+ val = hadoopHome + expHadoopHomeRelativePath;
+ }
+
+ if (!directoryExists(val))
+ throw new IOException("Failed to resolve Hadoop location [path=" + val + ']');
+
+ return val;
+ }
+
+ /**
+ * Note that this method does not treat empty value as an absent value.
+ *
+ * @param name Variable name.
+ * @param dflt Default.
+ * @return Value.
+ */
+ private static String systemOrEnv(String name, String dflt) {
+ String res = System.getProperty(name);
+
+ if (res == null)
+ res = System.getenv(name);
+
+ return res == null ? dflt : res;
+ }
+
+ /**
+ * Answers if the given path denotes existing directory.
+ *
+ * @param path The directory path.
+ * @return {@code True} if the given path denotes an existing directory.
+ */
+ private static boolean directoryExists(String path) {
+ if (path == null)
+ return false;
+
+ Path p = Paths.get(path);
+
+ return Files.exists(p) && Files.isDirectory(p) && Files.isReadable(p);
+ }
+
+ /**
+ * Simple pair-like structure to hold directory name and a mask assigned to it.
+ */
+ private static class SearchDirectory {
+ /** File. */
+ private final File dir;
+
+ /** The mask. */
+ private final String filter;
+
+ /**
+ * Constructor.
+ *
+ * @param dir Directory.
+ * @param filter Filter.
+ */
+ private SearchDirectory(File dir, String filter) throws IOException {
+ this.dir = dir;
+ this.filter = filter;
+
+ if (!directoryExists(dir.getAbsolutePath()))
+ throw new IOException("Directory cannot be read: " + dir.getAbsolutePath());
+ }
+
+ /**
+ * @return Absolute path.
+ */
+ private String absolutePath() {
+ return dir.getAbsolutePath();
+ }
+
+ /**
+ * @return Child files.
+ */
+ private File[] files() throws IOException {
+ File[] files = dir.listFiles(new FilenameFilter() {
+ @Override public boolean accept(File dir, String name) {
+ return filter == null || name.startsWith(filter);
+ }
+ });
+
+ if (files == null)
+ throw new IOException("Path is not a directory. [dir=" + dir + ']');
+
+ return files;
+ }
+
+ /**
+ * @return {@code True} if filter exists.
+ */
+ private boolean hasFilter() {
+ return filter != null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/26eec3a0/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopLocations.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopLocations.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopLocations.java
new file mode 100644
index 0000000..b3e2d12
--- /dev/null
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopLocations.java
@@ -0,0 +1,78 @@
+/*
+ * 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.processors.hadoop;
+
+/**
+ * Simple structure to hold Hadoop directory locations.
+ */
+public class HadoopLocations {
+ /** Hadoop home. */
+ private final String home;
+
+ /** Common home. */
+ private final String commonHome;
+
+ /** HDFS home. */
+ private final String hdfsHome;
+
+ /** Mapred home. */
+ private final String mapredHome;
+
+ /**
+ * Constructor.
+ *
+ * @param home Hadoop home.
+ * @param commonHome Common home.
+ * @param hdfsHome HDFS home.
+ * @param mapredHome Mapred home.
+ */
+ public HadoopLocations(String home, String commonHome, String hdfsHome, String mapredHome) {
+ this.home = home;
+ this.commonHome = commonHome;
+ this.hdfsHome = hdfsHome;
+ this.mapredHome = mapredHome;
+ }
+
+ /**
+ * @return Hadoop home.
+ */
+ public String home() {
+ return home;
+ }
+
+ /**
+ * @return Common home.
+ */
+ public String commonHome() {
+ return commonHome;
+ }
+
+ /**
+ * @return HDFS home.
+ */
+ public String hdfsHome() {
+ return hdfsHome;
+ }
+
+ /**
+ * @return Mapred home.
+ */
+ public String mapredHome() {
+ return mapredHome;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/26eec3a0/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
index 7292c78..c45953e 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
@@ -17,6 +17,7 @@
package org.apache.ignite.internal.processors.hadoop;
+import java.io.IOException;
import java.util.List;
import java.util.ListIterator;
import java.util.concurrent.atomic.AtomicInteger;
@@ -33,9 +34,6 @@ import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
-import static org.apache.ignite.internal.processors.hadoop.HadoopClassLoader.hadoopHome;
-import static org.apache.ignite.internal.processors.hadoop.HadoopClassLoader.hadoopUrls;
-
/**
* Hadoop processor.
*/
@@ -74,36 +72,35 @@ public class HadoopProcessor extends HadoopProcessorAdapter {
validate(cfg);
- if (hadoopHome() != null)
- U.quietAndInfo(log, "HADOOP_HOME is set to " + hadoopHome());
-
- boolean ok = false;
+ try {
+ HadoopLocations loc = HadoopClasspathUtils.hadoopLocations();
- try { // Check for Hadoop installation.
- hadoopUrls();
+ if (loc.home() != null)
+ U.quietAndInfo(log, "HADOOP_HOME is set to " + loc.home());
- ok = true;
+ U.quietAndInfo(log, "HADOOP_COMMON_HOME is set to " + loc.commonHome());
+ U.quietAndInfo(log, "HADOOP_HDFS_HOME is set to " + loc.hdfsHome());
+ U.quietAndInfo(log, "HADOOP_MAPRED_HOME is set to " + loc.mapredHome());
}
- catch (IgniteCheckedException e) {
- U.quietAndWarn(log, e.getMessage());
+ catch (IOException ioe) {
+ throw new IgniteCheckedException(ioe);
}
- if (ok) {
- hctx = new HadoopContext(
- ctx,
- cfg,
- new HadoopJobTracker(),
- new HadoopEmbeddedTaskExecutor(),
- // TODO: IGNITE-404: Uncomment when fixed.
- //cfg.isExternalExecution() ? new HadoopExternalTaskExecutor() : new HadoopEmbeddedTaskExecutor(),
- new HadoopShuffle());
+ HadoopClassLoader.hadoopUrls();
+ hctx = new HadoopContext(
+ ctx,
+ cfg,
+ new HadoopJobTracker(),
+ new HadoopEmbeddedTaskExecutor(),
+ // TODO: IGNITE-404: Uncomment when fixed.
+ //cfg.isExternalExecution() ? new HadoopExternalTaskExecutor() : new HadoopEmbeddedTaskExecutor(),
+ new HadoopShuffle());
- for (HadoopComponent c : hctx.components())
- c.start(hctx);
+ for (HadoopComponent c : hctx.components())
+ c.start(hctx);
- hadoop = new HadoopImpl(this);
- }
+ hadoop = new HadoopImpl(this);
}
/** {@inheritDoc} */
[38/50] [abbrv] ignite git commit: Merge remote-tracking branch
'remotes/community/gridgain-7.6.2'
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/community/gridgain-7.6.2'
# Conflicts:
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/00e966ae
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/00e966ae
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/00e966ae
Branch: refs/heads/ignite-1232
Commit: 00e966ae7dedbb65420c8289c9f76db7bebf1a60
Parents: 6611d0c
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jul 6 11:31:14 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jul 6 11:31:14 2016 +0300
----------------------------------------------------------------------
.../cache/distributed/GridCacheTxRecoveryRequest.java | 1 -
.../cache/distributed/GridCacheTxRecoveryResponse.java | 5 ++---
.../cache/distributed/GridDistributedTxFinishResponse.java | 1 -
3 files changed, 2 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/00e966ae/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryRequest.java
index 6fdb30b..76f39b0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryRequest.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache.distributed;
import java.io.Externalizable;
import java.nio.ByteBuffer;
-
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
http://git-wip-us.apache.org/repos/asf/ignite/blob/00e966ae/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
index dae19a3..c087a3d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
@@ -19,12 +19,11 @@ package org.apache.ignite.internal.processors.cache.distributed;
import java.io.Externalizable;
import java.nio.ByteBuffer;
+import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxState;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxStateAware;
-
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.lang.IgniteUuid;
http://git-wip-us.apache.org/repos/asf/ignite/blob/00e966ae/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java
index c08c5b2..109d665 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache.distributed;
import java.io.Externalizable;
import java.nio.ByteBuffer;
-
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.processors.cache.GridCacheMessage;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
[18/50] [abbrv] ignite git commit: Fixed IGFS max size.
Posted by sb...@apache.org.
Fixed IGFS max size.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/583ef2ed
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/583ef2ed
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/583ef2ed
Branch: refs/heads/ignite-1232
Commit: 583ef2edbc3b05c65d794611553e8a7ff0a83619
Parents: 860167c
Author: vsisko <vs...@gridgain.com>
Authored: Tue Jul 5 00:21:56 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Tue Jul 5 00:21:56 2016 +0700
----------------------------------------------------------------------
.../org/apache/ignite/internal/visor/igfs/VisorIgfs.java | 2 +-
.../ignite/internal/visor/igfs/VisorIgfsMetrics.java | 11 +++++++----
2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/583ef2ed/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfs.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfs.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfs.java
index 29c79fe..114d92d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfs.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfs.java
@@ -72,7 +72,7 @@ public class VisorIgfs implements Serializable, LessNamingBean {
return new VisorIgfs(
igfs.name(),
igfs.configuration().getDefaultMode(),
- VisorIgfsMetrics.from(igfs.metrics()),
+ VisorIgfsMetrics.from(igfs),
igfs.configuration().getSecondaryFileSystem() != null
);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/583ef2ed/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMetrics.java
index af7af06..58acee1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMetrics.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.visor.igfs;
import java.io.Serializable;
+import org.apache.ignite.IgniteFileSystem;
import org.apache.ignite.igfs.IgfsMetrics;
import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -72,15 +73,17 @@ public class VisorIgfsMetrics implements Serializable, LessNamingBean {
private long bytesWrtTm;
/**
- * @param m IGFS metrics.
+ * @param igfs Source IGFS.
* @return Data transfer object for given IGFS metrics.
*/
- public static VisorIgfsMetrics from(IgfsMetrics m) {
- assert m != null;
+ public static VisorIgfsMetrics from(IgniteFileSystem igfs) {
+ assert igfs != null;
+
+ IgfsMetrics m = igfs.metrics();
VisorIgfsMetrics metrics = new VisorIgfsMetrics();
- metrics.totalSpaceSz = m.maxSpaceSize();
+ metrics.totalSpaceSz = igfs.configuration().getMaxSpaceSize();
metrics.usedSpaceSz = m.localSpaceSize();
metrics.foldersCnt = m.directoriesCount();
metrics.filesCnt = m.filesCount();
[39/50] [abbrv] ignite git commit: IGNITE-3393: Maven build warning
on duplicate dependency declaration
Posted by sb...@apache.org.
IGNITE-3393: Maven build warning on duplicate dependency declaration
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cc0de452
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cc0de452
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cc0de452
Branch: refs/heads/ignite-1232
Commit: cc0de452fa29b43a4c58b20f77d78e0b3a429952
Parents: 00e966a
Author: shtykh_roman <rs...@yahoo.com>
Authored: Wed Jul 6 16:25:19 2016 +0900
Committer: shtykh_roman <rs...@yahoo.com>
Committed: Wed Jul 6 18:10:33 2016 +0900
----------------------------------------------------------------------
modules/spring/pom.xml | 7 -------
1 file changed, 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/cc0de452/modules/spring/pom.xml
----------------------------------------------------------------------
diff --git a/modules/spring/pom.xml b/modules/spring/pom.xml
index 397b209..352b51c 100644
--- a/modules/spring/pom.xml
+++ b/modules/spring/pom.xml
@@ -117,13 +117,6 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
-
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <version>${h2.version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
[35/50] [abbrv] ignite git commit: ignite-3336 Added properties
IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT,
IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT. Refactored cache message logging. (cherry
picked from commit 8ed13e8)
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/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 9291153..561c6c6 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
@@ -37,6 +37,7 @@ import javax.cache.processor.EntryProcessor;
import javax.cache.processor.EntryProcessorResult;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.NodeStoppingException;
@@ -148,6 +149,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
/** */
private GridNearAtomicCache<K, V> near;
+ /** Logger. */
+ private IgniteLogger msgLog;
+
/**
* Empty constructor required by {@link Externalizable}.
*/
@@ -160,6 +164,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
*/
public GridDhtAtomicCache(GridCacheContext<K, V> ctx) {
super(ctx);
+
+ msgLog = ctx.shared().atomicMessageLogger();
}
/**
@@ -168,6 +174,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
*/
public GridDhtAtomicCache(GridCacheContext<K, V> ctx, GridCacheConcurrentMap map) {
super(ctx, map);
+
+ msgLog = ctx.shared().atomicMessageLogger();
}
/** {@inheritDoc} */
@@ -1581,7 +1589,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
ClusterNode node = ctx.discovery().node(nodeId);
if (node == null) {
- U.warn(log, "Node originated update request left grid: " + nodeId);
+ U.warn(msgLog, "Skip near update request, node originated update request left [" +
+ "futId=" + req.futureVersion() + ", node=" + nodeId + ']');
return;
}
@@ -1596,14 +1605,15 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
if (hasNear)
res.nearVersion(ver);
+
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Assigned update version [futId=" + req.futureVersion() +
+ ", writeVer=" + ver + ']');
+ }
}
assert ver != null : "Got null version for update request: " + req;
- if (log.isDebugEnabled())
- log.debug("Using cache version for update request on primary node [ver=" + ver +
- ", req=" + req + ']');
-
boolean sndPrevVal = !top.rebalanceFinished(req.topologyVersion());
dhtFut = createDhtFuture(ver, req, res, completionCb, false);
@@ -2020,8 +2030,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
old,
req.keepBinary()),
ctx.unwrapBinaryIfNeeded(
- updated,
- req.keepBinary(),
+ updated,
+ req.keepBinary(),
false));
if (val == null)
@@ -2929,8 +2939,11 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
* @param req Near atomic update request.
*/
private void processNearAtomicUpdateRequest(UUID nodeId, GridNearAtomicUpdateRequest req) {
- if (log.isDebugEnabled())
- log.debug("Processing near atomic update request [nodeId=" + nodeId + ", req=" + req + ']');
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Received near atomic update request [futId=" + req.futureVersion() +
+ ", writeVer=" + req.updateVersion() +
+ ", node=" + nodeId + ']');
+ }
req.nodeId(ctx.localNodeId());
@@ -2943,8 +2956,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
*/
@SuppressWarnings("unchecked")
private void processNearAtomicUpdateResponse(UUID nodeId, GridNearAtomicUpdateResponse res) {
- if (log.isDebugEnabled())
- log.debug("Processing near atomic update response [nodeId=" + nodeId + ", res=" + res + ']');
+ if (msgLog.isDebugEnabled())
+ msgLog.debug("Received near atomic update response [futId" + res.futureVersion() + ", node=" + nodeId + ']');
res.nodeId(ctx.localNodeId());
@@ -2958,8 +2971,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
((GridNearAtomicUpdateFuture)fut).onResult(nodeId, res, false);
}
else
- U.warn(log, "Failed to find near update future for update response (will ignore) " +
- "[nodeId=" + nodeId + ", res=" + res + ']');
+ U.warn(msgLog, "Failed to find near update future for update response (will ignore) " +
+ "[futId" + res.futureVersion() + ", node=" + nodeId + ", res=" + res + ']');
}
/**
@@ -2967,8 +2980,10 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
* @param req Dht atomic update request.
*/
private void processDhtAtomicUpdateRequest(UUID nodeId, GridDhtAtomicUpdateRequest req) {
- if (log.isDebugEnabled())
- log.debug("Processing dht atomic update request [nodeId=" + nodeId + ", req=" + req + ']');
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Received DHT atomic update request [futId=" + req.futureVersion() +
+ ", writeVer=" + req.writeVersion() + ", node=" + nodeId + ']');
+ }
GridCacheVersion ver = req.writeVersion();
@@ -3066,20 +3081,31 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
((GridNearAtomicCache<K, V>)near()).processDhtAtomicUpdateRequest(nodeId, req, res);
try {
- if (res.failedKeys() != null || res.nearEvicted() != null || req.writeSynchronizationMode() == FULL_SYNC)
+ if (res.failedKeys() != null || res.nearEvicted() != null || req.writeSynchronizationMode() == FULL_SYNC) {
ctx.io().send(nodeId, res, ctx.ioPolicy());
+
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Sent DHT atomic update response [futId=" + req.futureVersion() +
+ ", writeVer=" + req.writeVersion() + ", node=" + nodeId + ']');
+ }
+ }
else {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Will send deferred DHT atomic update response [futId=" + req.futureVersion() +
+ ", writeVer=" + req.writeVersion() + ", node=" + nodeId + ']');
+ }
+
// No failed keys and sync mode is not FULL_SYNC, thus sending deferred response.
sendDeferredUpdateResponse(nodeId, req.futureVersion());
}
}
catch (ClusterTopologyCheckedException ignored) {
- U.warn(log, "Failed to send DHT atomic update response to node because it left grid: " +
- req.nodeId());
+ U.warn(msgLog, "Failed to send DHT atomic update response, node left [futId=" + req.futureVersion() +
+ ", node=" + req.nodeId() + ']');
}
catch (IgniteCheckedException e) {
- U.error(log, "Failed to send DHT atomic update response (did node leave grid?) [nodeId=" + nodeId +
- ", req=" + req + ']', e);
+ U.error(msgLog, "Failed to send DHT atomic update response [futId=" + req.futureVersion() +
+ ", node=" + nodeId + ", res=" + res + ']', e);
}
}
@@ -3118,16 +3144,20 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
*/
@SuppressWarnings("unchecked")
private void processDhtAtomicUpdateResponse(UUID nodeId, GridDhtAtomicUpdateResponse res) {
- if (log.isDebugEnabled())
- log.debug("Processing dht atomic update response [nodeId=" + nodeId + ", res=" + res + ']');
-
GridDhtAtomicUpdateFuture updateFut = (GridDhtAtomicUpdateFuture)ctx.mvcc().atomicFuture(res.futureVersion());
- if (updateFut != null)
+ if (updateFut != null) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Received DHT atomic update response [futId=" + res.futureVersion() +
+ ", writeVer=" + updateFut.writeVersion() + ", node=" + nodeId + ']');
+ }
+
updateFut.onResult(nodeId, res);
- else
- U.warn(log, "Failed to find DHT update future for update response [nodeId=" + nodeId +
- ", res=" + res + ']');
+ }
+ else {
+ U.warn(msgLog, "Failed to find DHT update future for update response [futId=" + res.futureVersion() +
+ ", node=" + nodeId + ", res=" + res + ']');
+ }
}
/**
@@ -3136,17 +3166,21 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
*/
@SuppressWarnings("unchecked")
private void processDhtAtomicDeferredUpdateResponse(UUID nodeId, GridDhtAtomicDeferredUpdateResponse res) {
- if (log.isDebugEnabled())
- log.debug("Processing deferred dht atomic update response [nodeId=" + nodeId + ", res=" + res + ']');
-
for (GridCacheVersion ver : res.futureVersions()) {
GridDhtAtomicUpdateFuture updateFut = (GridDhtAtomicUpdateFuture)ctx.mvcc().atomicFuture(ver);
- if (updateFut != null)
+ if (updateFut != null) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Received DHT atomic deferred update response [futId=" + ver +
+ ", writeVer=" + res + ", node=" + nodeId + ']');
+ }
+
updateFut.onResult(nodeId);
- else
- U.warn(log, "Failed to find DHT update future for deferred update response [nodeId=" +
- nodeId + ", ver=" + ver + ", res=" + res + ']');
+ }
+ else {
+ U.warn(msgLog, "Failed to find DHT update future for deferred update response [futId=" + ver +
+ ", nodeId=" + nodeId + ", res=" + res + ']');
+ }
}
}
@@ -3157,14 +3191,19 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
private void sendNearUpdateReply(UUID nodeId, GridNearAtomicUpdateResponse res) {
try {
ctx.io().send(nodeId, res, ctx.ioPolicy());
+
+ if (msgLog.isDebugEnabled())
+ msgLog.debug("Sent near update response [futId=" + res.futureVersion() + ", node=" + nodeId + ']');
}
catch (ClusterTopologyCheckedException ignored) {
- U.warn(log, "Failed to send near update reply to node because it left grid: " +
- nodeId);
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Failed to send near update response [futId=" + res.futureVersion() +
+ ", node=" + nodeId + ']');
+ }
}
catch (IgniteCheckedException e) {
- U.error(log, "Failed to send near update reply (did node leave grid?) [nodeId=" + nodeId +
- ", res=" + res + ']', e);
+ U.error(msgLog, "Failed to send near update response [futId=" + res.futureVersion() +
+ ", node=" + nodeId + ", res=" + res + ']', e);
}
}
@@ -3434,24 +3473,31 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
try {
ctx.io().send(nodeId, msg, ctx.ioPolicy());
+
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Sent deferred DHT update response [futIds=" + msg.futureVersions() +
+ ", node=" + nodeId + ']');
+ }
}
finally {
ctx.kernalContext().gateway().readUnlock();
}
}
catch (IllegalStateException ignored) {
- if (log.isDebugEnabled())
- log.debug("Failed to send deferred dht update response to remote node (grid is stopping) " +
- "[nodeId=" + nodeId + ", msg=" + msg + ']');
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Failed to send deferred DHT update response, node is stopping [" +
+ "futIds=" + msg.futureVersions() + ", node=" + nodeId + ']');
+ }
}
catch (ClusterTopologyCheckedException ignored) {
- if (log.isDebugEnabled())
- log.debug("Failed to send deferred dht update response to remote node (did node leave grid?) " +
- "[nodeId=" + nodeId + ", msg=" + msg + ']');
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Failed to send deferred DHT update response, node left [" +
+ "futIds=" + msg.futureVersions() + ", node=" + nodeId + ']');
+ }
}
catch (IgniteCheckedException e) {
- U.error(log, "Failed to send deferred dht update response to remote node [nodeId="
- + nodeId + ", msg=" + msg + ']', e);
+ U.error(log, "Failed to send deferred DHT update response to remote node [" +
+ "futIds=" + msg.futureVersions() + ", node=" + nodeId + ']', e);
}
pendingResponses.remove(nodeId, this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java
index 3a7bf1c..923b220 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java
@@ -20,9 +20,11 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
import java.io.Externalizable;
import java.nio.ByteBuffer;
import java.util.Collection;
+import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.GridDirectCollection;
import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
@@ -83,6 +85,11 @@ public class GridDhtAtomicDeferredUpdateResponse extends GridCacheMessage implem
}
/** {@inheritDoc} */
+ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.atomicMessageLogger();
+ }
+
+ /** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
writer.setBuffer(buf);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index 570f043..4e59d11 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -64,7 +64,10 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
private static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
/** Logger. */
- protected static IgniteLogger log;
+ private static IgniteLogger log;
+
+ /** Logger. */
+ private static IgniteLogger msgLog;
/** Cache context. */
private final GridCacheContext cctx;
@@ -116,8 +119,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
*/
public GridDhtAtomicUpdateFuture(
GridCacheContext cctx,
- CI2<GridNearAtomicUpdateRequest,
- GridNearAtomicUpdateResponse> completionCb,
+ CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
GridCacheVersion writeVer,
GridNearAtomicUpdateRequest updateReq,
GridNearAtomicUpdateResponse updateRes
@@ -130,8 +132,10 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
this.completionCb = completionCb;
this.updateRes = updateRes;
- if (log == null)
+ if (log == null) {
+ msgLog = cctx.shared().atomicMessageLogger();
log = U.logger(cctx.kernalContext(), logRef, GridDhtAtomicUpdateFuture.class);
+ }
keys = new ArrayList<>(updateReq.keys().size());
mappings = U.newHashMap(updateReq.keys().size());
@@ -139,6 +143,13 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
waitForExchange = !(updateReq.topologyLocked() || (updateReq.fastMap() && !updateReq.clientRequest()));
}
+ /**
+ * @return Write version.
+ */
+ GridCacheVersion writeVersion() {
+ return writeVer;
+ }
+
/** {@inheritDoc} */
@Override public IgniteUuid futureId() {
return futVer.asGridUuid();
@@ -151,10 +162,14 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
/** {@inheritDoc} */
@Override public boolean onNodeLeft(UUID nodeId) {
- if (log.isDebugEnabled())
- log.debug("Processing node leave event [fut=" + this + ", nodeId=" + nodeId + ']');
+ boolean res = registerResponse(nodeId);
+
+ if (res && msgLog.isDebugEnabled()) {
+ msgLog.debug("DTH update fut, node left [futId=" + futVer + ", writeVer=" + writeVer +
+ ", node=" + nodeId + ']');
+ }
- return registerResponse(nodeId);
+ return res;
}
/**
@@ -385,20 +400,24 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
if (!mappings.isEmpty()) {
for (GridDhtAtomicUpdateRequest req : mappings.values()) {
try {
- if (log.isDebugEnabled())
- log.debug("Sending DHT atomic update request [nodeId=" + req.nodeId() + ", req=" + req + ']');
-
cctx.io().send(req.nodeId(), req, cctx.ioPolicy());
+
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DTH update fut, sent request [futId=" + futVer +
+ ", writeVer=" + writeVer + ", node=" + req.nodeId() + ']');
+ }
}
catch (ClusterTopologyCheckedException ignored) {
- U.warn(log, "Failed to send update request to backup node because it left grid: " +
- req.nodeId());
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DTH update fut, failed to send request, node left [futId=" + futVer +
+ ", writeVer=" + writeVer + ", node=" + req.nodeId() + ']');
+ }
registerResponse(req.nodeId());
}
catch (IgniteCheckedException e) {
- U.error(log, "Failed to send update request to backup node (did node leave the grid?): "
- + req.nodeId(), e);
+ U.error(msgLog, "Failed to send request [futId=" + futVer +
+ ", writeVer=" + writeVer + ", node=" + req.nodeId() + ']');
registerResponse(req.nodeId());
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
index b1a94de..55f7560 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
@@ -25,6 +25,7 @@ import java.util.List;
import java.util.UUID;
import javax.cache.processor.EntryProcessor;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.internal.GridDirectCollection;
import org.apache.ignite.internal.GridDirectTransient;
@@ -715,6 +716,11 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
}
/** {@inheritDoc} */
+ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.atomicMessageLogger();
+ }
+
+ /** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
writer.setBuffer(buf);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
index 383e515..1334819 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
@@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.GridDirectCollection;
import org.apache.ignite.internal.GridDirectTransient;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
@@ -190,6 +191,11 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage implements Gri
}
/** {@inheritDoc} */
+ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.atomicMessageLogger();
+ }
+
+ /** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
writer.setBuffer(buf);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
index e847c7c..eb9be4d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
@@ -26,6 +26,7 @@ import java.util.UUID;
import javax.cache.expiry.ExpiryPolicy;
import javax.cache.processor.EntryProcessor;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.internal.GridDirectCollection;
import org.apache.ignite.internal.GridDirectTransient;
@@ -674,6 +675,11 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage implements Gri
}
/** {@inheritDoc} */
+ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.atomicMessageLogger();
+ }
+
+ /** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
writer.setBuffer(buf);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
index f47bb75..ff4008e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
@@ -25,6 +25,7 @@ import java.util.List;
import java.util.UUID;
import java.util.concurrent.ConcurrentLinkedQueue;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.GridDirectCollection;
import org.apache.ignite.internal.GridDirectTransient;
import org.apache.ignite.internal.processors.cache.CacheObject;
@@ -435,6 +436,11 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage implements Gr
}
/** {@inheritDoc} */
+ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.atomicMessageLogger();
+ }
+
+ /** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
writer.setBuffer(buf);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
index 3376510..176a90f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
@@ -1079,6 +1079,9 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
* @param res Response.
*/
private void processLockResponse(UUID nodeId, GridNearLockResponse res) {
+ if (txLockMsgLog.isDebugEnabled())
+ txLockMsgLog.debug("Received near lock response [txId=" + res.version() + ", node=" + nodeId + ']');
+
assert nodeId != null;
assert res != null;
@@ -1087,6 +1090,13 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
if (fut != null)
fut.onResult(nodeId, res);
+ else {
+ if (txLockMsgLog.isDebugEnabled()) {
+ txLockMsgLog.debug("Received near lock response for unknown future [txId=" + res.version() +
+ ", node=" + nodeId +
+ ", res=" + res + ']');
+ }
+ }
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
index 3b8b9b8..f77efee 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
@@ -93,6 +93,9 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
/** Logger. */
private static IgniteLogger log;
+ /** Logger. */
+ private static IgniteLogger msgLog;
+
/** Cache registry. */
@GridToStringExclude
private final GridCacheContext<?, ?> cctx;
@@ -199,8 +202,10 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
futId = IgniteUuid.randomUuid();
- if (log == null)
+ if (log == null) {
+ msgLog = cctx.shared().txLockMessageLogger();
log = U.logger(cctx.kernalContext(), logRef, GridDhtColocatedLockFuture.class);
+ }
if (timeout > 0) {
timeoutObj = new LockTimeoutObject();
@@ -390,10 +395,6 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
MiniFuture f = (MiniFuture)fut;
if (f.node().id().equals(nodeId)) {
- if (log.isDebugEnabled())
- log.debug("Found mini-future for left node [nodeId=" + nodeId + ", mini=" + f + ", fut=" +
- this + ']');
-
f.onResult(newTopologyException(null, nodeId));
found = true;
@@ -414,33 +415,29 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
*/
void onResult(UUID nodeId, GridNearLockResponse res) {
if (!isDone()) {
- if (log.isDebugEnabled())
- log.debug("Received lock response from node [nodeId=" + nodeId + ", res=" + res + ", fut=" +
- this + ']');
-
MiniFuture mini = miniFuture(res.miniId());
if (mini != null) {
assert mini.node().id().equals(nodeId);
- if (log.isDebugEnabled())
- log.debug("Found mini future for response [mini=" + mini + ", res=" + res + ']');
-
mini.onResult(res);
- if (log.isDebugEnabled())
- log.debug("Future after processed lock response [fut=" + this + ", mini=" + mini +
- ", res=" + res + ']');
-
return;
}
- U.warn(log, "Failed to find mini future for response (perhaps due to stale message) [res=" + res +
+ U.warn(msgLog, "Collocated lock fut, failed to find mini future [txId=" + lockVer +
+ ", inTx=" + inTx() +
+ ", node=" + nodeId +
+ ", res=" + res +
", fut=" + this + ']');
}
- else if (log.isDebugEnabled())
- log.debug("Ignoring lock response from node (future is done) [nodeId=" + nodeId + ", res=" + res +
- ", fut=" + this + ']');
+ else {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Collocated lock fut, response for finished future [txId=" + lockVer +
+ ", inTx=" + inTx() +
+ ", node=" + nodeId + ']');
+ }
+ }
}
/**
@@ -1046,10 +1043,13 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
if (txSync == null || txSync.isDone()) {
try {
- if (log.isDebugEnabled())
- log.debug("Sending near lock request [node=" + node.id() + ", req=" + req + ']');
-
cctx.io().send(node, req, cctx.ioPolicy());
+
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Collocated lock fut, sent request [txId=" + lockVer +
+ ", inTx=" + inTx() +
+ ", node=" + node.id() + ']');
+ }
}
catch (ClusterTopologyCheckedException ex) {
assert fut != null;
@@ -1061,10 +1061,13 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
txSync.listen(new CI1<IgniteInternalFuture<?>>() {
@Override public void apply(IgniteInternalFuture<?> t) {
try {
- if (log.isDebugEnabled())
- log.debug("Sending near lock request [node=" + node.id() + ", req=" + req + ']');
-
cctx.io().send(node, req, cctx.ioPolicy());
+
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Collocated lock fut, sent request [txId=" + lockVer +
+ ", inTx=" + inTx() +
+ ", node=" + node.id() + ']');
+ }
}
catch (ClusterTopologyCheckedException ex) {
assert fut != null;
@@ -1072,6 +1075,13 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
fut.onResult(ex);
}
catch (IgniteCheckedException e) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Collocated lock fut, failed to send request [txId=" + lockVer +
+ ", inTx=" + inTx() +
+ ", node=" + node.id() +
+ ", err=" + e + ']');
+ }
+
onError(e);
}
}
@@ -1404,6 +1414,12 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
* @param e Node left exception.
*/
void onResult(ClusterTopologyCheckedException e) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Collocated lock fut, mini future node left [txId=" + lockVer +
+ ", inTx=" + inTx() +
+ ", nodeId=" + node.id() + ']');
+ }
+
if (isDone())
return;
@@ -1414,9 +1430,6 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
rcvRes = true;
}
- if (log.isDebugEnabled())
- log.debug("Remote node left grid while sending or waiting for reply (will fail): " + this);
-
if (tx != null)
tx.removeMapping(node.id());
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index bea1957..80b3768 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -807,6 +807,9 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
U.warn(log, "Awaited locked entry [key=" + e.getKey() + ", mvcc=" + e.getValue() + ']');
dumpedObjects++;
+
+ if (IgniteSystemProperties.getBoolean(IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT, false))
+ U.dumpThreads(log);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
index 5d3f604..1ea99c4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
@@ -162,6 +162,22 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
mini.onResult(nodeId, res);
}
+ else {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near optimistic prepare fut, failed to find mini future [txId=" + tx.nearXidVersion() +
+ ", node=" + nodeId +
+ ", res=" + res +
+ ", fut=" + this + ']');
+ }
+ }
+ }
+ else {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near optimistic prepare fut, response for finished future [txId=" + tx.nearXidVersion() +
+ ", node=" + nodeId +
+ ", res=" + res +
+ ", fut=" + this + ']');
+ }
}
}
@@ -483,6 +499,11 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
else {
try {
cctx.io().send(n, req, tx.ioPolicy());
+
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near optimistic prepare fut, sent request [txId=" + tx.nearXidVersion() +
+ ", node=" + n.id() + ']');
+ }
}
catch (ClusterTopologyCheckedException e) {
e.retryReadyFuture(cctx.nextAffinityReadyFuture(tx.topologyVersion()));
@@ -490,6 +511,12 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
fut.onNodeLeft(e, false);
}
catch (IgniteCheckedException e) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near optimistic prepare fut, failed to sent request [txId=" + tx.nearXidVersion() +
+ ", node=" + n.id() +
+ ", err=" + e + ']');
+ }
+
fut.onResult(e);
}
}
@@ -696,8 +723,14 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
/**
* @param e Node failure.
+ * @param discoThread {@code True} if executed from discovery thread.
*/
void onNodeLeft(ClusterTopologyCheckedException e, boolean discoThread) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near optimistic prepare fut, mini future node left [txId=" + parent.tx.nearXidVersion() +
+ ", node=" + m.node().id() + ']');
+ }
+
if (isDone())
return;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
index 9adf580..5d347d7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
@@ -102,11 +102,24 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
if (f != null) {
assert f.node().id().equals(nodeId);
- if (log.isDebugEnabled())
- log.debug("Remote node left grid while sending or waiting for reply (will not retry): " + f);
-
f.onResult(res);
}
+ else {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near pessimistic prepare, failed to find mini future [txId=" + tx.nearXidVersion() +
+ ", node=" + nodeId +
+ ", res=" + res +
+ ", fut=" + this + ']');
+ }
+ }
+ }
+ else {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near pessimistic prepare, response for finished future [txId=" + tx.nearXidVersion() +
+ ", node=" + nodeId +
+ ", res=" + res +
+ ", fut=" + this + ']');
+ }
}
}
@@ -260,6 +273,11 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
else {
try {
cctx.io().send(node, req, tx.ioPolicy());
+
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near pessimistic prepare, sent request [txId=" + tx.nearXidVersion() +
+ ", node=" + node.id() + ']');
+ }
}
catch (ClusterTopologyCheckedException e) {
e.retryReadyFuture(cctx.nextAffinityReadyFuture(topVer));
@@ -267,6 +285,11 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
fut.onNodeLeft(e);
}
catch (IgniteCheckedException e) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near pessimistic prepare, failed send request [txId=" + tx.nearXidVersion() +
+ ", node=" + node.id() + ", err=" + e + ']');
+ }
+
fut.onError(e);
}
}
@@ -365,6 +388,11 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
* @param e Error.
*/
void onNodeLeft(ClusterTopologyCheckedException e) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near pessimistic prepare, mini future node left [txId=" + tx.nearXidVersion() +
+ ", nodeId=" + m.node().id() + ']');
+ }
+
if (tx.onePhaseCommit()) {
tx.markForBackupCheck();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
index fe6290d..39f3ff3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
@@ -84,6 +84,9 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
/** Logger. */
private static IgniteLogger log;
+ /** Logger. */
+ protected static IgniteLogger msgLog;
+
/** Context. */
private GridCacheSharedContext<K, V> cctx;
@@ -124,9 +127,6 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
futId = IgniteUuid.randomUuid();
- if (log == null)
- log = U.logger(cctx.kernalContext(), logRef, GridNearTxFinishFuture.class);
-
CacheWriteSynchronizationMode syncMode;
if (tx.explicitLock())
@@ -135,6 +135,11 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
syncMode = tx.syncMode();
tx.syncMode(syncMode);
+
+ if (log == null) {
+ msgLog = cctx.txFinishMessageLogger();
+ log = U.logger(cctx.kernalContext(), logRef, GridNearTxFinishFuture.class);
+ }
}
/** {@inheritDoc} */
@@ -162,6 +167,13 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
return found;
}
+ /**
+ * @return Transaction.
+ */
+ public GridNearTxLocal tx() {
+ return tx;
+ }
+
/** {@inheritDoc} */
@Override public boolean trackable() {
return trackable;
@@ -203,6 +215,22 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
if (finishFut != null)
finishFut.onNearFinishResponse(res);
+ else {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near finish fut, failed to find mini future [txId=" + tx.nearXidVersion() +
+ ", node=" + nodeId +
+ ", res=" + res +
+ ", fut=" + this + ']');
+ }
+ }
+ }
+ else {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near finish fut, response for finished future [txId=" + tx.nearXidVersion() +
+ ", node=" + nodeId +
+ ", res=" + res +
+ ", fut=" + this + ']');
+ }
}
}
@@ -211,12 +239,16 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
* @param res Result.
*/
public void onResult(UUID nodeId, GridDhtTxFinishResponse res) {
- if (!isDone())
+ if (!isDone()) {
+ boolean found = false;
+
for (IgniteInternalFuture<IgniteInternalTx> fut : futures()) {
if (fut.getClass() == CheckBackupMiniFuture.class) {
CheckBackupMiniFuture f = (CheckBackupMiniFuture)fut;
if (f.futureId().equals(res.miniId())) {
+ found = true;
+
assert f.node().id().equals(nodeId);
f.onDhtFinishResponse(res);
@@ -229,6 +261,22 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
f.onDhtFinishResponse(nodeId, false);
}
}
+
+ if (!found && msgLog.isDebugEnabled()) {
+ msgLog.debug("Near finish fut, failed to find mini future [txId=" + tx.nearXidVersion() +
+ ", node=" + nodeId +
+ ", res=" + res +
+ ", fut=" + this + ']');
+ }
+ }
+ else {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near finish fut, response for finished future [txId=" + tx.nearXidVersion() +
+ ", node=" + nodeId +
+ ", res=" + res +
+ ", fut=" + this + ']');
+ }
+ }
}
/** {@inheritDoc} */
@@ -458,8 +506,15 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
finishReq.syncCommit(true);
try {
- if (FINISH_NEAR_ONE_PHASE_SINCE.compareTo(backup.version()) <= 0)
+ if (FINISH_NEAR_ONE_PHASE_SINCE.compareTo(backup.version()) <= 0) {
cctx.io().send(backup, finishReq, tx.ioPolicy());
+
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near finish fut, sent check committed request [" +
+ "txId=" + tx.nearXidVersion() +
+ ", node=" + backup.id() + ']');
+ }
+ }
else {
mini.onDone(new IgniteTxHeuristicCheckedException("Failed to check for tx commit on " +
"the backup node (node has an old Ignite version) [rmtNodeId=" + backup.id() +
@@ -470,6 +525,13 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
mini.onNodeLeft(backupId, false);
}
catch (IgniteCheckedException e) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near finish fut, failed to send check committed request [" +
+ "txId=" + tx.nearXidVersion() +
+ ", node=" + backup.id() +
+ ", err=" + e + ']');
+ }
+
mini.onDone(e);
}
}
@@ -607,6 +669,12 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
try {
cctx.io().send(n, req, tx.ioPolicy());
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near finish fut, sent request [" +
+ "txId=" + tx.nearXidVersion() +
+ ", node=" + n.id() + ']');
+ }
+
boolean wait;
if (syncMode == PRIMARY_SYNC)
@@ -625,6 +693,13 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
fut.onNodeLeft(n.id(), false);
}
catch (IgniteCheckedException e) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near finish fut, failed to send request [" +
+ "txId=" + tx.nearXidVersion() +
+ ", node=" + n.id() +
+ ", err=" + e + ']');
+ }
+
// Fail the whole thing.
fut.onDone(e);
}
@@ -770,8 +845,10 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
/** {@inheritDoc} */
boolean onNodeLeft(UUID nodeId, boolean discoThread) {
if (nodeId.equals(m.node().id())) {
- if (log.isDebugEnabled())
- log.debug("Remote node left grid while sending or waiting for reply: " + this);
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("Near finish fut, mini future node left [txId=" + tx.nearXidVersion() +
+ ", node=" + m.node().id() + ']');
+ }
if (tx.syncMode() == FULL_SYNC) {
Map<UUID, Collection<UUID>> txNodes = tx.transactionNodes();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java
index fd959b4..3260d39 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java
@@ -74,6 +74,9 @@ public abstract class GridNearTxPrepareFutureAdapter extends
/** Logger. */
protected static IgniteLogger log;
+ /** Logger. */
+ protected static IgniteLogger msgLog;
+
/** Context. */
protected GridCacheSharedContext<?, ?> cctx;
@@ -110,8 +113,10 @@ public abstract class GridNearTxPrepareFutureAdapter extends
futId = IgniteUuid.randomUuid();
- if (log == null)
+ if (log == null) {
+ msgLog = cctx.txFinishMessageLogger();
log = U.logger(cctx.kernalContext(), logRef, GridNearTxPrepareFutureAdapter.class);
+ }
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
index 7039399..ba30e10 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
@@ -95,6 +95,15 @@ public class IgniteTxHandler {
/** Logger. */
private IgniteLogger log;
+ /** */
+ private final IgniteLogger txPrepareMsgLog;
+
+ /** */
+ private final IgniteLogger txFinishMsgLog;
+
+ /** */
+ private final IgniteLogger txRecoveryMsgLog;
+
/** Shared cache context. */
private GridCacheSharedContext<?, ?> ctx;
@@ -105,6 +114,11 @@ public class IgniteTxHandler {
*/
public IgniteInternalFuture<?> processNearTxPrepareRequest(final UUID nearNodeId,
final GridNearTxPrepareRequest req) {
+ if (txPrepareMsgLog.isDebugEnabled()) {
+ txPrepareMsgLog.debug("Received near prepare request [txId=" + req.version() +
+ ", node=" + nearNodeId + ']');
+ }
+
return prepareTx(nearNodeId, null, req);
}
@@ -116,6 +130,10 @@ public class IgniteTxHandler {
log = ctx.logger(IgniteTxHandler.class);
+ txRecoveryMsgLog = ctx.logger(CU.TX_MSG_RECOVERY_LOG_CATEGORY);
+ txPrepareMsgLog = ctx.logger(CU.TX_MSG_PREPARE_LOG_CATEGORY);
+ txFinishMsgLog = ctx.logger(CU.TX_MSG_FINISH_LOG_CATEGORY);
+
ctx.io().addHandler(0, GridNearTxPrepareRequest.class, new CI2<UUID, GridCacheMessage>() {
@Override public void apply(UUID nodeId, GridCacheMessage msg) {
processNearTxPrepareRequest(nodeId, (GridNearTxPrepareRequest)msg);
@@ -268,8 +286,11 @@ public class IgniteTxHandler {
ClusterNode nearNode = ctx.node(nearNodeId);
if (nearNode == null) {
- if (log.isDebugEnabled())
- log.debug("Received transaction request from node that left grid (will ignore): " + nearNodeId);
+ if (txPrepareMsgLog.isDebugEnabled()) {
+ txPrepareMsgLog.debug("Received near prepare from node that left grid (will ignore) [" +
+ "txId=" + req.version() +
+ ", node=" + nearNodeId + ']');
+ }
return null;
}
@@ -319,9 +340,11 @@ public class IgniteTxHandler {
try {
if (top != null && needRemap(req.topologyVersion(), top.topologyVersion(), req)) {
- if (log.isDebugEnabled()) {
- log.debug("Client topology version mismatch, need remap transaction [" +
- "reqTopVer=" + req.topologyVersion() +
+ if (txPrepareMsgLog.isDebugEnabled()) {
+ txPrepareMsgLog.debug("Topology version mismatch for near prepare, need remap transaction [" +
+ "txId=" + req.version() +
+ ", node=" + nearNodeId +
+ ", reqTopVer=" + req.topologyVersion() +
", locTopVer=" + top.topologyVersion() +
", req=" + req + ']');
}
@@ -339,15 +362,24 @@ public class IgniteTxHandler {
try {
ctx.io().send(nearNode, res, req.policy());
+
+ if (txPrepareMsgLog.isDebugEnabled()) {
+ txPrepareMsgLog.debug("Sent remap response for near prepare [txId=" + req.version() +
+ ", node=" + nearNodeId + ']');
+ }
}
catch (ClusterTopologyCheckedException ignored) {
- if (log.isDebugEnabled())
- log.debug("Failed to send client tx remap response, client node failed " +
- "[node=" + nearNode + ", req=" + req + ']');
+ if (txPrepareMsgLog.isDebugEnabled()) {
+ txPrepareMsgLog.debug("Failed to send remap response for near prepare, node failed [" +
+ "txId=" + req.version() +
+ ", node=" + nearNodeId + ']');
+ }
}
catch (IgniteCheckedException e) {
- U.error(log, "Failed to send client tx remap response " +
- "[node=" + nearNode + ", req=" + req + ']', e);
+ U.error(txPrepareMsgLog, "Failed to send remap response for near prepare " +
+ "[txId=" + req.version() +
+ ", node=" + nearNodeId +
+ ", req=" + req + ']', e);
}
return new GridFinishedFuture<>(res);
@@ -494,11 +526,16 @@ public class IgniteTxHandler {
* @param res Response.
*/
private void processNearTxPrepareResponse(UUID nodeId, GridNearTxPrepareResponse res) {
+ if (txPrepareMsgLog.isDebugEnabled())
+ txPrepareMsgLog.debug("Received near prepare response [txId=" + res.version() + ", node=" + nodeId + ']');
+
GridNearTxPrepareFutureAdapter fut = (GridNearTxPrepareFutureAdapter)ctx.mvcc()
.<IgniteInternalTx>mvccFuture(res.version(), res.futureId());
if (fut == null) {
- U.warn(log, "Failed to find future for prepare response [sender=" + nodeId + ", res=" + res + ']');
+ U.warn(log, "Failed to find future for near prepare response [txId=" + res.version() +
+ ", node=" + nodeId +
+ ", res=" + res + ']');
return;
}
@@ -511,13 +548,19 @@ public class IgniteTxHandler {
* @param res Response.
*/
private void processNearTxFinishResponse(UUID nodeId, GridNearTxFinishResponse res) {
+ if (txFinishMsgLog.isDebugEnabled())
+ txFinishMsgLog.debug("Received near finish response [txId=" + res.xid() + ", node=" + nodeId + ']');
+
ctx.tm().onFinishedRemote(nodeId, res.threadId());
GridNearTxFinishFuture fut = (GridNearTxFinishFuture)ctx.mvcc().<IgniteInternalTx>future(res.futureId());
if (fut == null) {
- if (log.isDebugEnabled())
- log.debug("Failed to find future for finish response [sender=" + nodeId + ", res=" + res + ']');
+ if (txFinishMsgLog.isDebugEnabled()) {
+ txFinishMsgLog.debug("Failed to find future for near finish response [txId=" + res.xid() +
+ ", node=" + nodeId +
+ ", res=" + res + ']');
+ }
return;
}
@@ -533,11 +576,17 @@ public class IgniteTxHandler {
GridDhtTxPrepareFuture fut = (GridDhtTxPrepareFuture)ctx.mvcc().mvccFuture(res.version(), res.futureId());
if (fut == null) {
- if (log.isDebugEnabled())
- log.debug("Received response for unknown future (will ignore): " + res);
+ if (txPrepareMsgLog.isDebugEnabled()) {
+ txPrepareMsgLog.debug("Failed to find future for dht prepare response [txId=null" +
+ ", dhtTxId=" + res.version() +
+ ", node=" + nodeId +
+ ", res=" + res + ']');
+ }
return;
}
+ else if (txPrepareMsgLog.isDebugEnabled())
+ txPrepareMsgLog.debug("Received dht prepare response [txId=" + fut.tx().nearXidVersion() + ", node=" + nodeId + ']');
fut.onResult(nodeId, res);
}
@@ -554,11 +603,20 @@ public class IgniteTxHandler {
GridNearTxFinishFuture fut = (GridNearTxFinishFuture)ctx.mvcc().<IgniteInternalTx>future(res.futureId());
if (fut == null) {
- if (log.isDebugEnabled())
- log.debug("Received response for unknown future (will ignore): " + res);
+ if (txFinishMsgLog.isDebugEnabled()) {
+ txFinishMsgLog.debug("Failed to find future for dht finish check committed response [txId=null" +
+ ", dhtTxId=" + res.xid() +
+ ", node=" + nodeId +
+ ", res=" + res + ']');
+ }
return;
}
+ else if (txFinishMsgLog.isDebugEnabled()) {
+ txFinishMsgLog.debug("Received dht finish check committed response [txId=" + fut.tx().nearXidVersion() +
+ ", dhtTxId=" + res.xid() +
+ ", node=" + nodeId + ']');
+ }
fut.onResult(nodeId, res);
}
@@ -566,11 +624,21 @@ public class IgniteTxHandler {
GridDhtTxFinishFuture fut = (GridDhtTxFinishFuture)ctx.mvcc().<IgniteInternalTx>future(res.futureId());
if (fut == null) {
- if (log.isDebugEnabled())
- log.debug("Received response for unknown future (will ignore): " + res);
+ if (txFinishMsgLog.isDebugEnabled()) {
+ txFinishMsgLog.debug("Failed to find future for dht finish response [txId=null" +
+ ", dhtTxId=" + res.xid() +
+ ", node=" + nodeId +
+ ", res=" + res);
+ }
return;
}
+ else if (txFinishMsgLog.isDebugEnabled()) {
+ txFinishMsgLog.debug("Received dht finish response [txId=" + fut.tx().nearXidVersion() +
+ ", dhtTxId=" + res.xid() +
+ ", node=" + nodeId + ']');
+ }
+
fut.onResult(nodeId, res);
}
@@ -583,6 +651,9 @@ public class IgniteTxHandler {
*/
@Nullable public IgniteInternalFuture<IgniteInternalTx> processNearTxFinishRequest(UUID nodeId,
GridNearTxFinishRequest req) {
+ if (txFinishMsgLog.isDebugEnabled())
+ txFinishMsgLog.debug("Received near finish request [txId=" + req.version() + ", node=" + nodeId + ']');
+
return finish(nodeId, null, req);
}
@@ -660,9 +731,11 @@ public class IgniteTxHandler {
if (tx == null && !req.explicitLock()) {
assert locTx == null : "DHT local tx should never be lost for near local tx: " + locTx;
- U.warn(log, "Received finish request for completed transaction (the message may be too late " +
- "and transaction could have been DGCed by now) [commit=" + req.commit() +
- ", xid=" + req.version() + ']');
+ U.warn(txFinishMsgLog, "Received finish request for completed transaction (the message may be too late) [" +
+ "txId=" + req.version() +
+ ", dhtTxId=" + dhtVer +
+ ", node=" + nodeId +
+ ", commit=" + req.commit() + ']');
// Always send finish response.
GridCacheMessage res = new GridNearTxFinishResponse(req.version(), req.threadId(), req.futureId(),
@@ -670,17 +743,31 @@ public class IgniteTxHandler {
try {
ctx.io().send(nodeId, res, req.policy());
+
+ if (txFinishMsgLog.isDebugEnabled()) {
+ txFinishMsgLog.debug("Sent near finish response for completed tx [txId=" + req.version() +
+ ", dhtTxId=" + dhtVer +
+ ", node=" + nodeId + ']');
+ }
}
catch (Throwable e) {
// Double-check.
if (ctx.discovery().node(nodeId) == null) {
- if (log.isDebugEnabled())
- log.debug("Node left while sending finish response [nodeId=" + nodeId + ", res=" + res +
- ']');
+ if (txFinishMsgLog.isDebugEnabled()) {
+ txFinishMsgLog.debug("Failed to send near finish response for completed tx, node failed [" +
+ "txId=" + req.version() +
+ ", dhtTxId=" + dhtVer +
+ ", node=" + nodeId + ']');
+ }
+ }
+ else {
+ U.error(txFinishMsgLog, "Failed to send near finish response for completed tx, node failed [" +
+ "txId=" + req.version() +
+ ", dhtTxId=" + dhtVer +
+ ", node=" + nodeId +
+ ", req=" + req +
+ ", res=" + res + ']', e);
}
- else
- U.error(log, "Failed to send finish response to node [nodeId=" + nodeId + ", " +
- "res=" + res + ']', e);
if (e instanceof Error)
throw (Error)e;
@@ -794,15 +881,17 @@ public class IgniteTxHandler {
* @param req Request.
*/
protected final void processDhtTxPrepareRequest(UUID nodeId, GridDhtTxPrepareRequest req) {
+ if (txPrepareMsgLog.isDebugEnabled()) {
+ txPrepareMsgLog.debug("Received dht prepare request [txId=" + req.nearXidVersion() +
+ ", dhtTxId=" + req.version() +
+ ", node=" + nodeId + ']');
+ }
+
assert nodeId != null;
assert req != null;
assert req.transactionNodes() != null;
- if (log.isDebugEnabled())
- log.debug("Processing dht tx prepare request [locNodeId=" + ctx.localNodeId() +
- ", nodeId=" + nodeId + ", req=" + req + ']');
-
GridDhtTxRemote dhtTx = null;
GridNearTxRemote nearTx = null;
@@ -862,16 +951,28 @@ public class IgniteTxHandler {
try {
// Reply back to sender.
ctx.io().send(nodeId, res, req.policy());
+
+ if (txPrepareMsgLog.isDebugEnabled()) {
+ txPrepareMsgLog.debug("Sent dht prepare response [txId=" + req.nearXidVersion() +
+ ", dhtTxId=" + req.version() +
+ ", node=" + nodeId + ']');
+ }
}
catch (IgniteCheckedException e) {
if (e instanceof ClusterTopologyCheckedException) {
- if (log.isDebugEnabled())
- log.debug("Failed to send tx response to remote node (node left grid) [node=" + nodeId +
- ", xid=" + req.version());
+ if (txPrepareMsgLog.isDebugEnabled()) {
+ txPrepareMsgLog.debug("Failed to send dht prepare response, node left [txId=" + req.nearXidVersion() +
+ ", dhtTxId=" + req.version() +
+ ", node=" + nodeId + ']');
+ }
+ }
+ else {
+ U.warn(log, "Failed to send tx response to remote node (will rollback transaction) [" +
+ "txId=" + req.nearXidVersion() +
+ ", dhtTxId=" + req.version() +
+ ", node=" + nodeId +
+ ", err=" + e.getMessage() + ']');
}
- else
- U.warn(log, "Failed to send tx response to remote node (will rollback transaction) [node=" + nodeId +
- ", xid=" + req.version() + ", err=" + e.getMessage() + ']');
if (nearTx != null)
nearTx.rollback();
@@ -890,20 +991,17 @@ public class IgniteTxHandler {
assert nodeId != null;
assert req != null;
- if (log.isDebugEnabled())
- log.debug("Processing dht tx finish request [nodeId=" + nodeId + ", req=" + req + ']');
-
if (req.checkCommitted()) {
boolean committed = req.waitRemoteTransactions() || !ctx.tm().addRolledbackTx(null, req.version());
if (!committed || !req.syncCommit())
- sendReply(nodeId, req, committed);
+ sendReply(nodeId, req, committed, null);
else {
IgniteInternalFuture<?> fut = ctx.tm().remoteTxFinishFuture(req.version());
fut.listen(new CI1<IgniteInternalFuture<?>>() {
@Override public void apply(IgniteInternalFuture<?> fut) {
- sendReply(nodeId, req, true);
+ sendReply(nodeId, req, true, null);
}
});
}
@@ -911,9 +1009,18 @@ public class IgniteTxHandler {
return;
}
- GridDhtTxRemote dhtTx = ctx.tm().tx(req.version());
+ final GridDhtTxRemote dhtTx = ctx.tm().tx(req.version());
GridNearTxRemote nearTx = ctx.tm().nearTx(req.version());
+ final GridCacheVersion nearTxId =
+ (dhtTx != null ? dhtTx.nearXidVersion() : (nearTx != null ? nearTx.nearXidVersion() : null));
+
+ if (txFinishMsgLog.isDebugEnabled()) {
+ txFinishMsgLog.debug("Received dht finish request [txId=" + nearTxId +
+ ", dhtTxId=" + req.version() +
+ ", node=" + nodeId + ']');
+ }
+
// Safety - local transaction will finish explicitly.
if (nearTx != null && nearTx.local())
nearTx = null;
@@ -929,7 +1036,7 @@ public class IgniteTxHandler {
IgniteInternalFuture<IgniteInternalTx> dhtFin = dhtTx == null ?
null : dhtTx.done() ? null : dhtTx.finishFuture();
- IgniteInternalFuture<IgniteInternalTx> nearFin = nearTx == null ?
+ final IgniteInternalFuture<IgniteInternalTx> nearFin = nearTx == null ?
null : nearTx.done() ? null : nearTx.finishFuture();
if (dhtFin != null && nearFin != null) {
@@ -948,15 +1055,15 @@ public class IgniteTxHandler {
if (completeFut != null) {
completeFut.listen(new CI1<IgniteInternalFuture<IgniteInternalTx>>() {
@Override public void apply(IgniteInternalFuture<IgniteInternalTx> igniteTxIgniteFuture) {
- sendReply(nodeId, req, true);
+ sendReply(nodeId, req, true, nearTxId);
}
});
}
else
- sendReply(nodeId, req, true);
+ sendReply(nodeId, req, true, nearTxId);
}
else
- sendReply(nodeId, req, true);
+ sendReply(nodeId, req, true, null);
}
/**
@@ -1073,8 +1180,9 @@ public class IgniteTxHandler {
* @param nodeId Node id that originated finish request.
* @param req Request.
* @param committed {@code True} if transaction committed on this node.
+ * @param nearTxId Near tx version.
*/
- protected void sendReply(UUID nodeId, GridDhtTxFinishRequest req, boolean committed) {
+ protected void sendReply(UUID nodeId, GridDhtTxFinishRequest req, boolean committed, GridCacheVersion nearTxId) {
if (req.replyRequired() || req.checkCommitted()) {
GridDhtTxFinishResponse res = new GridDhtTxFinishResponse(req.version(), req.futureId(), req.miniId());
@@ -1092,20 +1200,41 @@ public class IgniteTxHandler {
try {
ctx.io().send(nodeId, res, req.policy());
+
+ if (txFinishMsgLog.isDebugEnabled()) {
+ txFinishMsgLog.debug("Sent dht tx finish response [txId=" + nearTxId +
+ ", dhtTxId=" + req.version() +
+ ", node=" + nodeId +
+ ", checkCommitted=" + req.checkCommitted() + ']');
+ }
}
catch (Throwable e) {
// Double-check.
if (ctx.discovery().node(nodeId) == null) {
- if (log.isDebugEnabled())
- log.debug("Node left while sending finish response [nodeId=" + nodeId + ", res=" + res + ']');
+ if (txFinishMsgLog.isDebugEnabled()) {
+ txFinishMsgLog.debug("Node left while send dht tx finish response [txId=" + nearTxId +
+ ", dhtTxId=" + req.version() +
+ ", node=" + nodeId + ']');
+ }
+ }
+ else {
+ U.error(log, "Failed to send finish response to node [txId=" + nearTxId +
+ ", dhtTxId=" + req.version() +
+ ", nodeId=" + nodeId +
+ ", res=" + res + ']', e);
}
- else
- U.error(log, "Failed to send finish response to node [nodeId=" + nodeId + ", res=" + res + ']', e);
if (e instanceof Error)
throw (Error)e;
}
}
+ else {
+ if (txFinishMsgLog.isDebugEnabled()) {
+ txFinishMsgLog.debug("Skip send dht tx finish response [txId=" + nearTxId +
+ ", dhtTxId=" + req.version() +
+ ", node=" + nodeId + ']');
+ }
+ }
}
/**
@@ -1363,8 +1492,10 @@ public class IgniteTxHandler {
protected void processCheckPreparedTxRequest(final UUID nodeId,
final GridCacheTxRecoveryRequest req)
{
- if (log.isDebugEnabled())
- log.debug("Processing check prepared transaction requests [nodeId=" + nodeId + ", req=" + req + ']');
+ if (txRecoveryMsgLog.isDebugEnabled()) {
+ txRecoveryMsgLog.debug("Received tx recovery request [txId=" + req.nearXidVersion() +
+ ", node=" + nodeId + ']');
+ }
IgniteInternalFuture<Boolean> fut = req.nearTxCheck() ? ctx.tm().txCommitted(req.nearXidVersion()) :
ctx.tm().txsPreparedOrCommitted(req.nearXidVersion(), req.transactions());
@@ -1411,23 +1542,32 @@ public class IgniteTxHandler {
private void sendCheckPreparedResponse(UUID nodeId,
GridCacheTxRecoveryRequest req,
boolean prepared) {
- GridCacheTxRecoveryResponse res =
- new GridCacheTxRecoveryResponse(req.version(), req.futureId(), req.miniId(), prepared,
- req.deployInfo() != null);
+ GridCacheTxRecoveryResponse res = new GridCacheTxRecoveryResponse(req.version(),
+ req.futureId(),
+ req.miniId(),
+ prepared,
+ req.deployInfo() != null);
try {
- if (log.isDebugEnabled())
- log.debug("Sending check prepared transaction response [nodeId=" + nodeId + ", res=" + res + ']');
-
ctx.io().send(nodeId, res, req.system() ? UTILITY_CACHE_POOL : SYSTEM_POOL);
+
+ if (txRecoveryMsgLog.isDebugEnabled()) {
+ txRecoveryMsgLog.debug("Sent tx recovery response [txId=" + req.nearXidVersion() +
+ ", node=" + nodeId + ", res=" + res + ']');
+ }
}
catch (ClusterTopologyCheckedException ignored) {
- if (log.isDebugEnabled())
- log.debug("Failed to send check prepared transaction response (did node leave grid?) [nodeId=" +
- nodeId + ", res=" + res + ']');
+ if (txRecoveryMsgLog.isDebugEnabled())
+ txRecoveryMsgLog.debug("Failed to send tx recovery response, node failed [" +
+ ", txId=" + req.nearXidVersion() +
+ ", node=" + nodeId +
+ ", res=" + res + ']');
}
catch (IgniteCheckedException e) {
- U.error(log, "Failed to send response to node [nodeId=" + nodeId + ", res=" + res + ']', e);
+ U.error(txRecoveryMsgLog, "Failed to send tx recovery response [txId=" + req.nearXidVersion() +
+ ", node=" + nodeId +
+ ", req=" + req +
+ ", res=" + res + ']', e);
}
}
@@ -1436,14 +1576,19 @@ public class IgniteTxHandler {
* @param res Response.
*/
protected void processCheckPreparedTxResponse(UUID nodeId, GridCacheTxRecoveryResponse res) {
- if (log.isDebugEnabled())
- log.debug("Processing check prepared transaction response [nodeId=" + nodeId + ", res=" + res + ']');
+ if (txRecoveryMsgLog.isDebugEnabled()) {
+ txRecoveryMsgLog.debug("Received tx recovery response [txId=" + res.version() +
+ ", node=" + nodeId +
+ ", res=" + res + ']');
+ }
GridCacheTxRecoveryFuture fut = (GridCacheTxRecoveryFuture)ctx.mvcc().future(res.futureId());
if (fut == null) {
- if (log.isDebugEnabled())
- log.debug("Received response for unknown future (will ignore): " + res);
+ if (txRecoveryMsgLog.isDebugEnabled()) {
+ txRecoveryMsgLog.debug("Failed to find future for tx recovery response [txId=" + res.version() +
+ ", node=" + nodeId + ", res=" + res + ']');
+ }
return;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad76dda5/modules/core/src/test/config/log4j-test.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/log4j-test.xml b/modules/core/src/test/config/log4j-test.xml
index 29ae7b6..276de8c 100644
--- a/modules/core/src/test/config/log4j-test.xml
+++ b/modules/core/src/test/config/log4j-test.xml
@@ -96,6 +96,12 @@
</category>
-->
+ <!--
+ <category name="org.apache.ignite.cache.msg">
+ <level value="DEBUG"/>
+ </category>
+ -->
+
<!-- Disable all open source debugging. -->
<category name="org">
<level value="INFO"/>
[05/50] [abbrv] ignite git commit: Merge remote-tracking branch
'community/gridgain-7.6.1' into gridgain-7.6.1
Posted by sb...@apache.org.
Merge remote-tracking branch 'community/gridgain-7.6.1' into gridgain-7.6.1
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/735cc7ca
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/735cc7ca
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/735cc7ca
Branch: refs/heads/ignite-1232
Commit: 735cc7ca127435ddacb9ba9baf9a162c6cfc2a1f
Parents: 55e616f 5cc1f07
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jun 29 10:20:25 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jun 29 10:20:25 2016 +0300
----------------------------------------------------------------------
.../org/apache/ignite/IgniteDataStreamer.java | 5 +-
.../visor/compute/VisorGatewayTask.java | 3 +-
.../include/ignite/binary/binary_containers.h | 197 +-
.../include/ignite/binary/binary_raw_reader.h | 31 +-
.../include/ignite/binary/binary_raw_writer.h | 13 +
.../include/ignite/binary/binary_reader.h | 19 +-
.../include/ignite/binary/binary_writer.h | 13 +
.../ignite/impl/binary/binary_reader_impl.h | 11 +-
.../ignite/impl/binary/binary_writer_impl.h | 2 +-
modules/platforms/cpp/common/Makefile.am | 5 +-
.../platforms/cpp/common/include/Makefile.am | 19 +-
.../common/include/ignite/common/big_integer.h | 523 +++++
.../cpp/common/include/ignite/common/bits.h | 218 ++
.../include/ignite/common/default_allocator.h | 95 +
.../include/ignite/common/dynamic_size_array.h | 415 ++++
.../include/ignite/common/fixed_size_array.h | 288 +++
.../cpp/common/include/ignite/common/utils.h | 81 +-
.../platforms/cpp/common/include/ignite/date.h | 2 +-
.../platforms/cpp/common/include/ignite/guid.h | 4 +-
.../cpp/common/include/ignite/ignite_error.h | 19 +-
.../cpp/common/include/ignite/timestamp.h | 2 +-
.../cpp/common/os/win/src/common/utils.cpp | 21 -
.../cpp/common/project/vs/common.vcxproj | 17 +-
.../common/project/vs/common.vcxproj.filters | 27 +
.../cpp/common/src/common/big_integer.cpp | 830 +++++++
.../platforms/cpp/common/src/common/bits.cpp | 233 ++
.../platforms/cpp/common/src/ignite_error.cpp | 12 +-
modules/platforms/cpp/core-test/Makefile.am | 4 +
.../cpp/core-test/project/vs/core-test.vcxproj | 7 +
.../project/vs/core-test.vcxproj.filters | 12 +
.../platforms/cpp/core-test/src/bits_test.cpp | 124 +
.../cpp/core-test/src/decimal_test.cpp | 1101 +++++++++
.../core-test/src/dynamic_size_array_test.cpp | 360 +++
.../cpp/core-test/src/fixed_size_array_test.cpp | 208 ++
.../cpp/core/include/ignite/cache/cache.h | 186 +-
.../cpp/core/include/ignite/cache/cache_entry.h | 16 +-
.../include/ignite/cache/query/query_argument.h | 33 +-
.../include/ignite/cache/query/query_cursor.h | 17 +-
.../ignite/cache/query/query_fields_cursor.h | 11 +-
.../ignite/cache/query/query_fields_row.h | 22 +-
.../include/ignite/cache/query/query_scan.h | 10 +-
.../core/include/ignite/cache/query/query_sql.h | 15 +-
.../ignite/cache/query/query_sql_fields.h | 15 +-
.../platforms/cpp/core/include/ignite/ignite.h | 21 +-
.../core/include/ignite/ignite_configuration.h | 4 +-
.../cpp/core/include/ignite/ignition.h | 2 +-
.../include/ignite/transactions/transaction.h | 68 +-
.../ignite/transactions/transaction_consts.h | 84 +-
.../ignite/transactions/transaction_metrics.h | 13 +-
.../include/ignite/transactions/transactions.h | 36 +-
modules/platforms/cpp/core/namespaces.dox | 2 +-
modules/platforms/cpp/cpp.dxg | 4 +-
modules/platforms/cpp/odbc-test/Makefile.am | 1 -
.../cpp/odbc-test/project/vs/odbc-test.vcxproj | 1 -
.../project/vs/odbc-test.vcxproj.filters | 3 -
.../src/application_data_buffer_test.cpp | 35 +-
.../platforms/cpp/odbc-test/src/row_test.cpp | 5 +-
modules/platforms/cpp/odbc/Makefile.am | 1 -
modules/platforms/cpp/odbc/include/Makefile.am | 1 -
.../ignite/odbc/app/application_data_buffer.h | 11 +-
.../cpp/odbc/include/ignite/odbc/decimal.h | 137 --
.../cpp/odbc/include/ignite/odbc/utility.h | 12 +-
.../platforms/cpp/odbc/project/vs/odbc.vcxproj | 2 -
.../cpp/odbc/project/vs/odbc.vcxproj.filters | 6 -
.../odbc/src/app/application_data_buffer.cpp | 210 +-
.../platforms/cpp/odbc/src/app/parameter.cpp | 6 +-
modules/platforms/cpp/odbc/src/column.cpp | 6 +-
modules/platforms/cpp/odbc/src/connection.cpp | 1 -
modules/platforms/cpp/odbc/src/decimal.cpp | 135 --
modules/platforms/cpp/odbc/src/odbc.cpp | 3 -
modules/platforms/cpp/odbc/src/utility.cpp | 25 +-
modules/schema-import/README.txt | 12 +-
modules/web-agent/README.txt | 25 +-
.../web-agent/assembly/release-web-agent.xml | 2 -
modules/web-agent/bin/ignite-web-agent.bat | 2 +-
modules/web-agent/bin/ignite-web-agent.sh | 2 +-
modules/web-agent/pom.xml | 22 +-
.../console/agent/AgentConfiguration.java | 53 +-
.../ignite/console/agent/AgentLauncher.java | 21 +-
.../ignite/console/demo/AgentClusterDemo.java | 82 +-
modules/web-console/README.txt | 4 +-
modules/web-console/src/main/js/.eslintrc | 7 +-
.../src/main/js/app/data/getting-started.json | 2 +-
.../src/main/js/app/data/pom-dependencies.json | 20 +
.../directives/ui-ace-docker/ui-ace-docker.jade | 4 +-
.../ui-ace-java/ui-ace-java.directive.js | 4 +-
.../directives/ui-ace-pojos/ui-ace-pojos.jade | 4 +-
.../ui-ace-xml/ui-ace-xml.directive.js | 4 +-
.../src/main/js/app/helpers/jade/mixins.jade | 17 +-
modules/web-console/src/main/js/app/index.js | 18 +-
.../src/main/js/app/modules/Demo/Demo.module.js | 14 +-
.../QueryNotebooks/QueryNotebooks.provider.js | 115 -
.../main/js/app/modules/agent/agent.module.js | 323 +++
.../configuration/generator/Pom.service.js | 46 +-
.../form/field/input/datalist.directive.js | 6 +-
.../modules/form/field/input/text.directive.js | 9 +-
.../js/app/modules/form/field/input/text.jade | 2 +-
.../app/modules/form/group/group.directive.js | 6 +-
.../form/validator/java-keywords.directive.js | 9 +-
.../src/main/js/app/modules/loading/loading.css | 2 +-
.../query-notebooks/query-notebooks.module.js | 115 +
.../app/modules/states/configuration.state.js | 32 +-
.../states/configuration/caches/general.jade | 2 +-
.../states/configuration/caches/store.jade | 37 +-
.../clusters/attributes.directive.js | 27 +
.../configuration/clusters/attributes.jade | 58 +
.../states/configuration/clusters/binary.jade | 12 +-
.../clusters/collision.directive.js | 27 +
.../configuration/clusters/collision.jade | 60 +
.../clusters/collision/custom.directive.js | 27 +
.../clusters/collision/custom.jade | 24 +
.../clusters/collision/fifo-queue.directive.js | 27 +
.../clusters/collision/fifo-queue.jade | 28 +
.../collision/job-stealing.directive.js | 27 +
.../clusters/collision/job-stealing.jade | 64 +
.../collision/priority-queue.directive.js | 27 +
.../clusters/collision/priority-queue.jade | 43 +
.../configuration/clusters/communication.jade | 30 +-
.../configuration/clusters/deployment.jade | 31 +-
.../configuration/clusters/discovery.jade | 4 +-
.../clusters/failover.directive.js | 27 +
.../states/configuration/clusters/failover.jade | 82 +
.../states/configuration/clusters/general.jade | 20 +-
.../clusters/general/discovery/cloud.jade | 6 +-
.../clusters/general/discovery/google.jade | 11 +-
.../clusters/general/discovery/s3.jade | 4 +-
.../clusters/general/discovery/zookeeper.jade | 21 +-
.../bounded-exponential-backoff.jade | 6 +-
.../discovery/zookeeper/retrypolicy/custom.jade | 6 +-
.../retrypolicy/exponential-backoff.jade | 6 +-
.../zookeeper/retrypolicy/forever.jade | 2 +-
.../zookeeper/retrypolicy/n-times.jade | 2 +-
.../zookeeper/retrypolicy/one-time.jade | 2 +-
.../zookeeper/retrypolicy/until-elapsed.jade | 4 +-
.../states/configuration/clusters/igfs.jade | 4 +-
.../configuration/clusters/logger.directive.js | 27 +
.../states/configuration/clusters/logger.jade | 65 +
.../clusters/logger/custom.directive.js | 27 +
.../configuration/clusters/logger/custom.jade | 24 +
.../clusters/logger/log4j.directive.js | 27 +
.../configuration/clusters/logger/log4j.jade | 49 +
.../clusters/logger/log4j2.directive.js | 27 +
.../configuration/clusters/logger/log4j2.jade | 38 +
.../states/configuration/domains/query.jade | 4 +-
.../states/configuration/domains/store.jade | 2 +-
.../modules/states/configuration/igfs/misc.jade | 2 +-
.../main/js/app/modules/user/Auth.service.js | 19 +-
.../js/app/services/AgentMonitor.service.js | 337 ---
.../src/main/js/app/services/cleanup.service.js | 4 +-
.../src/main/js/build/system.config.js | 55 +-
.../src/main/js/controllers/admin-controller.js | 14 +-
.../main/js/controllers/caches-controller.js | 336 ++-
.../main/js/controllers/clusters-controller.js | 537 +++--
.../src/main/js/controllers/common-module.js | 1052 +++++----
.../main/js/controllers/domains-controller.js | 847 ++++---
.../src/main/js/controllers/igfs-controller.js | 212 +-
.../main/js/controllers/profile-controller.js | 60 +-
.../src/main/js/controllers/sql-controller.js | 2173 +++++++++---------
.../src/main/js/generator/generator-common.js | 151 +-
.../src/main/js/generator/generator-java.js | 998 ++++----
.../src/main/js/generator/generator-optional.js | 2 +-
.../main/js/generator/generator-properties.js | 25 +-
.../src/main/js/generator/generator-readme.js | 6 +-
.../src/main/js/generator/generator-xml.js | 430 +++-
.../main/js/gulpfile.babel.js/tasks/eslint.js | 3 +
.../src/main/js/public/images/cluster.png | Bin 29670 -> 29376 bytes
.../src/main/js/public/images/query-table.png | Bin 42253 -> 29189 bytes
.../src/main/js/public/stylesheets/style.scss | 28 +
modules/web-console/src/main/js/serve/agent.js | 222 +-
.../web-console/src/main/js/serve/browser.js | 120 +-
.../web-console/src/main/js/serve/configure.js | 1 +
modules/web-console/src/main/js/serve/mongo.js | 58 +-
.../src/main/js/serve/routes/agent.js | 3 +-
.../src/main/js/serve/routes/caches.js | 4 +-
.../src/main/js/serve/routes/clusters.js | 8 +-
.../src/main/js/serve/routes/igfs.js | 2 +-
.../src/main/js/serve/routes/profile.js | 11 +-
.../src/main/js/serve/routes/public.js | 35 +-
.../main/js/views/configuration/clusters.jade | 4 +
.../js/views/configuration/domains-import.jade | 325 +--
.../src/main/js/views/settings/profile.jade | 14 +-
.../web-console/src/main/js/views/signin.jade | 26 +-
.../src/main/js/views/sql/cache-metadata.jade | 2 +-
.../web-console/src/main/js/views/sql/sql.jade | 205 +-
184 files changed, 11535 insertions(+), 4909 deletions(-)
----------------------------------------------------------------------
[42/50] [abbrv] ignite git commit: Merge remote-tracking branch
'remotes/community/gridgain-7.6.2'
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/community/gridgain-7.6.2'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9e4d5505
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9e4d5505
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9e4d5505
Branch: refs/heads/ignite-1232
Commit: 9e4d55057eec8a3c2eb5876949cd496ebf05aa3f
Parents: cc0de45 f267a30
Author: Denis Magda <dm...@gridgain.com>
Authored: Wed Jul 6 13:25:25 2016 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Jul 6 13:25:25 2016 +0300
----------------------------------------------------------------------
.../IgniteCountDownLatchAbstractSelfTest.java | 2 -
modules/yardstick/pom.xml | 46 +++---
.../IgniteCacheRandomOperationBenchmark.java | 147 ++++++++++++-------
.../yardstick/cache/load/model/ModelUtil.java | 6 +-
4 files changed, 124 insertions(+), 77 deletions(-)
----------------------------------------------------------------------
[28/50] [abbrv] ignite git commit: IGNITE-3410: IGFS: Added missing
classes to BInaryContext.
Posted by sb...@apache.org.
IGNITE-3410: IGFS: Added missing classes to BInaryContext.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/58f3d0f9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/58f3d0f9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/58f3d0f9
Branch: refs/heads/ignite-1232
Commit: 58f3d0f99c71b7a610f91e7ae2aa12a9daeda017
Parents: 3b22e83
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Jul 1 14:58:31 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Jul 6 09:53:45 2016 +0300
----------------------------------------------------------------------
.../ignite/internal/binary/BinaryContext.java | 35 ++++++++++++++++++++
1 file changed, 35 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/58f3d0f9/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 d39f9c6..593e8af 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
@@ -70,9 +70,25 @@ import org.apache.ignite.internal.processors.igfs.IgfsFileAffinityRange;
import org.apache.ignite.internal.processors.igfs.IgfsFileInfo;
import org.apache.ignite.internal.processors.igfs.IgfsFileMap;
import org.apache.ignite.internal.processors.igfs.IgfsListingEntry;
+import org.apache.ignite.internal.processors.igfs.client.IgfsClientAffinityCallable;
+import org.apache.ignite.internal.processors.igfs.client.IgfsClientDeleteCallable;
+import org.apache.ignite.internal.processors.igfs.client.IgfsClientExistsCallable;
+import org.apache.ignite.internal.processors.igfs.client.IgfsClientInfoCallable;
+import org.apache.ignite.internal.processors.igfs.client.IgfsClientListFilesCallable;
+import org.apache.ignite.internal.processors.igfs.client.IgfsClientListPathsCallable;
+import org.apache.ignite.internal.processors.igfs.client.IgfsClientMkdirsCallable;
+import org.apache.ignite.internal.processors.igfs.client.IgfsClientRenameCallable;
+import org.apache.ignite.internal.processors.igfs.client.IgfsClientSetTimesCallable;
+import org.apache.ignite.internal.processors.igfs.client.IgfsClientSizeCallable;
+import org.apache.ignite.internal.processors.igfs.client.IgfsClientSummaryCallable;
+import org.apache.ignite.internal.processors.igfs.client.IgfsClientUpdateCallable;
+import org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaIdsForPathCallable;
+import org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaInfoForPathCallable;
+import org.apache.ignite.internal.processors.igfs.data.IgfsDataPutProcessor;
import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryCreateProcessor;
import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryListingAddProcessor;
import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryListingRemoveProcessor;
+import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryListingRenameProcessor;
import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryListingReplaceProcessor;
import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaFileCreateProcessor;
import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaFileLockProcessor;
@@ -126,9 +142,12 @@ public class BinaryContext {
sysClss.add(IgfsFileMap.class.getName());
sysClss.add(IgfsListingEntry.class.getName());
+ sysClss.add(IgfsDataPutProcessor.class.getName());
+
sysClss.add(IgfsMetaDirectoryCreateProcessor.class.getName());
sysClss.add(IgfsMetaDirectoryListingAddProcessor.class.getName());
sysClss.add(IgfsMetaDirectoryListingRemoveProcessor.class.getName());
+ sysClss.add(IgfsMetaDirectoryListingRenameProcessor.class.getName());
sysClss.add(IgfsMetaDirectoryListingReplaceProcessor.class.getName());
sysClss.add(IgfsMetaFileCreateProcessor.class.getName());
sysClss.add(IgfsMetaFileLockProcessor.class.getName());
@@ -139,6 +158,22 @@ public class BinaryContext {
sysClss.add(IgfsMetaUpdatePropertiesProcessor.class.getName());
sysClss.add(IgfsMetaUpdateTimesProcessor.class.getName());
+ sysClss.add(IgfsClientMetaIdsForPathCallable.class.getName());
+ sysClss.add(IgfsClientMetaInfoForPathCallable.class.getName());
+
+ sysClss.add(IgfsClientAffinityCallable.class.getName());
+ sysClss.add(IgfsClientDeleteCallable.class.getName());
+ sysClss.add(IgfsClientExistsCallable.class.getName());
+ sysClss.add(IgfsClientInfoCallable.class.getName());
+ sysClss.add(IgfsClientListFilesCallable.class.getName());
+ sysClss.add(IgfsClientListPathsCallable.class.getName());
+ sysClss.add(IgfsClientMkdirsCallable.class.getName());
+ sysClss.add(IgfsClientRenameCallable.class.getName());
+ sysClss.add(IgfsClientSetTimesCallable.class.getName());
+ sysClss.add(IgfsClientSizeCallable.class.getName());
+ sysClss.add(IgfsClientSummaryCallable.class.getName());
+ sysClss.add(IgfsClientUpdateCallable.class.getName());
+
// Closure processor classes.
sysClss.add(GridClosureProcessor.C1V2.class.getName());
sysClss.add(GridClosureProcessor.C1MLAV2.class.getName());
[04/50] [abbrv] ignite git commit: ignite-3361 Fixed condition in
GridServiceProcessor.reassign. (cherry picked from commit 76c76f8)
Posted by sb...@apache.org.
ignite-3361 Fixed condition in GridServiceProcessor.reassign.
(cherry picked from commit 76c76f8)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/55e616f7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/55e616f7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/55e616f7
Branch: refs/heads/ignite-1232
Commit: 55e616f781a653071b7992aba85ced9af895176d
Parents: a70ff4c
Author: sboikov <sb...@gridgain.com>
Authored: Mon Jun 27 15:53:03 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jun 29 10:19:38 2016 +0300
----------------------------------------------------------------------
.../service/GridServiceProcessor.java | 2 +-
.../service/IgniteServiceReassignmentTest.java | 250 +++++++++++++++++++
.../testsuites/IgniteKernalSelfTestSuite.java | 2 +
3 files changed, 253 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/55e616f7/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
index 0bc1141..fd895ea 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
@@ -963,7 +963,7 @@ public class GridServiceProcessor extends GridProcessorAdapter {
for (Map.Entry<UUID, Integer> e : entries) {
// Assign only the ones that have not been reused from previous assignments.
if (!used.contains(e.getKey())) {
- if (e.getValue() < maxPerNodeCnt) {
+ if (e.getValue() < maxPerNodeCnt || maxPerNodeCnt == 0) {
e.setValue(e.getValue() + 1);
if (--remainder == 0)
http://git-wip-us.apache.org/repos/asf/ignite/blob/55e616f7/modules/core/src/test/java/org/apache/ignite/internal/processors/service/IgniteServiceReassignmentTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/IgniteServiceReassignmentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/IgniteServiceReassignmentTest.java
new file mode 100644
index 0000000..d7937ec
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/IgniteServiceReassignmentTest.java
@@ -0,0 +1,250 @@
+/*
+ * 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.processors.service;
+
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.PA;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.services.Service;
+import org.apache.ignite.services.ServiceConfiguration;
+import org.apache.ignite.services.ServiceContext;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class IgniteServiceReassignmentTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private ServiceConfiguration srvcCfg;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
+
+ if (srvcCfg != null)
+ cfg.setServiceConfiguration(srvcCfg);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ super.afterTest();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testNodeRestart1() throws Exception {
+ srvcCfg = serviceConfiguration();
+
+ Ignite node1 = startGrid(1);
+
+ assertEquals(42, serviceProxy(node1).foo());
+
+ srvcCfg = serviceConfiguration();
+
+ Ignite node2 = startGrid(2);
+
+ node1.close();
+
+ waitForService(node2);
+
+ assertEquals(42, serviceProxy(node2).foo());
+
+ srvcCfg = serviceConfiguration();
+
+ Ignite node3 = startGrid(3);
+
+ assertEquals(42, serviceProxy(node3).foo());
+
+ srvcCfg = serviceConfiguration();
+
+ node1 = startGrid(1);
+
+ assertEquals(42, serviceProxy(node1).foo());
+ assertEquals(42, serviceProxy(node2).foo());
+ assertEquals(42, serviceProxy(node3).foo());
+
+ node2.close();
+
+ waitForService(node1);
+
+ assertEquals(42, serviceProxy(node1).foo());
+ assertEquals(42, serviceProxy(node3).foo());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testNodeRestart2() throws Exception {
+ startGrids(3);
+
+ ServiceConfiguration svcCfg = new ServiceConfiguration();
+
+ svcCfg.setName("DummyService");
+ svcCfg.setTotalCount(10);
+ svcCfg.setMaxPerNodeCount(1);
+ svcCfg.setService(new DummyService());
+
+ ignite(0).services().deploy(svcCfg);
+
+ for (int i = 0; i < 3; i++)
+ assertEquals(42, serviceProxy(ignite(i)).foo());
+
+ for (int i = 0; i < 3; i++)
+ startGrid(i + 3);
+
+ for (int i = 0; i < 3; i++)
+ stopGrid(i);
+
+ for (int i = 0; i < 3; i++)
+ assertEquals(42, serviceProxy(ignite(i + 3)).foo());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testNodeRestartRandom() throws Exception {
+ final int NODES = 5;
+
+ Ignite ignite = startGridsMultiThreaded(NODES);
+
+ ignite.services().deploy(serviceConfiguration());
+
+ for (int i = 0; i < 30; i++) {
+ log.info("Iteration: " + i);
+
+ int stopIdx = ThreadLocalRandom.current().nextInt(NODES);
+
+ stopGrid(stopIdx);
+
+ for (int nodeIdx = 0; nodeIdx < NODES; nodeIdx++) {
+ if (nodeIdx == stopIdx)
+ continue;
+
+ waitForService(ignite(nodeIdx));
+
+ assertEquals(42, serviceProxy(ignite(nodeIdx)).foo());
+ }
+
+ startGrid(stopIdx);
+
+ for (int nodeIdx = 0; nodeIdx < NODES; nodeIdx++)
+ assertEquals(42, serviceProxy(ignite(nodeIdx)).foo());
+ }
+ }
+
+ /**
+ * @param node Node.
+ * @throws Exception If failed.
+ */
+ private void waitForService(final Ignite node) throws Exception {
+ assertTrue(GridTestUtils.waitForCondition(new PA() {
+ @Override public boolean apply() {
+ try {
+ serviceProxy(node).foo();
+
+ return true;
+ }
+ catch (IgniteException e) {
+ return false;
+ }
+ }
+ }, 5000));
+ }
+
+ /**
+ * @param node Node.
+ * @return Service proxy.
+ */
+ private static MyService serviceProxy(Ignite node) {
+ return node.services().serviceProxy("DummyService", MyService.class, true);
+ }
+
+ /**
+ * @return Service configuration.
+ */
+ private ServiceConfiguration serviceConfiguration() {
+ ServiceConfiguration svc = new ServiceConfiguration();
+
+ svc.setName("DummyService");
+ svc.setTotalCount(1);
+ svc.setService(new DummyService());
+
+ return svc;
+ }
+
+ /**
+ *
+ */
+ public interface MyService {
+ /**
+ * @return Dummy result.
+ */
+ int foo();
+ }
+
+ /**
+ *
+ */
+ static class DummyService implements MyService, Service {
+ /** */
+ @IgniteInstanceResource
+ private Ignite locNode;
+
+ /** {@inheritDoc} */
+ @Override public void cancel(ServiceContext ctx) {
+ locNode.log().info("Service cancelled [execId=" + ctx.executionId() +
+ ", node=" + locNode.cluster().localNode() + ']');
+ }
+
+ /** {@inheritDoc} */
+ @Override public void init(ServiceContext ctx) {
+ locNode.log().info("Service initialized [execId=" + ctx.executionId() +
+ ", node=" + locNode.cluster().localNode() + ']');
+ }
+
+ /** {@inheritDoc} */
+ @Override public void execute(ServiceContext ctx) {
+ locNode.log().info("Service started [execId=" + ctx.executionId() +
+ ", node=" + locNode.cluster().localNode() + ']');
+ }
+
+ /** {@inheritDoc} */
+ @Override public int foo() {
+ locNode.log().info("Service called.");
+
+ return 42;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/55e616f7/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
index c9cb531..b91fff4 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
@@ -66,6 +66,7 @@ import org.apache.ignite.internal.processors.service.IgniteServiceDeployment2Cla
import org.apache.ignite.internal.processors.service.IgniteServiceDeploymentClassLoadingDefaultMarshallerTest;
import org.apache.ignite.internal.processors.service.IgniteServiceDeploymentClassLoadingJdkMarshallerTest;
import org.apache.ignite.internal.processors.service.IgniteServiceDeploymentClassLoadingOptimizedMarshallerTest;
+import org.apache.ignite.internal.processors.service.IgniteServiceReassignmentTest;
import org.apache.ignite.internal.processors.service.ServicePredicateAccessCacheTest;
import org.apache.ignite.internal.util.GridStartupWithSpecifiedWorkDirectorySelfTest;
import org.apache.ignite.internal.util.GridStartupWithUndefinedIgniteHomeSelfTest;
@@ -141,6 +142,7 @@ public class IgniteKernalSelfTestSuite extends TestSuite {
suite.addTestSuite(GridServiceSerializationSelfTest.class);
suite.addTestSuite(GridServiceProxyNodeStopSelfTest.class);
suite.addTestSuite(GridServiceProxyClientReconnectSelfTest.class);
+ suite.addTestSuite(IgniteServiceReassignmentTest.class);
suite.addTestSuite(IgniteServiceDeploymentClassLoadingDefaultMarshallerTest.class);
suite.addTestSuite(IgniteServiceDeploymentClassLoadingOptimizedMarshallerTest.class);
[19/50] [abbrv] ignite git commit: IGNITE-3326 Map-reduce query waits
for rebalancing forever when it's disabled. - Fixes #813.
Posted by sb...@apache.org.
IGNITE-3326 Map-reduce query waits for rebalancing forever when it's disabled. - Fixes #813.
Signed-off-by: Sergi Vladykin <se...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d33f4db1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d33f4db1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d33f4db1
Branch: refs/heads/ignite-1232
Commit: d33f4db130d4379fa3ab7320ccf118a94c17b889
Parents: 583ef2e
Author: ascherbakoff <al...@gmail.com>
Authored: Tue Jun 21 08:25:56 2016 +0300
Committer: Alexei Scherbakov <al...@gmail.com>
Committed: Tue Jul 5 09:07:56 2016 +0100
----------------------------------------------------------------------
.../ignite/internal/GridGetOrStartSelfTest.java | 70 +++++++++++++++++
.../query/h2/twostep/GridMapQueryExecutor.java | 2 +-
.../IgniteCacheQueryNoRebalanceSelfTest.java | 82 ++++++++++++++++++++
.../IgniteCacheQuerySelfTestSuite.java | 2 +
4 files changed, 155 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d33f4db1/modules/core/src/test/java/org/apache/ignite/internal/GridGetOrStartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridGetOrStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridGetOrStartSelfTest.java
new file mode 100644
index 0000000..26d98ba
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridGetOrStartSelfTest.java
@@ -0,0 +1,70 @@
+/*
+ * 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;
+
+import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+/**
+ * The GirdGetOrStartSelfTest tests get or start semantics. See IGNITE-2941
+ */
+
+@GridCommonTest(group = "Kernal Self")
+public class GridGetOrStartSelfTest extends GridCommonAbstractTest {
+ /**
+ * Default constructor.
+ */
+ public GridGetOrStartSelfTest() {
+ super(false);
+ }
+
+ /**
+ * Tests default grid
+ */
+ public void testDefaultGridGetOrStart() throws Exception {
+ IgniteConfiguration cfg = getConfiguration(null);
+ try(Ignite ignite = Ignition.getOrStart(cfg)) {
+ try {
+ Ignition.start(cfg);
+ fail("Expected exception after grid started");
+ }
+ catch (IgniteException ignored) {
+ }
+ Ignite ignite2 = Ignition.getOrStart(cfg);
+ assertEquals("Must return same instance", ignite, ignite2);
+ }
+ }
+
+ /**
+ * Tests named grid
+ */
+ public void testNamedGridGetOrStart() throws Exception {
+ IgniteConfiguration cfg = getConfiguration("test");
+ try(Ignite ignite = Ignition.getOrStart(cfg)) {
+ try {
+ Ignition.start(cfg);
+ fail("Expected exception after grid started");
+ }
+ catch (IgniteException ignored) {
+ }
+ Ignite ignite2 = Ignition.getOrStart(cfg);
+ assertEquals("Must return same instance", ignite, ignite2);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d33f4db1/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
index 3d226e5..580058c 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
@@ -277,7 +277,7 @@ public class GridMapQueryExecutor {
if (cctx == null) // Cache was not found, probably was not deployed yet.
return false;
- if (cctx.isLocal())
+ if (cctx.isLocal() || !cctx.rebalanceEnabled())
continue;
// For replicated cache topology version does not make sense.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d33f4db1/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNoRebalanceSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNoRebalanceSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNoRebalanceSelfTest.java
new file mode 100644
index 0000000..ac96cc5
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNoRebalanceSelfTest.java
@@ -0,0 +1,82 @@
+/*
+ * 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.processors.cache.distributed.near;
+
+import javax.cache.Cache;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheRebalanceMode;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.SqlQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * Test added to check for https://issues.apache.org/jira/browse/IGNITE-3326.
+ */
+public class IgniteCacheQueryNoRebalanceSelfTest extends GridCommonAbstractTest {
+ /** */
+ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /**
+ *
+ */
+ public IgniteCacheQueryNoRebalanceSelfTest() {
+ super(true);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration() throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration();
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+ CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+ ccfg.setBackups(0);
+ ccfg.setIndexedTypes(Integer.class, Integer.class);
+ ccfg.setRebalanceMode(CacheRebalanceMode.NONE);
+
+ cfg.setCacheConfiguration(ccfg);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+
+ super.afterTestsStopped();
+ }
+
+ /**
+ * Tests correct query execution with disabled re-balancing.
+ */
+ public void testQueryNoRebalance() {
+ IgniteCache<Object, Object> cache = grid().cache(null);
+
+ cache.put(1, 1);
+
+ QueryCursor<Cache.Entry<Integer, Integer>> qry =
+ cache.query(new SqlQuery<Integer, Integer>(Integer.class, "_key >= 0"));
+
+ assertEquals("Bad results count", 1, qry.getAll().size());
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d33f4db1/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
index 7b39453..1b1908d 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
@@ -47,6 +47,7 @@ import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCacheC
import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCachePartitionedQueryP2PDisabledSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCachePartitionedQuerySelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCachePartitionedSnapshotEnabledQuerySelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCacheQueryNoRebalanceSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCacheQueryNodeFailTest;
import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCacheQueryNodeRestartSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCacheQueryNodeRestartSelfTest2;
@@ -113,6 +114,7 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
suite.addTestSuite(IgniteBinaryObjectFieldsQuerySelfTest.class);
suite.addTestSuite(IgniteBinaryWrappedObjectFieldsQuerySelfTest.class);
suite.addTestSuite(IgniteCacheQueryH2IndexingLeakTest.class);
+ suite.addTestSuite(IgniteCacheQueryNoRebalanceSelfTest.class);
return suite;
}
[33/50] [abbrv] ignite git commit: ignite-3428 Fixed message recovery
handling on reconnect (cherry picked from commit 89d722c)
Posted by sb...@apache.org.
ignite-3428 Fixed message recovery handling on reconnect
(cherry picked from commit 89d722c)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e9a508ef
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e9a508ef
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e9a508ef
Branch: refs/heads/ignite-1232
Commit: e9a508ef0d86d5114d709bcaa7666bde7e69efd2
Parents: 2e65beb
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jul 6 09:31:07 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jul 6 10:47:41 2016 +0300
----------------------------------------------------------------------
.../util/nio/GridNioRecoveryDescriptor.java | 19 ++-
.../ignite/internal/util/nio/GridNioServer.java | 47 ++++--
.../util/nio/GridSelectorNioSessionImpl.java | 7 +
.../communication/tcp/TcpCommunicationSpi.java | 163 ++++++++++++-------
...gniteCacheMessageRecoveryIdleConnection.java | 154 ++++++++++++++++++
.../ignite/testsuites/IgniteCacheTestSuite.java | 2 +
6 files changed, 321 insertions(+), 71 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e9a508ef/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java
index 409bded..35480ac 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java
@@ -74,6 +74,9 @@ public class GridNioRecoveryDescriptor {
/** Maximum size of unacknowledged messages queue. */
private final int queueLimit;
+ /** Number of descriptor reservations (for info purposes). */
+ private int reserveCnt;
+
/**
* @param queueLimit Maximum size of unacknowledged messages queue.
* @param node Node.
@@ -256,9 +259,12 @@ public class GridNioRecoveryDescriptor {
while (!connected && reserved)
wait();
- if (!connected)
+ if (!connected) {
reserved = true;
+ reserveCnt++;
+ }
+
return !connected;
}
}
@@ -375,12 +381,23 @@ public class GridNioRecoveryDescriptor {
else {
reserved = true;
+ reserveCnt++;
+
return true;
}
}
}
/**
+ * @return Number of descriptor reservations.
+ */
+ public int reserveCount() {
+ synchronized (this) {
+ return reserveCnt;
+ }
+ }
+
+ /**
* @param futs Futures to complete.
*/
private void completeOnNodeLeft(GridNioFuture<?>[] futs) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/e9a508ef/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
index 9fd5e69..24b8fad 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
@@ -1461,11 +1461,7 @@ public class GridNioServer<T> {
sb.append(" Connection info [")
.append("rmtAddr=").append(ses.remoteAddress())
- .append(", locAddr=").append(ses.localAddress())
- .append(", msgWriter=").append(writer != null ? writer.toString() : "null")
- .append(", msgReader=").append(reader != null ? reader.toString() : "null")
- .append(", bytesRcvd=").append(ses.bytesReceived())
- .append(", bytesSent=").append(ses.bytesSent());
+ .append(", locAddr=").append(ses.localAddress());
GridNioRecoveryDescriptor desc = ses.recoveryDescriptor();
@@ -1478,6 +1474,28 @@ public class GridNioServer<T> {
else
sb.append(", recoveryDesc=null");
+ sb.append(", bytesRcvd=").append(ses.bytesReceived())
+ .append(", bytesSent=").append(ses.bytesSent())
+ .append(", opQueueSize=").append(ses.writeQueueSize())
+ .append(", msgWriter=").append(writer != null ? writer.toString() : "null")
+ .append(", msgReader=").append(reader != null ? reader.toString() : "null");
+
+ int cnt = 0;
+
+ for (GridNioFuture<?> fut : ses.writeQueue()) {
+ if (cnt == 0)
+ sb.append(",\n opQueue=[").append(fut);
+ else
+ sb.append(',').append(fut);
+
+ if (++cnt == 5) {
+ sb.append(']');
+
+ break;
+ }
+ }
+
+
sb.append("]").append(U.nl());
}
@@ -1803,13 +1821,6 @@ public class GridNioServer<T> {
if (e != null)
filterChain.onExceptionCaught(ses, e);
- try {
- filterChain.onSessionClosed(ses);
- }
- catch (IgniteCheckedException e1) {
- filterChain.onExceptionCaught(ses, e1);
- }
-
ses.removeMeta(BUF_META_KEY);
// Since ses is in closed state, no write requests will be added.
@@ -1837,6 +1848,13 @@ public class GridNioServer<T> {
fut.connectionClosed();
}
+ try {
+ filterChain.onSessionClosed(ses);
+ }
+ catch (IgniteCheckedException e1) {
+ filterChain.onExceptionCaught(ses, e1);
+ }
+
return true;
}
@@ -2062,24 +2080,29 @@ public class GridNioServer<T> {
private SocketChannel sockCh;
/** Session to perform operation on. */
+ @GridToStringExclude
private GridSelectorNioSessionImpl ses;
/** Is it a close request or a write request. */
private NioOperation op;
/** Message. */
+ @GridToStringExclude
private ByteBuffer msg;
/** Direct message. */
private Message commMsg;
/** */
+ @GridToStringExclude
private boolean accepted;
/** */
+ @GridToStringExclude
private Map<Integer, ?> meta;
/** */
+ @GridToStringExclude
private boolean skipRecovery;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/e9a508ef/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
index 1241f99..0ba6af2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
@@ -264,6 +264,13 @@ class GridSelectorNioSessionImpl extends GridNioSessionImpl {
return queueSize.get();
}
+ /**
+ * @return Write requests.
+ */
+ Collection<GridNioFuture<?>> writeQueue() {
+ return queue;
+ }
+
/** {@inheritDoc} */
@Override public void recoveryDescriptor(GridNioRecoveryDescriptor recoveryDesc) {
assert recoveryDesc != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/e9a508ef/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 875131d..2c03b2d 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -353,30 +353,31 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
UUID id = ses.meta(NODE_ID_META);
if (id != null) {
- GridCommunicationClient rmv = clients.get(id);
+ if (!stopping) {
+ boolean reconnect = false;
- if (rmv instanceof GridTcpNioCommunicationClient &&
- ((GridTcpNioCommunicationClient)rmv).session() == ses &&
- clients.remove(id, rmv)) {
- rmv.forceClose();
+ GridNioRecoveryDescriptor recoveryData = ses.recoveryDescriptor();
- if (!stopping) {
- GridNioRecoveryDescriptor recoveryData = ses.recoveryDescriptor();
+ if (recoveryData != null) {
+ if (recoveryData.nodeAlive(getSpiContext().node(id))) {
+ if (!recoveryData.messagesFutures().isEmpty()) {
+ reconnect = true;
- if (recoveryData != null) {
- if (recoveryData.nodeAlive(getSpiContext().node(id))) {
- if (!recoveryData.messagesFutures().isEmpty()) {
- if (log.isDebugEnabled())
- log.debug("Session was closed but there are unacknowledged messages, " +
- "will try to reconnect [rmtNode=" + recoveryData.node().id() + ']');
-
- commWorker.addReconnectRequest(recoveryData);
- }
+ if (log.isDebugEnabled())
+ log.debug("Session was closed but there are unacknowledged messages, " +
+ "will try to reconnect [rmtNode=" + recoveryData.node().id() + ']');
}
- else
- recoveryData.onNodeLeft();
}
+ else
+ recoveryData.onNodeLeft();
}
+
+ DisconnectedSessionInfo disconnectData = new DisconnectedSessionInfo(id,
+ ses,
+ recoveryData,
+ reconnect);
+
+ commWorker.addProcessDisconnectRequest(disconnectData);
}
CommunicationListener<Message> lsnr0 = lsnr;
@@ -1393,6 +1394,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
.append(", msgsSent=").append(desc.sent())
.append(", msgsAckedByRmt=").append(desc.acked())
.append(", msgsRcvd=").append(desc.received())
+ .append(", lastAcked=").append(desc.lastAcknowledged())
+ .append(", reserveCnt=").append(desc.reserveCount())
.append(", descIdHash=").append(System.identityHashCode(desc))
.append(']').append(U.nl());
}
@@ -3040,14 +3043,14 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
endpoint.close();
}
- /** @{@inheritDoc} */
+ /** {@inheritDoc} */
@Override protected void cleanup() {
super.cleanup();
endpoint.close();
}
- /** @{@inheritDoc} */
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(ShmemWorker.class, this);
}
@@ -3058,7 +3061,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
*/
private class CommunicationWorker extends IgniteSpiThread {
/** */
- private final BlockingQueue<GridNioRecoveryDescriptor> q = new LinkedBlockingQueue<>();
+ private final BlockingQueue<DisconnectedSessionInfo> q = new LinkedBlockingQueue<>();
/**
* @param gridName Grid name.
@@ -3073,10 +3076,10 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
log.debug("Tcp communication worker has been started.");
while (!isInterrupted()) {
- GridNioRecoveryDescriptor recoveryDesc = q.poll(idleConnTimeout, TimeUnit.MILLISECONDS);
+ DisconnectedSessionInfo disconnectData = q.poll(idleConnTimeout, TimeUnit.MILLISECONDS);
- if (recoveryDesc != null)
- processRecovery(recoveryDesc);
+ if (disconnectData != null)
+ processDisconnect(disconnectData);
else
processIdle();
}
@@ -3181,56 +3184,62 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
}
/**
- * @param recoveryDesc Recovery descriptor.
+ * @param sesInfo Disconnected session information.
*/
- private void processRecovery(GridNioRecoveryDescriptor recoveryDesc) {
- ClusterNode node = recoveryDesc.node();
+ private void processDisconnect(DisconnectedSessionInfo sesInfo) {
+ GridCommunicationClient client = clients.get(sesInfo.nodeId);
- try {
- if (clients.containsKey(node.id()) ||
- !recoveryDesc.nodeAlive(getSpiContext().node(node.id())) ||
- !getSpiContext().pingNode(node.id()))
- return;
- }
- catch (IgniteClientDisconnectedException e) {
- if (log.isDebugEnabled())
- log.debug("Failed to ping node, client disconnected.");
+ if (client instanceof GridTcpNioCommunicationClient &&
+ ((GridTcpNioCommunicationClient) client).session() == sesInfo.ses)
+ clients.remove(sesInfo.nodeId, client);
- return;
- }
+ if (sesInfo.reconnect) {
+ GridNioRecoveryDescriptor recoveryDesc = sesInfo.recoveryDesc;
- try {
- if (log.isDebugEnabled())
- log.debug("Recovery reconnect [rmtNode=" + recoveryDesc.node().id() + ']');
+ ClusterNode node = recoveryDesc.node();
- GridCommunicationClient client = reserveClient(node);
+ if (!recoveryDesc.nodeAlive(getSpiContext().node(node.id())))
+ return;
- client.release();
- }
- catch (IgniteCheckedException | IgniteException e) {
- if (recoveryDesc.nodeAlive(getSpiContext().node(node.id()))) {
+ try {
if (log.isDebugEnabled())
- log.debug("Recovery reconnect failed, will retry " +
- "[rmtNode=" + recoveryDesc.node().id() + ", err=" + e + ']');
+ log.debug("Recovery reconnect [rmtNode=" + recoveryDesc.node().id() + ']');
+
+ client = reserveClient(node);
- addReconnectRequest(recoveryDesc);
+ client.release();
}
- else {
- if (log.isDebugEnabled())
- log.debug("Recovery reconnect failed, " +
- "node left [rmtNode=" + recoveryDesc.node().id() + ", err=" + e + ']');
+ catch (IgniteCheckedException | IgniteException e) {
+ try {
+ if (recoveryDesc.nodeAlive(getSpiContext().node(node.id())) && getSpiContext().pingNode(node.id())) {
+ if (log.isDebugEnabled())
+ log.debug("Recovery reconnect failed, will retry " +
+ "[rmtNode=" + recoveryDesc.node().id() + ", err=" + e + ']');
+
+ addProcessDisconnectRequest(sesInfo);
+ }
+ else {
+ if (log.isDebugEnabled())
+ log.debug("Recovery reconnect failed, " +
+ "node left [rmtNode=" + recoveryDesc.node().id() + ", err=" + e + ']');
- onException("Recovery reconnect failed, node left [rmtNode=" + recoveryDesc.node().id() + "]",
- e);
+ onException("Recovery reconnect failed, node left [rmtNode=" + recoveryDesc.node().id() + "]",
+ e);
+ }
+ }
+ catch (IgniteClientDisconnectedException e0) {
+ if (log.isDebugEnabled())
+ log.debug("Failed to ping node, client disconnected.");
+ }
}
}
}
/**
- * @param recoverySnd Recovery send data.
+ * @param sesInfo Disconnected session information.
*/
- void addReconnectRequest(GridNioRecoveryDescriptor recoverySnd) {
- boolean add = q.add(recoverySnd);
+ void addProcessDisconnectRequest(DisconnectedSessionInfo sesInfo) {
+ boolean add = q.add(sesInfo);
assert add;
}
@@ -3741,4 +3750,42 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
lock.readUnlock();
}
}
+
+ /**
+ *
+ */
+ private static class DisconnectedSessionInfo {
+ /** */
+ private final UUID nodeId;
+
+ /** */
+ private final GridNioSession ses;
+
+ /** */
+ private final GridNioRecoveryDescriptor recoveryDesc;
+
+ /** */
+ private final boolean reconnect;
+
+ /**
+ * @param nodeId Node ID.
+ * @param ses Session.
+ * @param recoveryDesc Recovery descriptor.
+ * @param reconnect Reconnect flag.
+ */
+ public DisconnectedSessionInfo(UUID nodeId,
+ GridNioSession ses,
+ @Nullable GridNioRecoveryDescriptor recoveryDesc,
+ boolean reconnect) {
+ this.nodeId = nodeId;
+ this.ses = ses;
+ this.recoveryDesc = recoveryDesc;
+ this.reconnect = reconnect;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(DisconnectedSessionInfo.class, this);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e9a508ef/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnection.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnection.java
new file mode 100644
index 0000000..618fe2a
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnection.java
@@ -0,0 +1,154 @@
+/*
+ * 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.processors.cache.distributed;
+
+import java.util.List;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.IgnitionEx;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteFuture;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheMode.REPLICATED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ *
+ */
+public class IgniteCacheMessageRecoveryIdleConnection extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private static final int NODES = 3;
+
+ /** */
+ private static final long IDLE_TIMEOUT = 50;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
+
+ TcpCommunicationSpi commSpi = new TcpCommunicationSpi();
+
+ commSpi.setIdleConnectionTimeout(IDLE_TIMEOUT);
+ commSpi.setSharedMemoryPort(-1);
+
+ cfg.setCommunicationSpi(commSpi);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected long getTestTimeout() {
+ return 2 * 60_000;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ super.beforeTestsStarted();
+
+ startGridsMultiThreaded(NODES);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ super.afterTestsStopped();
+
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testCacheOperationsIdleConnectionCloseTx() throws Exception {
+ cacheOperationsIdleConnectionClose(TRANSACTIONAL);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testCacheOperationsIdleConnectionCloseAtomic() throws Exception {
+ cacheOperationsIdleConnectionClose(ATOMIC);
+ }
+
+ /**
+ * @param atomicityMode Cache atomicity mode.
+ * @throws Exception If failed.
+ */
+ private void cacheOperationsIdleConnectionClose(CacheAtomicityMode atomicityMode) throws Exception {
+ CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+
+ ccfg.setAtomicityMode(atomicityMode);
+ ccfg.setCacheMode(REPLICATED);
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+
+ IgniteCache<Object, Object> cache = ignite(0).createCache(ccfg).withAsync();
+
+ try {
+ ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+ int iter = 0;
+
+ long stopTime = System.currentTimeMillis() + 90_000;
+
+ while (System.currentTimeMillis() < stopTime) {
+ if (iter++ % 10 == 0)
+ log.info("Iteration: " + iter);
+
+ cache.put(iter, 1);
+
+ IgniteFuture<?> fut = cache.future();
+
+ try {
+ fut.get(10_000);
+ }
+ catch (IgniteException e) {
+ List<Ignite> nodes = IgnitionEx.allGridsx();
+
+ for (Ignite node : nodes)
+ ((IgniteKernal)node).dumpDebugInfo();
+
+ U.dumpThreads(log);
+
+ throw e;
+ }
+
+ U.sleep(rnd.nextLong(IDLE_TIMEOUT - 10, IDLE_TIMEOUT + 10));
+ }
+ }
+ finally {
+ ignite(0).destroyCache(ccfg.getName());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e9a508ef/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index 1ad74a5..2e45faa 100755
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -125,6 +125,7 @@ import org.apache.ignite.internal.processors.cache.distributed.CacheAtomicNearUp
import org.apache.ignite.internal.processors.cache.distributed.CacheTxNearUpdateTopologyChangeTest;
import org.apache.ignite.internal.processors.cache.distributed.GridCacheEntrySetIterationPreloadingSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheAtomicMessageRecoveryTest;
+import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheMessageRecoveryIdleConnection;
import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheMessageWriteTimeoutTest;
import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheSystemTransactionsSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheTxMessageRecoveryTest;
@@ -278,6 +279,7 @@ public class IgniteCacheTestSuite extends TestSuite {
suite.addTestSuite(IgniteCacheAtomicMessageRecoveryTest.class);
suite.addTestSuite(IgniteCacheTxMessageRecoveryTest.class);
suite.addTestSuite(IgniteCacheMessageWriteTimeoutTest.class);
+ suite.addTestSuite(IgniteCacheMessageRecoveryIdleConnection.class);
GridTestUtils.addTestIfNeeded(suite, GridCacheOffHeapTieredEvictionAtomicSelfTest.class, ignoredTests);
GridTestUtils.addTestIfNeeded(suite, GridCacheOffHeapTieredEvictionSelfTest.class, ignoredTests);
GridTestUtils.addTestIfNeeded(suite, GridCacheOffHeapTieredAtomicSelfTest.class, ignoredTests);
[27/50] [abbrv] ignite git commit: Merge branch 'gridgain-7.6.2'
Posted by sb...@apache.org.
Merge branch 'gridgain-7.6.2'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c44ee639
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c44ee639
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c44ee639
Branch: refs/heads/ignite-1232
Commit: c44ee639210301bf386af986396b120698df3133
Parents: 2fdc321 3b22e83
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Tue Jul 5 18:44:36 2016 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Tue Jul 5 18:44:36 2016 -0700
----------------------------------------------------------------------
assembly/LICENSE_FABRIC | 8 +-------
assembly/LICENSE_HADOOP | 6 ------
examples/pom-standalone-lgpl.xml | 6 +++---
examples/pom-standalone.xml | 6 +++---
examples/pom.xml | 6 +++---
examples/schema-import/pom-standalone.xml | 6 +++---
examples/schema-import/pom.xml | 6 +++---
modules/cassandra/pom.xml | 4 ++--
modules/core/pom.xml | 6 +++---
modules/flume/README.txt | 2 +-
modules/kafka/README.txt | 4 ++--
.../dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs | 4 ++--
parent/pom.xml | 1 -
13 files changed, 26 insertions(+), 39 deletions(-)
----------------------------------------------------------------------