From 46c1a71bfd73c966d94e174030acb94cd3a26100 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Wed, 13 May 2026 21:08:46 +0300 Subject: [PATCH 01/44] WIP --- assembly/dependencies-apache-ignite-lgpl.xml | 1 + assembly/dependencies-apache-ignite-slim.xml | 1 + assembly/dependencies-apache-ignite.xml | 1 + modules/bom/pom.xml | 5 ++ modules/core/pom.xml | 7 ++ modules/thin-client/api/README.txt | 9 +++ modules/thin-client/api/pom.xml | 69 +++++++++++++++++++ .../client/ClientAffinityConfiguration.java | 0 .../client/ClientAuthenticationException.java | 0 .../client/ClientAuthorizationException.java | 0 .../client/ClientAutoCloseableIterator.java | 0 .../client/ClientConnectionException.java | 0 .../apache/ignite/client/ClientException.java | 0 .../client/ClientReconnectedException.java | 0 .../client/ClientServiceDescriptor.java | 1 - .../ignite/client/ClientTransaction.java | 0 .../ignite/client/IgniteClientFuture.java | 0 .../org/apache/ignite/client/SslMode.java | 0 .../org/apache/ignite/client/SslProtocol.java | 0 .../client/events/ClientLifecycleEvent.java | 0 .../client/events/ConnectionClosedEvent.java | 0 .../client/events/ConnectionDescription.java | 0 .../ignite/client/events/ConnectionEvent.java | 0 .../events/ConnectionEventListener.java | 0 .../client/events/HandshakeFailEvent.java | 0 .../client/events/HandshakeStartEvent.java | 0 .../client/events/HandshakeSuccessEvent.java | 0 .../ignite/client/events/RequestEvent.java | 0 .../client/events/RequestEventListener.java | 0 .../client/events/RequestFailEvent.java | 0 .../client/events/RequestStartEvent.java | 0 .../client/events/RequestSuccessEvent.java | 0 .../internal/client/thin/ClientError.java | 0 .../client/thin/ClientServerError.java | 0 pom.xml | 1 + 35 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 modules/thin-client/api/README.txt create mode 100644 modules/thin-client/api/pom.xml rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientAffinityConfiguration.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientAuthenticationException.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientAuthorizationException.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientAutoCloseableIterator.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientConnectionException.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientException.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientReconnectedException.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientServiceDescriptor.java (98%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientTransaction.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/IgniteClientFuture.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/SslMode.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/SslProtocol.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/ClientLifecycleEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/ConnectionClosedEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/ConnectionDescription.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/ConnectionEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/ConnectionEventListener.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/HandshakeFailEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/HandshakeStartEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/HandshakeSuccessEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/RequestEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/RequestEventListener.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/RequestFailEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/RequestStartEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/RequestSuccessEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/internal/client/thin/ClientError.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/internal/client/thin/ClientServerError.java (100%) diff --git a/assembly/dependencies-apache-ignite-lgpl.xml b/assembly/dependencies-apache-ignite-lgpl.xml index 7d7e016459bb1..ac3d35c972a66 100644 --- a/assembly/dependencies-apache-ignite-lgpl.xml +++ b/assembly/dependencies-apache-ignite-lgpl.xml @@ -118,6 +118,7 @@ ${project.groupId}:ignite-commons ${project.groupId}:ignite-binary-api ${project.groupId}:ignite-binary-impl + ${project.groupId}:ignite-thin-client-api ${project.groupId}:ignite-clients ${project.groupId}:ignite-spring ${project.groupId}:ignite-tools diff --git a/assembly/dependencies-apache-ignite-slim.xml b/assembly/dependencies-apache-ignite-slim.xml index 53676f307378b..f113444139b1a 100644 --- a/assembly/dependencies-apache-ignite-slim.xml +++ b/assembly/dependencies-apache-ignite-slim.xml @@ -118,6 +118,7 @@ ${project.groupId}:ignite-commons ${project.groupId}:ignite-binary-api ${project.groupId}:ignite-binary-impl + ${project.groupId}:ignite-thin-client-api ${project.groupId}:ignite-clients ${project.groupId}:ignite-spring ${project.groupId}:ignite-tools diff --git a/assembly/dependencies-apache-ignite.xml b/assembly/dependencies-apache-ignite.xml index 2ed7861597401..5952320cba9b2 100644 --- a/assembly/dependencies-apache-ignite.xml +++ b/assembly/dependencies-apache-ignite.xml @@ -119,6 +119,7 @@ ${project.groupId}:ignite-commons ${project.groupId}:ignite-binary-api ${project.groupId}:ignite-binary-impl + ${project.groupId}:ignite-thin-client-api ${project.groupId}:ignite-clients ${project.groupId}:ignite-spring ${project.groupId}:ignite-tools diff --git a/modules/bom/pom.xml b/modules/bom/pom.xml index 25f8124d03fc0..e14c89f779b55 100644 --- a/modules/bom/pom.xml +++ b/modules/bom/pom.xml @@ -181,6 +181,11 @@ ignite-commons ${revision} + + ${project.groupId} + ignite-thin-client-api + ${revision} + ${project.groupId} ignite-codegen diff --git a/modules/core/pom.xml b/modules/core/pom.xml index ccb994b73a74b..eac0fa9940024 100644 --- a/modules/core/pom.xml +++ b/modules/core/pom.xml @@ -75,6 +75,12 @@ compile + + ${project.groupId} + ignite-thin-client-api + compile + + ${project.groupId} ignite-codegen @@ -353,6 +359,7 @@ ${project.groupId}:ignite-binary-api ${project.groupId}:ignite-binary-impl ${project.groupId}:ignite-grid-unsafe + ${project.groupId}:ignite-thin-client-api diff --git a/modules/thin-client/api/README.txt b/modules/thin-client/api/README.txt new file mode 100644 index 0000000000000..a3562700500f6 --- /dev/null +++ b/modules/thin-client/api/README.txt @@ -0,0 +1,9 @@ +Apache Ignite Binary API Module +------------------------ + +ignite-thin-client-api module is internal module to separate thin-client API and implementation. +Other modules like ignite-core must depend on ignite-thin-client-api, only. +Implementation of API in ignite-thin-client-impl, it added in runtime. + +Note, class files of this module are copied in ignite-core.jar during project assembly +to ensure compatibility with previous Ignite releases. diff --git a/modules/thin-client/api/pom.xml b/modules/thin-client/api/pom.xml new file mode 100644 index 0000000000000..d329d6d7522be --- /dev/null +++ b/modules/thin-client/api/pom.xml @@ -0,0 +1,69 @@ + + + + + + + 4.0.0 + + + org.apache.ignite + ignite-parent-internal + ${revision} + ../../../parent-internal/pom.xml + + + ignite-thin-client-api + + http://ignite.apache.org + + + + ${project.groupId} + ignite-commons + provided + + + + ${project.groupId} + ignite-binary-api + provided + + + + org.jetbrains + annotations + ${jetbrains.annotations.version} + + + + + + + org.apache.maven.plugins + maven-deploy-plugin + 2.8.2 + + false + + + + + diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientAffinityConfiguration.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAffinityConfiguration.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientAffinityConfiguration.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAffinityConfiguration.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientAuthenticationException.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAuthenticationException.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientAuthenticationException.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAuthenticationException.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientAuthorizationException.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAuthorizationException.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientAuthorizationException.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAuthorizationException.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientAutoCloseableIterator.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAutoCloseableIterator.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientAutoCloseableIterator.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAutoCloseableIterator.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientConnectionException.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientConnectionException.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientConnectionException.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientConnectionException.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientException.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientException.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientException.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientException.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientReconnectedException.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientReconnectedException.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientReconnectedException.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientReconnectedException.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientServiceDescriptor.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientServiceDescriptor.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/client/ClientServiceDescriptor.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientServiceDescriptor.java index 1feba70a92ee8..75fe4621a8f3b 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/ClientServiceDescriptor.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientServiceDescriptor.java @@ -19,7 +19,6 @@ import java.util.UUID; import org.apache.ignite.platform.PlatformType; -import org.apache.ignite.services.Service; import org.jetbrains.annotations.Nullable; /** diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientTransaction.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientTransaction.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientTransaction.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientTransaction.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/IgniteClientFuture.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/IgniteClientFuture.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/IgniteClientFuture.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/IgniteClientFuture.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/SslMode.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/SslMode.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/SslMode.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/SslMode.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/SslProtocol.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/SslProtocol.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/SslProtocol.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/SslProtocol.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/ClientLifecycleEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ClientLifecycleEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/ClientLifecycleEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ClientLifecycleEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/ConnectionClosedEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ConnectionClosedEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/ConnectionClosedEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ConnectionClosedEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/ConnectionDescription.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ConnectionDescription.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/ConnectionDescription.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ConnectionDescription.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/ConnectionEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ConnectionEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/ConnectionEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ConnectionEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/ConnectionEventListener.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ConnectionEventListener.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/ConnectionEventListener.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ConnectionEventListener.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/HandshakeFailEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/HandshakeFailEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/HandshakeFailEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/HandshakeFailEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/HandshakeStartEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/HandshakeStartEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/HandshakeStartEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/HandshakeStartEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/HandshakeSuccessEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/HandshakeSuccessEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/HandshakeSuccessEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/HandshakeSuccessEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/RequestEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/RequestEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/RequestEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/RequestEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/RequestEventListener.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/RequestEventListener.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/RequestEventListener.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/RequestEventListener.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/RequestFailEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/RequestFailEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/RequestFailEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/RequestFailEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/RequestStartEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/RequestStartEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/RequestStartEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/RequestStartEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/RequestSuccessEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/RequestSuccessEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/RequestSuccessEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/RequestSuccessEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientError.java b/modules/thin-client/api/src/main/java/org/apache/ignite/internal/client/thin/ClientError.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientError.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/internal/client/thin/ClientError.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientServerError.java b/modules/thin-client/api/src/main/java/org/apache/ignite/internal/client/thin/ClientServerError.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientServerError.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/internal/client/thin/ClientServerError.java diff --git a/pom.xml b/pom.xml index 02103bcccd055..df249427c22fe 100644 --- a/pom.xml +++ b/pom.xml @@ -42,6 +42,7 @@ modules/commons modules/binary/api modules/binary/impl + modules/thin-client/api modules/unsafe modules/core modules/compress From ea5cc9d5e6ab1cac1e89dd1ac63af267ac9ec757 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 14 May 2026 10:12:44 +0300 Subject: [PATCH 02/44] WIP --- .../java/org/apache/ignite/cache/CacheAtomicityMode.java | 2 -- .../src/main/java/org/apache/ignite/cache/CacheMode.java | 2 -- .../ignite/transactions/TransactionConcurrency.java | 0 .../apache/ignite/transactions/TransactionIsolation.java | 0 .../org/apache/ignite/client/ClientAddressFinder.java | 0 .../apache/ignite/client/ClientAtomicConfiguration.java | 1 - .../apache/ignite/client/ClientDisconnectListener.java | 8 ++++---- .../ClientFeatureNotSupportedByServerException.java | 0 .../java/org/apache/ignite/client/ClientIgniteSet.java | 0 .../org/apache/ignite/client/ClientOperationType.java | 4 ---- .../ignite/client/ClientPartitionAwarenessMapper.java | 4 ---- .../client/ClientPartitionAwarenessMapperFactory.java | 3 --- .../java/org/apache/ignite/client/ClientTransactions.java | 2 -- .../internal/client/thin/ProtocolBitmaskFeature.java | 6 ------ 14 files changed, 4 insertions(+), 28 deletions(-) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java (98%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/CacheMode.java (96%) rename modules/{core => commons}/src/main/java/org/apache/ignite/transactions/TransactionConcurrency.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/transactions/TransactionIsolation.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientAddressFinder.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientAtomicConfiguration.java (98%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientDisconnectListener.java (80%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientFeatureNotSupportedByServerException.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientIgniteSet.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientOperationType.java (97%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapper.java (90%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapperFactory.java (95%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientTransactions.java (96%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/internal/client/thin/ProtocolBitmaskFeature.java (93%) diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java b/modules/commons/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java rename to modules/commons/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java index f83dcdd6d9525..37d4a8379736b 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java @@ -18,8 +18,6 @@ package org.apache.ignite.cache; import javax.cache.processor.EntryProcessor; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.transactions.Transaction; import org.jetbrains.annotations.Nullable; /** diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheMode.java b/modules/commons/src/main/java/org/apache/ignite/cache/CacheMode.java similarity index 96% rename from modules/core/src/main/java/org/apache/ignite/cache/CacheMode.java rename to modules/commons/src/main/java/org/apache/ignite/cache/CacheMode.java index 392bb615dfe81..69d6be9a5c9c0 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/CacheMode.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/CacheMode.java @@ -18,8 +18,6 @@ package org.apache.ignite.cache; import java.util.stream.Stream; -import org.apache.ignite.cache.affinity.AffinityFunction; -import org.apache.ignite.configuration.NearCacheConfiguration; import org.jetbrains.annotations.Nullable; /** diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionConcurrency.java b/modules/commons/src/main/java/org/apache/ignite/transactions/TransactionConcurrency.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/transactions/TransactionConcurrency.java rename to modules/commons/src/main/java/org/apache/ignite/transactions/TransactionConcurrency.java diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionIsolation.java b/modules/commons/src/main/java/org/apache/ignite/transactions/TransactionIsolation.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/transactions/TransactionIsolation.java rename to modules/commons/src/main/java/org/apache/ignite/transactions/TransactionIsolation.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientAddressFinder.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAddressFinder.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientAddressFinder.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAddressFinder.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientAtomicConfiguration.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAtomicConfiguration.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/client/ClientAtomicConfiguration.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAtomicConfiguration.java index 248265fdd7240..8d0ab76905ca2 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/ClientAtomicConfiguration.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAtomicConfiguration.java @@ -17,7 +17,6 @@ package org.apache.ignite.client; -import org.apache.ignite.IgniteAtomicSequence; import org.apache.ignite.cache.CacheMode; import org.apache.ignite.internal.util.typedef.internal.S; import static org.apache.ignite.cache.CacheMode.PARTITIONED; diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientDisconnectListener.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientDisconnectListener.java similarity index 80% rename from modules/core/src/main/java/org/apache/ignite/client/ClientDisconnectListener.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientDisconnectListener.java index e2c76b86be49a..ccacdf97fd422 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/ClientDisconnectListener.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientDisconnectListener.java @@ -18,12 +18,12 @@ package org.apache.ignite.client; import javax.cache.configuration.CacheEntryListenerConfiguration; -import org.apache.ignite.cache.query.ContinuousQuery; /** - * Client disconnected event listener. Such listeners can be used in {@link ClientCache#query(ContinuousQuery, - * ClientDisconnectListener)} or {@link ClientCache#registerCacheEntryListener(CacheEntryListenerConfiguration, - * ClientDisconnectListener)} methods to handle client channel failure. + * Client disconnected event listener. Such listeners can be used in + * {@link ClientCache#query(org.apache.ignite.cache.query.ContinuousQuery, ClientDisconnectListener)} or + * {@link ClientCache#registerCacheEntryListener(CacheEntryListenerConfiguration, ClientDisconnectListener)} + * methods to handle client channel failure. */ public interface ClientDisconnectListener { /** diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientFeatureNotSupportedByServerException.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientFeatureNotSupportedByServerException.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientFeatureNotSupportedByServerException.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientFeatureNotSupportedByServerException.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientIgniteSet.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientIgniteSet.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientIgniteSet.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientIgniteSet.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientOperationType.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientOperationType.java similarity index 97% rename from modules/core/src/main/java/org/apache/ignite/client/ClientOperationType.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientOperationType.java index 913ec88107d52..bb8e318c08932 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/ClientOperationType.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientOperationType.java @@ -20,10 +20,6 @@ import java.util.Collection; import java.util.Set; import javax.cache.processor.EntryProcessor; -import org.apache.ignite.cache.query.ContinuousQuery; -import org.apache.ignite.cache.query.Query; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.cluster.ClusterState; /** * Client operation type. diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapper.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapper.java similarity index 90% rename from modules/core/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapper.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapper.java index 64ea78b928211..dc9af29bad0e7 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapper.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapper.java @@ -17,10 +17,6 @@ package org.apache.ignite.client; -import org.apache.ignite.cache.affinity.AffinityFunction; -import org.apache.ignite.cache.affinity.AffinityKeyMapper; -import org.apache.ignite.configuration.ClientConfiguration; - /** * This function calculates the cache key to a partition mapping for each cache key. It is used only for local calculation on a client side. *

diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapperFactory.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapperFactory.java similarity index 95% rename from modules/core/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapperFactory.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapperFactory.java index c26421dda8454..d49aba72e7cf8 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapperFactory.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapperFactory.java @@ -17,9 +17,6 @@ package org.apache.ignite.client; -import org.apache.ignite.cache.affinity.AffinityFunction; -import org.apache.ignite.cache.affinity.AffinityKeyMapper; - /** * This factory is used on the client side and only when the partition awareness thin client feature is enabled. By default, * on a new cache the RendezvousAffinityFunction will be used for calculating mappings 'key-to-partition' and 'partition-to-node'. diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientTransactions.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientTransactions.java similarity index 96% rename from modules/core/src/main/java/org/apache/ignite/client/ClientTransactions.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientTransactions.java index c6db25b35775d..183439d4b88ba 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/ClientTransactions.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientTransactions.java @@ -17,8 +17,6 @@ package org.apache.ignite.client; -import org.apache.ignite.configuration.ClientConfiguration; -import org.apache.ignite.configuration.ClientTransactionConfiguration; import org.apache.ignite.internal.client.thin.ClientServerError; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ProtocolBitmaskFeature.java b/modules/thin-client/api/src/main/java/org/apache/ignite/internal/client/thin/ProtocolBitmaskFeature.java similarity index 93% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ProtocolBitmaskFeature.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/internal/client/thin/ProtocolBitmaskFeature.java index 6c4a3fa676c0f..b3287169a2e3c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ProtocolBitmaskFeature.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/internal/client/thin/ProtocolBitmaskFeature.java @@ -20,12 +20,6 @@ import java.util.BitSet; import java.util.Collection; import java.util.EnumSet; -import org.apache.ignite.client.ClientCacheConfiguration; -import org.apache.ignite.client.ClientServices; -import org.apache.ignite.cluster.ClusterState; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.internal.processors.cache.GridCacheProcessor; /** * Defines supported bitmask features for thin client. From ddc1cd333a579e3c937cccaafa278c6ef95a8f7c Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 14 May 2026 11:11:41 +0300 Subject: [PATCH 03/44] WIP --- .../src/main/java/org/apache/ignite/client/ClientAtomicLong.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientAtomicLong.java (100%) diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientAtomicLong.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAtomicLong.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientAtomicLong.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAtomicLong.java From 998f9f300ca2337b8d40aace8f8a3a3f7cbc13fd Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 15 May 2026 17:54:06 +0300 Subject: [PATCH 04/44] WIP --- .../java/org/apache/ignite/cache/CacheKeyConfiguration.java | 0 .../main/java/org/apache/ignite/cache/CacheRebalanceMode.java | 1 - .../org/apache/ignite/cache/CacheWriteSynchronizationMode.java | 1 - .../main/java/org/apache/ignite/cache/PartitionLossPolicy.java | 2 -- 4 files changed, 4 deletions(-) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/CacheRebalanceMode.java (97%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/CacheWriteSynchronizationMode.java (98%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java (98%) diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java b/modules/commons/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java rename to modules/commons/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheRebalanceMode.java b/modules/commons/src/main/java/org/apache/ignite/cache/CacheRebalanceMode.java similarity index 97% rename from modules/core/src/main/java/org/apache/ignite/cache/CacheRebalanceMode.java rename to modules/commons/src/main/java/org/apache/ignite/cache/CacheRebalanceMode.java index 9901922d38282..2f2f360b49885 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/CacheRebalanceMode.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/CacheRebalanceMode.java @@ -17,7 +17,6 @@ package org.apache.ignite.cache; -import org.apache.ignite.cache.affinity.AffinityFunction; import org.jetbrains.annotations.Nullable; /** diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheWriteSynchronizationMode.java b/modules/commons/src/main/java/org/apache/ignite/cache/CacheWriteSynchronizationMode.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/cache/CacheWriteSynchronizationMode.java rename to modules/commons/src/main/java/org/apache/ignite/cache/CacheWriteSynchronizationMode.java index f3455a838c4b9..8b4b7c4645d21 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/CacheWriteSynchronizationMode.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/CacheWriteSynchronizationMode.java @@ -17,7 +17,6 @@ package org.apache.ignite.cache; -import org.apache.ignite.transactions.Transaction; import org.jetbrains.annotations.Nullable; /** diff --git a/modules/core/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java b/modules/commons/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java rename to modules/commons/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java index 3b2f46a5f738f..46287be78480e 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java @@ -18,8 +18,6 @@ package org.apache.ignite.cache; import java.util.Collection; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; import org.jetbrains.annotations.Nullable; /** From c77b0bf0155288d06753a008739a1614f39b5586 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 15 May 2026 17:54:58 +0300 Subject: [PATCH 05/44] WIP --- .../org/apache/ignite/client/ClientCollectionConfiguration.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientCollectionConfiguration.java (100%) diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientCollectionConfiguration.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCollectionConfiguration.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientCollectionConfiguration.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCollectionConfiguration.java From 6091eb12c2a846745df6c18b1dc80826e52f7ccc Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 15 May 2026 17:56:20 +0300 Subject: [PATCH 06/44] WIP --- .../src/main/java/org/apache/ignite/lang/IgniteExperimental.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename modules/{core => commons}/src/main/java/org/apache/ignite/lang/IgniteExperimental.java (100%) diff --git a/modules/core/src/main/java/org/apache/ignite/lang/IgniteExperimental.java b/modules/commons/src/main/java/org/apache/ignite/lang/IgniteExperimental.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/lang/IgniteExperimental.java rename to modules/commons/src/main/java/org/apache/ignite/lang/IgniteExperimental.java From 0b6a7809d189624f70f52d62b590181bbb9f7300 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 15 May 2026 18:59:43 +0300 Subject: [PATCH 07/44] WIP --- .../org/apache/ignite/cache/QueryEntity.java | 244 +--------------- .../org/apache/ignite/cache/QueryIndex.java | 1 - .../apache/ignite/cache/QueryIndexType.java | 0 .../cache/affinity/AffinityKeyMapped.java | 0 .../query/annotations/QueryGroupIndex.java | 1 - .../query/annotations/QuerySqlField.java | 2 - .../query/annotations/QueryTextField.java | 1 - .../cache/query/QueryEntityClassProperty.java | 0 .../query/QueryEntityIndexDescriptor.java | 0 .../query/QueryEntityTypeDescriptor.java | 0 .../query/GridQueryIndexDescriptor.java | 0 .../ignite/internal/util/CommonUtils.java | 89 ++++++ .../processors/query/QuerySchema.java | 2 +- .../internal/processors/query/QueryUtils.java | 275 +++++++++++++++--- .../ignite/internal/util/IgniteUtils.java | 29 -- 15 files changed, 330 insertions(+), 314 deletions(-) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/QueryEntity.java (70%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/QueryIndex.java (99%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/QueryIndexType.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/affinity/AffinityKeyMapped.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/query/annotations/QueryGroupIndex.java (97%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlField.java (98%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/query/annotations/QueryTextField.java (95%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityClassProperty.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityIndexDescriptor.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityTypeDescriptor.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexDescriptor.java (100%) diff --git a/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java b/modules/commons/src/main/java/org/apache/ignite/cache/QueryEntity.java similarity index 70% rename from modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java rename to modules/commons/src/main/java/org/apache/ignite/cache/QueryEntity.java index 35a632909131e..933ba1f1cc2d9 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/QueryEntity.java @@ -27,11 +27,9 @@ import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; -import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; -import java.util.UUID; import javax.cache.CacheException; import org.apache.ignite.cache.query.annotations.QueryGroupIndex; import org.apache.ignite.cache.query.annotations.QuerySqlField; @@ -39,16 +37,11 @@ import org.apache.ignite.internal.processors.cache.query.QueryEntityClassProperty; import org.apache.ignite.internal.processors.cache.query.QueryEntityTypeDescriptor; import org.apache.ignite.internal.processors.query.GridQueryIndexDescriptor; -import org.apache.ignite.internal.processors.query.QueryField; -import org.apache.ignite.internal.processors.query.QueryUtils; -import org.apache.ignite.internal.processors.query.schema.operation.SchemaAbstractOperation; -import org.apache.ignite.internal.processors.query.schema.operation.SchemaAlterTableAddColumnOperation; -import org.apache.ignite.internal.processors.query.schema.operation.SchemaIndexCreateOperation; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.tostring.GridToStringInclude; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -161,223 +154,6 @@ public QueryEntity(Class keyCls, Class valCls) { this(convert(processKeyAndValueClasses(keyCls, valCls))); } - /** - * Make query entity patch. This patch can only add properties to entity and can't remove them. - * Other words, the patch will contain only add operations(e.g. add column, create index) and not remove ones. - * - * @param target Query entity to which this entity should be expanded. - * @return Patch which contains operations for expanding this entity. - */ - @NotNull public QueryEntityPatch makePatch(QueryEntity target) { - if (target == null) - return QueryEntityPatch.empty(); - - StringBuilder conflicts = new StringBuilder(); - - checkEquals(conflicts, "keyType", keyType, target.keyType); - checkEquals(conflicts, "valType", valType, target.valType); - checkEquals(conflicts, "keyFieldName", keyFieldName, target.keyFieldName); - checkEquals(conflicts, "valueFieldName", valueFieldName, target.valueFieldName); - checkEquals(conflicts, "tableName", tableName, target.tableName); - - List qryFieldsToAdd = checkFields(target, conflicts); - - Collection indexesToAdd = checkIndexes(target, conflicts); - - if (conflicts.length() != 0) - return QueryEntityPatch.conflict(tableName + " conflict: \n" + conflicts.toString()); - - Collection patchOperations = new ArrayList<>(); - - if (!qryFieldsToAdd.isEmpty()) - patchOperations.add(new SchemaAlterTableAddColumnOperation( - UUID.randomUUID(), - null, - null, - tableName, - qryFieldsToAdd, - true, - true - )); - - if (!indexesToAdd.isEmpty()) { - for (QueryIndex idx : indexesToAdd) { - patchOperations.add(new SchemaIndexCreateOperation( - UUID.randomUUID(), - null, - null, - tableName, - idx, - true, - 0 - )); - } - } - - return QueryEntityPatch.patch(patchOperations); - } - - /** - * Comparing local fields and target fields. - * - * @param target Query entity for check. - * @param conflicts Storage of conflicts. - * @return Indexes which exist in target and not exist in local. - */ - @NotNull private Collection checkIndexes(QueryEntity target, StringBuilder conflicts) { - HashSet indexesToAdd = new HashSet<>(); - - Map curIndexes = new HashMap<>(); - - for (QueryIndex idx : getIndexes()) { - if (curIndexes.put(idx.getName(), idx) != null) - throw new IllegalStateException("Duplicate key"); - } - - for (QueryIndex qryIdx : target.getIndexes()) { - if (curIndexes.containsKey(qryIdx.getName())) { - checkEquals( - conflicts, - "index " + qryIdx.getName(), - curIndexes.get(qryIdx.getName()), - qryIdx - ); - } - else - indexesToAdd.add(qryIdx); - } - return indexesToAdd; - } - - /** - * Comparing local entity fields and target entity fields. - * - * @param target Query entity for check. - * @param conflicts Storage of conflicts. - * @return Fields which exist in target and not exist in local. - */ - private List checkFields(QueryEntity target, StringBuilder conflicts) { - List qryFieldsToAdd = new ArrayList<>(); - - for (Map.Entry targetField : target.getFields().entrySet()) { - String targetFieldName = targetField.getKey(); - String targetFieldType = targetField.getValue(); - String targetFieldAlias = target.getAliases().get(targetFieldName); - - if (getFields().containsKey(targetFieldName)) { - checkEquals( - conflicts, - "alias of " + targetFieldName, - getAliases().get(targetFieldName), - targetFieldAlias - ); - - checkEquals( - conflicts, - "fieldType of " + targetFieldName, - getFields().get(targetFieldName), - targetFieldType - ); - - checkEquals( - conflicts, - "nullable of " + targetFieldName, - contains(getNotNullFields(), targetFieldName), - contains(target.getNotNullFields(), targetFieldName) - ); - - checkEquals( - conflicts, - "default value of " + targetFieldName, - getFromMap(getDefaultFieldValues(), targetFieldName), - getFromMap(target.getDefaultFieldValues(), targetFieldName) - ); - - checkEquals(conflicts, - "precision of " + targetFieldName, - getFromMap(getFieldsPrecision(), targetFieldName), - getFromMap(target.getFieldsPrecision(), targetFieldName)); - - checkEquals( - conflicts, - "scale of " + targetFieldName, - getFromMap(getFieldsScale(), targetFieldName), - getFromMap(target.getFieldsScale(), targetFieldName)); - } - else { - boolean isAliasConflictsFound = findAliasConflicts(targetFieldAlias, targetFieldName, conflicts); - - if (!isAliasConflictsFound) { - Integer precision = getFromMap(target.getFieldsPrecision(), targetFieldName); - Integer scale = getFromMap(target.getFieldsScale(), targetFieldName); - - qryFieldsToAdd.add(new QueryField( - targetFieldName, - targetFieldType, - targetFieldAlias, - !contains(target.getNotNullFields(), targetFieldName), - getFromMap(target.getDefaultFieldValues(), targetFieldName), - precision == null ? -1 : precision, - scale == null ? -1 : scale - )); - } - } - } - - return qryFieldsToAdd; - } - - /** - * Checks if received query entity field has the alias which is already used by a field on the local node. - * - * @return Whether conflicts were found. - */ - private boolean findAliasConflicts(String targetFieldAlias, String targetFieldName, StringBuilder conflicts) { - for (Map.Entry entry : getAliases().entrySet()) { - if (Objects.equals(entry.getValue(), targetFieldAlias)) { - conflicts.append(String.format( - "multiple fields are associated with the same alias: alias=%s, localField=%s, receivedField=%s\n", - targetFieldAlias, - entry.getKey(), - targetFieldName) - ); - - return true; - } - } - - return false; - } - - /** - * @param collection Collection for checking. - * @param elementToCheck Element for checking to containing in collection. - * @return {@code true} if collection contain elementToCheck. - */ - private static boolean contains(Collection collection, String elementToCheck) { - return collection != null && collection.contains(elementToCheck); - } - - /** - * @return Value from sourceMap or null if map is null. - */ - private static V getFromMap(Map sourceMap, String key) { - return sourceMap == null ? null : sourceMap.get(key); - } - - /** - * Comparing two objects and add formatted text to conflicts if needed. - * - * @param conflicts Storage of conflicts resulting error message. - * @param name Name of comparing object. - * @param local Local object. - * @param received Received object. - */ - private void checkEquals(StringBuilder conflicts, String name, V local, V received) { - if (!Objects.equals(local, received)) - conflicts.append(String.format("%s is different: local=%s, received=%s\n", name, local, received)); - } - /** * Gets key type for this query pair. * @@ -716,7 +492,7 @@ private static QueryEntity convert(QueryEntityTypeDescriptor desc) { entity.setValueType(desc.valueClass().getName()); for (QueryEntityClassProperty prop : desc.properties().values()) - entity.addQueryField(prop.fullName(), U.box(prop.type()).getName(), prop.alias()); + entity.addQueryField(prop.fullName(), CommonUtils.box(prop.type()).getName(), prop.alias()); entity.setKeyFields(desc.keyProperties()); @@ -762,10 +538,10 @@ private static QueryEntity convert(QueryEntityTypeDescriptor desc) { txtIdx.setIndexType(QueryIndexType.FULLTEXT); - txtIdx.setFieldNames(Arrays.asList(QueryUtils.VAL_FIELD_NAME), true); + txtIdx.setFieldNames(Arrays.asList(CommonUtils.VAL_FIELD_NAME), true); } else - txtIdx.getFields().put(QueryUtils.VAL_FIELD_NAME, true); + txtIdx.getFields().put(CommonUtils.VAL_FIELD_NAME, true); } if (txtIdx != null) @@ -813,14 +589,14 @@ private static QueryEntityTypeDescriptor processKeyAndValueClasses( */ private static void processAnnotationsInClass(boolean key, Class cls, QueryEntityTypeDescriptor type, @Nullable QueryEntityClassProperty parent) { - if (U.isJdk(cls) || U.isGeometryClass(cls)) { - if (parent == null && !key && QueryUtils.isSqlType(cls)) { // We have to index primitive _val. - String idxName = cls.getSimpleName() + "_" + QueryUtils.VAL_FIELD_NAME + "_idx"; + if (CommonUtils.isJdk(cls) || CommonUtils.isGeometryClass(cls)) { + if (parent == null && !key && CommonUtils.isSqlType(cls)) { // We have to index primitive _val. + String idxName = cls.getSimpleName() + "_" + CommonUtils.VAL_FIELD_NAME + "_idx"; - type.addIndex(idxName, U.isGeometryClass(cls) ? + type.addIndex(idxName, CommonUtils.isGeometryClass(cls) ? QueryIndexType.GEOSPATIAL : QueryIndexType.SORTED, QueryIndex.DFLT_INLINE_SIZE); - type.addFieldToIndex(idxName, QueryUtils.VAL_FIELD_NAME, 0, false); + type.addFieldToIndex(idxName, CommonUtils.VAL_FIELD_NAME, 0, false); } return; @@ -896,7 +672,7 @@ private static void processAnnotation(boolean key, QuerySqlField sqlAnn, QueryTe if (cls != curCls) idxName = cls.getSimpleName() + "_" + idxName; - desc.addIndex(idxName, U.isGeometryClass(prop.type()) ? + desc.addIndex(idxName, CommonUtils.isGeometryClass(prop.type()) ? QueryIndexType.GEOSPATIAL : QueryIndexType.SORTED, sqlAnn.inlineSize()); desc.addFieldToIndex(idxName, prop.fullName(), 0, sqlAnn.descending()); diff --git a/modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java b/modules/commons/src/main/java/org/apache/ignite/cache/QueryIndex.java similarity index 99% rename from modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java rename to modules/commons/src/main/java/org/apache/ignite/cache/QueryIndex.java index df24cf9bcadc1..b51719ab8913b 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/QueryIndex.java @@ -21,7 +21,6 @@ import java.util.Collection; import java.util.LinkedHashMap; import java.util.Objects; -import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.internal.util.tostring.GridToStringInclude; import org.apache.ignite.internal.util.typedef.internal.S; diff --git a/modules/core/src/main/java/org/apache/ignite/cache/QueryIndexType.java b/modules/commons/src/main/java/org/apache/ignite/cache/QueryIndexType.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/cache/QueryIndexType.java rename to modules/commons/src/main/java/org/apache/ignite/cache/QueryIndexType.java diff --git a/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityKeyMapped.java b/modules/commons/src/main/java/org/apache/ignite/cache/affinity/AffinityKeyMapped.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityKeyMapped.java rename to modules/commons/src/main/java/org/apache/ignite/cache/affinity/AffinityKeyMapped.java diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QueryGroupIndex.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QueryGroupIndex.java similarity index 97% rename from modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QueryGroupIndex.java rename to modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QueryGroupIndex.java index 797fbe453a827..3c76347ececba 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QueryGroupIndex.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QueryGroupIndex.java @@ -22,7 +22,6 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.apache.ignite.cache.QueryIndex; -import org.apache.ignite.configuration.CacheConfiguration; /** * Describes group index. diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlField.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlField.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlField.java rename to modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlField.java index 1593018cb2ac2..64550aed6e7a9 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlField.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlField.java @@ -23,8 +23,6 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.apache.ignite.cache.QueryIndex; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.internal.processors.cache.query.CacheQuery; /** * Annotates fields for SQL queries. All fields that will be involved in SQL clauses must have diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QueryTextField.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QueryTextField.java similarity index 95% rename from modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QueryTextField.java rename to modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QueryTextField.java index 9e90e9247d5d5..6fdae549eba74 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QueryTextField.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QueryTextField.java @@ -22,7 +22,6 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.apache.ignite.internal.processors.cache.query.CacheQuery; /** * Annotation for fields to be indexed for full text diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityClassProperty.java b/modules/commons/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityClassProperty.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityClassProperty.java rename to modules/commons/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityClassProperty.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityIndexDescriptor.java b/modules/commons/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityIndexDescriptor.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityIndexDescriptor.java rename to modules/commons/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityIndexDescriptor.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityTypeDescriptor.java b/modules/commons/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityTypeDescriptor.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityTypeDescriptor.java rename to modules/commons/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityTypeDescriptor.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexDescriptor.java b/modules/commons/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexDescriptor.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexDescriptor.java rename to modules/commons/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexDescriptor.java diff --git a/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java index 46ebe48608ce0..d07978e07c69a 100644 --- a/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java +++ b/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java @@ -29,6 +29,7 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; +import java.math.BigDecimal; import java.net.DatagramSocket; import java.net.Socket; import java.net.SocketException; @@ -44,18 +45,25 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.security.ProtectionDomain; +import java.sql.Time; +import java.sql.Timestamp; import java.time.Instant; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.Map; import java.util.ServiceLoader; +import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -82,6 +90,7 @@ import org.apache.ignite.lang.IgniteFutureTimeoutException; import org.apache.ignite.lang.IgnitePredicate; import org.apache.ignite.thread.IgniteThread; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static java.util.Objects.isNull; @@ -223,6 +232,18 @@ public abstract class CommonUtils { /** */ private static final Class GEOMETRY_CLASS = classForName("org.locationtech.jts.geom.Geometry", null); + /** Boxed class map. */ + private static final Map, Class> boxedClsMap = new HashMap<>(16, .5f); + + /** Field name for key. */ + public static final String KEY_FIELD_NAME = "_KEY"; + + /** Field name for value. */ + public static final String VAL_FIELD_NAME = "_VAL"; + + /** */ + private static final Set> SQL_TYPES = createSqlTypes(); + static { primitiveMap.put("byte", byte.class); primitiveMap.put("short", short.class); @@ -234,6 +255,16 @@ public abstract class CommonUtils { primitiveMap.put("boolean", boolean.class); primitiveMap.put("void", void.class); + boxedClsMap.put(byte.class, Byte.class); + boxedClsMap.put(short.class, Short.class); + boxedClsMap.put(int.class, Integer.class); + boxedClsMap.put(long.class, Long.class); + boxedClsMap.put(float.class, Float.class); + boxedClsMap.put(double.class, Double.class); + boxedClsMap.put(char.class, Character.class); + boxedClsMap.put(boolean.class, Boolean.class); + boxedClsMap.put(void.class, Void.class); + try { OBJECT_CTOR = Object.class.getConstructor(); } @@ -2122,4 +2153,62 @@ public static IgniteException convertException(IgniteCheckedException e) { public static boolean isGeometryClass(Class cls) { return GEOMETRY_CLASS != null && GEOMETRY_CLASS.isAssignableFrom(cls); } + + /** + * Gets wrapper class for a primitive type. + * + * @param cls Class. If {@code null}, method is no-op. + * @return Wrapper class or original class if it is non-primitive. + */ + @Nullable public static Class box(@Nullable Class cls) { + if (cls == null) + return null; + + if (!cls.isPrimitive()) + return cls; + + return boxedClsMap.get(cls); + } + + /** + * Checks if the given class can be mapped to a simple SQL type. + * + * @param cls Class. + * @return {@code true} If can. + */ + public static boolean isSqlType(Class cls) { + cls = box(cls); + + return SQL_TYPES.contains(cls) || isGeometryClass(cls); + } + + /** + * Creates SQL types set. + * + * @return SQL types set. + */ + @NotNull private static Set> createSqlTypes() { + Set> sqlClasses = new HashSet<>(Arrays.>asList( + Integer.class, + Boolean.class, + Byte.class, + Short.class, + Long.class, + BigDecimal.class, + Double.class, + Float.class, + Time.class, + Timestamp.class, + Date.class, + java.sql.Date.class, + LocalTime.class, + LocalDate.class, + LocalDateTime.class, + String.class, + UUID.class, + byte[].class + )); + + return sqlClasses; + } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QuerySchema.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QuerySchema.java index 6b5838ee824fa..0105eaa68b909 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QuerySchema.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QuerySchema.java @@ -140,7 +140,7 @@ public QuerySchemaPatch makePatch(CacheConfiguration targetCfg, Collection if (locEntities.containsKey(qryEntity.getTableName())) { QueryEntity locEntity = locEntities.get(qryEntity.getTableName()); - QueryEntityPatch entityPatch = locEntity.makePatch(qryEntity); + QueryEntityPatch entityPatch = QueryUtils.makePatch(locEntity, qryEntity); if (entityPatch.hasConflict()) { if (conflicts.length() > 0) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java index 782012cc9da2a..1ead1e64a10e6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java @@ -20,15 +20,8 @@ import java.lang.reflect.Method; import java.math.BigDecimal; import java.sql.SQLException; -import java.sql.Time; -import java.sql.Timestamp; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; -import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; @@ -44,6 +37,7 @@ import org.apache.ignite.IgniteSystemProperties; import org.apache.ignite.binary.BinaryField; import org.apache.ignite.cache.QueryEntity; +import org.apache.ignite.cache.QueryEntityPatch; import org.apache.ignite.cache.QueryIndex; import org.apache.ignite.cache.QueryIndexType; import org.apache.ignite.cache.affinity.AffinityKeyMapper; @@ -68,6 +62,10 @@ import org.apache.ignite.internal.processors.query.property.QueryPropertyAccessor; import org.apache.ignite.internal.processors.query.property.QueryReadOnlyMethodsAccessor; import org.apache.ignite.internal.processors.query.schema.SchemaOperationException; +import org.apache.ignite.internal.processors.query.schema.operation.SchemaAbstractOperation; +import org.apache.ignite.internal.processors.query.schema.operation.SchemaAlterTableAddColumnOperation; +import org.apache.ignite.internal.processors.query.schema.operation.SchemaIndexCreateOperation; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.internal.util.typedef.internal.A; @@ -113,10 +111,10 @@ public class QueryUtils { public static final String SCHEMA_INFORMATION = "INFORMATION_SCHEMA"; /** Field name for key. */ - public static final String KEY_FIELD_NAME = "_KEY"; + public static final String KEY_FIELD_NAME = CommonUtils.KEY_FIELD_NAME; /** Field name for value. */ - public static final String VAL_FIELD_NAME = "_VAL"; + public static final String VAL_FIELD_NAME = CommonUtils.VAL_FIELD_NAME; /** Well-known template name for PARTITIONED cache. */ public static final String TEMPLATE_PARTITIONED = "PARTITIONED"; @@ -131,9 +129,6 @@ public class QueryUtils { private static final int DISCO_HIST_SIZE = getInteger(IGNITE_INDEXING_DISCOVERY_HISTORY_SIZE, DFLT_INDEXING_DISCOVERY_HISTORY_SIZE); - /** */ - private static final Set> SQL_TYPES = createSqlTypes(); - /** Default SQL delimeter. */ public static final char DEFAULT_DELIM = '\n'; @@ -157,36 +152,6 @@ public class QueryUtils { public static final ThreadLocal INCLUDE_SENSITIVE_TL = ThreadLocal.withInitial(() -> DFLT_TO_STRING_INCLUDE_SENSITIVE); - /** - * Creates SQL types set. - * - * @return SQL types set. - */ - @NotNull private static Set> createSqlTypes() { - Set> sqlClasses = new HashSet<>(Arrays.>asList( - Integer.class, - Boolean.class, - Byte.class, - Short.class, - Long.class, - BigDecimal.class, - Double.class, - Float.class, - Time.class, - Timestamp.class, - Date.class, - java.sql.Date.class, - LocalTime.class, - LocalDate.class, - LocalDateTime.class, - String.class, - UUID.class, - byte[].class - )); - - return sqlClasses; - } - /** * Get table name for entity. * @@ -1168,9 +1133,7 @@ private static boolean mustDeserializeBinary(GridKernalContext ctx, Class cls) { * @return {@code true} If can. */ public static boolean isSqlType(Class cls) { - cls = U.box(cls); - - return SQL_TYPES.contains(cls) || U.isGeometryClass(cls); + return CommonUtils.isSqlType(cls); } /** @@ -1811,6 +1774,228 @@ public static IgniteInternalCache cacheForDML(IgniteInternalCache qryFieldsToAdd = checkFields(locEntity, target, conflicts); + + Collection indexesToAdd = checkIndexes(locEntity, target, conflicts); + + if (conflicts.length() != 0) + return QueryEntityPatch.conflict(locEntity.getTableName() + " conflict: \n" + conflicts.toString()); + + Collection patchOperations = new ArrayList<>(); + + if (!qryFieldsToAdd.isEmpty()) + patchOperations.add(new SchemaAlterTableAddColumnOperation( + UUID.randomUUID(), + null, + null, + locEntity.getTableName(), + qryFieldsToAdd, + true, + true + )); + + if (!indexesToAdd.isEmpty()) { + for (QueryIndex idx : indexesToAdd) { + patchOperations.add(new SchemaIndexCreateOperation( + UUID.randomUUID(), + null, + null, + locEntity.getTableName(), + idx, + true, + 0 + )); + } + } + + return QueryEntityPatch.patch(patchOperations); + } + + /** + * Comparing local entity fields and target entity fields. + * + * @param target Query entity for check. + * @param conflicts Storage of conflicts. + * @return Fields which exist in target and not exist in local. + */ + private static List checkFields(QueryEntity locEntity, QueryEntity target, StringBuilder conflicts) { + List qryFieldsToAdd = new ArrayList<>(); + + for (Map.Entry targetField : target.getFields().entrySet()) { + String targetFieldName = targetField.getKey(); + String targetFieldType = targetField.getValue(); + String targetFieldAlias = target.getAliases().get(targetFieldName); + + if (locEntity.getFields().containsKey(targetFieldName)) { + checkEquals( + conflicts, + "alias of " + targetFieldName, + locEntity.getAliases().get(targetFieldName), + targetFieldAlias + ); + + checkEquals( + conflicts, + "fieldType of " + targetFieldName, + locEntity.getFields().get(targetFieldName), + targetFieldType + ); + + checkEquals( + conflicts, + "nullable of " + targetFieldName, + contains(locEntity.getNotNullFields(), targetFieldName), + contains(target.getNotNullFields(), targetFieldName) + ); + + checkEquals( + conflicts, + "default value of " + targetFieldName, + getFromMap(locEntity.getDefaultFieldValues(), targetFieldName), + getFromMap(target.getDefaultFieldValues(), targetFieldName) + ); + + checkEquals(conflicts, + "precision of " + targetFieldName, + getFromMap(locEntity.getFieldsPrecision(), targetFieldName), + getFromMap(target.getFieldsPrecision(), targetFieldName)); + + checkEquals( + conflicts, + "scale of " + targetFieldName, + getFromMap(locEntity.getFieldsScale(), targetFieldName), + getFromMap(target.getFieldsScale(), targetFieldName)); + } + else { + boolean isAliasConflictsFound = findAliasConflicts(locEntity, targetFieldAlias, targetFieldName, conflicts); + + if (!isAliasConflictsFound) { + Integer precision = getFromMap(target.getFieldsPrecision(), targetFieldName); + Integer scale = getFromMap(target.getFieldsScale(), targetFieldName); + + qryFieldsToAdd.add(new QueryField( + targetFieldName, + targetFieldType, + targetFieldAlias, + !contains(target.getNotNullFields(), targetFieldName), + getFromMap(target.getDefaultFieldValues(), targetFieldName), + precision == null ? -1 : precision, + scale == null ? -1 : scale + )); + } + } + } + + return qryFieldsToAdd; + } + + /** + * Comparing local fields and target fields. + * + * @param target Query entity for check. + * @param conflicts Storage of conflicts. + * @return Indexes which exist in target and not exist in local. + */ + @NotNull private static Collection checkIndexes(QueryEntity locEntity, QueryEntity target, StringBuilder conflicts) { + HashSet indexesToAdd = new HashSet<>(); + + Map curIndexes = new HashMap<>(); + + for (QueryIndex idx : locEntity.getIndexes()) { + if (curIndexes.put(idx.getName(), idx) != null) + throw new IllegalStateException("Duplicate key"); + } + + for (QueryIndex qryIdx : target.getIndexes()) { + if (curIndexes.containsKey(qryIdx.getName())) { + checkEquals( + conflicts, + "index " + qryIdx.getName(), + curIndexes.get(qryIdx.getName()), + qryIdx + ); + } + else + indexesToAdd.add(qryIdx); + } + return indexesToAdd; + } + + /** + * @param collection Collection for checking. + * @param elementToCheck Element for checking to containing in collection. + * @return {@code true} if collection contain elementToCheck. + */ + private static boolean contains(Collection collection, String elementToCheck) { + return collection != null && collection.contains(elementToCheck); + } + + /** + * @return Value from sourceMap or null if map is null. + */ + private static V getFromMap(Map sourceMap, String key) { + return sourceMap == null ? null : sourceMap.get(key); + } + + /** + * Comparing two objects and add formatted text to conflicts if needed. + * + * @param conflicts Storage of conflicts resulting error message. + * @param name Name of comparing object. + * @param local Local object. + * @param received Received object. + */ + private static void checkEquals(StringBuilder conflicts, String name, V local, V received) { + if (!Objects.equals(local, received)) + conflicts.append(String.format("%s is different: local=%s, received=%s\n", name, local, received)); + } + + /** + * Checks if received query entity field has the alias which is already used by a field on the local node. + * + * @return Whether conflicts were found. + */ + private static boolean findAliasConflicts( + QueryEntity locEntity, + String targetFieldAlias, + String targetFieldName, + StringBuilder conflicts + ) { + for (Map.Entry entry : locEntity.getAliases().entrySet()) { + if (Objects.equals(entry.getValue(), targetFieldAlias)) { + conflicts.append(String.format( + "multiple fields are associated with the same alias: alias=%s, localField=%s, receivedField=%s\n", + targetFieldAlias, + entry.getKey(), + targetFieldName) + ); + + return true; + } + } + + return false; + } + /** * Private constructor. */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java index c8ea0134a6ad5..050f6b21299a4 100755 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java @@ -377,9 +377,6 @@ public abstract class IgniteUtils extends CommonUtils { /** Supplier of network interfaces. Could be used for tests purposes, must not be changed in production code. */ public static InterfaceSupplier INTERFACE_SUPPLIER = NetworkInterface::getNetworkInterfaces; - /** Boxed class map. */ - private static final Map, Class> boxedClsMap = new HashMap<>(16, .5f); - /** MAC OS invalid argument socket error message. */ public static final String MAC_INVALID_ARG_MSG = "On MAC OS you may have too many file descriptors open " + "(simple restart usually solves the issue)"; @@ -486,16 +483,6 @@ public abstract class IgniteUtils extends CommonUtils { jvm32Bit = "32".equals(jvmArchDataModel); - boxedClsMap.put(byte.class, Byte.class); - boxedClsMap.put(short.class, Short.class); - boxedClsMap.put(int.class, Integer.class); - boxedClsMap.put(long.class, Long.class); - boxedClsMap.put(float.class, Float.class); - boxedClsMap.put(double.class, Double.class); - boxedClsMap.put(char.class, Character.class); - boxedClsMap.put(boolean.class, Boolean.class); - boxedClsMap.put(void.class, Void.class); - // Disable hostname SSL verification for development and testing with self-signed certificates. if (Boolean.parseBoolean(System.getProperty(IGNITE_DISABLE_HOSTNAME_VERIFIER))) { HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { @@ -5806,22 +5793,6 @@ public static long ensurePositive(long i, long dflt) { return i <= 0 ? dflt : i; } - /** - * Gets wrapper class for a primitive type. - * - * @param cls Class. If {@code null}, method is no-op. - * @return Wrapper class or original class if it is non-primitive. - */ - @Nullable public static Class box(@Nullable Class cls) { - if (cls == null) - return null; - - if (!cls.isPrimitive()) - return cls; - - return boxedClsMap.get(cls); - } - /** * Gets class for provided name. Accepts primitive types names. * From 579f2cf949c63d3735aaf8b7458f08de1d82a84b Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 15 May 2026 19:08:49 +0300 Subject: [PATCH 08/44] WIP --- .../CacheConfigurationDefaults.java | 72 +++++++++++++++++++ .../IgniteConfigurationDefaults.java | 33 +++++++++ .../configuration/CacheConfiguration.java | 48 +------------ .../configuration/IgniteConfiguration.java | 14 +--- .../client/ClientCacheConfiguration.java | 41 ++++++----- 5 files changed, 127 insertions(+), 81 deletions(-) create mode 100644 modules/commons/src/main/java/org/apache/ignite/configuration/CacheConfigurationDefaults.java create mode 100644 modules/commons/src/main/java/org/apache/ignite/configuration/IgniteConfigurationDefaults.java rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java (94%) diff --git a/modules/commons/src/main/java/org/apache/ignite/configuration/CacheConfigurationDefaults.java b/modules/commons/src/main/java/org/apache/ignite/configuration/CacheConfigurationDefaults.java new file mode 100644 index 0000000000000..f5f3882ad4c34 --- /dev/null +++ b/modules/commons/src/main/java/org/apache/ignite/configuration/CacheConfigurationDefaults.java @@ -0,0 +1,72 @@ +/* + * 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.configuration; + +import org.apache.ignite.cache.CacheAtomicityMode; +import org.apache.ignite.cache.CacheMode; +import org.apache.ignite.cache.CacheRebalanceMode; +import org.apache.ignite.cache.PartitionLossPolicy; + +/** */ +public interface CacheConfigurationDefaults { + /** Default atomicity mode. */ + public static final CacheAtomicityMode DFLT_CACHE_ATOMICITY_MODE = CacheAtomicityMode.ATOMIC; + + /** Default number of backups. */ + public static final int DFLT_BACKUPS = 0; + + /** Default caching mode. */ + public static final CacheMode DFLT_CACHE_MODE = CacheMode.PARTITIONED; + + /** Default value for eager ttl flag. */ + public static final boolean DFLT_EAGER_TTL = true; + + /** + * Default lock timeout. + * @deprecated Default lock timeout configuration property has no effect. + */ + @Deprecated + public static final long DFLT_LOCK_TIMEOUT = 0; + + /** Default partition loss policy. */ + public static final PartitionLossPolicy DFLT_PARTITION_LOSS_POLICY = PartitionLossPolicy.IGNORE; + + /** Default value for 'readFromBackup' flag. */ + public static final boolean DFLT_READ_FROM_BACKUP = true; + + /** Default rebalance mode for distributed cache. */ + public static final CacheRebalanceMode DFLT_REBALANCE_MODE = CacheRebalanceMode.ASYNC; + + /** Default value for 'copyOnRead' flag. */ + public static final boolean DFLT_COPY_ON_READ = true; + + /** Default value for 'maxConcurrentAsyncOps'. */ + public static final int DFLT_MAX_CONCURRENT_ASYNC_OPS = 500; + + /** Default maximum number of query iterators that can be stored. */ + public static final int DFLT_MAX_QUERY_ITERATOR_CNT = 1024; + + /** Default number of queries detail metrics to collect. */ + public static final int DFLT_QRY_DETAIL_METRICS_SIZE = 0; + + /** Default query parallelism. */ + public static final int DFLT_QUERY_PARALLELISM = 1; + + /** Default maximum inline size for sql indexes. */ + public static final int DFLT_SQL_INDEX_MAX_INLINE_SIZE = -1; +} diff --git a/modules/commons/src/main/java/org/apache/ignite/configuration/IgniteConfigurationDefaults.java b/modules/commons/src/main/java/org/apache/ignite/configuration/IgniteConfigurationDefaults.java new file mode 100644 index 0000000000000..25b8e7ced9418 --- /dev/null +++ b/modules/commons/src/main/java/org/apache/ignite/configuration/IgniteConfigurationDefaults.java @@ -0,0 +1,33 @@ +/* + * 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.configuration; + +/** */ +public interface IgniteConfigurationDefaults { + /** Default rebalance batch size in bytes (value is {@code 512Kb}). */ + public static final int DFLT_REBALANCE_BATCH_SIZE = 512 * 1024; // 512K + + /** Default rebalance batches prefetch count (value is {@code 3}). */ + public static final long DFLT_REBALANCE_BATCHES_PREFETCH_COUNT = 3; + + /** Time to wait between rebalance messages in milliseconds to avoid overloading CPU (value is {@code 0}). */ + public static final long DFLT_REBALANCE_THROTTLE = 0; + + /** Default rebalance message timeout in milliseconds (value is {@code 10000}). */ + public static final long DFLT_REBALANCE_TIMEOUT = 10000; +} diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java index 7140c603e5cd8..107c720de2c0b 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java @@ -79,7 +79,7 @@ * can be configured from Spring XML files (or other DI frameworks).

Note that absolutely all configuration * properties are optional, so users should only change what they need. */ -public class CacheConfiguration extends MutableConfiguration { +public class CacheConfiguration extends MutableConfiguration implements CacheConfigurationDefaults { /** */ private static final long serialVersionUID = 0L; @@ -114,37 +114,15 @@ public class CacheConfiguration extends MutableConfiguration { @Deprecated public static final long DFLT_REBALANCE_THROTTLE = IgniteConfiguration.DFLT_REBALANCE_THROTTLE; - /** Default number of backups. */ - public static final int DFLT_BACKUPS = 0; - - /** Default caching mode. */ - public static final CacheMode DFLT_CACHE_MODE = CacheMode.PARTITIONED; - - /** Default atomicity mode. */ - public static final CacheAtomicityMode DFLT_CACHE_ATOMICITY_MODE = CacheAtomicityMode.ATOMIC; - - /** - * Default lock timeout. - * @deprecated Default lock timeout configuration property has no effect. - */ - @Deprecated - public static final long DFLT_LOCK_TIMEOUT = 0; - /** Default cache size to use with eviction policy. */ public static final int DFLT_CACHE_SIZE = 100000; - /** Default maximum inline size for sql indexes. */ - public static final int DFLT_SQL_INDEX_MAX_INLINE_SIZE = -1; - /** Initial default near cache size. */ public static final int DFLT_NEAR_START_SIZE = 1500000 / 4; /** Default value for 'invalidate' flag that indicates if this is invalidation-based cache. */ public static final boolean DFLT_INVALIDATE = false; - /** Default rebalance mode for distributed cache. */ - public static final CacheRebalanceMode DFLT_REBALANCE_MODE = CacheRebalanceMode.ASYNC; - /** * Default rebalance batch size in bytes. * @deprecated Use {@link IgniteConfiguration#DFLT_REBALANCE_BATCH_SIZE} instead. @@ -152,12 +130,6 @@ public class CacheConfiguration extends MutableConfiguration { @Deprecated public static final int DFLT_REBALANCE_BATCH_SIZE = IgniteConfiguration.DFLT_REBALANCE_BATCH_SIZE; - /** Default value for eager ttl flag. */ - public static final boolean DFLT_EAGER_TTL = true; - - /** Default value for 'maxConcurrentAsyncOps'. */ - public static final int DFLT_MAX_CONCURRENT_ASYNC_OPS = 500; - /** Default value for 'writeBehindEnabled' flag. */ public static final boolean DFLT_WRITE_BEHIND_ENABLED = false; @@ -179,15 +151,9 @@ public class CacheConfiguration extends MutableConfiguration { /** Default write coalescing for write-behind cache store. */ public static final boolean DFLT_WRITE_BEHIND_COALESCING = true; - /** Default maximum number of query iterators that can be stored. */ - public static final int DFLT_MAX_QUERY_ITERATOR_CNT = 1024; - /** Default value for load previous value flag. */ public static final boolean DFLT_LOAD_PREV_VAL = false; - /** Default value for 'readFromBackup' flag. */ - public static final boolean DFLT_READ_FROM_BACKUP = true; - /** Filter that accepts all nodes. */ public static final IgnitePredicate ALL_NODES = new IgniteAllNodesPredicate(); @@ -195,9 +161,6 @@ public class CacheConfiguration extends MutableConfiguration { @Deprecated public static final long DFLT_LONG_QRY_WARN_TIMEOUT = 3000; - /** Default number of queries detail metrics to collect. */ - public static final int DFLT_QRY_DETAIL_METRICS_SIZE = 0; - /** Default value for keep binary in store behavior . */ @SuppressWarnings({"UnnecessaryBoxing", "BooleanConstructorCall"}) public static final Boolean DFLT_STORE_KEEP_BINARY = new Boolean(false); @@ -205,12 +168,6 @@ public class CacheConfiguration extends MutableConfiguration { /** Default threshold for concurrent loading of keys from {@link CacheStore}. */ public static final int DFLT_CONCURRENT_LOAD_ALL_THRESHOLD = 5; - /** Default partition loss policy. */ - public static final PartitionLossPolicy DFLT_PARTITION_LOSS_POLICY = PartitionLossPolicy.IGNORE; - - /** Default query parallelism. */ - public static final int DFLT_QUERY_PARALLELISM = 1; - /** Default value for events disabled flag. */ public static final boolean DFLT_EVENTS_DISABLED = false; @@ -274,9 +231,6 @@ public class CacheConfiguration extends MutableConfiguration { /** Platform cache configuration. Enables native cache in platforms (.NET, ...). */ private PlatformCacheConfiguration platformCfg; - /** Default value for 'copyOnRead' flag. */ - public static final boolean DFLT_COPY_ON_READ = true; - /** Write synchronization mode. */ private CacheWriteSynchronizationMode writeSync; diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java index 16d0bac76cf53..481bbdeae118a 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java @@ -105,7 +105,7 @@ * For more information about grid configuration and startup refer to {@link Ignition} * documentation. */ -public class IgniteConfiguration { +public class IgniteConfiguration implements IgniteConfigurationDefaults { /** Courtesy notice log category. */ public static final String COURTESY_LOGGER_NAME = "org.apache.ignite.CourtesyConfigNotice"; @@ -166,18 +166,6 @@ public class IgniteConfiguration { /** Default limit of threads used for rebalance. */ public static final int DFLT_REBALANCE_THREAD_POOL_SIZE = min(4, max(1, AVAILABLE_PROC_CNT / 4)); - /** Default rebalance message timeout in milliseconds (value is {@code 10000}). */ - public static final long DFLT_REBALANCE_TIMEOUT = 10000; - - /** Default rebalance batches prefetch count (value is {@code 3}). */ - public static final long DFLT_REBALANCE_BATCHES_PREFETCH_COUNT = 3; - - /** Time to wait between rebalance messages in milliseconds to avoid overloading CPU (value is {@code 0}). */ - public static final long DFLT_REBALANCE_THROTTLE = 0; - - /** Default rebalance batch size in bytes (value is {@code 512Kb}). */ - public static final int DFLT_REBALANCE_BATCH_SIZE = 512 * 1024; // 512K - /** Default size of system thread pool. */ public static final int DFLT_SYSTEM_CORE_THREAD_CNT = DFLT_PUBLIC_THREAD_CNT; diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java similarity index 94% rename from modules/core/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java index 693832b30add7..04e8b597e124d 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java @@ -26,9 +26,8 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode; import org.apache.ignite.cache.PartitionLossPolicy; import org.apache.ignite.cache.QueryEntity; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.DataStorageConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.configuration.CacheConfigurationDefaults; +import org.apache.ignite.configuration.IgniteConfigurationDefaults; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.lang.IgniteExperimental; import org.jetbrains.annotations.Nullable; @@ -42,55 +41,55 @@ public final class ClientCacheConfiguration implements Serializable { private String name; /** @serial Atomicity mode. */ - private CacheAtomicityMode atomicityMode = CacheConfiguration.DFLT_CACHE_ATOMICITY_MODE; + private CacheAtomicityMode atomicityMode = CacheConfigurationDefaults.DFLT_CACHE_ATOMICITY_MODE; /** @serial Backups. */ - private int backups = CacheConfiguration.DFLT_BACKUPS; + private int backups = CacheConfigurationDefaults.DFLT_BACKUPS; /** @serial Cache mode. */ - private CacheMode cacheMode = CacheConfiguration.DFLT_CACHE_MODE; + private CacheMode cacheMode = CacheConfigurationDefaults.DFLT_CACHE_MODE; /** @serial Eager TTL flag. */ - private boolean eagerTtl = CacheConfiguration.DFLT_EAGER_TTL; + private boolean eagerTtl = CacheConfigurationDefaults.DFLT_EAGER_TTL; /** @serial Group name. */ private String grpName = null; /** @serial Default lock timeout. */ - private long dfltLockTimeout = CacheConfiguration.DFLT_LOCK_TIMEOUT; + private long dfltLockTimeout = CacheConfigurationDefaults.DFLT_LOCK_TIMEOUT; /** @serial Partition loss policy. */ - private PartitionLossPolicy partLossPlc = CacheConfiguration.DFLT_PARTITION_LOSS_POLICY; + private PartitionLossPolicy partLossPlc = CacheConfigurationDefaults.DFLT_PARTITION_LOSS_POLICY; /** @serial Read from backup. */ - private boolean readFromBackup = CacheConfiguration.DFLT_READ_FROM_BACKUP; + private boolean readFromBackup = CacheConfigurationDefaults.DFLT_READ_FROM_BACKUP; /** @serial Rebalance batch size. */ - private int rebalanceBatchSize = IgniteConfiguration.DFLT_REBALANCE_BATCH_SIZE; + private int rebalanceBatchSize = IgniteConfigurationDefaults.DFLT_REBALANCE_BATCH_SIZE; /** @serial Rebalance batches prefetch count. */ - private long rebalanceBatchesPrefetchCnt = IgniteConfiguration.DFLT_REBALANCE_BATCHES_PREFETCH_COUNT; + private long rebalanceBatchesPrefetchCnt = IgniteConfigurationDefaults.DFLT_REBALANCE_BATCHES_PREFETCH_COUNT; /** @serial Rebalance delay. */ private long rebalanceDelay = 0; /** @serial Rebalance mode. */ - private CacheRebalanceMode rebalanceMode = CacheConfiguration.DFLT_REBALANCE_MODE; + private CacheRebalanceMode rebalanceMode = CacheConfigurationDefaults.DFLT_REBALANCE_MODE; /** @serial Rebalance order. */ private int rebalanceOrder = 0; /** @serial Rebalance throttle. */ - private long rebalanceThrottle = IgniteConfiguration.DFLT_REBALANCE_THROTTLE; + private long rebalanceThrottle = IgniteConfigurationDefaults.DFLT_REBALANCE_THROTTLE; /** @serial Rebalance timeout. */ - private long rebalanceTimeout = IgniteConfiguration.DFLT_REBALANCE_TIMEOUT; + private long rebalanceTimeout = IgniteConfigurationDefaults.DFLT_REBALANCE_TIMEOUT; /** @serial Write synchronization mode. */ private CacheWriteSynchronizationMode writeSynchronizationMode = CacheWriteSynchronizationMode.PRIMARY_SYNC; /** @serial Copy on read. */ - private boolean cpOnRead = CacheConfiguration.DFLT_COPY_ON_READ; + private boolean cpOnRead = CacheConfigurationDefaults.DFLT_COPY_ON_READ; /** @serial Data region name. */ private String dataRegionName = null; @@ -99,25 +98,25 @@ public final class ClientCacheConfiguration implements Serializable { private boolean statisticsEnabled = false; /** @serial Max concurrent async operations. */ - private int maxConcurrentAsyncOperations = CacheConfiguration.DFLT_MAX_CONCURRENT_ASYNC_OPS; + private int maxConcurrentAsyncOperations = CacheConfigurationDefaults.DFLT_MAX_CONCURRENT_ASYNC_OPS; /** @serial Max query iterators count. */ - private int maxQryIteratorsCnt = CacheConfiguration.DFLT_MAX_QUERY_ITERATOR_CNT; + private int maxQryIteratorsCnt = CacheConfigurationDefaults.DFLT_MAX_QUERY_ITERATOR_CNT; /** @serial Onheap cache enabled. */ private boolean onheapCacheEnabled = false; /** @serial Query detail metrics size. */ - private int qryDetailMetricsSize = CacheConfiguration.DFLT_QRY_DETAIL_METRICS_SIZE; + private int qryDetailMetricsSize = CacheConfigurationDefaults.DFLT_QRY_DETAIL_METRICS_SIZE; /** @serial Query parallelism. */ - private int qryParallelism = CacheConfiguration.DFLT_QUERY_PARALLELISM; + private int qryParallelism = CacheConfigurationDefaults.DFLT_QUERY_PARALLELISM; /** @serial Sql escape all. */ private boolean sqlEscapeAll = false; /** @serial Sql index max inline size. */ - private int sqlIdxMaxInlineSize = CacheConfiguration.DFLT_SQL_INDEX_MAX_INLINE_SIZE; + private int sqlIdxMaxInlineSize = CacheConfigurationDefaults.DFLT_SQL_INDEX_MAX_INLINE_SIZE; /** @serial Sql schema. */ private String sqlSchema = null; From a49de7fcedfc2560d45319bfdc67f1ba835f5b2a Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 15 May 2026 22:07:43 +0300 Subject: [PATCH 09/44] WIP --- .../CacheEntryEventSerializableFilter.java | 0 .../org/apache/ignite/cache/CachePeekMode.java | 1 - .../cache/query/AbstractContinuousQuery.java | 2 -- .../ignite/cache/query/ContinuousQuery.java | 4 ---- .../ignite/cache/query/FieldsQueryCursor.java | 0 .../org/apache/ignite/cache/query/Query.java | 5 ++--- .../apache/ignite/cache/query/QueryCursor.java | 0 .../apache/ignite/cache/query/ScanQuery.java | 1 - .../ignite/cache/query/SqlFieldsQuery.java | 5 ++--- .../CacheConfigurationDefaults.java | 3 +++ .../ignite/internal/util/CommonUtils.java | 16 ++++++++++++++++ .../org/apache/ignite/cache/query/SqlQuery.java | 3 ++- .../configuration/CacheConfiguration.java | 3 --- .../internal/processors/query/QueryUtils.java | 17 ----------------- .../org/apache/ignite/client/ClientCache.java | 0 15 files changed, 25 insertions(+), 35 deletions(-) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/CacheEntryEventSerializableFilter.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/CachePeekMode.java (98%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/query/AbstractContinuousQuery.java (98%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java (97%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/query/FieldsQueryCursor.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/query/Query.java (96%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/query/QueryCursor.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/query/ScanQuery.java (99%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java (98%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientCache.java (100%) diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheEntryEventSerializableFilter.java b/modules/commons/src/main/java/org/apache/ignite/cache/CacheEntryEventSerializableFilter.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/cache/CacheEntryEventSerializableFilter.java rename to modules/commons/src/main/java/org/apache/ignite/cache/CacheEntryEventSerializableFilter.java diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CachePeekMode.java b/modules/commons/src/main/java/org/apache/ignite/cache/CachePeekMode.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/cache/CachePeekMode.java rename to modules/commons/src/main/java/org/apache/ignite/cache/CachePeekMode.java index 108021c6eead0..ff281f546720c 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/CachePeekMode.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/CachePeekMode.java @@ -17,7 +17,6 @@ package org.apache.ignite.cache; -import org.apache.ignite.IgniteCache; import org.jetbrains.annotations.Nullable; /** diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/AbstractContinuousQuery.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/AbstractContinuousQuery.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/cache/query/AbstractContinuousQuery.java rename to modules/commons/src/main/java/org/apache/ignite/cache/query/AbstractContinuousQuery.java index a9391e4a98c2e..5fdbe09399ed9 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/AbstractContinuousQuery.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/AbstractContinuousQuery.java @@ -21,8 +21,6 @@ import javax.cache.configuration.Factory; import javax.cache.event.CacheEntryEventFilter; import javax.cache.event.EventType; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.lang.IgniteAsyncCallback; /** * Base class for continuous query. diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java similarity index 97% rename from modules/core/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java rename to modules/commons/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java index ef76a8c2bf940..bbf5d4d410c4a 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java @@ -21,11 +21,7 @@ import javax.cache.configuration.Factory; import javax.cache.event.CacheEntryEventFilter; import javax.cache.event.CacheEntryUpdatedListener; -import org.apache.ignite.IgniteCache; import org.apache.ignite.cache.CacheEntryEventSerializableFilter; -import org.apache.ignite.cache.query.ContinuousQueryWithTransformer.EventListener; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.lang.IgniteAsyncCallback; /** * API for configuring continuous cache queries. diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/FieldsQueryCursor.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/FieldsQueryCursor.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/cache/query/FieldsQueryCursor.java rename to modules/commons/src/main/java/org/apache/ignite/cache/query/FieldsQueryCursor.java diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/Query.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/Query.java similarity index 96% rename from modules/core/src/main/java/org/apache/ignite/cache/query/Query.java rename to modules/commons/src/main/java/org/apache/ignite/cache/query/Query.java index cfd58d298cd91..0d79db9e777d4 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/Query.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/Query.java @@ -19,8 +19,7 @@ import java.io.Serializable; import java.util.Arrays; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.configuration.CacheConfigurationDefaults; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.S; @@ -127,7 +126,7 @@ protected int[] prepare(int[] parts) { else if (sorted) validateDups(parts[i], parts[i + 1]); - A.ensure(0 <= parts[i] && parts[i] < CacheConfiguration.MAX_PARTITIONS_COUNT, "Illegal partition"); + A.ensure(0 <= parts[i] && parts[i] < CacheConfigurationDefaults.MAX_PARTITIONS_COUNT, "Illegal partition"); } // Sort and validate again. diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryCursor.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/QueryCursor.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/cache/query/QueryCursor.java rename to modules/commons/src/main/java/org/apache/ignite/cache/query/QueryCursor.java diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/ScanQuery.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/ScanQuery.java similarity index 99% rename from modules/core/src/main/java/org/apache/ignite/cache/query/ScanQuery.java rename to modules/commons/src/main/java/org/apache/ignite/cache/query/ScanQuery.java index abf89e158a4c3..eeef1f6052021 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/ScanQuery.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/ScanQuery.java @@ -18,7 +18,6 @@ package org.apache.ignite.cache.query; import javax.cache.Cache; -import org.apache.ignite.IgniteCache; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.lang.IgniteBiPredicate; import org.jetbrains.annotations.Nullable; diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java rename to modules/commons/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java index af4ef81fa38aa..af001e570e7c1 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java @@ -19,8 +19,7 @@ import java.util.List; import java.util.concurrent.TimeUnit; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.internal.processors.query.QueryUtils; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.tostring.GridToStringInclude; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.S; @@ -196,7 +195,7 @@ public int getTimeout() { * @return {@code this} For chaining. */ public SqlFieldsQuery setTimeout(int timeout, TimeUnit timeUnit) { - this.timeout = QueryUtils.validateTimeout(timeout, timeUnit); + this.timeout = CommonUtils.validateTimeout(timeout, timeUnit); return this; } diff --git a/modules/commons/src/main/java/org/apache/ignite/configuration/CacheConfigurationDefaults.java b/modules/commons/src/main/java/org/apache/ignite/configuration/CacheConfigurationDefaults.java index f5f3882ad4c34..ef940114c3e12 100644 --- a/modules/commons/src/main/java/org/apache/ignite/configuration/CacheConfigurationDefaults.java +++ b/modules/commons/src/main/java/org/apache/ignite/configuration/CacheConfigurationDefaults.java @@ -69,4 +69,7 @@ public interface CacheConfigurationDefaults { /** Default maximum inline size for sql indexes. */ public static final int DFLT_SQL_INDEX_MAX_INLINE_SIZE = -1; + + /** Maximum number of partitions. */ + public static final int MAX_PARTITIONS_COUNT = 65000; } diff --git a/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java index d07978e07c69a..36596da310e56 100644 --- a/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java +++ b/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java @@ -2182,6 +2182,22 @@ public static boolean isSqlType(Class cls) { return SQL_TYPES.contains(cls) || isGeometryClass(cls); } + /** + * @param timeout Timeout. + * @param timeUnit Time unit. + * @return Converted time. + */ + public static int validateTimeout(int timeout, TimeUnit timeUnit) { + A.ensure(timeUnit != TimeUnit.MICROSECONDS && timeUnit != TimeUnit.NANOSECONDS, + "timeUnit minimal resolution is millisecond."); + + A.ensure(timeout >= 0, "timeout value should be non-negative."); + + long tmp = TimeUnit.MILLISECONDS.convert(timeout, timeUnit); + + return (int)tmp; + } + /** * Creates SQL types set. * diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java b/modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java index b5d0fcf15f719..64864b3510406 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java @@ -21,6 +21,7 @@ import javax.cache.Cache; import org.apache.ignite.IgniteCache; import org.apache.ignite.internal.processors.query.QueryUtils; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.tostring.GridToStringInclude; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.S; @@ -188,7 +189,7 @@ public int getTimeout() { * @return {@code this} For chaining. */ public SqlQuery setTimeout(int timeout, TimeUnit timeUnit) { - this.timeout = QueryUtils.validateTimeout(timeout, timeUnit); + this.timeout = CommonUtils.validateTimeout(timeout, timeUnit); return this; } diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java index 107c720de2c0b..4a8d52e81e770 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java @@ -83,9 +83,6 @@ public class CacheConfiguration extends MutableConfiguration impleme /** */ private static final long serialVersionUID = 0L; - /** Maximum number of partitions. */ - public static final int MAX_PARTITIONS_COUNT = 65000; - /** * Default size of rebalance thread pool. * @deprecated Use {@link IgniteConfiguration#DFLT_REBALANCE_THREAD_POOL_SIZE} instead. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java index 1ead1e64a10e6..916b6ad26a3f6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java @@ -68,7 +68,6 @@ import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.X; -import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.U; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -1194,22 +1193,6 @@ public static String typeName(Class cls) { return typeName; } - /** - * @param timeout Timeout. - * @param timeUnit Time unit. - * @return Converted time. - */ - public static int validateTimeout(int timeout, TimeUnit timeUnit) { - A.ensure(timeUnit != TimeUnit.MICROSECONDS && timeUnit != TimeUnit.NANOSECONDS, - "timeUnit minimal resolution is millisecond."); - - A.ensure(timeout >= 0, "timeout value should be non-negative."); - - long tmp = TimeUnit.MILLISECONDS.convert(timeout, timeUnit); - - return (int)tmp; - } - /** * @param ccfg Cache configuration. * @return {@code true} If query index must be enabled for this cache. diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientCache.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCache.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientCache.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCache.java From 23d2437a8f7a416c1113db66108e590cee598cc2 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Mon, 18 May 2026 22:39:41 +0300 Subject: [PATCH 10/44] WIP --- .../org/apache/ignite/configuration/BinaryConfiguration.java | 0 .../java/org/apache/ignite/client/ClientRetryAllPolicy.java | 0 .../java/org/apache/ignite/client/ClientRetryNonePolicy.java | 0 .../main/java/org/apache/ignite/client/ClientRetryPolicy.java | 0 .../java/org/apache/ignite/client/ClientRetryPolicyContext.java | 0 .../java/org/apache/ignite/client/ClientRetryReadPolicy.java | 0 .../org/apache/ignite/configuration/ClientConfiguration.java | 2 -- .../ignite/configuration/ClientTransactionConfiguration.java | 1 - 8 files changed, 3 deletions(-) rename modules/{core => binary/api}/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientRetryAllPolicy.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientRetryNonePolicy.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientRetryPolicy.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientRetryPolicyContext.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientRetryReadPolicy.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/configuration/ClientConfiguration.java (99%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/configuration/ClientTransactionConfiguration.java (98%) diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java b/modules/binary/api/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java rename to modules/binary/api/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientRetryAllPolicy.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientRetryAllPolicy.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientRetryAllPolicy.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientRetryAllPolicy.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientRetryNonePolicy.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientRetryNonePolicy.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientRetryNonePolicy.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientRetryNonePolicy.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientRetryPolicy.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientRetryPolicy.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientRetryPolicy.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientRetryPolicy.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientRetryPolicyContext.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientRetryPolicyContext.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientRetryPolicyContext.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientRetryPolicyContext.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientRetryReadPolicy.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientRetryReadPolicy.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientRetryReadPolicy.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientRetryReadPolicy.java diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/ClientConfiguration.java b/modules/thin-client/api/src/main/java/org/apache/ignite/configuration/ClientConfiguration.java similarity index 99% rename from modules/core/src/main/java/org/apache/ignite/configuration/ClientConfiguration.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/configuration/ClientConfiguration.java index 8badaa9fd93a8..58b99f92429dd 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/ClientConfiguration.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/configuration/ClientConfiguration.java @@ -27,7 +27,6 @@ import javax.net.ssl.SSLContext; import org.apache.ignite.IgniteLogger; -import org.apache.ignite.cache.query.IndexQuery; import org.apache.ignite.cache.query.ScanQuery; import org.apache.ignite.client.ClientAddressFinder; import org.apache.ignite.client.ClientPartitionAwarenessMapper; @@ -37,7 +36,6 @@ import org.apache.ignite.client.ClientTransactions; import org.apache.ignite.client.SslMode; import org.apache.ignite.client.SslProtocol; -import org.apache.ignite.internal.client.thin.TcpIgniteClient; import org.apache.ignite.internal.util.typedef.internal.LT; import org.apache.ignite.internal.util.typedef.internal.S; diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/ClientTransactionConfiguration.java b/modules/thin-client/api/src/main/java/org/apache/ignite/configuration/ClientTransactionConfiguration.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/configuration/ClientTransactionConfiguration.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/configuration/ClientTransactionConfiguration.java index fd1d50f8008a9..ddde73b1c7b75 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/ClientTransactionConfiguration.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/configuration/ClientTransactionConfiguration.java @@ -19,7 +19,6 @@ import java.io.Serializable; import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; From c5a9be442c34ffd04380d69bda1c8ee3e119be84 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Mon, 18 May 2026 22:41:50 +0300 Subject: [PATCH 11/44] WIP --- .../java/org/apache/ignite/client/events/ClientFailEvent.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/ClientFailEvent.java (100%) diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/ClientFailEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ClientFailEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/ClientFailEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ClientFailEvent.java From 6f823f83e6b4d20648527ebb213b2f929fdb45e3 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Mon, 18 May 2026 23:24:40 +0300 Subject: [PATCH 12/44] WIP --- .../internal/MessageSerializerGenerator.java | 6 + .../apache/ignite/cluster/BaselineNode.java | 1 - .../apache/ignite/cluster/ClusterMetrics.java | 3 - .../apache/ignite/cluster/ClusterNode.java | 2 - .../apache/ignite/cluster/ClusterState.java | 0 .../ignite/internal/IgniteNodeAttributes.java | 0 .../ignite/internal/IgniteProperties.java | 0 .../ignite/internal/IgniteVersionUtils.java | 0 .../ignite/internal/util/CommonUtils.java | 127 ++++++++++++++++++ .../ignite/lang/IgniteProductVersion.java | 21 +-- .../ignite/internal/CoreMessagesProvider.java | 2 - .../ignite/internal/util/IgniteUtils.java | 127 ------------------ .../communication/MessageReader.java | 6 + .../communication/MessageWriter.java | 11 ++ .../apache/ignite/client/ClientCluster.java | 0 .../ignite/client/ClientClusterGroup.java | 2 - 16 files changed, 156 insertions(+), 152 deletions(-) rename modules/{core => commons}/src/main/java/org/apache/ignite/cluster/BaselineNode.java (97%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java (99%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cluster/ClusterNode.java (99%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cluster/ClusterState.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/IgniteProperties.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java (94%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientCluster.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientClusterGroup.java (98%) diff --git a/modules/codegen/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java index 7874b5dcd8c42..58fb71f13cf4d 100644 --- a/modules/codegen/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java +++ b/modules/codegen/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java @@ -459,6 +459,9 @@ else if (assignableFrom(type, type("org.apache.ignite.internal.processors.cache. else if (assignableFrom(type, type("org.apache.ignite.internal.util.GridLongList"))) returnFalseIfWriteFailed(write, field, "writer.writeGridLongList", getExpr); + else if (assignableFrom(type, type("org.apache.ignite.lang.IgniteProductVersion"))) + returnFalseIfWriteFailed(write, field, "writer.writeIgniteProductVersion", getExpr); + else if (assignableFrom(type, type(MESSAGE_INTERFACE))) { if (sameType(type, COMPRESSED_MESSAGE_INTERFACE)) throw new IllegalArgumentException(COMPRESSED_MSG_ERROR); @@ -685,6 +688,9 @@ else if (assignableFrom(type, type("org.apache.ignite.internal.processors.cache. else if (assignableFrom(type, type("org.apache.ignite.internal.util.GridLongList"))) returnFalseIfReadFailed(field, "reader.readGridLongList"); + else if (assignableFrom(type, type("org.apache.ignite.lang.IgniteProductVersion"))) + returnFalseIfReadFailed(field, "reader.readIgniteProductVersion"); + else if (assignableFrom(type, type(MESSAGE_INTERFACE))) { if (sameType(type, COMPRESSED_MESSAGE_INTERFACE)) throw new IllegalArgumentException(COMPRESSED_MSG_ERROR); diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/BaselineNode.java b/modules/commons/src/main/java/org/apache/ignite/cluster/BaselineNode.java similarity index 97% rename from modules/core/src/main/java/org/apache/ignite/cluster/BaselineNode.java rename to modules/commons/src/main/java/org/apache/ignite/cluster/BaselineNode.java index 9564aa01a55af..57c5f0f2bb5da 100644 --- a/modules/core/src/main/java/org/apache/ignite/cluster/BaselineNode.java +++ b/modules/commons/src/main/java/org/apache/ignite/cluster/BaselineNode.java @@ -18,7 +18,6 @@ package org.apache.ignite.cluster; import java.util.Map; -import org.apache.ignite.configuration.IgniteConfiguration; import org.jetbrains.annotations.Nullable; /** diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java b/modules/commons/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java similarity index 99% rename from modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java rename to modules/commons/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java index 326e725c0f186..7f46e9d2763e6 100644 --- a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java +++ b/modules/commons/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java @@ -17,9 +17,6 @@ package org.apache.ignite.cluster; -import org.apache.ignite.IgniteCluster; -import org.apache.ignite.configuration.IgniteConfiguration; - /** * This class represents runtime information on a cluster. Apart from obvious * statistical value, this information is used for implementation of diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java b/modules/commons/src/main/java/org/apache/ignite/cluster/ClusterNode.java similarity index 99% rename from modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java rename to modules/commons/src/main/java/org/apache/ignite/cluster/ClusterNode.java index bc698c38889ea..1aa43fbbfc0c5 100644 --- a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java +++ b/modules/commons/src/main/java/org/apache/ignite/cluster/ClusterNode.java @@ -21,8 +21,6 @@ import java.util.List; import java.util.Map; import java.util.UUID; -import org.apache.ignite.Ignite; -import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteNodeAttributes; import org.apache.ignite.lang.IgniteExperimental; import org.apache.ignite.lang.IgniteProductVersion; diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterState.java b/modules/commons/src/main/java/org/apache/ignite/cluster/ClusterState.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/cluster/ClusterState.java rename to modules/commons/src/main/java/org/apache/ignite/cluster/ClusterState.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java b/modules/commons/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java rename to modules/commons/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteProperties.java b/modules/commons/src/main/java/org/apache/ignite/internal/IgniteProperties.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/IgniteProperties.java rename to modules/commons/src/main/java/org/apache/ignite/internal/IgniteProperties.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java b/modules/commons/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java rename to modules/commons/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java diff --git a/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java index 36596da310e56..e87513b9b0aae 100644 --- a/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java +++ b/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java @@ -241,6 +241,9 @@ public abstract class CommonUtils { /** Field name for value. */ public static final String VAL_FIELD_NAME = "_VAL"; + /** Byte bit-mask. */ + private static final int MASK = 0xf; + /** */ private static final Set> SQL_TYPES = createSqlTypes(); @@ -1692,6 +1695,43 @@ else if (utfBytes == 3) { return strBuilder.toString(); } + /** + * Writes byte array to output stream accounting for null values. + * + * @param out Output stream to write to. + * @param arr Array to write, possibly null. + * @throws java.io.IOException If write failed. + */ + public static void writeByteArray(DataOutput out, @Nullable byte[] arr) throws IOException { + if (arr == null) + out.writeInt(-1); + else { + out.writeInt(arr.length); + + out.write(arr); + } + } + + /** + * Reads byte array from input stream accounting for null values. + * + * @param in Stream to read from. + * @return Read byte array, possibly null. + * @throws java.io.IOException If read failed. + */ + @Nullable public static byte[] readByteArray(DataInput in) throws IOException { + int len = in.readInt(); + + if (len == -1) + return null; // Value "-1" indicates null. + + byte[] res = new byte[len]; + + in.readFully(res); + + return res; + } + /** * Get number of bytes for {@link DataOutput#writeUTF}, * depending on character:
@@ -2198,6 +2238,93 @@ public static int validateTimeout(int timeout, TimeUnit timeUnit) { return (int)tmp; } + /** + * Converts byte array to hex string. + * + * @param arr Array of bytes. + * @return Hex string. + */ + public static String byteArray2HexString(byte[] arr) { + return byteArray2HexString(arr, true); + } + + /** + * Converts byte array to hex string. + * + * @param arr Array of bytes. + * @param toUpper If {@code true} returns upper cased result. + * @return Hex string. + */ + public static String byteArray2HexString(byte[] arr, boolean toUpper) { + StringBuilder sb = new StringBuilder(arr.length << 1); + + for (byte b : arr) + addByteAsHex(sb, b); + + return toUpper ? sb.toString().toUpperCase() : sb.toString(); + } + + /** + * @param sb String builder. + * @param b Byte to add in hexadecimal format. + */ + protected static void addByteAsHex(StringBuilder sb, byte b) { + sb.append(Integer.toHexString(MASK & b >>> 4)).append(Integer.toHexString(MASK & b)); + } + + /** + * Converts an array of characters representing hexidecimal values into an + * array of bytes of those same values. The returned array will be half the + * length of the passed array, as it takes two characters to represent any + * given byte. An exception is thrown if the passed char array has an odd + * number of elements. + * + * @param data An array of characters containing hexidecimal digits + * @return A byte array containing binary data decoded from + * the supplied char array. + * @throws IgniteCheckedException Thrown if an odd number or illegal of characters is supplied. + */ + public static byte[] decodeHex(char[] data) throws IgniteCheckedException { + int len = data.length; + + if ((len & 0x01) != 0) + throw new IgniteCheckedException("Odd number of characters."); + + byte[] out = new byte[len >> 1]; + + // Two characters form the hex value. + for (int i = 0, j = 0; j < len; i++) { + int f = toDigit(data[j], j) << 4; + + j++; + + f |= toDigit(data[j], j); + + j++; + + out[i] = (byte)(f & 0xFF); + } + + return out; + } + + /** + * Converts a hexadecimal character to an integer. + * + * @param ch A character to convert to an integer digit + * @param idx The index of the character in the source + * @return An integer + * @throws IgniteCheckedException Thrown if ch is an illegal hex character + */ + public static int toDigit(char ch, int idx) throws IgniteCheckedException { + int digit = Character.digit(ch, 16); + + if (digit == -1) + throw new IgniteCheckedException("Illegal hexadecimal character " + ch + " at index " + idx); + + return digit; + } + /** * Creates SQL types set. * diff --git a/modules/core/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java b/modules/commons/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java similarity index 94% rename from modules/core/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java rename to modules/commons/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java index b4177fcfd7810..23f4d3171c5f6 100644 --- a/modules/core/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java +++ b/modules/commons/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java @@ -25,11 +25,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.internal.CoreMessagesProvider; import org.apache.ignite.internal.IgniteVersionUtils; -import org.apache.ignite.internal.Order; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.plugin.extensions.communication.Message; +import org.apache.ignite.internal.util.CommonUtils; import org.jetbrains.annotations.NotNull; /** @@ -40,7 +37,7 @@ * Two versions are compared in the following order: major number, * minor number, maintenance number, revision timestamp. */ -public class IgniteProductVersion implements Comparable, Externalizable, Message { +public class IgniteProductVersion implements Comparable, Externalizable { /** */ private static final long serialVersionUID = 0L; @@ -55,27 +52,21 @@ public class IgniteProductVersion implements Comparable, E Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)([-.]([^0123456789][^-]+)(-SNAPSHOT)?)?(-(\\d+))?(-([\\da-f]+))?"); /** Major version number. */ - @Order(0) byte major; /** Minor version number. */ - @Order(1) byte minor; /** Maintenance version number. */ - @Order(2) byte maintenance; /** Stage of development. */ - @Order(3) String stage; /** Revision timestamp. */ - @Order(4) long revTs; /** Revision hash. */ - @Order(5) byte[] revHash; /** @@ -262,7 +253,7 @@ public int compareToIgnoreTimestamp(@NotNull IgniteProductVersion o) { out.writeByte(minor); out.writeByte(maintenance); out.writeLong(revTs); - U.writeByteArray(out, revHash); + CommonUtils.writeByteArray(out, revHash); } /** {@inheritDoc} */ @@ -271,14 +262,14 @@ public int compareToIgnoreTimestamp(@NotNull IgniteProductVersion o) { minor = in.readByte(); maintenance = in.readByte(); revTs = in.readLong(); - revHash = U.readByteArray(in); + revHash = CommonUtils.readByteArray(in); } /** {@inheritDoc} */ @Override public String toString() { String revTsStr = IgniteVersionUtils.formatBuildTimeStamp(revTs * 1000); - String hash = U.byteArray2HexString(revHash).toLowerCase(); + String hash = CommonUtils.byteArray2HexString(revHash).toLowerCase(); hash = hash.length() > 8 ? hash.substring(0, 8) : hash; @@ -318,7 +309,7 @@ public static IgniteProductVersion fromString(String verStr) { byte[] revHash = null; if (match.group(9) != null) - revHash = U.decodeHex(match.group(10).toCharArray()); + revHash = CommonUtils.decodeHex(match.group(10).toCharArray()); return new IgniteProductVersion(major, minor, maintenance, stage, revTs, revHash); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java b/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java index f1f7883ea1961..3e4492cd0ca50 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java @@ -238,7 +238,6 @@ import org.apache.ignite.internal.util.distributed.FullMessage; import org.apache.ignite.internal.util.distributed.InitMessage; import org.apache.ignite.internal.util.distributed.SingleNodeMessage; -import org.apache.ignite.lang.IgniteProductVersion; import org.apache.ignite.marshaller.Marshaller; import org.apache.ignite.marshaller.jdk.JdkMarshaller; import org.apache.ignite.plugin.extensions.communication.Message; @@ -344,7 +343,6 @@ public CoreMessagesProvider(Marshaller dfltMarsh, Marshaller schemaAwareMarsh, C withNoSchema(InetSocketAddressMessage.class); withNoSchema(InetAddressMessage.class); withNoSchema(TcpDiscoveryNode.class); - withNoSchema(IgniteProductVersion.class); withNoSchema(DiscoveryDataPacket.class); withNoSchema(GridByteArrayList.class); withNoSchema(CacheVersionedValue.class); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java index 050f6b21299a4..1513346138589 100755 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java @@ -356,9 +356,6 @@ public abstract class IgniteUtils extends CommonUtils { /** Default buffer size = 4K. */ private static final int BUF_SIZE = 4096; - /** Byte bit-mask. */ - private static final int MASK = 0xf; - /** Long date format pattern for log messages. */ public static final DateTimeFormatter LONG_DATE_FMT = DateTimeFormatter.ofPattern("MM/dd/yyyy HH:mm:ss").withZone(ZoneId.systemDefault()); @@ -1789,23 +1786,6 @@ public static boolean hasParent(@Nullable ClassLoader parent, ClassLoader ldr) { return true; } - /** - * Writes byte array to output stream accounting for null values. - * - * @param out Output stream to write to. - * @param arr Array to write, possibly null. - * @throws java.io.IOException If write failed. - */ - public static void writeByteArray(DataOutput out, @Nullable byte[] arr) throws IOException { - if (arr == null) - out.writeInt(-1); - else { - out.writeInt(arr.length); - - out.write(arr); - } - } - /** * Writes byte array to output stream accounting for null values. * @@ -1825,26 +1805,6 @@ public static void writeByteArray(DataOutput out, @Nullable byte[] arr, int maxL } } - /** - * Reads byte array from input stream accounting for null values. - * - * @param in Stream to read from. - * @return Read byte array, possibly null. - * @throws java.io.IOException If read failed. - */ - @Nullable public static byte[] readByteArray(DataInput in) throws IOException { - int len = in.readInt(); - - if (len == -1) - return null; // Value "-1" indicates null. - - byte[] res = new byte[len]; - - in.readFully(res); - - return res; - } - /** * Join byte arrays into single one. * @@ -2192,42 +2152,6 @@ public static boolean bytesEqual(byte[] a, int aOff, byte[] b, int bOff, int len } } - /** - * Converts an array of characters representing hexidecimal values into an - * array of bytes of those same values. The returned array will be half the - * length of the passed array, as it takes two characters to represent any - * given byte. An exception is thrown if the passed char array has an odd - * number of elements. - * - * @param data An array of characters containing hexidecimal digits - * @return A byte array containing binary data decoded from - * the supplied char array. - * @throws IgniteCheckedException Thrown if an odd number or illegal of characters is supplied. - */ - public static byte[] decodeHex(char[] data) throws IgniteCheckedException { - int len = data.length; - - if ((len & 0x01) != 0) - throw new IgniteCheckedException("Odd number of characters."); - - byte[] out = new byte[len >> 1]; - - // Two characters form the hex value. - for (int i = 0, j = 0; j < len; i++) { - int f = toDigit(data[j], j) << 4; - - j++; - - f |= toDigit(data[j], j); - - j++; - - out[i] = (byte)(f & 0xFF); - } - - return out; - } - /** * @param bytes Number of bytes to display. * @param si If {@code true}, then unit base is 1000, otherwise unit base is 1024. @@ -2744,40 +2668,6 @@ public static URL resolveSpringUrl(String springCfgPath) throws IgniteCheckedExc return null; } - /** - * Converts byte array to hex string. - * - * @param arr Array of bytes. - * @return Hex string. - */ - public static String byteArray2HexString(byte[] arr) { - return byteArray2HexString(arr, true); - } - - /** - * Converts byte array to hex string. - * - * @param arr Array of bytes. - * @param toUpper If {@code true} returns upper cased result. - * @return Hex string. - */ - public static String byteArray2HexString(byte[] arr, boolean toUpper) { - StringBuilder sb = new StringBuilder(arr.length << 1); - - for (byte b : arr) - addByteAsHex(sb, b); - - return toUpper ? sb.toString().toUpperCase() : sb.toString(); - } - - /** - * @param sb String builder. - * @param b Byte to add in hexadecimal format. - */ - private static void addByteAsHex(StringBuilder sb, byte b) { - sb.append(Integer.toHexString(MASK & b >>> 4)).append(Integer.toHexString(MASK & b)); - } - /** * Checks for containment of the value in the array. * Both array cells and value may be {@code null}. Two {@code null}s are considered equal. @@ -6403,23 +6293,6 @@ public static IgniteCheckedException exceptionWithSuppressed(String msg, @Nullab return e; } - /** - * Converts a hexadecimal character to an integer. - * - * @param ch A character to convert to an integer digit - * @param idx The index of the character in the source - * @return An integer - * @throws IgniteCheckedException Thrown if ch is an illegal hex character - */ - public static int toDigit(char ch, int idx) throws IgniteCheckedException { - int digit = Character.digit(ch, 16); - - if (digit == -1) - throw new IgniteCheckedException("Illegal hexadecimal character " + ch + " at index " + idx); - - return digit; - } - /** * Gets oldest node out of collection of nodes. * diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java index f2190a1e86a41..08adcf1febb84 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java @@ -26,6 +26,7 @@ import org.apache.ignite.internal.processors.cache.CacheObject; import org.apache.ignite.internal.processors.cache.KeyCacheObject; import org.apache.ignite.internal.util.GridLongList; +import org.apache.ignite.lang.IgniteProductVersion; import org.apache.ignite.lang.IgniteUuid; /** @@ -270,6 +271,11 @@ public default T readMessage() { */ public > M readMap(MessageMapType type, boolean compress); + /** @return Ignite product version. */ + default IgniteProductVersion readIgniteProductVersion() { + return null; + } + /** * Tells whether last invocation of any of {@code readXXX(...)} * methods has fully written the value. {@code False} is returned diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java index c29e3ac093db9..02a6cff137da9 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java @@ -26,6 +26,7 @@ import org.apache.ignite.internal.processors.cache.CacheObject; import org.apache.ignite.internal.processors.cache.KeyCacheObject; import org.apache.ignite.internal.util.GridLongList; +import org.apache.ignite.lang.IgniteProductVersion; import org.apache.ignite.lang.IgniteUuid; import org.jetbrains.annotations.Nullable; @@ -328,6 +329,16 @@ public default boolean writeMap(Map map, MessageMapType type) { */ public boolean writeMap(Map map, MessageMapType type, boolean compress); + /** + * Writes ignite product version. + * + * @param ver Version. + * @return Whether value was fully written. + */ + default boolean writeIgniteProductVersion(IgniteProductVersion ver) { + return true; + } + /** * @return Whether header of current message is already written. */ diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientCluster.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCluster.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientCluster.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCluster.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientClusterGroup.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientClusterGroup.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/client/ClientClusterGroup.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientClusterGroup.java index 01f8d31ebb2cc..bde1c9b54083b 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/ClientClusterGroup.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientClusterGroup.java @@ -20,9 +20,7 @@ import java.util.Collection; import java.util.UUID; import java.util.function.Predicate; -import org.apache.ignite.Ignition; import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.configuration.IgniteConfiguration; import org.jetbrains.annotations.Nullable; /** From 39c12ac33719e5db3aba8fb93e2cab548825c4a3 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Mon, 18 May 2026 23:25:28 +0300 Subject: [PATCH 13/44] WIP --- .../src/main/java/org/apache/ignite/client/ClientCompute.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientCompute.java (100%) diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientCompute.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCompute.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientCompute.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCompute.java From b883442227c9f817bfedcb2ccdfec2cf63ec84b2 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Mon, 18 May 2026 23:28:22 +0300 Subject: [PATCH 14/44] WIP --- .../internal/processors/service/ServiceCallContextImpl.java | 0 .../main/java/org/apache/ignite/services/ServiceCallContext.java | 0 .../org/apache/ignite/services/ServiceCallContextBuilder.java | 0 .../src/main/java/org/apache/ignite/client/ClientServices.java | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/processors/service/ServiceCallContextImpl.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/services/ServiceCallContext.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/services/ServiceCallContextBuilder.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientServices.java (100%) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/ServiceCallContextImpl.java b/modules/commons/src/main/java/org/apache/ignite/internal/processors/service/ServiceCallContextImpl.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/processors/service/ServiceCallContextImpl.java rename to modules/commons/src/main/java/org/apache/ignite/internal/processors/service/ServiceCallContextImpl.java diff --git a/modules/core/src/main/java/org/apache/ignite/services/ServiceCallContext.java b/modules/commons/src/main/java/org/apache/ignite/services/ServiceCallContext.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/services/ServiceCallContext.java rename to modules/commons/src/main/java/org/apache/ignite/services/ServiceCallContext.java diff --git a/modules/core/src/main/java/org/apache/ignite/services/ServiceCallContextBuilder.java b/modules/commons/src/main/java/org/apache/ignite/services/ServiceCallContextBuilder.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/services/ServiceCallContextBuilder.java rename to modules/commons/src/main/java/org/apache/ignite/services/ServiceCallContextBuilder.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientServices.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientServices.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientServices.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientServices.java From 56a788ade962042770234f73e95135a47c5d53c5 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Mon, 18 May 2026 23:31:55 +0300 Subject: [PATCH 15/44] WIP --- .../api}/src/main/java/org/apache/ignite/IgniteBinary.java | 0 .../src/main/java/org/apache/ignite/client/ClientCompute.java | 1 - .../src/main/java/org/apache/ignite/client/IgniteClient.java | 0 .../ignite/client/events/ClientLifecycleEventListener.java | 0 .../java/org/apache/ignite/client/events/ClientStartEvent.java | 0 .../java/org/apache/ignite/client/events/ClientStopEvent.java | 0 .../src/main/java/org/apache/ignite/client/package-info.java | 0 7 files changed, 1 deletion(-) rename modules/{core => binary/api}/src/main/java/org/apache/ignite/IgniteBinary.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/IgniteClient.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/ClientLifecycleEventListener.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/ClientStartEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/ClientStopEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/package-info.java (100%) diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java b/modules/binary/api/src/main/java/org/apache/ignite/IgniteBinary.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/IgniteBinary.java rename to modules/binary/api/src/main/java/org/apache/ignite/IgniteBinary.java diff --git a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCompute.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCompute.java index d97b99197efdf..ab307c44169b7 100644 --- a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCompute.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCompute.java @@ -18,7 +18,6 @@ package org.apache.ignite.client; import java.util.concurrent.Future; -import org.apache.ignite.compute.ComputeTask; import org.jetbrains.annotations.Nullable; /** diff --git a/modules/core/src/main/java/org/apache/ignite/client/IgniteClient.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/IgniteClient.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/IgniteClient.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/IgniteClient.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/ClientLifecycleEventListener.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ClientLifecycleEventListener.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/ClientLifecycleEventListener.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ClientLifecycleEventListener.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/ClientStartEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ClientStartEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/ClientStartEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ClientStartEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/ClientStopEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ClientStopEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/ClientStopEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ClientStopEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/package-info.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/package-info.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/package-info.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/package-info.java From f357bbb40501b3fee319fd30001d5c1a3f9756b9 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Mon, 18 May 2026 23:53:43 +0300 Subject: [PATCH 16/44] WIP --- assembly/dependencies-apache-ignite-lgpl.xml | 1 + assembly/dependencies-apache-ignite-slim.xml | 1 + assembly/dependencies-apache-ignite.xml | 1 + modules/bom/pom.xml | 5 ++ modules/core/pom.xml | 9 ++- modules/thin-client/impl/pom.xml | 75 +++++++++++++++++++ .../client/thin/BinaryNameMapperMode.java | 0 .../client/thin/ClientCacheEntry.java | 0 .../client/thin/ClientNotificationType.java | 0 .../client/thin/ClientProtocolError.java | 0 .../client/thin/FieldsQueryPager.java | 0 .../client/thin/IgniteClientFutureImpl.java | 0 .../client/thin/NotificationListener.java | 0 .../internal/client/thin/ProtocolVersion.java | 0 .../internal/client/thin/QueryPager.java | 0 .../client/thin/io/ClientConnection.java | 0 .../thin/io/ClientConnectionMultiplexer.java | 0 .../thin/io/ClientConnectionStateHandler.java | 0 .../client/thin/io/ClientMessageDecoder.java | 0 .../client/thin/io/ClientMessageHandler.java | 0 pom.xml | 1 + 21 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 modules/thin-client/impl/pom.xml rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/BinaryNameMapperMode.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheEntry.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientNotificationType.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientProtocolError.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/FieldsQueryPager.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/IgniteClientFutureImpl.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/NotificationListener.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ProtocolVersion.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/QueryPager.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/io/ClientConnection.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/io/ClientConnectionMultiplexer.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/io/ClientConnectionStateHandler.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/io/ClientMessageDecoder.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/io/ClientMessageHandler.java (100%) diff --git a/assembly/dependencies-apache-ignite-lgpl.xml b/assembly/dependencies-apache-ignite-lgpl.xml index ac3d35c972a66..6a12956482793 100644 --- a/assembly/dependencies-apache-ignite-lgpl.xml +++ b/assembly/dependencies-apache-ignite-lgpl.xml @@ -119,6 +119,7 @@ ${project.groupId}:ignite-binary-api ${project.groupId}:ignite-binary-impl ${project.groupId}:ignite-thin-client-api + ${project.groupId}:ignite-thin-client-impl ${project.groupId}:ignite-clients ${project.groupId}:ignite-spring ${project.groupId}:ignite-tools diff --git a/assembly/dependencies-apache-ignite-slim.xml b/assembly/dependencies-apache-ignite-slim.xml index f113444139b1a..537d5c55beae4 100644 --- a/assembly/dependencies-apache-ignite-slim.xml +++ b/assembly/dependencies-apache-ignite-slim.xml @@ -119,6 +119,7 @@ ${project.groupId}:ignite-binary-api ${project.groupId}:ignite-binary-impl ${project.groupId}:ignite-thin-client-api + ${project.groupId}:ignite-thin-client-impl ${project.groupId}:ignite-clients ${project.groupId}:ignite-spring ${project.groupId}:ignite-tools diff --git a/assembly/dependencies-apache-ignite.xml b/assembly/dependencies-apache-ignite.xml index 5952320cba9b2..208fbe8eda207 100644 --- a/assembly/dependencies-apache-ignite.xml +++ b/assembly/dependencies-apache-ignite.xml @@ -120,6 +120,7 @@ ${project.groupId}:ignite-binary-api ${project.groupId}:ignite-binary-impl ${project.groupId}:ignite-thin-client-api + ${project.groupId}:ignite-thin-client-impl ${project.groupId}:ignite-clients ${project.groupId}:ignite-spring ${project.groupId}:ignite-tools diff --git a/modules/bom/pom.xml b/modules/bom/pom.xml index e14c89f779b55..865b97ca23582 100644 --- a/modules/bom/pom.xml +++ b/modules/bom/pom.xml @@ -186,6 +186,11 @@ ignite-thin-client-api ${revision} + + ${project.groupId} + ignite-thin-client-impl + ${revision} + ${project.groupId} ignite-codegen diff --git a/modules/core/pom.xml b/modules/core/pom.xml index eac0fa9940024..f440bbace970d 100644 --- a/modules/core/pom.xml +++ b/modules/core/pom.xml @@ -72,7 +72,7 @@ ${project.groupId} ignite-binary-impl - compile + runtime @@ -81,6 +81,12 @@ compile + + ${project.groupId} + ignite-thin-client-impl + compile + + ${project.groupId} ignite-codegen @@ -360,6 +366,7 @@ ${project.groupId}:ignite-binary-impl ${project.groupId}:ignite-grid-unsafe ${project.groupId}:ignite-thin-client-api + ${project.groupId}:ignite-thin-client-impl diff --git a/modules/thin-client/impl/pom.xml b/modules/thin-client/impl/pom.xml new file mode 100644 index 0000000000000..772e79f6d51e9 --- /dev/null +++ b/modules/thin-client/impl/pom.xml @@ -0,0 +1,75 @@ + + + + + + + 4.0.0 + + + org.apache.ignite + ignite-parent-internal + ${revision} + ../../../parent-internal/pom.xml + + + ignite-thin-client-impl + + http://ignite.apache.org + + + + ${project.groupId} + ignite-commons + provided + + + + ${project.groupId} + ignite-binary-api + provided + + + + ${project.groupId} + ignite-thin-client-api + provided + + + + org.jetbrains + annotations + ${jetbrains.annotations.version} + + + + + + + org.apache.maven.plugins + maven-deploy-plugin + 2.8.2 + + false + + + + + diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/BinaryNameMapperMode.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/BinaryNameMapperMode.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/BinaryNameMapperMode.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/BinaryNameMapperMode.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheEntry.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheEntry.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheEntry.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheEntry.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientNotificationType.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientNotificationType.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientNotificationType.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientNotificationType.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientProtocolError.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientProtocolError.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientProtocolError.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientProtocolError.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/FieldsQueryPager.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/FieldsQueryPager.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/FieldsQueryPager.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/FieldsQueryPager.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/IgniteClientFutureImpl.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/IgniteClientFutureImpl.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/IgniteClientFutureImpl.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/IgniteClientFutureImpl.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/NotificationListener.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/NotificationListener.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/NotificationListener.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/NotificationListener.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ProtocolVersion.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ProtocolVersion.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ProtocolVersion.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ProtocolVersion.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/QueryPager.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/QueryPager.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/QueryPager.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/QueryPager.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/io/ClientConnection.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/io/ClientConnection.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/io/ClientConnection.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/io/ClientConnection.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/io/ClientConnectionMultiplexer.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/io/ClientConnectionMultiplexer.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/io/ClientConnectionMultiplexer.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/io/ClientConnectionMultiplexer.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/io/ClientConnectionStateHandler.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/io/ClientConnectionStateHandler.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/io/ClientConnectionStateHandler.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/io/ClientConnectionStateHandler.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/io/ClientMessageDecoder.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/io/ClientMessageDecoder.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/io/ClientMessageDecoder.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/io/ClientMessageDecoder.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/io/ClientMessageHandler.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/io/ClientMessageHandler.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/io/ClientMessageHandler.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/io/ClientMessageHandler.java diff --git a/pom.xml b/pom.xml index df249427c22fe..f84aaa792e262 100644 --- a/pom.xml +++ b/pom.xml @@ -43,6 +43,7 @@ modules/binary/api modules/binary/impl modules/thin-client/api + modules/thin-client/impl modules/unsafe modules/core modules/compress From 1a58cfb83e5e8a98c1e46ef89d4d3f0ef8705e6b Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Tue, 19 May 2026 11:18:38 +0300 Subject: [PATCH 17/44] WIP --- .../ignite/internal/client/thin/ClientFieldsQueryCursor.java | 0 .../apache/ignite/internal/client/thin/ClientJCacheAdapter.java | 0 .../internal/client/thin/ClientJCacheEntryListenerAdapter.java | 0 .../org/apache/ignite/internal/client/thin/ClientOperation.java | 0 .../org/apache/ignite/internal/client/thin/ClientQueryCursor.java | 0 .../ignite/internal/client/thin/ClientRetryPolicyContextImpl.java | 0 .../org/apache/ignite/internal/client/thin/ProtocolContext.java | 0 .../ignite/internal/client/thin/ProtocolVersionFeature.java | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientFieldsQueryCursor.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientJCacheAdapter.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientJCacheEntryListenerAdapter.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientOperation.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientQueryCursor.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientRetryPolicyContextImpl.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ProtocolContext.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ProtocolVersionFeature.java (100%) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientFieldsQueryCursor.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientFieldsQueryCursor.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientFieldsQueryCursor.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientFieldsQueryCursor.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientJCacheAdapter.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientJCacheAdapter.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientJCacheAdapter.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientJCacheAdapter.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientJCacheEntryListenerAdapter.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientJCacheEntryListenerAdapter.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientJCacheEntryListenerAdapter.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientJCacheEntryListenerAdapter.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientOperation.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientOperation.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientOperation.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientOperation.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientQueryCursor.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientQueryCursor.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientQueryCursor.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientQueryCursor.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientRetryPolicyContextImpl.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientRetryPolicyContextImpl.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientRetryPolicyContextImpl.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientRetryPolicyContextImpl.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ProtocolContext.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ProtocolContext.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ProtocolContext.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ProtocolContext.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ProtocolVersionFeature.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ProtocolVersionFeature.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ProtocolVersionFeature.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ProtocolVersionFeature.java From 95098ffe6f10d3136281962df252a9a0659bad7f Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 22 May 2026 16:24:50 +0300 Subject: [PATCH 18/44] WIP --- .../org/apache/ignite/internal/processors/query/QueryUtils.java | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java index 916b6ad26a3f6..75a86bdaa5fd6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java @@ -1880,7 +1880,6 @@ private static List checkFields(QueryEntity locEntity, QueryEntity t targetFieldType, targetFieldAlias, !contains(target.getNotNullFields(), targetFieldName), - getFromMap(target.getDefaultFieldValues(), targetFieldName), precision == null ? -1 : precision, scale == null ? -1 : scale )); From 0c0b7a3390489d20af286984e09aba2b6340db2f Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 22 May 2026 17:16:57 +0300 Subject: [PATCH 19/44] IGNITE-28207 Thin client API extraction --- assembly/dependencies-apache-ignite-lgpl.xml | 1 + assembly/dependencies-apache-ignite-slim.xml | 1 + assembly/dependencies-apache-ignite.xml | 1 + .../java/org/apache/ignite/IgniteBinary.java | 0 .../configuration/BinaryConfiguration.java | 0 modules/bom/pom.xml | 5 + .../internal/MessageSerializerGenerator.java | 6 + .../ignite/cache/CacheAtomicityMode.java | 2 - .../CacheEntryEventSerializableFilter.java | 0 .../ignite/cache/CacheKeyConfiguration.java | 0 .../org/apache/ignite/cache/CacheMode.java | 2 - .../apache/ignite/cache/CachePeekMode.java | 1 - .../ignite/cache/CacheRebalanceMode.java | 1 - .../cache/CacheWriteSynchronizationMode.java | 1 - .../ignite/cache/PartitionLossPolicy.java | 2 - .../org/apache/ignite/cache/QueryEntity.java | 243 +----- .../apache/ignite/cache/QueryIndexType.java | 0 .../cache/affinity/AffinityKeyMapped.java | 0 .../cache/query/AbstractContinuousQuery.java | 2 - .../ignite/cache/query/ContinuousQuery.java | 4 - .../ignite/cache/query/FieldsQueryCursor.java | 0 .../org/apache/ignite/cache/query/Query.java | 5 +- .../ignite/cache/query/QueryCursor.java | 0 .../apache/ignite/cache/query/ScanQuery.java | 1 - .../ignite/cache/query/SqlFieldsQuery.java | 5 +- .../query/annotations/QueryGroupIndex.java | 1 - .../query/annotations/QuerySqlField.java | 2 - .../query/annotations/QueryTextField.java | 1 - .../apache/ignite/cluster/BaselineNode.java | 1 - .../apache/ignite/cluster/ClusterState.java | 0 .../CacheConfigurationDefaults.java | 75 ++ .../IgniteConfigurationDefaults.java | 33 + .../ignite/internal/IgniteNodeAttributes.java | 0 .../ignite/internal/IgniteProperties.java | 0 .../cache/query/QueryEntityClassProperty.java | 0 .../query/QueryEntityIndexDescriptor.java | 0 .../query/QueryEntityTypeDescriptor.java | 0 .../query/GridQueryIndexDescriptor.java | 0 .../service/ServiceCallContextImpl.java | 0 .../ignite/internal/util/CommonUtils.java | 232 ++++++ .../ignite/lang/IgniteExperimental.java | 0 .../ignite/lang/IgniteProductVersion.java | 21 +- .../ignite/services/ServiceCallContext.java | 0 .../services/ServiceCallContextBuilder.java | 0 .../transactions/TransactionConcurrency.java | 0 .../transactions/TransactionIsolation.java | 0 modules/core/pom.xml | 7 + .../org/apache/ignite/cache/QueryIndex.java | 322 -------- .../apache/ignite/cache/query/SqlQuery.java | 3 +- .../apache/ignite/cluster/ClusterMetrics.java | 704 ------------------ .../apache/ignite/cluster/ClusterNode.java | 255 ------- .../configuration/CacheConfiguration.java | 51 +- .../configuration/IgniteConfiguration.java | 14 +- .../ignite/internal/CoreMessagesProvider.java | 6 +- .../ignite/internal/IgniteVersionUtils.java | 113 --- .../processors/query/QuerySchema.java | 2 +- .../internal/processors/query/QueryUtils.java | 291 ++++++-- .../ignite/internal/util/IgniteUtils.java | 156 ---- .../communication/MessageReader.java | 6 + .../communication/MessageWriter.java | 11 + modules/thin-client/api/README.txt | 9 + modules/thin-client/api/pom.xml | 69 ++ .../ignite/client/ClientAddressFinder.java | 0 .../client/ClientAffinityConfiguration.java | 0 .../client/ClientAtomicConfiguration.java | 1 - .../ignite/client/ClientAtomicLong.java | 0 .../client/ClientAuthenticationException.java | 0 .../client/ClientAuthorizationException.java | 0 .../client/ClientAutoCloseableIterator.java | 0 .../org/apache/ignite/client/ClientCache.java | 0 .../client/ClientCacheConfiguration.java | 41 +- .../apache/ignite/client/ClientCluster.java | 0 .../ignite/client/ClientClusterGroup.java | 2 - .../client/ClientCollectionConfiguration.java | 0 .../apache/ignite/client/ClientCompute.java | 1 - .../client/ClientConnectionException.java | 0 .../client/ClientDisconnectListener.java | 8 +- .../apache/ignite/client/ClientException.java | 0 ...tFeatureNotSupportedByServerException.java | 0 .../apache/ignite/client/ClientIgniteSet.java | 0 .../ignite/client/ClientOperationType.java | 4 - .../ClientPartitionAwarenessMapper.java | 4 - ...ClientPartitionAwarenessMapperFactory.java | 3 - .../client/ClientReconnectedException.java | 0 .../ignite/client/ClientRetryAllPolicy.java | 0 .../ignite/client/ClientRetryNonePolicy.java | 0 .../ignite/client/ClientRetryPolicy.java | 0 .../client/ClientRetryPolicyContext.java | 0 .../ignite/client/ClientRetryReadPolicy.java | 0 .../client/ClientServiceDescriptor.java | 1 - .../apache/ignite/client/ClientServices.java | 0 .../ignite/client/ClientTransaction.java | 0 .../ignite/client/ClientTransactions.java | 2 - .../apache/ignite/client/IgniteClient.java | 0 .../ignite/client/IgniteClientFuture.java | 0 .../org/apache/ignite/client/SslMode.java | 0 .../org/apache/ignite/client/SslProtocol.java | 0 .../ignite/client/events/ClientFailEvent.java | 0 .../client/events/ClientLifecycleEvent.java | 0 .../events/ClientLifecycleEventListener.java | 0 .../client/events/ClientStartEvent.java | 0 .../ignite/client/events/ClientStopEvent.java | 0 .../client/events/ConnectionClosedEvent.java | 0 .../client/events/ConnectionDescription.java | 0 .../ignite/client/events/ConnectionEvent.java | 0 .../events/ConnectionEventListener.java | 0 .../client/events/HandshakeFailEvent.java | 0 .../client/events/HandshakeStartEvent.java | 0 .../client/events/HandshakeSuccessEvent.java | 0 .../ignite/client/events/RequestEvent.java | 0 .../client/events/RequestEventListener.java | 0 .../client/events/RequestFailEvent.java | 0 .../client/events/RequestStartEvent.java | 0 .../client/events/RequestSuccessEvent.java | 0 .../apache/ignite/client/package-info.java | 0 .../configuration/ClientConfiguration.java | 2 - .../ClientTransactionConfiguration.java | 1 - .../internal/client/thin/ClientError.java | 0 .../client/thin/ClientServerError.java | 0 .../client/thin/ProtocolBitmaskFeature.java | 6 - pom.xml | 1 + 121 files changed, 737 insertions(+), 2008 deletions(-) rename modules/{core => binary/api}/src/main/java/org/apache/ignite/IgniteBinary.java (100%) rename modules/{core => binary/api}/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java (98%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/CacheEntryEventSerializableFilter.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/CacheMode.java (96%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/CachePeekMode.java (98%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/CacheRebalanceMode.java (97%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/CacheWriteSynchronizationMode.java (98%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java (98%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/QueryEntity.java (70%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/QueryIndexType.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/affinity/AffinityKeyMapped.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/query/AbstractContinuousQuery.java (98%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java (97%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/query/FieldsQueryCursor.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/query/Query.java (96%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/query/QueryCursor.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/query/ScanQuery.java (99%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java (98%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/query/annotations/QueryGroupIndex.java (97%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlField.java (98%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/query/annotations/QueryTextField.java (95%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cluster/BaselineNode.java (97%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cluster/ClusterState.java (100%) create mode 100644 modules/commons/src/main/java/org/apache/ignite/configuration/CacheConfigurationDefaults.java create mode 100644 modules/commons/src/main/java/org/apache/ignite/configuration/IgniteConfigurationDefaults.java rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/IgniteProperties.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityClassProperty.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityIndexDescriptor.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityTypeDescriptor.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexDescriptor.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/processors/service/ServiceCallContextImpl.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/lang/IgniteExperimental.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java (94%) rename modules/{core => commons}/src/main/java/org/apache/ignite/services/ServiceCallContext.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/services/ServiceCallContextBuilder.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/transactions/TransactionConcurrency.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/transactions/TransactionIsolation.java (100%) delete mode 100644 modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java create mode 100644 modules/thin-client/api/README.txt create mode 100644 modules/thin-client/api/pom.xml rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientAddressFinder.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientAffinityConfiguration.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientAtomicConfiguration.java (98%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientAtomicLong.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientAuthenticationException.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientAuthorizationException.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientAutoCloseableIterator.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientCache.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java (94%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientCluster.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientClusterGroup.java (98%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientCollectionConfiguration.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientCompute.java (99%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientConnectionException.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientDisconnectListener.java (80%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientException.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientFeatureNotSupportedByServerException.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientIgniteSet.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientOperationType.java (97%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapper.java (90%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapperFactory.java (95%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientReconnectedException.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientRetryAllPolicy.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientRetryNonePolicy.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientRetryPolicy.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientRetryPolicyContext.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientRetryReadPolicy.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientServiceDescriptor.java (98%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientServices.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientTransaction.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/ClientTransactions.java (96%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/IgniteClient.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/IgniteClientFuture.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/SslMode.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/SslProtocol.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/ClientFailEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/ClientLifecycleEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/ClientLifecycleEventListener.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/ClientStartEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/ClientStopEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/ConnectionClosedEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/ConnectionDescription.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/ConnectionEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/ConnectionEventListener.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/HandshakeFailEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/HandshakeStartEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/HandshakeSuccessEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/RequestEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/RequestEventListener.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/RequestFailEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/RequestStartEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/events/RequestSuccessEvent.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/client/package-info.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/configuration/ClientConfiguration.java (99%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/configuration/ClientTransactionConfiguration.java (98%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/internal/client/thin/ClientError.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/internal/client/thin/ClientServerError.java (100%) rename modules/{core => thin-client/api}/src/main/java/org/apache/ignite/internal/client/thin/ProtocolBitmaskFeature.java (93%) diff --git a/assembly/dependencies-apache-ignite-lgpl.xml b/assembly/dependencies-apache-ignite-lgpl.xml index 7d7e016459bb1..ac3d35c972a66 100644 --- a/assembly/dependencies-apache-ignite-lgpl.xml +++ b/assembly/dependencies-apache-ignite-lgpl.xml @@ -118,6 +118,7 @@ ${project.groupId}:ignite-commons ${project.groupId}:ignite-binary-api ${project.groupId}:ignite-binary-impl + ${project.groupId}:ignite-thin-client-api ${project.groupId}:ignite-clients ${project.groupId}:ignite-spring ${project.groupId}:ignite-tools diff --git a/assembly/dependencies-apache-ignite-slim.xml b/assembly/dependencies-apache-ignite-slim.xml index 53676f307378b..f113444139b1a 100644 --- a/assembly/dependencies-apache-ignite-slim.xml +++ b/assembly/dependencies-apache-ignite-slim.xml @@ -118,6 +118,7 @@ ${project.groupId}:ignite-commons ${project.groupId}:ignite-binary-api ${project.groupId}:ignite-binary-impl + ${project.groupId}:ignite-thin-client-api ${project.groupId}:ignite-clients ${project.groupId}:ignite-spring ${project.groupId}:ignite-tools diff --git a/assembly/dependencies-apache-ignite.xml b/assembly/dependencies-apache-ignite.xml index 2ed7861597401..5952320cba9b2 100644 --- a/assembly/dependencies-apache-ignite.xml +++ b/assembly/dependencies-apache-ignite.xml @@ -119,6 +119,7 @@ ${project.groupId}:ignite-commons ${project.groupId}:ignite-binary-api ${project.groupId}:ignite-binary-impl + ${project.groupId}:ignite-thin-client-api ${project.groupId}:ignite-clients ${project.groupId}:ignite-spring ${project.groupId}:ignite-tools diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java b/modules/binary/api/src/main/java/org/apache/ignite/IgniteBinary.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/IgniteBinary.java rename to modules/binary/api/src/main/java/org/apache/ignite/IgniteBinary.java diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java b/modules/binary/api/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java rename to modules/binary/api/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java diff --git a/modules/bom/pom.xml b/modules/bom/pom.xml index 25f8124d03fc0..e14c89f779b55 100644 --- a/modules/bom/pom.xml +++ b/modules/bom/pom.xml @@ -181,6 +181,11 @@ ignite-commons ${revision} + + ${project.groupId} + ignite-thin-client-api + ${revision} + ${project.groupId} ignite-codegen diff --git a/modules/codegen/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java index 7874b5dcd8c42..58fb71f13cf4d 100644 --- a/modules/codegen/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java +++ b/modules/codegen/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java @@ -459,6 +459,9 @@ else if (assignableFrom(type, type("org.apache.ignite.internal.processors.cache. else if (assignableFrom(type, type("org.apache.ignite.internal.util.GridLongList"))) returnFalseIfWriteFailed(write, field, "writer.writeGridLongList", getExpr); + else if (assignableFrom(type, type("org.apache.ignite.lang.IgniteProductVersion"))) + returnFalseIfWriteFailed(write, field, "writer.writeIgniteProductVersion", getExpr); + else if (assignableFrom(type, type(MESSAGE_INTERFACE))) { if (sameType(type, COMPRESSED_MESSAGE_INTERFACE)) throw new IllegalArgumentException(COMPRESSED_MSG_ERROR); @@ -685,6 +688,9 @@ else if (assignableFrom(type, type("org.apache.ignite.internal.processors.cache. else if (assignableFrom(type, type("org.apache.ignite.internal.util.GridLongList"))) returnFalseIfReadFailed(field, "reader.readGridLongList"); + else if (assignableFrom(type, type("org.apache.ignite.lang.IgniteProductVersion"))) + returnFalseIfReadFailed(field, "reader.readIgniteProductVersion"); + else if (assignableFrom(type, type(MESSAGE_INTERFACE))) { if (sameType(type, COMPRESSED_MESSAGE_INTERFACE)) throw new IllegalArgumentException(COMPRESSED_MSG_ERROR); diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java b/modules/commons/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java rename to modules/commons/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java index f83dcdd6d9525..37d4a8379736b 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java @@ -18,8 +18,6 @@ package org.apache.ignite.cache; import javax.cache.processor.EntryProcessor; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.transactions.Transaction; import org.jetbrains.annotations.Nullable; /** diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheEntryEventSerializableFilter.java b/modules/commons/src/main/java/org/apache/ignite/cache/CacheEntryEventSerializableFilter.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/cache/CacheEntryEventSerializableFilter.java rename to modules/commons/src/main/java/org/apache/ignite/cache/CacheEntryEventSerializableFilter.java diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java b/modules/commons/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java rename to modules/commons/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheMode.java b/modules/commons/src/main/java/org/apache/ignite/cache/CacheMode.java similarity index 96% rename from modules/core/src/main/java/org/apache/ignite/cache/CacheMode.java rename to modules/commons/src/main/java/org/apache/ignite/cache/CacheMode.java index 392bb615dfe81..69d6be9a5c9c0 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/CacheMode.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/CacheMode.java @@ -18,8 +18,6 @@ package org.apache.ignite.cache; import java.util.stream.Stream; -import org.apache.ignite.cache.affinity.AffinityFunction; -import org.apache.ignite.configuration.NearCacheConfiguration; import org.jetbrains.annotations.Nullable; /** diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CachePeekMode.java b/modules/commons/src/main/java/org/apache/ignite/cache/CachePeekMode.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/cache/CachePeekMode.java rename to modules/commons/src/main/java/org/apache/ignite/cache/CachePeekMode.java index 108021c6eead0..ff281f546720c 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/CachePeekMode.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/CachePeekMode.java @@ -17,7 +17,6 @@ package org.apache.ignite.cache; -import org.apache.ignite.IgniteCache; import org.jetbrains.annotations.Nullable; /** diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheRebalanceMode.java b/modules/commons/src/main/java/org/apache/ignite/cache/CacheRebalanceMode.java similarity index 97% rename from modules/core/src/main/java/org/apache/ignite/cache/CacheRebalanceMode.java rename to modules/commons/src/main/java/org/apache/ignite/cache/CacheRebalanceMode.java index 9901922d38282..2f2f360b49885 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/CacheRebalanceMode.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/CacheRebalanceMode.java @@ -17,7 +17,6 @@ package org.apache.ignite.cache; -import org.apache.ignite.cache.affinity.AffinityFunction; import org.jetbrains.annotations.Nullable; /** diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheWriteSynchronizationMode.java b/modules/commons/src/main/java/org/apache/ignite/cache/CacheWriteSynchronizationMode.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/cache/CacheWriteSynchronizationMode.java rename to modules/commons/src/main/java/org/apache/ignite/cache/CacheWriteSynchronizationMode.java index f3455a838c4b9..8b4b7c4645d21 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/CacheWriteSynchronizationMode.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/CacheWriteSynchronizationMode.java @@ -17,7 +17,6 @@ package org.apache.ignite.cache; -import org.apache.ignite.transactions.Transaction; import org.jetbrains.annotations.Nullable; /** diff --git a/modules/core/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java b/modules/commons/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java rename to modules/commons/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java index 3b2f46a5f738f..46287be78480e 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java @@ -18,8 +18,6 @@ package org.apache.ignite.cache; import java.util.Collection; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; import org.jetbrains.annotations.Nullable; /** diff --git a/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java b/modules/commons/src/main/java/org/apache/ignite/cache/QueryEntity.java similarity index 70% rename from modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java rename to modules/commons/src/main/java/org/apache/ignite/cache/QueryEntity.java index 567b8f1b15ff6..933ba1f1cc2d9 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/QueryEntity.java @@ -27,11 +27,9 @@ import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; -import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; -import java.util.UUID; import javax.cache.CacheException; import org.apache.ignite.cache.query.annotations.QueryGroupIndex; import org.apache.ignite.cache.query.annotations.QuerySqlField; @@ -39,16 +37,11 @@ import org.apache.ignite.internal.processors.cache.query.QueryEntityClassProperty; import org.apache.ignite.internal.processors.cache.query.QueryEntityTypeDescriptor; import org.apache.ignite.internal.processors.query.GridQueryIndexDescriptor; -import org.apache.ignite.internal.processors.query.QueryField; -import org.apache.ignite.internal.processors.query.QueryUtils; -import org.apache.ignite.internal.processors.query.schema.operation.SchemaAbstractOperation; -import org.apache.ignite.internal.processors.query.schema.operation.SchemaAlterTableAddColumnOperation; -import org.apache.ignite.internal.processors.query.schema.operation.SchemaIndexCreateOperation; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.tostring.GridToStringInclude; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -161,222 +154,6 @@ public QueryEntity(Class keyCls, Class valCls) { this(convert(processKeyAndValueClasses(keyCls, valCls))); } - /** - * Make query entity patch. This patch can only add properties to entity and can't remove them. - * Other words, the patch will contain only add operations(e.g. add column, create index) and not remove ones. - * - * @param target Query entity to which this entity should be expanded. - * @return Patch which contains operations for expanding this entity. - */ - @NotNull public QueryEntityPatch makePatch(QueryEntity target) { - if (target == null) - return QueryEntityPatch.empty(); - - StringBuilder conflicts = new StringBuilder(); - - checkEquals(conflicts, "keyType", keyType, target.keyType); - checkEquals(conflicts, "valType", valType, target.valType); - checkEquals(conflicts, "keyFieldName", keyFieldName, target.keyFieldName); - checkEquals(conflicts, "valueFieldName", valueFieldName, target.valueFieldName); - checkEquals(conflicts, "tableName", tableName, target.tableName); - - List qryFieldsToAdd = checkFields(target, conflicts); - - Collection indexesToAdd = checkIndexes(target, conflicts); - - if (conflicts.length() != 0) - return QueryEntityPatch.conflict(tableName + " conflict: \n" + conflicts.toString()); - - Collection patchOperations = new ArrayList<>(); - - if (!qryFieldsToAdd.isEmpty()) - patchOperations.add(new SchemaAlterTableAddColumnOperation( - UUID.randomUUID(), - null, - null, - tableName, - qryFieldsToAdd, - true, - true - )); - - if (!indexesToAdd.isEmpty()) { - for (QueryIndex idx : indexesToAdd) { - patchOperations.add(new SchemaIndexCreateOperation( - UUID.randomUUID(), - null, - null, - tableName, - idx, - true, - 0 - )); - } - } - - return QueryEntityPatch.patch(patchOperations); - } - - /** - * Comparing local fields and target fields. - * - * @param target Query entity for check. - * @param conflicts Storage of conflicts. - * @return Indexes which exist in target and not exist in local. - */ - @NotNull private Collection checkIndexes(QueryEntity target, StringBuilder conflicts) { - HashSet indexesToAdd = new HashSet<>(); - - Map curIndexes = new HashMap<>(); - - for (QueryIndex idx : getIndexes()) { - if (curIndexes.put(idx.getName(), idx) != null) - throw new IllegalStateException("Duplicate key"); - } - - for (QueryIndex qryIdx : target.getIndexes()) { - if (curIndexes.containsKey(qryIdx.getName())) { - checkEquals( - conflicts, - "index " + qryIdx.getName(), - curIndexes.get(qryIdx.getName()), - qryIdx - ); - } - else - indexesToAdd.add(qryIdx); - } - return indexesToAdd; - } - - /** - * Comparing local entity fields and target entity fields. - * - * @param target Query entity for check. - * @param conflicts Storage of conflicts. - * @return Fields which exist in target and not exist in local. - */ - private List checkFields(QueryEntity target, StringBuilder conflicts) { - List qryFieldsToAdd = new ArrayList<>(); - - for (Map.Entry targetField : target.getFields().entrySet()) { - String targetFieldName = targetField.getKey(); - String targetFieldType = targetField.getValue(); - String targetFieldAlias = target.getAliases().get(targetFieldName); - - if (getFields().containsKey(targetFieldName)) { - checkEquals( - conflicts, - "alias of " + targetFieldName, - getAliases().get(targetFieldName), - targetFieldAlias - ); - - checkEquals( - conflicts, - "fieldType of " + targetFieldName, - getFields().get(targetFieldName), - targetFieldType - ); - - checkEquals( - conflicts, - "nullable of " + targetFieldName, - contains(getNotNullFields(), targetFieldName), - contains(target.getNotNullFields(), targetFieldName) - ); - - checkEquals( - conflicts, - "default value of " + targetFieldName, - getFromMap(getDefaultFieldValues(), targetFieldName), - getFromMap(target.getDefaultFieldValues(), targetFieldName) - ); - - checkEquals(conflicts, - "precision of " + targetFieldName, - getFromMap(getFieldsPrecision(), targetFieldName), - getFromMap(target.getFieldsPrecision(), targetFieldName)); - - checkEquals( - conflicts, - "scale of " + targetFieldName, - getFromMap(getFieldsScale(), targetFieldName), - getFromMap(target.getFieldsScale(), targetFieldName)); - } - else { - boolean isAliasConflictsFound = findAliasConflicts(targetFieldAlias, targetFieldName, conflicts); - - if (!isAliasConflictsFound) { - Integer precision = getFromMap(target.getFieldsPrecision(), targetFieldName); - Integer scale = getFromMap(target.getFieldsScale(), targetFieldName); - - qryFieldsToAdd.add(new QueryField( - targetFieldName, - targetFieldType, - targetFieldAlias, - !contains(target.getNotNullFields(), targetFieldName), - precision == null ? -1 : precision, - scale == null ? -1 : scale - )); - } - } - } - - return qryFieldsToAdd; - } - - /** - * Checks if received query entity field has the alias which is already used by a field on the local node. - * - * @return Whether conflicts were found. - */ - private boolean findAliasConflicts(String targetFieldAlias, String targetFieldName, StringBuilder conflicts) { - for (Map.Entry entry : getAliases().entrySet()) { - if (Objects.equals(entry.getValue(), targetFieldAlias)) { - conflicts.append(String.format( - "multiple fields are associated with the same alias: alias=%s, localField=%s, receivedField=%s\n", - targetFieldAlias, - entry.getKey(), - targetFieldName) - ); - - return true; - } - } - - return false; - } - - /** - * @param collection Collection for checking. - * @param elementToCheck Element for checking to containing in collection. - * @return {@code true} if collection contain elementToCheck. - */ - private static boolean contains(Collection collection, String elementToCheck) { - return collection != null && collection.contains(elementToCheck); - } - - /** - * @return Value from sourceMap or null if map is null. - */ - private static V getFromMap(Map sourceMap, String key) { - return sourceMap == null ? null : sourceMap.get(key); - } - - /** - * Comparing two objects and add formatted text to conflicts if needed. - * - * @param conflicts Storage of conflicts resulting error message. - * @param name Name of comparing object. - * @param local Local object. - * @param received Received object. - */ - private void checkEquals(StringBuilder conflicts, String name, V local, V received) { - if (!Objects.equals(local, received)) - conflicts.append(String.format("%s is different: local=%s, received=%s\n", name, local, received)); - } - /** * Gets key type for this query pair. * @@ -715,7 +492,7 @@ private static QueryEntity convert(QueryEntityTypeDescriptor desc) { entity.setValueType(desc.valueClass().getName()); for (QueryEntityClassProperty prop : desc.properties().values()) - entity.addQueryField(prop.fullName(), U.box(prop.type()).getName(), prop.alias()); + entity.addQueryField(prop.fullName(), CommonUtils.box(prop.type()).getName(), prop.alias()); entity.setKeyFields(desc.keyProperties()); @@ -761,10 +538,10 @@ private static QueryEntity convert(QueryEntityTypeDescriptor desc) { txtIdx.setIndexType(QueryIndexType.FULLTEXT); - txtIdx.setFieldNames(Arrays.asList(QueryUtils.VAL_FIELD_NAME), true); + txtIdx.setFieldNames(Arrays.asList(CommonUtils.VAL_FIELD_NAME), true); } else - txtIdx.getFields().put(QueryUtils.VAL_FIELD_NAME, true); + txtIdx.getFields().put(CommonUtils.VAL_FIELD_NAME, true); } if (txtIdx != null) @@ -812,14 +589,14 @@ private static QueryEntityTypeDescriptor processKeyAndValueClasses( */ private static void processAnnotationsInClass(boolean key, Class cls, QueryEntityTypeDescriptor type, @Nullable QueryEntityClassProperty parent) { - if (U.isJdk(cls) || U.isGeometryClass(cls)) { - if (parent == null && !key && QueryUtils.isSqlType(cls)) { // We have to index primitive _val. - String idxName = cls.getSimpleName() + "_" + QueryUtils.VAL_FIELD_NAME + "_idx"; + if (CommonUtils.isJdk(cls) || CommonUtils.isGeometryClass(cls)) { + if (parent == null && !key && CommonUtils.isSqlType(cls)) { // We have to index primitive _val. + String idxName = cls.getSimpleName() + "_" + CommonUtils.VAL_FIELD_NAME + "_idx"; - type.addIndex(idxName, U.isGeometryClass(cls) ? + type.addIndex(idxName, CommonUtils.isGeometryClass(cls) ? QueryIndexType.GEOSPATIAL : QueryIndexType.SORTED, QueryIndex.DFLT_INLINE_SIZE); - type.addFieldToIndex(idxName, QueryUtils.VAL_FIELD_NAME, 0, false); + type.addFieldToIndex(idxName, CommonUtils.VAL_FIELD_NAME, 0, false); } return; @@ -895,7 +672,7 @@ private static void processAnnotation(boolean key, QuerySqlField sqlAnn, QueryTe if (cls != curCls) idxName = cls.getSimpleName() + "_" + idxName; - desc.addIndex(idxName, U.isGeometryClass(prop.type()) ? + desc.addIndex(idxName, CommonUtils.isGeometryClass(prop.type()) ? QueryIndexType.GEOSPATIAL : QueryIndexType.SORTED, sqlAnn.inlineSize()); desc.addFieldToIndex(idxName, prop.fullName(), 0, sqlAnn.descending()); diff --git a/modules/core/src/main/java/org/apache/ignite/cache/QueryIndexType.java b/modules/commons/src/main/java/org/apache/ignite/cache/QueryIndexType.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/cache/QueryIndexType.java rename to modules/commons/src/main/java/org/apache/ignite/cache/QueryIndexType.java diff --git a/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityKeyMapped.java b/modules/commons/src/main/java/org/apache/ignite/cache/affinity/AffinityKeyMapped.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityKeyMapped.java rename to modules/commons/src/main/java/org/apache/ignite/cache/affinity/AffinityKeyMapped.java diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/AbstractContinuousQuery.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/AbstractContinuousQuery.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/cache/query/AbstractContinuousQuery.java rename to modules/commons/src/main/java/org/apache/ignite/cache/query/AbstractContinuousQuery.java index a9391e4a98c2e..5fdbe09399ed9 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/AbstractContinuousQuery.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/AbstractContinuousQuery.java @@ -21,8 +21,6 @@ import javax.cache.configuration.Factory; import javax.cache.event.CacheEntryEventFilter; import javax.cache.event.EventType; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.lang.IgniteAsyncCallback; /** * Base class for continuous query. diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java similarity index 97% rename from modules/core/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java rename to modules/commons/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java index ef76a8c2bf940..bbf5d4d410c4a 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java @@ -21,11 +21,7 @@ import javax.cache.configuration.Factory; import javax.cache.event.CacheEntryEventFilter; import javax.cache.event.CacheEntryUpdatedListener; -import org.apache.ignite.IgniteCache; import org.apache.ignite.cache.CacheEntryEventSerializableFilter; -import org.apache.ignite.cache.query.ContinuousQueryWithTransformer.EventListener; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.lang.IgniteAsyncCallback; /** * API for configuring continuous cache queries. diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/FieldsQueryCursor.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/FieldsQueryCursor.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/cache/query/FieldsQueryCursor.java rename to modules/commons/src/main/java/org/apache/ignite/cache/query/FieldsQueryCursor.java diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/Query.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/Query.java similarity index 96% rename from modules/core/src/main/java/org/apache/ignite/cache/query/Query.java rename to modules/commons/src/main/java/org/apache/ignite/cache/query/Query.java index cfd58d298cd91..0d79db9e777d4 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/Query.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/Query.java @@ -19,8 +19,7 @@ import java.io.Serializable; import java.util.Arrays; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.configuration.CacheConfigurationDefaults; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.S; @@ -127,7 +126,7 @@ protected int[] prepare(int[] parts) { else if (sorted) validateDups(parts[i], parts[i + 1]); - A.ensure(0 <= parts[i] && parts[i] < CacheConfiguration.MAX_PARTITIONS_COUNT, "Illegal partition"); + A.ensure(0 <= parts[i] && parts[i] < CacheConfigurationDefaults.MAX_PARTITIONS_COUNT, "Illegal partition"); } // Sort and validate again. diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryCursor.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/QueryCursor.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/cache/query/QueryCursor.java rename to modules/commons/src/main/java/org/apache/ignite/cache/query/QueryCursor.java diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/ScanQuery.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/ScanQuery.java similarity index 99% rename from modules/core/src/main/java/org/apache/ignite/cache/query/ScanQuery.java rename to modules/commons/src/main/java/org/apache/ignite/cache/query/ScanQuery.java index abf89e158a4c3..eeef1f6052021 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/ScanQuery.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/ScanQuery.java @@ -18,7 +18,6 @@ package org.apache.ignite.cache.query; import javax.cache.Cache; -import org.apache.ignite.IgniteCache; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.lang.IgniteBiPredicate; import org.jetbrains.annotations.Nullable; diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java rename to modules/commons/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java index af4ef81fa38aa..af001e570e7c1 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java @@ -19,8 +19,7 @@ import java.util.List; import java.util.concurrent.TimeUnit; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.internal.processors.query.QueryUtils; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.tostring.GridToStringInclude; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.S; @@ -196,7 +195,7 @@ public int getTimeout() { * @return {@code this} For chaining. */ public SqlFieldsQuery setTimeout(int timeout, TimeUnit timeUnit) { - this.timeout = QueryUtils.validateTimeout(timeout, timeUnit); + this.timeout = CommonUtils.validateTimeout(timeout, timeUnit); return this; } diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QueryGroupIndex.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QueryGroupIndex.java similarity index 97% rename from modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QueryGroupIndex.java rename to modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QueryGroupIndex.java index 797fbe453a827..3c76347ececba 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QueryGroupIndex.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QueryGroupIndex.java @@ -22,7 +22,6 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.apache.ignite.cache.QueryIndex; -import org.apache.ignite.configuration.CacheConfiguration; /** * Describes group index. diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlField.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlField.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlField.java rename to modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlField.java index 1593018cb2ac2..64550aed6e7a9 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlField.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlField.java @@ -23,8 +23,6 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.apache.ignite.cache.QueryIndex; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.internal.processors.cache.query.CacheQuery; /** * Annotates fields for SQL queries. All fields that will be involved in SQL clauses must have diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QueryTextField.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QueryTextField.java similarity index 95% rename from modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QueryTextField.java rename to modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QueryTextField.java index 9e90e9247d5d5..6fdae549eba74 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QueryTextField.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QueryTextField.java @@ -22,7 +22,6 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.apache.ignite.internal.processors.cache.query.CacheQuery; /** * Annotation for fields to be indexed for full text diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/BaselineNode.java b/modules/commons/src/main/java/org/apache/ignite/cluster/BaselineNode.java similarity index 97% rename from modules/core/src/main/java/org/apache/ignite/cluster/BaselineNode.java rename to modules/commons/src/main/java/org/apache/ignite/cluster/BaselineNode.java index 9564aa01a55af..57c5f0f2bb5da 100644 --- a/modules/core/src/main/java/org/apache/ignite/cluster/BaselineNode.java +++ b/modules/commons/src/main/java/org/apache/ignite/cluster/BaselineNode.java @@ -18,7 +18,6 @@ package org.apache.ignite.cluster; import java.util.Map; -import org.apache.ignite.configuration.IgniteConfiguration; import org.jetbrains.annotations.Nullable; /** diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterState.java b/modules/commons/src/main/java/org/apache/ignite/cluster/ClusterState.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/cluster/ClusterState.java rename to modules/commons/src/main/java/org/apache/ignite/cluster/ClusterState.java diff --git a/modules/commons/src/main/java/org/apache/ignite/configuration/CacheConfigurationDefaults.java b/modules/commons/src/main/java/org/apache/ignite/configuration/CacheConfigurationDefaults.java new file mode 100644 index 0000000000000..ef940114c3e12 --- /dev/null +++ b/modules/commons/src/main/java/org/apache/ignite/configuration/CacheConfigurationDefaults.java @@ -0,0 +1,75 @@ +/* + * 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.configuration; + +import org.apache.ignite.cache.CacheAtomicityMode; +import org.apache.ignite.cache.CacheMode; +import org.apache.ignite.cache.CacheRebalanceMode; +import org.apache.ignite.cache.PartitionLossPolicy; + +/** */ +public interface CacheConfigurationDefaults { + /** Default atomicity mode. */ + public static final CacheAtomicityMode DFLT_CACHE_ATOMICITY_MODE = CacheAtomicityMode.ATOMIC; + + /** Default number of backups. */ + public static final int DFLT_BACKUPS = 0; + + /** Default caching mode. */ + public static final CacheMode DFLT_CACHE_MODE = CacheMode.PARTITIONED; + + /** Default value for eager ttl flag. */ + public static final boolean DFLT_EAGER_TTL = true; + + /** + * Default lock timeout. + * @deprecated Default lock timeout configuration property has no effect. + */ + @Deprecated + public static final long DFLT_LOCK_TIMEOUT = 0; + + /** Default partition loss policy. */ + public static final PartitionLossPolicy DFLT_PARTITION_LOSS_POLICY = PartitionLossPolicy.IGNORE; + + /** Default value for 'readFromBackup' flag. */ + public static final boolean DFLT_READ_FROM_BACKUP = true; + + /** Default rebalance mode for distributed cache. */ + public static final CacheRebalanceMode DFLT_REBALANCE_MODE = CacheRebalanceMode.ASYNC; + + /** Default value for 'copyOnRead' flag. */ + public static final boolean DFLT_COPY_ON_READ = true; + + /** Default value for 'maxConcurrentAsyncOps'. */ + public static final int DFLT_MAX_CONCURRENT_ASYNC_OPS = 500; + + /** Default maximum number of query iterators that can be stored. */ + public static final int DFLT_MAX_QUERY_ITERATOR_CNT = 1024; + + /** Default number of queries detail metrics to collect. */ + public static final int DFLT_QRY_DETAIL_METRICS_SIZE = 0; + + /** Default query parallelism. */ + public static final int DFLT_QUERY_PARALLELISM = 1; + + /** Default maximum inline size for sql indexes. */ + public static final int DFLT_SQL_INDEX_MAX_INLINE_SIZE = -1; + + /** Maximum number of partitions. */ + public static final int MAX_PARTITIONS_COUNT = 65000; +} diff --git a/modules/commons/src/main/java/org/apache/ignite/configuration/IgniteConfigurationDefaults.java b/modules/commons/src/main/java/org/apache/ignite/configuration/IgniteConfigurationDefaults.java new file mode 100644 index 0000000000000..25b8e7ced9418 --- /dev/null +++ b/modules/commons/src/main/java/org/apache/ignite/configuration/IgniteConfigurationDefaults.java @@ -0,0 +1,33 @@ +/* + * 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.configuration; + +/** */ +public interface IgniteConfigurationDefaults { + /** Default rebalance batch size in bytes (value is {@code 512Kb}). */ + public static final int DFLT_REBALANCE_BATCH_SIZE = 512 * 1024; // 512K + + /** Default rebalance batches prefetch count (value is {@code 3}). */ + public static final long DFLT_REBALANCE_BATCHES_PREFETCH_COUNT = 3; + + /** Time to wait between rebalance messages in milliseconds to avoid overloading CPU (value is {@code 0}). */ + public static final long DFLT_REBALANCE_THROTTLE = 0; + + /** Default rebalance message timeout in milliseconds (value is {@code 10000}). */ + public static final long DFLT_REBALANCE_TIMEOUT = 10000; +} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java b/modules/commons/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java rename to modules/commons/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteProperties.java b/modules/commons/src/main/java/org/apache/ignite/internal/IgniteProperties.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/IgniteProperties.java rename to modules/commons/src/main/java/org/apache/ignite/internal/IgniteProperties.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityClassProperty.java b/modules/commons/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityClassProperty.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityClassProperty.java rename to modules/commons/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityClassProperty.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityIndexDescriptor.java b/modules/commons/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityIndexDescriptor.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityIndexDescriptor.java rename to modules/commons/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityIndexDescriptor.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityTypeDescriptor.java b/modules/commons/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityTypeDescriptor.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityTypeDescriptor.java rename to modules/commons/src/main/java/org/apache/ignite/internal/processors/cache/query/QueryEntityTypeDescriptor.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexDescriptor.java b/modules/commons/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexDescriptor.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexDescriptor.java rename to modules/commons/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexDescriptor.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/ServiceCallContextImpl.java b/modules/commons/src/main/java/org/apache/ignite/internal/processors/service/ServiceCallContextImpl.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/processors/service/ServiceCallContextImpl.java rename to modules/commons/src/main/java/org/apache/ignite/internal/processors/service/ServiceCallContextImpl.java diff --git a/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java index 46ebe48608ce0..e87513b9b0aae 100644 --- a/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java +++ b/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java @@ -29,6 +29,7 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; +import java.math.BigDecimal; import java.net.DatagramSocket; import java.net.Socket; import java.net.SocketException; @@ -44,18 +45,25 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.security.ProtectionDomain; +import java.sql.Time; +import java.sql.Timestamp; import java.time.Instant; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.Map; import java.util.ServiceLoader; +import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -82,6 +90,7 @@ import org.apache.ignite.lang.IgniteFutureTimeoutException; import org.apache.ignite.lang.IgnitePredicate; import org.apache.ignite.thread.IgniteThread; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static java.util.Objects.isNull; @@ -223,6 +232,21 @@ public abstract class CommonUtils { /** */ private static final Class GEOMETRY_CLASS = classForName("org.locationtech.jts.geom.Geometry", null); + /** Boxed class map. */ + private static final Map, Class> boxedClsMap = new HashMap<>(16, .5f); + + /** Field name for key. */ + public static final String KEY_FIELD_NAME = "_KEY"; + + /** Field name for value. */ + public static final String VAL_FIELD_NAME = "_VAL"; + + /** Byte bit-mask. */ + private static final int MASK = 0xf; + + /** */ + private static final Set> SQL_TYPES = createSqlTypes(); + static { primitiveMap.put("byte", byte.class); primitiveMap.put("short", short.class); @@ -234,6 +258,16 @@ public abstract class CommonUtils { primitiveMap.put("boolean", boolean.class); primitiveMap.put("void", void.class); + boxedClsMap.put(byte.class, Byte.class); + boxedClsMap.put(short.class, Short.class); + boxedClsMap.put(int.class, Integer.class); + boxedClsMap.put(long.class, Long.class); + boxedClsMap.put(float.class, Float.class); + boxedClsMap.put(double.class, Double.class); + boxedClsMap.put(char.class, Character.class); + boxedClsMap.put(boolean.class, Boolean.class); + boxedClsMap.put(void.class, Void.class); + try { OBJECT_CTOR = Object.class.getConstructor(); } @@ -1661,6 +1695,43 @@ else if (utfBytes == 3) { return strBuilder.toString(); } + /** + * Writes byte array to output stream accounting for null values. + * + * @param out Output stream to write to. + * @param arr Array to write, possibly null. + * @throws java.io.IOException If write failed. + */ + public static void writeByteArray(DataOutput out, @Nullable byte[] arr) throws IOException { + if (arr == null) + out.writeInt(-1); + else { + out.writeInt(arr.length); + + out.write(arr); + } + } + + /** + * Reads byte array from input stream accounting for null values. + * + * @param in Stream to read from. + * @return Read byte array, possibly null. + * @throws java.io.IOException If read failed. + */ + @Nullable public static byte[] readByteArray(DataInput in) throws IOException { + int len = in.readInt(); + + if (len == -1) + return null; // Value "-1" indicates null. + + byte[] res = new byte[len]; + + in.readFully(res); + + return res; + } + /** * Get number of bytes for {@link DataOutput#writeUTF}, * depending on character:
@@ -2122,4 +2193,165 @@ public static IgniteException convertException(IgniteCheckedException e) { public static boolean isGeometryClass(Class cls) { return GEOMETRY_CLASS != null && GEOMETRY_CLASS.isAssignableFrom(cls); } + + /** + * Gets wrapper class for a primitive type. + * + * @param cls Class. If {@code null}, method is no-op. + * @return Wrapper class or original class if it is non-primitive. + */ + @Nullable public static Class box(@Nullable Class cls) { + if (cls == null) + return null; + + if (!cls.isPrimitive()) + return cls; + + return boxedClsMap.get(cls); + } + + /** + * Checks if the given class can be mapped to a simple SQL type. + * + * @param cls Class. + * @return {@code true} If can. + */ + public static boolean isSqlType(Class cls) { + cls = box(cls); + + return SQL_TYPES.contains(cls) || isGeometryClass(cls); + } + + /** + * @param timeout Timeout. + * @param timeUnit Time unit. + * @return Converted time. + */ + public static int validateTimeout(int timeout, TimeUnit timeUnit) { + A.ensure(timeUnit != TimeUnit.MICROSECONDS && timeUnit != TimeUnit.NANOSECONDS, + "timeUnit minimal resolution is millisecond."); + + A.ensure(timeout >= 0, "timeout value should be non-negative."); + + long tmp = TimeUnit.MILLISECONDS.convert(timeout, timeUnit); + + return (int)tmp; + } + + /** + * Converts byte array to hex string. + * + * @param arr Array of bytes. + * @return Hex string. + */ + public static String byteArray2HexString(byte[] arr) { + return byteArray2HexString(arr, true); + } + + /** + * Converts byte array to hex string. + * + * @param arr Array of bytes. + * @param toUpper If {@code true} returns upper cased result. + * @return Hex string. + */ + public static String byteArray2HexString(byte[] arr, boolean toUpper) { + StringBuilder sb = new StringBuilder(arr.length << 1); + + for (byte b : arr) + addByteAsHex(sb, b); + + return toUpper ? sb.toString().toUpperCase() : sb.toString(); + } + + /** + * @param sb String builder. + * @param b Byte to add in hexadecimal format. + */ + protected static void addByteAsHex(StringBuilder sb, byte b) { + sb.append(Integer.toHexString(MASK & b >>> 4)).append(Integer.toHexString(MASK & b)); + } + + /** + * Converts an array of characters representing hexidecimal values into an + * array of bytes of those same values. The returned array will be half the + * length of the passed array, as it takes two characters to represent any + * given byte. An exception is thrown if the passed char array has an odd + * number of elements. + * + * @param data An array of characters containing hexidecimal digits + * @return A byte array containing binary data decoded from + * the supplied char array. + * @throws IgniteCheckedException Thrown if an odd number or illegal of characters is supplied. + */ + public static byte[] decodeHex(char[] data) throws IgniteCheckedException { + int len = data.length; + + if ((len & 0x01) != 0) + throw new IgniteCheckedException("Odd number of characters."); + + byte[] out = new byte[len >> 1]; + + // Two characters form the hex value. + for (int i = 0, j = 0; j < len; i++) { + int f = toDigit(data[j], j) << 4; + + j++; + + f |= toDigit(data[j], j); + + j++; + + out[i] = (byte)(f & 0xFF); + } + + return out; + } + + /** + * Converts a hexadecimal character to an integer. + * + * @param ch A character to convert to an integer digit + * @param idx The index of the character in the source + * @return An integer + * @throws IgniteCheckedException Thrown if ch is an illegal hex character + */ + public static int toDigit(char ch, int idx) throws IgniteCheckedException { + int digit = Character.digit(ch, 16); + + if (digit == -1) + throw new IgniteCheckedException("Illegal hexadecimal character " + ch + " at index " + idx); + + return digit; + } + + /** + * Creates SQL types set. + * + * @return SQL types set. + */ + @NotNull private static Set> createSqlTypes() { + Set> sqlClasses = new HashSet<>(Arrays.>asList( + Integer.class, + Boolean.class, + Byte.class, + Short.class, + Long.class, + BigDecimal.class, + Double.class, + Float.class, + Time.class, + Timestamp.class, + Date.class, + java.sql.Date.class, + LocalTime.class, + LocalDate.class, + LocalDateTime.class, + String.class, + UUID.class, + byte[].class + )); + + return sqlClasses; + } } diff --git a/modules/core/src/main/java/org/apache/ignite/lang/IgniteExperimental.java b/modules/commons/src/main/java/org/apache/ignite/lang/IgniteExperimental.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/lang/IgniteExperimental.java rename to modules/commons/src/main/java/org/apache/ignite/lang/IgniteExperimental.java diff --git a/modules/core/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java b/modules/commons/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java similarity index 94% rename from modules/core/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java rename to modules/commons/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java index b4177fcfd7810..23f4d3171c5f6 100644 --- a/modules/core/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java +++ b/modules/commons/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java @@ -25,11 +25,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.internal.CoreMessagesProvider; import org.apache.ignite.internal.IgniteVersionUtils; -import org.apache.ignite.internal.Order; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.plugin.extensions.communication.Message; +import org.apache.ignite.internal.util.CommonUtils; import org.jetbrains.annotations.NotNull; /** @@ -40,7 +37,7 @@ * Two versions are compared in the following order: major number, * minor number, maintenance number, revision timestamp. */ -public class IgniteProductVersion implements Comparable, Externalizable, Message { +public class IgniteProductVersion implements Comparable, Externalizable { /** */ private static final long serialVersionUID = 0L; @@ -55,27 +52,21 @@ public class IgniteProductVersion implements Comparable, E Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)([-.]([^0123456789][^-]+)(-SNAPSHOT)?)?(-(\\d+))?(-([\\da-f]+))?"); /** Major version number. */ - @Order(0) byte major; /** Minor version number. */ - @Order(1) byte minor; /** Maintenance version number. */ - @Order(2) byte maintenance; /** Stage of development. */ - @Order(3) String stage; /** Revision timestamp. */ - @Order(4) long revTs; /** Revision hash. */ - @Order(5) byte[] revHash; /** @@ -262,7 +253,7 @@ public int compareToIgnoreTimestamp(@NotNull IgniteProductVersion o) { out.writeByte(minor); out.writeByte(maintenance); out.writeLong(revTs); - U.writeByteArray(out, revHash); + CommonUtils.writeByteArray(out, revHash); } /** {@inheritDoc} */ @@ -271,14 +262,14 @@ public int compareToIgnoreTimestamp(@NotNull IgniteProductVersion o) { minor = in.readByte(); maintenance = in.readByte(); revTs = in.readLong(); - revHash = U.readByteArray(in); + revHash = CommonUtils.readByteArray(in); } /** {@inheritDoc} */ @Override public String toString() { String revTsStr = IgniteVersionUtils.formatBuildTimeStamp(revTs * 1000); - String hash = U.byteArray2HexString(revHash).toLowerCase(); + String hash = CommonUtils.byteArray2HexString(revHash).toLowerCase(); hash = hash.length() > 8 ? hash.substring(0, 8) : hash; @@ -318,7 +309,7 @@ public static IgniteProductVersion fromString(String verStr) { byte[] revHash = null; if (match.group(9) != null) - revHash = U.decodeHex(match.group(10).toCharArray()); + revHash = CommonUtils.decodeHex(match.group(10).toCharArray()); return new IgniteProductVersion(major, minor, maintenance, stage, revTs, revHash); } diff --git a/modules/core/src/main/java/org/apache/ignite/services/ServiceCallContext.java b/modules/commons/src/main/java/org/apache/ignite/services/ServiceCallContext.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/services/ServiceCallContext.java rename to modules/commons/src/main/java/org/apache/ignite/services/ServiceCallContext.java diff --git a/modules/core/src/main/java/org/apache/ignite/services/ServiceCallContextBuilder.java b/modules/commons/src/main/java/org/apache/ignite/services/ServiceCallContextBuilder.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/services/ServiceCallContextBuilder.java rename to modules/commons/src/main/java/org/apache/ignite/services/ServiceCallContextBuilder.java diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionConcurrency.java b/modules/commons/src/main/java/org/apache/ignite/transactions/TransactionConcurrency.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/transactions/TransactionConcurrency.java rename to modules/commons/src/main/java/org/apache/ignite/transactions/TransactionConcurrency.java diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionIsolation.java b/modules/commons/src/main/java/org/apache/ignite/transactions/TransactionIsolation.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/transactions/TransactionIsolation.java rename to modules/commons/src/main/java/org/apache/ignite/transactions/TransactionIsolation.java diff --git a/modules/core/pom.xml b/modules/core/pom.xml index 8737f69637427..fa735fba4ebd0 100644 --- a/modules/core/pom.xml +++ b/modules/core/pom.xml @@ -72,6 +72,12 @@ ${project.groupId} ignite-binary-impl + runtime + + + + ${project.groupId} + ignite-thin-client-api compile @@ -353,6 +359,7 @@ ${project.groupId}:ignite-binary-api ${project.groupId}:ignite-binary-impl ${project.groupId}:ignite-grid-unsafe + ${project.groupId}:ignite-thin-client-api diff --git a/modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java b/modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java deleted file mode 100644 index df24cf9bcadc1..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java +++ /dev/null @@ -1,322 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.cache; - -import java.io.Serializable; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.Objects; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.internal.util.tostring.GridToStringInclude; -import org.apache.ignite.internal.util.typedef.internal.S; - -/** - * Contains list of fields to be indexed. It is possible to provide field name - * suffixed with index specific extension, for example for {@link QueryIndexType#SORTED sorted} index - * the list can be provided as following {@code (id, name asc, age desc)}. - */ -@SuppressWarnings("TypeMayBeWeakened") -public class QueryIndex implements Serializable { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private static final QueryIndexType DFLT_IDX_TYP = QueryIndexType.SORTED; - - /** Default index inline size. */ - public static final int DFLT_INLINE_SIZE = -1; - - /** Index name. */ - private String name; - - /** */ - @GridToStringInclude - private LinkedHashMap fields; - - /** */ - private QueryIndexType type = DFLT_IDX_TYP; - - /** */ - private int inlineSize = DFLT_INLINE_SIZE; - - /** - * Creates an empty index. Should be populated via setters. - */ - public QueryIndex() { - // Empty constructor. - } - - /** - * Creates single-field sorted ascending index. - * - * @param field Field name. - */ - public QueryIndex(String field) { - this(field, QueryIndexType.SORTED, true); - } - - /** - * Creates single-field sorted index. - * - * @param field Field name. - * @param asc Ascending flag. - */ - public QueryIndex(String field, boolean asc) { - this(field, QueryIndexType.SORTED, asc); - } - - /** - * Creates single-field sorted index. - * - * @param field Field name. - * @param asc Ascending flag. - * @param name Index name. - */ - public QueryIndex(String field, boolean asc, String name) { - this(field, QueryIndexType.SORTED, asc); - - this.name = name; - } - - /** - * Creates index for one field. - * If index is sorted, then ascending sorting is used by default. - * To specify sort order, use the next method. - * This constructor should also have a corresponding setter method. - * - * @param field Field name. - * @param type Index type. - */ - public QueryIndex(String field, QueryIndexType type) { - this(Arrays.asList(field), type); - } - - /** - * Creates index for one field. The last boolean parameter is ignored for non-sorted indexes. - * - * @param field Field name. - * @param type Index type. - * @param asc Ascending flag. - */ - public QueryIndex(String field, QueryIndexType type, boolean asc) { - fields = new LinkedHashMap<>(); - fields.put(field, asc); - - this.type = type; - } - - /** - * Creates index for one field. The last boolean parameter is ignored for non-sorted indexes. - * - * @param field Field name. - * @param type Index type. - * @param asc Ascending flag. - * @param name Index name. - */ - public QueryIndex(String field, QueryIndexType type, boolean asc, String name) { - fields = new LinkedHashMap<>(); - fields.put(field, asc); - - this.type = type; - this.name = name; - } - - /** - * Creates index for a collection of fields. If index is sorted, fields will be sorted in - * ascending order. - * - * @param fields Collection of fields to create an index. - * @param type Index type. - */ - public QueryIndex(Collection fields, QueryIndexType type) { - this.fields = new LinkedHashMap<>(); - - for (String field : fields) - this.fields.put(field, true); - - this.type = type; - } - - /** - * Creates index for a collection of fields. The order of fields in the created index will be the same - * as iteration order in the passed map. Map value defines whether the index will be ascending. - * - * @param fields Field name to field sort direction for sorted indexes. - * @param type Index type. - */ - public QueryIndex(LinkedHashMap fields, QueryIndexType type) { - this.fields = fields; - this.type = type; - } - - /** - * Gets index name. Will be automatically set if not provided by a user. - * - * @return Index name. - */ - public String getName() { - return name; - } - - /** - * Sets index name. - * - * @param name Index name. - * @return {@code this} for chaining. - */ - public QueryIndex setName(String name) { - this.name = name; - - return this; - } - - /** - * Gets fields included in the index. - * - * @return Collection of index fields. - */ - public LinkedHashMap getFields() { - return fields; - } - - /** - * Sets fields included in the index. - * - * @param fields Collection of index fields. - * @return {@code this} for chaining. - */ - public QueryIndex setFields(LinkedHashMap fields) { - this.fields = fields; - - return this; - } - - /** - * @return Gets a collection of field names. - */ - public Collection getFieldNames() { - return fields.keySet(); - } - - /** - * Sets a collection of field names altogether with the field sorting direction. Sorting direction will be - * ignored for non-sorted indexes. - * - * @param fields Collection of fields. - * @param asc Ascending flag. - * @return {@code this} for chaining. - */ - public QueryIndex setFieldNames(Collection fields, boolean asc) { - this.fields = new LinkedHashMap<>(); - - for (String field : fields) - this.fields.put(field, asc); - - return this; - } - - /** - * Gets index type. - * - * @return Index type. - */ - public QueryIndexType getIndexType() { - return type; - } - - /** - * Sets index type. - * - * @param type Index type. - * @return {@code this} for chaining. - */ - public QueryIndex setIndexType(QueryIndexType type) { - this.type = type; - - return this; - } - - /** - * Gets index inline size in bytes. When enabled part of indexed value will be placed directly to index pages, - * thus minimizing data page accesses, thus increasing query performance. - *

- * Allowed values: - *

    - *
  • {@code -1} (default) - determine inline size automatically (see below)
  • - *
  • {@code 0} - index inline is disabled (not recommended)
  • - *
  • positive value - fixed index inline
  • - *
- * When set to {@code -1}, Ignite will try to detect inline size automatically. It will be no more than - * {@link CacheConfiguration#getSqlIndexMaxInlineSize()}. Index inline will be enabled for all fixed-length types, - * but will not be enabled for {@code String}. - * - * @return Index inline size in bytes. - */ - public int getInlineSize() { - return inlineSize; - } - - /** - * Sets index inline size in bytes. When enabled part of indexed value will be placed directly to index pages, - * thus minimizing data page accesses, thus increasing query performance. - *

- * Allowed values: - *

    - *
  • {@code -1} (default) - determine inline size automatically (see below)
  • - *
  • {@code 0} - index inline is disabled (not recommended)
  • - *
  • positive value - fixed index inline
  • - *
- * When set to {@code -1}, Ignite will try to detect inline size automatically. It will be no more than - * {@link CacheConfiguration#getSqlIndexMaxInlineSize()}. Index inline will be enabled for all fixed-length types, - * but will not be enabled for {@code String}. - * - * @param inlineSize Inline size. - * @return {@code this} for chaining. - */ - public QueryIndex setInlineSize(int inlineSize) { - this.inlineSize = inlineSize; - - return this; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (o == null || getClass() != o.getClass()) - return false; - - QueryIndex idx = (QueryIndex)o; - - return inlineSize == idx.inlineSize && - Objects.equals(name, idx.name) && - Objects.equals(fields, idx.fields) && - type == idx.type; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - return Objects.hash(name, fields, type, inlineSize); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(QueryIndex.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java b/modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java index b5d0fcf15f719..64864b3510406 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java @@ -21,6 +21,7 @@ import javax.cache.Cache; import org.apache.ignite.IgniteCache; import org.apache.ignite.internal.processors.query.QueryUtils; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.tostring.GridToStringInclude; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.S; @@ -188,7 +189,7 @@ public int getTimeout() { * @return {@code this} For chaining. */ public SqlQuery setTimeout(int timeout, TimeUnit timeUnit) { - this.timeout = QueryUtils.validateTimeout(timeout, timeUnit); + this.timeout = CommonUtils.validateTimeout(timeout, timeUnit); return this; } diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java deleted file mode 100644 index 326e725c0f186..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java +++ /dev/null @@ -1,704 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.cluster; - -import org.apache.ignite.IgniteCluster; -import org.apache.ignite.configuration.IgniteConfiguration; - -/** - * This class represents runtime information on a cluster. Apart from obvious - * statistical value, this information is used for implementation of - * load balancing, failover, and collision SPIs. For example, collision SPI - * in combination with fail-over SPI could check if other nodes don't have - * any active or waiting jobs and fail-over some jobs to those nodes. - *

- * Node metrics for any node can be accessed via {@link ClusterNode#metrics()} - * method. Keep in mind that there will be a certain network delay (usually - * equal to metrics update delay) for the accuracy of node metrics. However, when accessing - * metrics on local node {@link IgniteCluster#localNode() IgniteCluster.localNode().getMetrics()} - * the metrics are always accurate and up to date. - *

- * Local node metrics are registered as {@code MBean} and can be accessed from - * any JMX management console. The simplest way is to use standard {@code jconsole} - * that comes with JDK as it also provides ability to view any node parameter - * as a graph. - */ -public interface ClusterMetrics { - /** - * Gets last update time of this node metrics. - * - * @return Last update time. - */ - public long getLastUpdateTime(); - - /** - * Gets maximum number of jobs that ever ran concurrently on this node. - * Note that this different from {@link #getTotalExecutedJobs()} - * metric and only reflects maximum number of jobs that ran at the same time. - *

- * Note: all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - *

    - *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • - *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • - *
- * - * @return Maximum number of jobs that ever ran concurrently on this node. - */ - public int getMaximumActiveJobs(); - - /** - * Gets number of currently active jobs concurrently executing on the node. - * - * @return Number of currently active jobs concurrently executing on the node. - */ - public int getCurrentActiveJobs(); - - /** - * Gets average number of active jobs concurrently executing on the node. - *

- * Note: all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - *

    - *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • - *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • - *
- * - * @return Average number of active jobs. - */ - public float getAverageActiveJobs(); - - /** - * Gets maximum number of waiting jobs this node had. - *

- * Note: all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - *

    - *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • - *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • - *
- * - * @return Maximum number of waiting jobs. - */ - public int getMaximumWaitingJobs(); - - /** - * Gets number of queued jobs currently waiting to be executed. - * - * @return Number of queued jobs currently waiting to be executed. - */ - public int getCurrentWaitingJobs(); - - /** - * Gets average number of waiting jobs this node had queued. - *

- * Note: all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - *

    - *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • - *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • - *
- * - * @return Average number of waiting jobs. - */ - public float getAverageWaitingJobs(); - - /** - * Gets maximum number of jobs rejected at once during a single collision resolution - * operation. - *

- * Note: all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - *

    - *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • - *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • - *
- * - * @return Maximum number of jobs rejected at once. - */ - public int getMaximumRejectedJobs(); - - /** - * Gets number of jobs rejected after more recent collision resolution operation. - * - * @return Number of jobs rejected after more recent collision resolution operation. - */ - public int getCurrentRejectedJobs(); - - /** - * Gets average number of jobs this node rejects during collision resolution operations. - *

- * Note: all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of grid configuration settings: - *

    - *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • - *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • - *
- * - * @return Average number of jobs this node rejects during collision resolution operations. - */ - public float getAverageRejectedJobs(); - - /** - * Gets total number of jobs this node rejects during collision resolution operations since node startup. - *

- * Note: Unlike most of other aggregation metrics this metric is not calculated over history - * but over the entire node life. - * - * @return Total number of jobs this node rejects during collision resolution - * operations since node startup. - */ - public int getTotalRejectedJobs(); - - /** - * Gets maximum number of cancelled jobs this node ever had running - * concurrently. - * - * @return Maximum number of cancelled jobs. - */ - public int getMaximumCancelledJobs(); - - /** - * Gets number of cancelled jobs that are still running. Just like - * regular java threads, jobs will receive cancel notification, but - * it's ultimately up to the job itself to gracefully exit. - * - * @return Number of cancelled jobs that are still running. - */ - public int getCurrentCancelledJobs(); - - /** - * Gets average number of cancelled jobs this node ever had running - * concurrently. - *

- * Note: all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - *

    - *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • - *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • - *
- * - * @return Average number of cancelled jobs. - */ - public float getAverageCancelledJobs(); - - /** - * Gets number of cancelled jobs since node startup. - *

- * Note: Unlike most of other aggregation metrics this metric is not calculated over history - * but over the entire node life. - * - * @return Total number of cancelled jobs since node startup. - */ - public int getTotalCancelledJobs(); - - /** - * Gets total number of jobs handled by the node since node startup. - *

- * Note: Unlike most of other aggregation metrics this metric is not calculated over history - * but over the entire node life. - * - * @return Total number of jobs handled by the node since node startup. - */ - public int getTotalExecutedJobs(); - - /** - * Gets total time all finished jobs takes to execute on the node since node startup. - *

- * Note: Unlike most of other aggregation metrics this metric is not calculated over history - * but over the entire node life. - * - * @return Total jobs execution time. - */ - public long getTotalJobsExecutionTime(); - - /** - * Gets maximum time a job ever spent waiting in a queue to be executed. - *

- * Note: all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - *

    - *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • - *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • - *
- * - * @return Maximum waiting time. - */ - public long getMaximumJobWaitTime(); - - /** - * Gets current time an oldest jobs has spent waiting to be executed. - * - * @return Current wait time of oldest job. - */ - public long getCurrentJobWaitTime(); - - /** - * Gets average time jobs spend waiting in the queue to be executed. - *

- * Note: all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - *

    - *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • - *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • - *
- * - * @return Average job wait time. - */ - public double getAverageJobWaitTime(); - - /** - * Gets time it took to execute the longest job on the node. - *

- * Note: all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - *

    - *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • - *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • - *
- * - * @return Time it took to execute the longest job on the node. - */ - public long getMaximumJobExecuteTime(); - - /** - * Gets longest time a current job has been executing for. - * - * @return Longest time a current job has been executing for. - */ - public long getCurrentJobExecuteTime(); - - /** - * Gets average time a job takes to execute on the node. - *

- * Note: all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - *

    - *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • - *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • - *
- * - * @return Average job execution time. - */ - public double getAverageJobExecuteTime(); - - /** - * Gets total number of tasks handled by the node. - *

- * Note: all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - *

    - *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • - *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • - *
- * - * @return Total number of jobs handled by the node. - */ - public int getTotalExecutedTasks(); - - /** - * Gets total time this node spent executing jobs. - * - * @return Total time this node spent executing jobs. - */ - public long getTotalBusyTime(); - - /** - * Gets total time this node spent idling (not executing any jobs). - * - * @return Gets total time this node spent idling. - */ - public long getTotalIdleTime(); - - /** - * Gets time this node spend idling since executing last job. - * - * @return Time this node spend idling since executing last job. - */ - public long getCurrentIdleTime(); - - /** - * Gets percentage of time this node is busy executing jobs vs. idling. - * - * @return Percentage of time this node is busy (value is less than - * or equal to {@code 1} and greater than or equal to {@code 0}) - */ - public float getBusyTimePercentage(); - - /** - * Gets percentage of time this node is idling vs. executing jobs. - * - * @return Percentage of time this node is idle (value is less than - * or equal to {@code 1} and greater than or equal to {@code 0}) - */ - public float getIdleTimePercentage(); - - /** - * Returns the number of CPUs available to the Java Virtual Machine. - * This method is equivalent to the {@link Runtime#availableProcessors()} - * method. - *

- * Note that this value may change during successive invocations of the - * virtual machine. - * - * @return The number of processors available to the virtual - * machine, never smaller than one. - */ - public int getTotalCpus(); - - /** - * Returns the CPU usage in {@code [0, 1]} range. - * The exact way how this number is calculated depends on SPI implementation. - *

- * If the CPU usage is not available, a negative value is returned. - *

- * This method is designed to provide a hint about the system load - * and may be queried frequently. The load average may be unavailable on - * some platform where it is expensive to implement this method. - * - * @return The estimated CPU usage in {@code [0, 1]} range. - * Negative value if not available. - */ - public double getCurrentCpuLoad(); - - /** - * Gets average of CPU load values over all metrics kept in the history. - *

- * Note: all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - *

    - *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • - *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • - *
- * - * @return Average of CPU load value in {@code [0, 1]} range over all metrics kept - * in the history. - */ - public double getAverageCpuLoad(); - - /** - * Returns average time spent in CG since the last update. - * - * @return Average time spent in CG since the last update. - */ - public double getCurrentGcCpuLoad(); - - /** - * Returns the amount of heap memory in bytes that the JVM - * initially requests from the operating system for memory management. - * This method returns {@code -1} if the initial memory size is undefined. - *

- * This value represents a setting of the heap memory for Java VM and is - * not a sum of all initial heap values for all memory pools. - *

- * Note: this is not an aggregated metric and it's calculated - * from the time of the node's startup. - * - * @return The initial size of memory in bytes; {@code -1} if undefined. - */ - public long getHeapMemoryInitialized(); - - /** - * Returns the current heap size that is used for object allocation. - * The heap consists of one or more memory pools. This value is - * the sum of {@code used} heap memory values of all heap memory pools. - *

- * The amount of used memory in the returned is the amount of memory - * occupied by both live objects and garbage objects that have not - * been collected, if any. - *

- * Note: this is not an aggregated metric and it's calculated - * from the time of the node's startup. - * - * @return Amount of heap memory used. - */ - public long getHeapMemoryUsed(); - - /** - * Returns the amount of heap memory in bytes that is committed for - * the JVM to use. This amount of memory is - * guaranteed for the JVM to use. - * The heap consists of one or more memory pools. This value is - * the sum of {@code committed} heap memory values of all heap memory pools. - *

- * Note: this is not an aggregated metric and it's calculated - * from the time of the node's startup. - * - * @return The amount of committed memory in bytes. - */ - public long getHeapMemoryCommitted(); - - /** - * Returns the maximum amount of heap memory in bytes that can be - * used for memory management. This method returns {@code -1} - * if the maximum memory size is undefined. - *

- * This amount of memory is not guaranteed to be available - * for memory management if it is greater than the amount of - * committed memory. The JVM may fail to allocate - * memory even if the amount of used memory does not exceed this - * maximum size. - *

- * This value represents a setting of the heap memory for Java VM and is - * not a sum of all initial heap values for all memory pools. - *

- * Note: this is not an aggregated metric and it's calculated - * from the time of the node's startup. - * - * @return The maximum amount of memory in bytes; {@code -1} if undefined. - */ - public long getHeapMemoryMaximum(); - - /** - * Returns the total amount of heap memory in bytes. This method returns {@code -1} - * if the total memory size is undefined. - *

- * This amount of memory is not guaranteed to be available - * for memory management if it is greater than the amount of - * committed memory. The JVM may fail to allocate - * memory even if the amount of used memory does not exceed this - * maximum size. - *

- * This value represents a setting of the heap memory for Java VM and is - * not a sum of all initial heap values for all memory pools. - *

- * Note: this is not an aggregated metric and it's calculated - * from the time of the node's startup. - * - * @return The total amount of memory in bytes; {@code -1} if undefined. - */ - public long getHeapMemoryTotal(); - - /** - * Returns the amount of non-heap memory in bytes that the JVM - * initially requests from the operating system for memory management. - * This method returns {@code -1} if the initial memory size is undefined. - *

- * This value represents a setting of non-heap memory for Java VM and is - * not a sum of all initial heap values for all memory pools. - *

- * Note: this is not an aggregated metric and it's calculated - * from the time of the node's startup. - * - * @return The initial size of memory in bytes; {@code -1} if undefined. - */ - public long getNonHeapMemoryInitialized(); - - /** - * Returns the current non-heap memory size that is used by Java VM. - * The non-heap memory consists of one or more memory pools. This value is - * the sum of {@code used} non-heap memory values of all non-heap memory pools. - *

- * Note: this is not an aggregated metric and it's calculated - * from the time of the node's startup. - *

- * Note: this is not an aggregated metric and it's calculated - * from the time of the node's startup. - * - * @return Amount of none-heap memory used. - */ - public long getNonHeapMemoryUsed(); - - /** - * Returns the amount of non-heap memory in bytes that is committed for - * the JVM to use. This amount of memory is - * guaranteed for the JVM to use. - * The non-heap memory consists of one or more memory pools. This value is - * the sum of {@code committed} non-heap memory values of all non-heap memory pools. - *

- * Note: this is not an aggregated metric and it's calculated - * from the time of the node's startup. - * - * @return The amount of committed memory in bytes. - */ - public long getNonHeapMemoryCommitted(); - - /** - * Returns the maximum amount of non-heap memory in bytes that can be - * used for memory management. This method returns {@code -1} - * if the maximum memory size is undefined. - *

- * This amount of memory is not guaranteed to be available - * for memory management if it is greater than the amount of - * committed memory. The JVM may fail to allocate - * memory even if the amount of used memory does not exceed this - * maximum size. - *

- * This value represents a setting of the non-heap memory for Java VM and is - * not a sum of all initial non-heap values for all memory pools. - *

- * Note: this is not an aggregated metric and it's calculated - * from the time of the node's startup. - * - * @return The maximum amount of memory in bytes; {@code -1} if undefined. - */ - public long getNonHeapMemoryMaximum(); - - /** - * Returns the total amount of non-heap memory in bytes that can be - * used for memory management. This method returns {@code -1} - * if the total memory size is undefined. - *

- * This amount of memory is not guaranteed to be available - * for memory management if it is greater than the amount of - * committed memory. The JVM may fail to allocate - * memory even if the amount of used memory does not exceed this - * maximum size. - *

- * This value represents a setting of the non-heap memory for Java VM and is - * not a sum of all initial non-heap values for all memory pools. - *

- * Note: this is not an aggregated metric and it's calculated - * from the time of the node's startup. - * - * @return The total amount of memory in bytes; {@code -1} if undefined. - */ - public long getNonHeapMemoryTotal(); - - /** - * Returns the uptime of the JVM in milliseconds. - * - * @return Uptime of the JVM in milliseconds. - */ - public long getUpTime(); - - /** - * Returns the start time of the JVM in milliseconds. - * This method returns the approximate time when the Java virtual - * machine started. - * - * @return Start time of the JVM in milliseconds. - */ - public long getStartTime(); - - /** - * Returns the start time of grid node in milliseconds. - * There can be several grid nodes started in one JVM, so JVM start time will be - * the same for all of them, but node start time will be different. - * - * @return Start time of the grid node in milliseconds. - */ - public long getNodeStartTime(); - - /** - * Returns the current number of live threads including both - * daemon and non-daemon threads. - * - * @return Current number of live threads. - */ - public int getCurrentThreadCount(); - - /** - * Returns the maximum live thread count since the JVM - * started or peak was reset. - *

- * Note: this is not an aggregated metric and it's calculated - * from the time of the node's startup. - * - * @return The peak live thread count. - */ - public int getMaximumThreadCount(); - - /** - * Returns the total number of threads created and also started - * since the JVM started. - *

- * Note: this is not an aggregated metric and it's calculated - * from the time of the node's startup. - * - * @return The total number of threads started. - */ - public long getTotalStartedThreadCount(); - - /** - * Returns the current number of live daemon threads. - * - * @return Current number of live daemon threads. - */ - public int getCurrentDaemonThreadCount(); - - /** - * In-Memory Data Grid assigns incremental versions to all cache operations. This method provides - * the latest data version on the node. - * - * @return Last data version. - */ - public long getLastDataVersion(); - - /** - * Gets sent messages count. - * - * @return Sent messages count. - */ - public int getSentMessagesCount(); - - /** - * Gets sent bytes count. - * - * @return Sent bytes count. - */ - public long getSentBytesCount(); - - /** - * Gets received messages count. - * - * @return Received messages count. - */ - public int getReceivedMessagesCount(); - - /** - * Gets received bytes count. - * - * @return Received bytes count. - */ - public long getReceivedBytesCount(); - - /** - * Gets outbound messages queue size. - * - * @return Outbound messages queue size. - */ - public int getOutboundMessagesQueueSize(); - - /** - * Gets total number of nodes. - * - * @return Total number of nodes. - */ - public int getTotalNodes(); - - /** - * Gets execution duration for current partition map exchange in milliseconds. - * - * @return Gets execution duration for current partition map exchange in milliseconds. {@code 0} if there is no running PME. - */ - public long getCurrentPmeDuration(); -} diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java deleted file mode 100644 index bc698c38889ea..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.cluster; - -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import org.apache.ignite.Ignite; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteNodeAttributes; -import org.apache.ignite.lang.IgniteExperimental; -import org.apache.ignite.lang.IgniteProductVersion; -import org.jetbrains.annotations.Nullable; - -/** - * Interface representing a single cluster node. Use {@link #attribute(String)} or - * {@link #metrics()} to get static and dynamic information about cluster nodes. - * {@code ClusterNode} list, which includes all nodes within task topology, is provided - * to {@link org.apache.ignite.compute.ComputeTask#map(List, Object)} method. - *

- *

Cluster Node Attributes

- * You can use cluster node attributes to provide static information about a node. - * This information is initialized once within a cluster, during the node startup, and - * remains the same throughout the lifetime of a node. Use - * {@link IgniteConfiguration#getUserAttributes()} method to initialize your custom - * node attributes at startup. Here is an example of how to assign an attribute to a node at startup: - *
- * <bean class="org.apache.ignite.configuration.IgniteConfiguration">
- *     ...
- *     <property name="userAttributes">
- *         <map>
- *             <entry key="worker" value="true"/>
- *         </map>
- *     </property>
- *     ...
- * </bean>
- * 
- *

- * The system adds the following attributes automatically: - *

    - *
  • {@code {@link System#getProperties()}} - All system properties.
  • - *
  • {@code {@link System#getenv(String)}} - All environment properties.
  • - *
  • {@code org.ignite.build.ver} - Ignite build version.
  • - *
  • {@code org.apache.ignite.jit.name} - Name of JIT compiler used.
  • - *
  • {@code org.apache.ignite.net.itf.name} - Name of network interface.
  • - *
  • {@code org.apache.ignite.user.name} - Operating system user name.
  • - *
  • {@code org.apache.ignite.ignite.name} - Ignite name (see {@link Ignite#name()}).
  • - *
  • - * {@code spiName.org.apache.ignite.spi.class} - SPI implementation class for every SPI, - * where {@code spiName} is the name of the SPI (see {@link org.apache.ignite.spi.IgniteSpi#getName()}. - *
  • - *
  • - * {@code spiName.org.apache.ignite.spi.ver} - SPI version for every SPI, - * where {@code spiName} is the name of the SPI (see {@link org.apache.ignite.spi.IgniteSpi#getName()}. - *
  • - *
- *

- * Note that all System and Environment properties for all nodes are automatically included - * into node attributes. This gives you an ability to get any information specified - * in {@link System#getProperties()} about any node. So for example, in order to print out - * information about Operating System for all nodes you would do the following: - *

- * for (ClusterNode node : ignite.cluster().nodes()) {
- *     System.out.println("Operating system name: " + node.getAttribute("os.name"));
- *     System.out.println("Operating system architecture: " + node.getAttribute("os.arch"));
- *     System.out.println("Operating system version: " + node.getAttribute("os.version"));
- * }
- * 
- *

- *

Cluster Node Metrics

- * Cluster node metrics (see {@link #metrics()}) are updated frequently for all nodes - * and can be used to get dynamic information about a node. The frequency of update - * is controlled by {@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsUpdateFrequency()} parameter. - * The metrics data will be updated every {@code 2} seconds by default. - *

- * Grid node metrics provide information that can frequently change, - * such as Heap and Non-Heap memory utilization, CPU load, number of active and waiting - * grid jobs, etc... This information can become useful during job collision resolution or - * {@link org.apache.ignite.compute.ComputeTask#map(List, Object)} operation when jobs are - * assigned to remote nodes for execution. - *

- * Local node metrics are registered as {@code MBean} and can be accessed from - * any JMX management console. The simplest way is to use standard {@code jconsole} - * that comes with JDK as it also provides ability to view any node parameter - * as a graph. - */ -public interface ClusterNode extends BaselineNode { - /** - * Gets globally unique node ID. A new ID is generated every time a node restarts. - * - * @return Globally unique node ID. - */ - public UUID id(); - - /** - * Gets consistent globally unique node ID. Unlike {@link #id()} method, - * this method returns consistent node ID which survives node restarts. - * - * @return Consistent globally unique node ID. - */ - @Override public Object consistentId(); - - /** - * Gets a node attribute. Attributes are assigned to nodes at startup - * via {@link IgniteConfiguration#getUserAttributes()} method. - *

- * The system adds the following attributes automatically: - *

    - *
  • {@code {@link System#getProperties()}} - All system properties.
  • - *
  • {@code {@link System#getenv(String)}} - All environment properties.
  • - *
  • All attributes defined in {@link org.apache.ignite.internal.IgniteNodeAttributes}
  • - *
- *

- * Note that attributes cannot be changed at runtime. - * - * @param Attribute Type. - * @param name Attribute name. Note that attribute names starting with - * {@code org.apache.ignite} are reserved for internal use. - * @return Attribute value or {@code null}. - */ - @Override @Nullable public T attribute(String name); - - /** - * Gets metrics snapshot for this node. Note that node metrics are constantly updated - * and provide up to date information about nodes. For example, you can get - * an idea about CPU load on remote node via {@link ClusterMetrics#getCurrentCpuLoad()} - * method and use it during {@link org.apache.ignite.compute.ComputeTask#map(List, Object)} or during collision - * resolution. - *

- * Node metrics are updated with some delay which is controlled by - * {@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsUpdateFrequency()} parameter. - * By default the update will happen every {@code 2} seconds. - * - * @return Runtime metrics snapshot for this node. - */ - public ClusterMetrics metrics(); - - /** - * Gets all node attributes. Attributes are assigned to nodes at startup - * via {@link IgniteConfiguration#getUserAttributes()} method. - *

- * The system adds the following attributes automatically: - *

    - *
  • {@code {@link System#getProperties()}} - All system properties.
  • - *
  • {@code {@link System#getenv(String)}} - All environment properties.
  • - *
  • All attributes defined in {@link org.apache.ignite.internal.IgniteNodeAttributes}
  • - *
- *

- * Note that attributes cannot be changed at runtime. - * - * @return All node attributes. - */ - @Override public Map attributes(); - - /** - * Gets the Data Center ID where the node is located. In a cluster deployed in only one data center, this method - * returns {@code null}. - *

- * The data center ID is resolved at node startup and is used for optimizing operations like: - *

    - *
  • Minimizing cross-data center communication;
  • - *
  • Improving fault tolerance and redundancy strategies;
  • - *
  • Supporting affinity-based task execution within the same data center;
  • - *
  • Providing input to discovery SPIs for topology-aware node grouping.
  • - *
- * - * @return The Data Center ID of the node, or {@code null} if the cluster is deployed in a single DC. - */ - @IgniteExperimental - @Nullable public default String dataCenterId() { - return attribute(IgniteNodeAttributes.ATTR_DATA_CENTER_ID); - } - - /** - * Gets collection of addresses this node is known by. - *

- * If {@link IgniteConfiguration#getLocalHost()} value isn't {@code null} node will try to use that - * address for all communications and returned collection will contain only that address. - * If it is {@code null} then local wildcard address will be used, and Ignite - * will make the best effort to supply all addresses of that node in returned collection. - * - * @return Collection of addresses. - */ - public Collection addresses(); - - /** - * Gets collection of host names this node is known by. - *

- * If {@link IgniteConfiguration#getLocalHost()} value isn't {@code null} node will try to use - * the host name of that resolved address for all communications and - * returned collection will contain only that host name. - * If that host name can not be resolved then ip address returned by method {@link #addresses()} is used. - *

- * If {@link IgniteConfiguration#getLocalHost()} value is {@code null} then local wildcard address will be used, - * and this method returns host names of all addresses of that node. - *

- * Note: the loopback address will be omitted in results. - * - * @return Collection of host names. - */ - public Collection hostNames(); - - /** - * Node order within grid topology. Discovery SPIs that support node ordering will - * assign a proper order to each node and will guarantee that discovery event notifications - * for new nodes will come in proper order. All other SPIs not supporting ordering - * may choose to return node startup time here. - *

- * NOTE: in cases when discovery SPI doesn't support ordering Ignite cannot - * guarantee that orders on all nodes will be unique or chronologically correct. - * If such guarantee is required - make sure use discovery SPI that provides ordering. - * - * @return Node startup order. - */ - public long order(); - - /** - * Gets node version. - * - * @return Node version. - */ - public IgniteProductVersion version(); - - /** - * Tests whether or not this node is a local node. - * - * @return {@code True} if this node is a local node, {@code false} otherwise. - */ - public boolean isLocal(); - - /** - * Whether this node is cache client (see {@link IgniteConfiguration#isClientMode()}). - * - * @return {@code True if client}. - * - * @see IgniteConfiguration#isClientMode() - */ - public boolean isClient(); -} diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java index 7140c603e5cd8..4a8d52e81e770 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java @@ -79,13 +79,10 @@ * can be configured from Spring XML files (or other DI frameworks).

Note that absolutely all configuration * properties are optional, so users should only change what they need. */ -public class CacheConfiguration extends MutableConfiguration { +public class CacheConfiguration extends MutableConfiguration implements CacheConfigurationDefaults { /** */ private static final long serialVersionUID = 0L; - /** Maximum number of partitions. */ - public static final int MAX_PARTITIONS_COUNT = 65000; - /** * Default size of rebalance thread pool. * @deprecated Use {@link IgniteConfiguration#DFLT_REBALANCE_THREAD_POOL_SIZE} instead. @@ -114,37 +111,15 @@ public class CacheConfiguration extends MutableConfiguration { @Deprecated public static final long DFLT_REBALANCE_THROTTLE = IgniteConfiguration.DFLT_REBALANCE_THROTTLE; - /** Default number of backups. */ - public static final int DFLT_BACKUPS = 0; - - /** Default caching mode. */ - public static final CacheMode DFLT_CACHE_MODE = CacheMode.PARTITIONED; - - /** Default atomicity mode. */ - public static final CacheAtomicityMode DFLT_CACHE_ATOMICITY_MODE = CacheAtomicityMode.ATOMIC; - - /** - * Default lock timeout. - * @deprecated Default lock timeout configuration property has no effect. - */ - @Deprecated - public static final long DFLT_LOCK_TIMEOUT = 0; - /** Default cache size to use with eviction policy. */ public static final int DFLT_CACHE_SIZE = 100000; - /** Default maximum inline size for sql indexes. */ - public static final int DFLT_SQL_INDEX_MAX_INLINE_SIZE = -1; - /** Initial default near cache size. */ public static final int DFLT_NEAR_START_SIZE = 1500000 / 4; /** Default value for 'invalidate' flag that indicates if this is invalidation-based cache. */ public static final boolean DFLT_INVALIDATE = false; - /** Default rebalance mode for distributed cache. */ - public static final CacheRebalanceMode DFLT_REBALANCE_MODE = CacheRebalanceMode.ASYNC; - /** * Default rebalance batch size in bytes. * @deprecated Use {@link IgniteConfiguration#DFLT_REBALANCE_BATCH_SIZE} instead. @@ -152,12 +127,6 @@ public class CacheConfiguration extends MutableConfiguration { @Deprecated public static final int DFLT_REBALANCE_BATCH_SIZE = IgniteConfiguration.DFLT_REBALANCE_BATCH_SIZE; - /** Default value for eager ttl flag. */ - public static final boolean DFLT_EAGER_TTL = true; - - /** Default value for 'maxConcurrentAsyncOps'. */ - public static final int DFLT_MAX_CONCURRENT_ASYNC_OPS = 500; - /** Default value for 'writeBehindEnabled' flag. */ public static final boolean DFLT_WRITE_BEHIND_ENABLED = false; @@ -179,15 +148,9 @@ public class CacheConfiguration extends MutableConfiguration { /** Default write coalescing for write-behind cache store. */ public static final boolean DFLT_WRITE_BEHIND_COALESCING = true; - /** Default maximum number of query iterators that can be stored. */ - public static final int DFLT_MAX_QUERY_ITERATOR_CNT = 1024; - /** Default value for load previous value flag. */ public static final boolean DFLT_LOAD_PREV_VAL = false; - /** Default value for 'readFromBackup' flag. */ - public static final boolean DFLT_READ_FROM_BACKUP = true; - /** Filter that accepts all nodes. */ public static final IgnitePredicate ALL_NODES = new IgniteAllNodesPredicate(); @@ -195,9 +158,6 @@ public class CacheConfiguration extends MutableConfiguration { @Deprecated public static final long DFLT_LONG_QRY_WARN_TIMEOUT = 3000; - /** Default number of queries detail metrics to collect. */ - public static final int DFLT_QRY_DETAIL_METRICS_SIZE = 0; - /** Default value for keep binary in store behavior . */ @SuppressWarnings({"UnnecessaryBoxing", "BooleanConstructorCall"}) public static final Boolean DFLT_STORE_KEEP_BINARY = new Boolean(false); @@ -205,12 +165,6 @@ public class CacheConfiguration extends MutableConfiguration { /** Default threshold for concurrent loading of keys from {@link CacheStore}. */ public static final int DFLT_CONCURRENT_LOAD_ALL_THRESHOLD = 5; - /** Default partition loss policy. */ - public static final PartitionLossPolicy DFLT_PARTITION_LOSS_POLICY = PartitionLossPolicy.IGNORE; - - /** Default query parallelism. */ - public static final int DFLT_QUERY_PARALLELISM = 1; - /** Default value for events disabled flag. */ public static final boolean DFLT_EVENTS_DISABLED = false; @@ -274,9 +228,6 @@ public class CacheConfiguration extends MutableConfiguration { /** Platform cache configuration. Enables native cache in platforms (.NET, ...). */ private PlatformCacheConfiguration platformCfg; - /** Default value for 'copyOnRead' flag. */ - public static final boolean DFLT_COPY_ON_READ = true; - /** Write synchronization mode. */ private CacheWriteSynchronizationMode writeSync; diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java index 16d0bac76cf53..481bbdeae118a 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java @@ -105,7 +105,7 @@ * For more information about grid configuration and startup refer to {@link Ignition} * documentation. */ -public class IgniteConfiguration { +public class IgniteConfiguration implements IgniteConfigurationDefaults { /** Courtesy notice log category. */ public static final String COURTESY_LOGGER_NAME = "org.apache.ignite.CourtesyConfigNotice"; @@ -166,18 +166,6 @@ public class IgniteConfiguration { /** Default limit of threads used for rebalance. */ public static final int DFLT_REBALANCE_THREAD_POOL_SIZE = min(4, max(1, AVAILABLE_PROC_CNT / 4)); - /** Default rebalance message timeout in milliseconds (value is {@code 10000}). */ - public static final long DFLT_REBALANCE_TIMEOUT = 10000; - - /** Default rebalance batches prefetch count (value is {@code 3}). */ - public static final long DFLT_REBALANCE_BATCHES_PREFETCH_COUNT = 3; - - /** Time to wait between rebalance messages in milliseconds to avoid overloading CPU (value is {@code 0}). */ - public static final long DFLT_REBALANCE_THROTTLE = 0; - - /** Default rebalance batch size in bytes (value is {@code 512Kb}). */ - public static final int DFLT_REBALANCE_BATCH_SIZE = 512 * 1024; // 512K - /** Default size of system thread pool. */ public static final int DFLT_SYSTEM_CORE_THREAD_CNT = DFLT_PUBLIC_THREAD_CNT; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java b/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java index b3666694a15dd..23db559af3b2f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java @@ -242,7 +242,6 @@ import org.apache.ignite.internal.util.distributed.FullMessage; import org.apache.ignite.internal.util.distributed.InitMessage; import org.apache.ignite.internal.util.distributed.SingleNodeMessage; -import org.apache.ignite.lang.IgniteProductVersion; import org.apache.ignite.marshaller.Marshaller; import org.apache.ignite.marshaller.jdk.JdkMarshaller; import org.apache.ignite.plugin.extensions.communication.Message; @@ -337,8 +336,8 @@ public CoreMessagesProvider(Marshaller dfltMarsh, Marshaller schemaAwareMarsh, C this.factory = factory; - // [-44, 0..2, 42, 200..204, 210] - Use in tests. - // [300 - 500] - CalciteMessageFactory. + // [-44, 0..2, 42, 200..204, 210, 302] - Use in tests. + // [300..307, 350..352] - CalciteMessageFactory. // [-4..-22, -30..-35, -54..-57] - SQL // [5000 - 5500]: Utility messages. Most of them originally come from Discovery. @@ -349,7 +348,6 @@ public CoreMessagesProvider(Marshaller dfltMarsh, Marshaller schemaAwareMarsh, C withNoSchema(InetSocketAddressMessage.class); withNoSchema(InetAddressMessage.class); withNoSchema(TcpDiscoveryNode.class); - withNoSchema(IgniteProductVersion.class); withNoSchema(DiscoveryDataPacket.class); withNoSchema(GridByteArrayList.class); withNoSchema(CacheVersionedValue.class); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java deleted file mode 100644 index 58f0887b0d593..0000000000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal; - -import java.time.Instant; -import java.time.LocalDate; -import java.time.ZoneId; -import java.time.format.DateTimeFormatter; -import java.util.Locale; -import org.apache.ignite.lang.IgniteProductVersion; - -/** - * Ignite version utils. - */ -public class IgniteVersionUtils { - /** Ignite version in String form. */ - public static final String VER_STR; - - /** Ignite version. */ - public static final IgniteProductVersion VER; - - /** UTC build date formatter. */ - private static final DateTimeFormatter BUILD_TSTAMP_DATE_FORMATTER; - - /** Formatted build date. */ - public static final String BUILD_TSTAMP_STR; - - /** Build timestamp in seconds. */ - public static final long BUILD_TSTAMP; - - /** Build timestamp string property value. */ - private static final String BUILD_TSTAMP_FROM_PROPERTY; - - /** Revision hash. */ - public static final String REV_HASH_STR; - - /** Release date. */ - public static final LocalDate RELEASE_DATE; - - /** Compound version. */ - public static final String ACK_VER_STR; - - /** Copyright blurb. */ - public static final String COPYRIGHT; - - /** - * Static initializer. - */ - static { - VER_STR = IgniteProperties.get("ignite.version") - .replace(".a", "-a") // Backward compatibility fix. - .replace(".b", "-b") - .replace(".final", "-final"); - - BUILD_TSTAMP_FROM_PROPERTY = IgniteProperties.get("ignite.build"); - - //Development ignite.properties file contains ignite.build = 0, so we will add the check for it. - BUILD_TSTAMP = !BUILD_TSTAMP_FROM_PROPERTY.isEmpty() && Long.parseLong(BUILD_TSTAMP_FROM_PROPERTY) != 0 - ? Long.parseLong(BUILD_TSTAMP_FROM_PROPERTY) : System.currentTimeMillis() / 1000; - - BUILD_TSTAMP_DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd").withZone(ZoneId.of("UTC")); - - BUILD_TSTAMP_STR = formatBuildTimeStamp(BUILD_TSTAMP * 1000); - - COPYRIGHT = BUILD_TSTAMP_STR.substring(0, 4) + " Copyright(C) Apache Software Foundation"; - - REV_HASH_STR = IgniteProperties.get("ignite.revision"); - - String releaseDateStr = IgniteProperties.get("ignite.rel.date"); - - DateTimeFormatter releaseDateFormatter = DateTimeFormatter.ofPattern("ddMMyyyy", Locale.US); - - RELEASE_DATE = LocalDate.parse(releaseDateStr, releaseDateFormatter); - - String rev = REV_HASH_STR.length() > 8 ? REV_HASH_STR.substring(0, 8) : REV_HASH_STR; - - ACK_VER_STR = VER_STR + '#' + BUILD_TSTAMP_STR + "-sha1:" + rev; - - VER = IgniteProductVersion.fromString(VER_STR + '-' + BUILD_TSTAMP + '-' + REV_HASH_STR); - } - - /** - * Builds string date representation in "yyyyMMdd" format. - * - * @param ts Timestamp. - * @return Timestamp date in UTC timezone. - */ - public static String formatBuildTimeStamp(long ts) { - return BUILD_TSTAMP_DATE_FORMATTER.format(Instant.ofEpochMilli(ts)); - } - - /** - * Private constructor. - */ - private IgniteVersionUtils() { - // No-op. - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QuerySchema.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QuerySchema.java index 6b5838ee824fa..0105eaa68b909 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QuerySchema.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QuerySchema.java @@ -140,7 +140,7 @@ public QuerySchemaPatch makePatch(CacheConfiguration targetCfg, Collection if (locEntities.containsKey(qryEntity.getTableName())) { QueryEntity locEntity = locEntities.get(qryEntity.getTableName()); - QueryEntityPatch entityPatch = locEntity.makePatch(qryEntity); + QueryEntityPatch entityPatch = QueryUtils.makePatch(locEntity, qryEntity); if (entityPatch.hasConflict()) { if (conflicts.length() > 0) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java index 782012cc9da2a..75a86bdaa5fd6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java @@ -20,15 +20,8 @@ import java.lang.reflect.Method; import java.math.BigDecimal; import java.sql.SQLException; -import java.sql.Time; -import java.sql.Timestamp; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; -import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; @@ -44,6 +37,7 @@ import org.apache.ignite.IgniteSystemProperties; import org.apache.ignite.binary.BinaryField; import org.apache.ignite.cache.QueryEntity; +import org.apache.ignite.cache.QueryEntityPatch; import org.apache.ignite.cache.QueryIndex; import org.apache.ignite.cache.QueryIndexType; import org.apache.ignite.cache.affinity.AffinityKeyMapper; @@ -68,9 +62,12 @@ import org.apache.ignite.internal.processors.query.property.QueryPropertyAccessor; import org.apache.ignite.internal.processors.query.property.QueryReadOnlyMethodsAccessor; import org.apache.ignite.internal.processors.query.schema.SchemaOperationException; +import org.apache.ignite.internal.processors.query.schema.operation.SchemaAbstractOperation; +import org.apache.ignite.internal.processors.query.schema.operation.SchemaAlterTableAddColumnOperation; +import org.apache.ignite.internal.processors.query.schema.operation.SchemaIndexCreateOperation; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.X; -import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.U; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -113,10 +110,10 @@ public class QueryUtils { public static final String SCHEMA_INFORMATION = "INFORMATION_SCHEMA"; /** Field name for key. */ - public static final String KEY_FIELD_NAME = "_KEY"; + public static final String KEY_FIELD_NAME = CommonUtils.KEY_FIELD_NAME; /** Field name for value. */ - public static final String VAL_FIELD_NAME = "_VAL"; + public static final String VAL_FIELD_NAME = CommonUtils.VAL_FIELD_NAME; /** Well-known template name for PARTITIONED cache. */ public static final String TEMPLATE_PARTITIONED = "PARTITIONED"; @@ -131,9 +128,6 @@ public class QueryUtils { private static final int DISCO_HIST_SIZE = getInteger(IGNITE_INDEXING_DISCOVERY_HISTORY_SIZE, DFLT_INDEXING_DISCOVERY_HISTORY_SIZE); - /** */ - private static final Set> SQL_TYPES = createSqlTypes(); - /** Default SQL delimeter. */ public static final char DEFAULT_DELIM = '\n'; @@ -157,36 +151,6 @@ public class QueryUtils { public static final ThreadLocal INCLUDE_SENSITIVE_TL = ThreadLocal.withInitial(() -> DFLT_TO_STRING_INCLUDE_SENSITIVE); - /** - * Creates SQL types set. - * - * @return SQL types set. - */ - @NotNull private static Set> createSqlTypes() { - Set> sqlClasses = new HashSet<>(Arrays.>asList( - Integer.class, - Boolean.class, - Byte.class, - Short.class, - Long.class, - BigDecimal.class, - Double.class, - Float.class, - Time.class, - Timestamp.class, - Date.class, - java.sql.Date.class, - LocalTime.class, - LocalDate.class, - LocalDateTime.class, - String.class, - UUID.class, - byte[].class - )); - - return sqlClasses; - } - /** * Get table name for entity. * @@ -1168,9 +1132,7 @@ private static boolean mustDeserializeBinary(GridKernalContext ctx, Class cls) { * @return {@code true} If can. */ public static boolean isSqlType(Class cls) { - cls = U.box(cls); - - return SQL_TYPES.contains(cls) || U.isGeometryClass(cls); + return CommonUtils.isSqlType(cls); } /** @@ -1231,22 +1193,6 @@ public static String typeName(Class cls) { return typeName; } - /** - * @param timeout Timeout. - * @param timeUnit Time unit. - * @return Converted time. - */ - public static int validateTimeout(int timeout, TimeUnit timeUnit) { - A.ensure(timeUnit != TimeUnit.MICROSECONDS && timeUnit != TimeUnit.NANOSECONDS, - "timeUnit minimal resolution is millisecond."); - - A.ensure(timeout >= 0, "timeout value should be non-negative."); - - long tmp = TimeUnit.MILLISECONDS.convert(timeout, timeUnit); - - return (int)tmp; - } - /** * @param ccfg Cache configuration. * @return {@code true} If query index must be enabled for this cache. @@ -1811,6 +1757,227 @@ public static IgniteInternalCache cacheForDML(IgniteInternalCache qryFieldsToAdd = checkFields(locEntity, target, conflicts); + + Collection indexesToAdd = checkIndexes(locEntity, target, conflicts); + + if (conflicts.length() != 0) + return QueryEntityPatch.conflict(locEntity.getTableName() + " conflict: \n" + conflicts.toString()); + + Collection patchOperations = new ArrayList<>(); + + if (!qryFieldsToAdd.isEmpty()) + patchOperations.add(new SchemaAlterTableAddColumnOperation( + UUID.randomUUID(), + null, + null, + locEntity.getTableName(), + qryFieldsToAdd, + true, + true + )); + + if (!indexesToAdd.isEmpty()) { + for (QueryIndex idx : indexesToAdd) { + patchOperations.add(new SchemaIndexCreateOperation( + UUID.randomUUID(), + null, + null, + locEntity.getTableName(), + idx, + true, + 0 + )); + } + } + + return QueryEntityPatch.patch(patchOperations); + } + + /** + * Comparing local entity fields and target entity fields. + * + * @param target Query entity for check. + * @param conflicts Storage of conflicts. + * @return Fields which exist in target and not exist in local. + */ + private static List checkFields(QueryEntity locEntity, QueryEntity target, StringBuilder conflicts) { + List qryFieldsToAdd = new ArrayList<>(); + + for (Map.Entry targetField : target.getFields().entrySet()) { + String targetFieldName = targetField.getKey(); + String targetFieldType = targetField.getValue(); + String targetFieldAlias = target.getAliases().get(targetFieldName); + + if (locEntity.getFields().containsKey(targetFieldName)) { + checkEquals( + conflicts, + "alias of " + targetFieldName, + locEntity.getAliases().get(targetFieldName), + targetFieldAlias + ); + + checkEquals( + conflicts, + "fieldType of " + targetFieldName, + locEntity.getFields().get(targetFieldName), + targetFieldType + ); + + checkEquals( + conflicts, + "nullable of " + targetFieldName, + contains(locEntity.getNotNullFields(), targetFieldName), + contains(target.getNotNullFields(), targetFieldName) + ); + + checkEquals( + conflicts, + "default value of " + targetFieldName, + getFromMap(locEntity.getDefaultFieldValues(), targetFieldName), + getFromMap(target.getDefaultFieldValues(), targetFieldName) + ); + + checkEquals(conflicts, + "precision of " + targetFieldName, + getFromMap(locEntity.getFieldsPrecision(), targetFieldName), + getFromMap(target.getFieldsPrecision(), targetFieldName)); + + checkEquals( + conflicts, + "scale of " + targetFieldName, + getFromMap(locEntity.getFieldsScale(), targetFieldName), + getFromMap(target.getFieldsScale(), targetFieldName)); + } + else { + boolean isAliasConflictsFound = findAliasConflicts(locEntity, targetFieldAlias, targetFieldName, conflicts); + + if (!isAliasConflictsFound) { + Integer precision = getFromMap(target.getFieldsPrecision(), targetFieldName); + Integer scale = getFromMap(target.getFieldsScale(), targetFieldName); + + qryFieldsToAdd.add(new QueryField( + targetFieldName, + targetFieldType, + targetFieldAlias, + !contains(target.getNotNullFields(), targetFieldName), + precision == null ? -1 : precision, + scale == null ? -1 : scale + )); + } + } + } + + return qryFieldsToAdd; + } + + /** + * Comparing local fields and target fields. + * + * @param target Query entity for check. + * @param conflicts Storage of conflicts. + * @return Indexes which exist in target and not exist in local. + */ + @NotNull private static Collection checkIndexes(QueryEntity locEntity, QueryEntity target, StringBuilder conflicts) { + HashSet indexesToAdd = new HashSet<>(); + + Map curIndexes = new HashMap<>(); + + for (QueryIndex idx : locEntity.getIndexes()) { + if (curIndexes.put(idx.getName(), idx) != null) + throw new IllegalStateException("Duplicate key"); + } + + for (QueryIndex qryIdx : target.getIndexes()) { + if (curIndexes.containsKey(qryIdx.getName())) { + checkEquals( + conflicts, + "index " + qryIdx.getName(), + curIndexes.get(qryIdx.getName()), + qryIdx + ); + } + else + indexesToAdd.add(qryIdx); + } + return indexesToAdd; + } + + /** + * @param collection Collection for checking. + * @param elementToCheck Element for checking to containing in collection. + * @return {@code true} if collection contain elementToCheck. + */ + private static boolean contains(Collection collection, String elementToCheck) { + return collection != null && collection.contains(elementToCheck); + } + + /** + * @return Value from sourceMap or null if map is null. + */ + private static V getFromMap(Map sourceMap, String key) { + return sourceMap == null ? null : sourceMap.get(key); + } + + /** + * Comparing two objects and add formatted text to conflicts if needed. + * + * @param conflicts Storage of conflicts resulting error message. + * @param name Name of comparing object. + * @param local Local object. + * @param received Received object. + */ + private static void checkEquals(StringBuilder conflicts, String name, V local, V received) { + if (!Objects.equals(local, received)) + conflicts.append(String.format("%s is different: local=%s, received=%s\n", name, local, received)); + } + + /** + * Checks if received query entity field has the alias which is already used by a field on the local node. + * + * @return Whether conflicts were found. + */ + private static boolean findAliasConflicts( + QueryEntity locEntity, + String targetFieldAlias, + String targetFieldName, + StringBuilder conflicts + ) { + for (Map.Entry entry : locEntity.getAliases().entrySet()) { + if (Objects.equals(entry.getValue(), targetFieldAlias)) { + conflicts.append(String.format( + "multiple fields are associated with the same alias: alias=%s, localField=%s, receivedField=%s\n", + targetFieldAlias, + entry.getKey(), + targetFieldName) + ); + + return true; + } + } + + return false; + } + /** * Private constructor. */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java index c8ea0134a6ad5..1513346138589 100755 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java @@ -356,9 +356,6 @@ public abstract class IgniteUtils extends CommonUtils { /** Default buffer size = 4K. */ private static final int BUF_SIZE = 4096; - /** Byte bit-mask. */ - private static final int MASK = 0xf; - /** Long date format pattern for log messages. */ public static final DateTimeFormatter LONG_DATE_FMT = DateTimeFormatter.ofPattern("MM/dd/yyyy HH:mm:ss").withZone(ZoneId.systemDefault()); @@ -377,9 +374,6 @@ public abstract class IgniteUtils extends CommonUtils { /** Supplier of network interfaces. Could be used for tests purposes, must not be changed in production code. */ public static InterfaceSupplier INTERFACE_SUPPLIER = NetworkInterface::getNetworkInterfaces; - /** Boxed class map. */ - private static final Map, Class> boxedClsMap = new HashMap<>(16, .5f); - /** MAC OS invalid argument socket error message. */ public static final String MAC_INVALID_ARG_MSG = "On MAC OS you may have too many file descriptors open " + "(simple restart usually solves the issue)"; @@ -486,16 +480,6 @@ public abstract class IgniteUtils extends CommonUtils { jvm32Bit = "32".equals(jvmArchDataModel); - boxedClsMap.put(byte.class, Byte.class); - boxedClsMap.put(short.class, Short.class); - boxedClsMap.put(int.class, Integer.class); - boxedClsMap.put(long.class, Long.class); - boxedClsMap.put(float.class, Float.class); - boxedClsMap.put(double.class, Double.class); - boxedClsMap.put(char.class, Character.class); - boxedClsMap.put(boolean.class, Boolean.class); - boxedClsMap.put(void.class, Void.class); - // Disable hostname SSL verification for development and testing with self-signed certificates. if (Boolean.parseBoolean(System.getProperty(IGNITE_DISABLE_HOSTNAME_VERIFIER))) { HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { @@ -1802,23 +1786,6 @@ public static boolean hasParent(@Nullable ClassLoader parent, ClassLoader ldr) { return true; } - /** - * Writes byte array to output stream accounting for null values. - * - * @param out Output stream to write to. - * @param arr Array to write, possibly null. - * @throws java.io.IOException If write failed. - */ - public static void writeByteArray(DataOutput out, @Nullable byte[] arr) throws IOException { - if (arr == null) - out.writeInt(-1); - else { - out.writeInt(arr.length); - - out.write(arr); - } - } - /** * Writes byte array to output stream accounting for null values. * @@ -1838,26 +1805,6 @@ public static void writeByteArray(DataOutput out, @Nullable byte[] arr, int maxL } } - /** - * Reads byte array from input stream accounting for null values. - * - * @param in Stream to read from. - * @return Read byte array, possibly null. - * @throws java.io.IOException If read failed. - */ - @Nullable public static byte[] readByteArray(DataInput in) throws IOException { - int len = in.readInt(); - - if (len == -1) - return null; // Value "-1" indicates null. - - byte[] res = new byte[len]; - - in.readFully(res); - - return res; - } - /** * Join byte arrays into single one. * @@ -2205,42 +2152,6 @@ public static boolean bytesEqual(byte[] a, int aOff, byte[] b, int bOff, int len } } - /** - * Converts an array of characters representing hexidecimal values into an - * array of bytes of those same values. The returned array will be half the - * length of the passed array, as it takes two characters to represent any - * given byte. An exception is thrown if the passed char array has an odd - * number of elements. - * - * @param data An array of characters containing hexidecimal digits - * @return A byte array containing binary data decoded from - * the supplied char array. - * @throws IgniteCheckedException Thrown if an odd number or illegal of characters is supplied. - */ - public static byte[] decodeHex(char[] data) throws IgniteCheckedException { - int len = data.length; - - if ((len & 0x01) != 0) - throw new IgniteCheckedException("Odd number of characters."); - - byte[] out = new byte[len >> 1]; - - // Two characters form the hex value. - for (int i = 0, j = 0; j < len; i++) { - int f = toDigit(data[j], j) << 4; - - j++; - - f |= toDigit(data[j], j); - - j++; - - out[i] = (byte)(f & 0xFF); - } - - return out; - } - /** * @param bytes Number of bytes to display. * @param si If {@code true}, then unit base is 1000, otherwise unit base is 1024. @@ -2757,40 +2668,6 @@ public static URL resolveSpringUrl(String springCfgPath) throws IgniteCheckedExc return null; } - /** - * Converts byte array to hex string. - * - * @param arr Array of bytes. - * @return Hex string. - */ - public static String byteArray2HexString(byte[] arr) { - return byteArray2HexString(arr, true); - } - - /** - * Converts byte array to hex string. - * - * @param arr Array of bytes. - * @param toUpper If {@code true} returns upper cased result. - * @return Hex string. - */ - public static String byteArray2HexString(byte[] arr, boolean toUpper) { - StringBuilder sb = new StringBuilder(arr.length << 1); - - for (byte b : arr) - addByteAsHex(sb, b); - - return toUpper ? sb.toString().toUpperCase() : sb.toString(); - } - - /** - * @param sb String builder. - * @param b Byte to add in hexadecimal format. - */ - private static void addByteAsHex(StringBuilder sb, byte b) { - sb.append(Integer.toHexString(MASK & b >>> 4)).append(Integer.toHexString(MASK & b)); - } - /** * Checks for containment of the value in the array. * Both array cells and value may be {@code null}. Two {@code null}s are considered equal. @@ -5806,22 +5683,6 @@ public static long ensurePositive(long i, long dflt) { return i <= 0 ? dflt : i; } - /** - * Gets wrapper class for a primitive type. - * - * @param cls Class. If {@code null}, method is no-op. - * @return Wrapper class or original class if it is non-primitive. - */ - @Nullable public static Class box(@Nullable Class cls) { - if (cls == null) - return null; - - if (!cls.isPrimitive()) - return cls; - - return boxedClsMap.get(cls); - } - /** * Gets class for provided name. Accepts primitive types names. * @@ -6432,23 +6293,6 @@ public static IgniteCheckedException exceptionWithSuppressed(String msg, @Nullab return e; } - /** - * Converts a hexadecimal character to an integer. - * - * @param ch A character to convert to an integer digit - * @param idx The index of the character in the source - * @return An integer - * @throws IgniteCheckedException Thrown if ch is an illegal hex character - */ - public static int toDigit(char ch, int idx) throws IgniteCheckedException { - int digit = Character.digit(ch, 16); - - if (digit == -1) - throw new IgniteCheckedException("Illegal hexadecimal character " + ch + " at index " + idx); - - return digit; - } - /** * Gets oldest node out of collection of nodes. * diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java index f2190a1e86a41..08adcf1febb84 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java @@ -26,6 +26,7 @@ import org.apache.ignite.internal.processors.cache.CacheObject; import org.apache.ignite.internal.processors.cache.KeyCacheObject; import org.apache.ignite.internal.util.GridLongList; +import org.apache.ignite.lang.IgniteProductVersion; import org.apache.ignite.lang.IgniteUuid; /** @@ -270,6 +271,11 @@ public default T readMessage() { */ public > M readMap(MessageMapType type, boolean compress); + /** @return Ignite product version. */ + default IgniteProductVersion readIgniteProductVersion() { + return null; + } + /** * Tells whether last invocation of any of {@code readXXX(...)} * methods has fully written the value. {@code False} is returned diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java index c29e3ac093db9..02a6cff137da9 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java @@ -26,6 +26,7 @@ import org.apache.ignite.internal.processors.cache.CacheObject; import org.apache.ignite.internal.processors.cache.KeyCacheObject; import org.apache.ignite.internal.util.GridLongList; +import org.apache.ignite.lang.IgniteProductVersion; import org.apache.ignite.lang.IgniteUuid; import org.jetbrains.annotations.Nullable; @@ -328,6 +329,16 @@ public default boolean writeMap(Map map, MessageMapType type) { */ public boolean writeMap(Map map, MessageMapType type, boolean compress); + /** + * Writes ignite product version. + * + * @param ver Version. + * @return Whether value was fully written. + */ + default boolean writeIgniteProductVersion(IgniteProductVersion ver) { + return true; + } + /** * @return Whether header of current message is already written. */ diff --git a/modules/thin-client/api/README.txt b/modules/thin-client/api/README.txt new file mode 100644 index 0000000000000..a3562700500f6 --- /dev/null +++ b/modules/thin-client/api/README.txt @@ -0,0 +1,9 @@ +Apache Ignite Binary API Module +------------------------ + +ignite-thin-client-api module is internal module to separate thin-client API and implementation. +Other modules like ignite-core must depend on ignite-thin-client-api, only. +Implementation of API in ignite-thin-client-impl, it added in runtime. + +Note, class files of this module are copied in ignite-core.jar during project assembly +to ensure compatibility with previous Ignite releases. diff --git a/modules/thin-client/api/pom.xml b/modules/thin-client/api/pom.xml new file mode 100644 index 0000000000000..d329d6d7522be --- /dev/null +++ b/modules/thin-client/api/pom.xml @@ -0,0 +1,69 @@ + + + + + + + 4.0.0 + + + org.apache.ignite + ignite-parent-internal + ${revision} + ../../../parent-internal/pom.xml + + + ignite-thin-client-api + + http://ignite.apache.org + + + + ${project.groupId} + ignite-commons + provided + + + + ${project.groupId} + ignite-binary-api + provided + + + + org.jetbrains + annotations + ${jetbrains.annotations.version} + + + + + + + org.apache.maven.plugins + maven-deploy-plugin + 2.8.2 + + false + + + + + diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientAddressFinder.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAddressFinder.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientAddressFinder.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAddressFinder.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientAffinityConfiguration.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAffinityConfiguration.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientAffinityConfiguration.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAffinityConfiguration.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientAtomicConfiguration.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAtomicConfiguration.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/client/ClientAtomicConfiguration.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAtomicConfiguration.java index 248265fdd7240..8d0ab76905ca2 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/ClientAtomicConfiguration.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAtomicConfiguration.java @@ -17,7 +17,6 @@ package org.apache.ignite.client; -import org.apache.ignite.IgniteAtomicSequence; import org.apache.ignite.cache.CacheMode; import org.apache.ignite.internal.util.typedef.internal.S; import static org.apache.ignite.cache.CacheMode.PARTITIONED; diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientAtomicLong.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAtomicLong.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientAtomicLong.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAtomicLong.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientAuthenticationException.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAuthenticationException.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientAuthenticationException.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAuthenticationException.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientAuthorizationException.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAuthorizationException.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientAuthorizationException.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAuthorizationException.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientAutoCloseableIterator.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAutoCloseableIterator.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientAutoCloseableIterator.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAutoCloseableIterator.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientCache.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCache.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientCache.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCache.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java similarity index 94% rename from modules/core/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java index 693832b30add7..04e8b597e124d 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java @@ -26,9 +26,8 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode; import org.apache.ignite.cache.PartitionLossPolicy; import org.apache.ignite.cache.QueryEntity; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.DataStorageConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.configuration.CacheConfigurationDefaults; +import org.apache.ignite.configuration.IgniteConfigurationDefaults; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.lang.IgniteExperimental; import org.jetbrains.annotations.Nullable; @@ -42,55 +41,55 @@ public final class ClientCacheConfiguration implements Serializable { private String name; /** @serial Atomicity mode. */ - private CacheAtomicityMode atomicityMode = CacheConfiguration.DFLT_CACHE_ATOMICITY_MODE; + private CacheAtomicityMode atomicityMode = CacheConfigurationDefaults.DFLT_CACHE_ATOMICITY_MODE; /** @serial Backups. */ - private int backups = CacheConfiguration.DFLT_BACKUPS; + private int backups = CacheConfigurationDefaults.DFLT_BACKUPS; /** @serial Cache mode. */ - private CacheMode cacheMode = CacheConfiguration.DFLT_CACHE_MODE; + private CacheMode cacheMode = CacheConfigurationDefaults.DFLT_CACHE_MODE; /** @serial Eager TTL flag. */ - private boolean eagerTtl = CacheConfiguration.DFLT_EAGER_TTL; + private boolean eagerTtl = CacheConfigurationDefaults.DFLT_EAGER_TTL; /** @serial Group name. */ private String grpName = null; /** @serial Default lock timeout. */ - private long dfltLockTimeout = CacheConfiguration.DFLT_LOCK_TIMEOUT; + private long dfltLockTimeout = CacheConfigurationDefaults.DFLT_LOCK_TIMEOUT; /** @serial Partition loss policy. */ - private PartitionLossPolicy partLossPlc = CacheConfiguration.DFLT_PARTITION_LOSS_POLICY; + private PartitionLossPolicy partLossPlc = CacheConfigurationDefaults.DFLT_PARTITION_LOSS_POLICY; /** @serial Read from backup. */ - private boolean readFromBackup = CacheConfiguration.DFLT_READ_FROM_BACKUP; + private boolean readFromBackup = CacheConfigurationDefaults.DFLT_READ_FROM_BACKUP; /** @serial Rebalance batch size. */ - private int rebalanceBatchSize = IgniteConfiguration.DFLT_REBALANCE_BATCH_SIZE; + private int rebalanceBatchSize = IgniteConfigurationDefaults.DFLT_REBALANCE_BATCH_SIZE; /** @serial Rebalance batches prefetch count. */ - private long rebalanceBatchesPrefetchCnt = IgniteConfiguration.DFLT_REBALANCE_BATCHES_PREFETCH_COUNT; + private long rebalanceBatchesPrefetchCnt = IgniteConfigurationDefaults.DFLT_REBALANCE_BATCHES_PREFETCH_COUNT; /** @serial Rebalance delay. */ private long rebalanceDelay = 0; /** @serial Rebalance mode. */ - private CacheRebalanceMode rebalanceMode = CacheConfiguration.DFLT_REBALANCE_MODE; + private CacheRebalanceMode rebalanceMode = CacheConfigurationDefaults.DFLT_REBALANCE_MODE; /** @serial Rebalance order. */ private int rebalanceOrder = 0; /** @serial Rebalance throttle. */ - private long rebalanceThrottle = IgniteConfiguration.DFLT_REBALANCE_THROTTLE; + private long rebalanceThrottle = IgniteConfigurationDefaults.DFLT_REBALANCE_THROTTLE; /** @serial Rebalance timeout. */ - private long rebalanceTimeout = IgniteConfiguration.DFLT_REBALANCE_TIMEOUT; + private long rebalanceTimeout = IgniteConfigurationDefaults.DFLT_REBALANCE_TIMEOUT; /** @serial Write synchronization mode. */ private CacheWriteSynchronizationMode writeSynchronizationMode = CacheWriteSynchronizationMode.PRIMARY_SYNC; /** @serial Copy on read. */ - private boolean cpOnRead = CacheConfiguration.DFLT_COPY_ON_READ; + private boolean cpOnRead = CacheConfigurationDefaults.DFLT_COPY_ON_READ; /** @serial Data region name. */ private String dataRegionName = null; @@ -99,25 +98,25 @@ public final class ClientCacheConfiguration implements Serializable { private boolean statisticsEnabled = false; /** @serial Max concurrent async operations. */ - private int maxConcurrentAsyncOperations = CacheConfiguration.DFLT_MAX_CONCURRENT_ASYNC_OPS; + private int maxConcurrentAsyncOperations = CacheConfigurationDefaults.DFLT_MAX_CONCURRENT_ASYNC_OPS; /** @serial Max query iterators count. */ - private int maxQryIteratorsCnt = CacheConfiguration.DFLT_MAX_QUERY_ITERATOR_CNT; + private int maxQryIteratorsCnt = CacheConfigurationDefaults.DFLT_MAX_QUERY_ITERATOR_CNT; /** @serial Onheap cache enabled. */ private boolean onheapCacheEnabled = false; /** @serial Query detail metrics size. */ - private int qryDetailMetricsSize = CacheConfiguration.DFLT_QRY_DETAIL_METRICS_SIZE; + private int qryDetailMetricsSize = CacheConfigurationDefaults.DFLT_QRY_DETAIL_METRICS_SIZE; /** @serial Query parallelism. */ - private int qryParallelism = CacheConfiguration.DFLT_QUERY_PARALLELISM; + private int qryParallelism = CacheConfigurationDefaults.DFLT_QUERY_PARALLELISM; /** @serial Sql escape all. */ private boolean sqlEscapeAll = false; /** @serial Sql index max inline size. */ - private int sqlIdxMaxInlineSize = CacheConfiguration.DFLT_SQL_INDEX_MAX_INLINE_SIZE; + private int sqlIdxMaxInlineSize = CacheConfigurationDefaults.DFLT_SQL_INDEX_MAX_INLINE_SIZE; /** @serial Sql schema. */ private String sqlSchema = null; diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientCluster.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCluster.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientCluster.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCluster.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientClusterGroup.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientClusterGroup.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/client/ClientClusterGroup.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientClusterGroup.java index 01f8d31ebb2cc..bde1c9b54083b 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/ClientClusterGroup.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientClusterGroup.java @@ -20,9 +20,7 @@ import java.util.Collection; import java.util.UUID; import java.util.function.Predicate; -import org.apache.ignite.Ignition; import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.configuration.IgniteConfiguration; import org.jetbrains.annotations.Nullable; /** diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientCollectionConfiguration.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCollectionConfiguration.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientCollectionConfiguration.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCollectionConfiguration.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientCompute.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCompute.java similarity index 99% rename from modules/core/src/main/java/org/apache/ignite/client/ClientCompute.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCompute.java index d97b99197efdf..ab307c44169b7 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/ClientCompute.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCompute.java @@ -18,7 +18,6 @@ package org.apache.ignite.client; import java.util.concurrent.Future; -import org.apache.ignite.compute.ComputeTask; import org.jetbrains.annotations.Nullable; /** diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientConnectionException.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientConnectionException.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientConnectionException.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientConnectionException.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientDisconnectListener.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientDisconnectListener.java similarity index 80% rename from modules/core/src/main/java/org/apache/ignite/client/ClientDisconnectListener.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientDisconnectListener.java index e2c76b86be49a..ccacdf97fd422 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/ClientDisconnectListener.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientDisconnectListener.java @@ -18,12 +18,12 @@ package org.apache.ignite.client; import javax.cache.configuration.CacheEntryListenerConfiguration; -import org.apache.ignite.cache.query.ContinuousQuery; /** - * Client disconnected event listener. Such listeners can be used in {@link ClientCache#query(ContinuousQuery, - * ClientDisconnectListener)} or {@link ClientCache#registerCacheEntryListener(CacheEntryListenerConfiguration, - * ClientDisconnectListener)} methods to handle client channel failure. + * Client disconnected event listener. Such listeners can be used in + * {@link ClientCache#query(org.apache.ignite.cache.query.ContinuousQuery, ClientDisconnectListener)} or + * {@link ClientCache#registerCacheEntryListener(CacheEntryListenerConfiguration, ClientDisconnectListener)} + * methods to handle client channel failure. */ public interface ClientDisconnectListener { /** diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientException.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientException.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientException.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientException.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientFeatureNotSupportedByServerException.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientFeatureNotSupportedByServerException.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientFeatureNotSupportedByServerException.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientFeatureNotSupportedByServerException.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientIgniteSet.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientIgniteSet.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientIgniteSet.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientIgniteSet.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientOperationType.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientOperationType.java similarity index 97% rename from modules/core/src/main/java/org/apache/ignite/client/ClientOperationType.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientOperationType.java index 913ec88107d52..bb8e318c08932 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/ClientOperationType.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientOperationType.java @@ -20,10 +20,6 @@ import java.util.Collection; import java.util.Set; import javax.cache.processor.EntryProcessor; -import org.apache.ignite.cache.query.ContinuousQuery; -import org.apache.ignite.cache.query.Query; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.cluster.ClusterState; /** * Client operation type. diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapper.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapper.java similarity index 90% rename from modules/core/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapper.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapper.java index 64ea78b928211..dc9af29bad0e7 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapper.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapper.java @@ -17,10 +17,6 @@ package org.apache.ignite.client; -import org.apache.ignite.cache.affinity.AffinityFunction; -import org.apache.ignite.cache.affinity.AffinityKeyMapper; -import org.apache.ignite.configuration.ClientConfiguration; - /** * This function calculates the cache key to a partition mapping for each cache key. It is used only for local calculation on a client side. *

diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapperFactory.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapperFactory.java similarity index 95% rename from modules/core/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapperFactory.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapperFactory.java index c26421dda8454..d49aba72e7cf8 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapperFactory.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapperFactory.java @@ -17,9 +17,6 @@ package org.apache.ignite.client; -import org.apache.ignite.cache.affinity.AffinityFunction; -import org.apache.ignite.cache.affinity.AffinityKeyMapper; - /** * This factory is used on the client side and only when the partition awareness thin client feature is enabled. By default, * on a new cache the RendezvousAffinityFunction will be used for calculating mappings 'key-to-partition' and 'partition-to-node'. diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientReconnectedException.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientReconnectedException.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientReconnectedException.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientReconnectedException.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientRetryAllPolicy.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientRetryAllPolicy.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientRetryAllPolicy.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientRetryAllPolicy.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientRetryNonePolicy.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientRetryNonePolicy.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientRetryNonePolicy.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientRetryNonePolicy.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientRetryPolicy.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientRetryPolicy.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientRetryPolicy.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientRetryPolicy.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientRetryPolicyContext.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientRetryPolicyContext.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientRetryPolicyContext.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientRetryPolicyContext.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientRetryReadPolicy.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientRetryReadPolicy.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientRetryReadPolicy.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientRetryReadPolicy.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientServiceDescriptor.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientServiceDescriptor.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/client/ClientServiceDescriptor.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientServiceDescriptor.java index 1feba70a92ee8..75fe4621a8f3b 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/ClientServiceDescriptor.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientServiceDescriptor.java @@ -19,7 +19,6 @@ import java.util.UUID; import org.apache.ignite.platform.PlatformType; -import org.apache.ignite.services.Service; import org.jetbrains.annotations.Nullable; /** diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientServices.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientServices.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientServices.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientServices.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientTransaction.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientTransaction.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/ClientTransaction.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientTransaction.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientTransactions.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientTransactions.java similarity index 96% rename from modules/core/src/main/java/org/apache/ignite/client/ClientTransactions.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientTransactions.java index c6db25b35775d..183439d4b88ba 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/ClientTransactions.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientTransactions.java @@ -17,8 +17,6 @@ package org.apache.ignite.client; -import org.apache.ignite.configuration.ClientConfiguration; -import org.apache.ignite.configuration.ClientTransactionConfiguration; import org.apache.ignite.internal.client.thin.ClientServerError; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; diff --git a/modules/core/src/main/java/org/apache/ignite/client/IgniteClient.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/IgniteClient.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/IgniteClient.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/IgniteClient.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/IgniteClientFuture.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/IgniteClientFuture.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/IgniteClientFuture.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/IgniteClientFuture.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/SslMode.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/SslMode.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/SslMode.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/SslMode.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/SslProtocol.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/SslProtocol.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/SslProtocol.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/SslProtocol.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/ClientFailEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ClientFailEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/ClientFailEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ClientFailEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/ClientLifecycleEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ClientLifecycleEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/ClientLifecycleEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ClientLifecycleEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/ClientLifecycleEventListener.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ClientLifecycleEventListener.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/ClientLifecycleEventListener.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ClientLifecycleEventListener.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/ClientStartEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ClientStartEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/ClientStartEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ClientStartEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/ClientStopEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ClientStopEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/ClientStopEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ClientStopEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/ConnectionClosedEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ConnectionClosedEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/ConnectionClosedEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ConnectionClosedEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/ConnectionDescription.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ConnectionDescription.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/ConnectionDescription.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ConnectionDescription.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/ConnectionEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ConnectionEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/ConnectionEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ConnectionEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/ConnectionEventListener.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ConnectionEventListener.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/ConnectionEventListener.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/ConnectionEventListener.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/HandshakeFailEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/HandshakeFailEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/HandshakeFailEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/HandshakeFailEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/HandshakeStartEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/HandshakeStartEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/HandshakeStartEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/HandshakeStartEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/HandshakeSuccessEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/HandshakeSuccessEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/HandshakeSuccessEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/HandshakeSuccessEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/RequestEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/RequestEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/RequestEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/RequestEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/RequestEventListener.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/RequestEventListener.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/RequestEventListener.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/RequestEventListener.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/RequestFailEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/RequestFailEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/RequestFailEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/RequestFailEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/RequestStartEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/RequestStartEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/RequestStartEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/RequestStartEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/events/RequestSuccessEvent.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/events/RequestSuccessEvent.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/events/RequestSuccessEvent.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/events/RequestSuccessEvent.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/package-info.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/package-info.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/client/package-info.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/client/package-info.java diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/ClientConfiguration.java b/modules/thin-client/api/src/main/java/org/apache/ignite/configuration/ClientConfiguration.java similarity index 99% rename from modules/core/src/main/java/org/apache/ignite/configuration/ClientConfiguration.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/configuration/ClientConfiguration.java index 8badaa9fd93a8..58b99f92429dd 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/ClientConfiguration.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/configuration/ClientConfiguration.java @@ -27,7 +27,6 @@ import javax.net.ssl.SSLContext; import org.apache.ignite.IgniteLogger; -import org.apache.ignite.cache.query.IndexQuery; import org.apache.ignite.cache.query.ScanQuery; import org.apache.ignite.client.ClientAddressFinder; import org.apache.ignite.client.ClientPartitionAwarenessMapper; @@ -37,7 +36,6 @@ import org.apache.ignite.client.ClientTransactions; import org.apache.ignite.client.SslMode; import org.apache.ignite.client.SslProtocol; -import org.apache.ignite.internal.client.thin.TcpIgniteClient; import org.apache.ignite.internal.util.typedef.internal.LT; import org.apache.ignite.internal.util.typedef.internal.S; diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/ClientTransactionConfiguration.java b/modules/thin-client/api/src/main/java/org/apache/ignite/configuration/ClientTransactionConfiguration.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/configuration/ClientTransactionConfiguration.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/configuration/ClientTransactionConfiguration.java index fd1d50f8008a9..ddde73b1c7b75 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/ClientTransactionConfiguration.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/configuration/ClientTransactionConfiguration.java @@ -19,7 +19,6 @@ import java.io.Serializable; import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientError.java b/modules/thin-client/api/src/main/java/org/apache/ignite/internal/client/thin/ClientError.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientError.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/internal/client/thin/ClientError.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientServerError.java b/modules/thin-client/api/src/main/java/org/apache/ignite/internal/client/thin/ClientServerError.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientServerError.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/internal/client/thin/ClientServerError.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ProtocolBitmaskFeature.java b/modules/thin-client/api/src/main/java/org/apache/ignite/internal/client/thin/ProtocolBitmaskFeature.java similarity index 93% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ProtocolBitmaskFeature.java rename to modules/thin-client/api/src/main/java/org/apache/ignite/internal/client/thin/ProtocolBitmaskFeature.java index 6c4a3fa676c0f..b3287169a2e3c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ProtocolBitmaskFeature.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/internal/client/thin/ProtocolBitmaskFeature.java @@ -20,12 +20,6 @@ import java.util.BitSet; import java.util.Collection; import java.util.EnumSet; -import org.apache.ignite.client.ClientCacheConfiguration; -import org.apache.ignite.client.ClientServices; -import org.apache.ignite.cluster.ClusterState; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.internal.processors.cache.GridCacheProcessor; /** * Defines supported bitmask features for thin client. diff --git a/pom.xml b/pom.xml index 97f40222cc8b1..5b4ef9e6f5516 100644 --- a/pom.xml +++ b/pom.xml @@ -42,6 +42,7 @@ modules/commons modules/binary/api modules/binary/impl + modules/thin-client/api modules/unsafe modules/core modules/compress From 6ed8e86581f2185c71229cf7d47ce0ba8d6c82c5 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 22 May 2026 17:25:58 +0300 Subject: [PATCH 20/44] IGNITE-28207 Thin client API extraction --- .../org/apache/ignite/cache/QueryIndex.java | 322 ++++++++ .../apache/ignite/cluster/ClusterMetrics.java | 704 ++++++++++++++++++ .../apache/ignite/cluster/ClusterNode.java | 255 +++++++ 3 files changed, 1281 insertions(+) create mode 100644 modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java create mode 100644 modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java create mode 100644 modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java diff --git a/modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java b/modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java new file mode 100644 index 0000000000000..df24cf9bcadc1 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java @@ -0,0 +1,322 @@ +/* + * 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.cache; + +import java.io.Serializable; +import java.util.Arrays; +import java.util.Collection; +import java.util.LinkedHashMap; +import java.util.Objects; +import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.internal.util.tostring.GridToStringInclude; +import org.apache.ignite.internal.util.typedef.internal.S; + +/** + * Contains list of fields to be indexed. It is possible to provide field name + * suffixed with index specific extension, for example for {@link QueryIndexType#SORTED sorted} index + * the list can be provided as following {@code (id, name asc, age desc)}. + */ +@SuppressWarnings("TypeMayBeWeakened") +public class QueryIndex implements Serializable { + /** */ + private static final long serialVersionUID = 0L; + + /** */ + private static final QueryIndexType DFLT_IDX_TYP = QueryIndexType.SORTED; + + /** Default index inline size. */ + public static final int DFLT_INLINE_SIZE = -1; + + /** Index name. */ + private String name; + + /** */ + @GridToStringInclude + private LinkedHashMap fields; + + /** */ + private QueryIndexType type = DFLT_IDX_TYP; + + /** */ + private int inlineSize = DFLT_INLINE_SIZE; + + /** + * Creates an empty index. Should be populated via setters. + */ + public QueryIndex() { + // Empty constructor. + } + + /** + * Creates single-field sorted ascending index. + * + * @param field Field name. + */ + public QueryIndex(String field) { + this(field, QueryIndexType.SORTED, true); + } + + /** + * Creates single-field sorted index. + * + * @param field Field name. + * @param asc Ascending flag. + */ + public QueryIndex(String field, boolean asc) { + this(field, QueryIndexType.SORTED, asc); + } + + /** + * Creates single-field sorted index. + * + * @param field Field name. + * @param asc Ascending flag. + * @param name Index name. + */ + public QueryIndex(String field, boolean asc, String name) { + this(field, QueryIndexType.SORTED, asc); + + this.name = name; + } + + /** + * Creates index for one field. + * If index is sorted, then ascending sorting is used by default. + * To specify sort order, use the next method. + * This constructor should also have a corresponding setter method. + * + * @param field Field name. + * @param type Index type. + */ + public QueryIndex(String field, QueryIndexType type) { + this(Arrays.asList(field), type); + } + + /** + * Creates index for one field. The last boolean parameter is ignored for non-sorted indexes. + * + * @param field Field name. + * @param type Index type. + * @param asc Ascending flag. + */ + public QueryIndex(String field, QueryIndexType type, boolean asc) { + fields = new LinkedHashMap<>(); + fields.put(field, asc); + + this.type = type; + } + + /** + * Creates index for one field. The last boolean parameter is ignored for non-sorted indexes. + * + * @param field Field name. + * @param type Index type. + * @param asc Ascending flag. + * @param name Index name. + */ + public QueryIndex(String field, QueryIndexType type, boolean asc, String name) { + fields = new LinkedHashMap<>(); + fields.put(field, asc); + + this.type = type; + this.name = name; + } + + /** + * Creates index for a collection of fields. If index is sorted, fields will be sorted in + * ascending order. + * + * @param fields Collection of fields to create an index. + * @param type Index type. + */ + public QueryIndex(Collection fields, QueryIndexType type) { + this.fields = new LinkedHashMap<>(); + + for (String field : fields) + this.fields.put(field, true); + + this.type = type; + } + + /** + * Creates index for a collection of fields. The order of fields in the created index will be the same + * as iteration order in the passed map. Map value defines whether the index will be ascending. + * + * @param fields Field name to field sort direction for sorted indexes. + * @param type Index type. + */ + public QueryIndex(LinkedHashMap fields, QueryIndexType type) { + this.fields = fields; + this.type = type; + } + + /** + * Gets index name. Will be automatically set if not provided by a user. + * + * @return Index name. + */ + public String getName() { + return name; + } + + /** + * Sets index name. + * + * @param name Index name. + * @return {@code this} for chaining. + */ + public QueryIndex setName(String name) { + this.name = name; + + return this; + } + + /** + * Gets fields included in the index. + * + * @return Collection of index fields. + */ + public LinkedHashMap getFields() { + return fields; + } + + /** + * Sets fields included in the index. + * + * @param fields Collection of index fields. + * @return {@code this} for chaining. + */ + public QueryIndex setFields(LinkedHashMap fields) { + this.fields = fields; + + return this; + } + + /** + * @return Gets a collection of field names. + */ + public Collection getFieldNames() { + return fields.keySet(); + } + + /** + * Sets a collection of field names altogether with the field sorting direction. Sorting direction will be + * ignored for non-sorted indexes. + * + * @param fields Collection of fields. + * @param asc Ascending flag. + * @return {@code this} for chaining. + */ + public QueryIndex setFieldNames(Collection fields, boolean asc) { + this.fields = new LinkedHashMap<>(); + + for (String field : fields) + this.fields.put(field, asc); + + return this; + } + + /** + * Gets index type. + * + * @return Index type. + */ + public QueryIndexType getIndexType() { + return type; + } + + /** + * Sets index type. + * + * @param type Index type. + * @return {@code this} for chaining. + */ + public QueryIndex setIndexType(QueryIndexType type) { + this.type = type; + + return this; + } + + /** + * Gets index inline size in bytes. When enabled part of indexed value will be placed directly to index pages, + * thus minimizing data page accesses, thus increasing query performance. + *

+ * Allowed values: + *

    + *
  • {@code -1} (default) - determine inline size automatically (see below)
  • + *
  • {@code 0} - index inline is disabled (not recommended)
  • + *
  • positive value - fixed index inline
  • + *
+ * When set to {@code -1}, Ignite will try to detect inline size automatically. It will be no more than + * {@link CacheConfiguration#getSqlIndexMaxInlineSize()}. Index inline will be enabled for all fixed-length types, + * but will not be enabled for {@code String}. + * + * @return Index inline size in bytes. + */ + public int getInlineSize() { + return inlineSize; + } + + /** + * Sets index inline size in bytes. When enabled part of indexed value will be placed directly to index pages, + * thus minimizing data page accesses, thus increasing query performance. + *

+ * Allowed values: + *

    + *
  • {@code -1} (default) - determine inline size automatically (see below)
  • + *
  • {@code 0} - index inline is disabled (not recommended)
  • + *
  • positive value - fixed index inline
  • + *
+ * When set to {@code -1}, Ignite will try to detect inline size automatically. It will be no more than + * {@link CacheConfiguration#getSqlIndexMaxInlineSize()}. Index inline will be enabled for all fixed-length types, + * but will not be enabled for {@code String}. + * + * @param inlineSize Inline size. + * @return {@code this} for chaining. + */ + public QueryIndex setInlineSize(int inlineSize) { + this.inlineSize = inlineSize; + + return this; + } + + /** {@inheritDoc} */ + @Override public boolean equals(Object o) { + if (this == o) + return true; + + if (o == null || getClass() != o.getClass()) + return false; + + QueryIndex idx = (QueryIndex)o; + + return inlineSize == idx.inlineSize && + Objects.equals(name, idx.name) && + Objects.equals(fields, idx.fields) && + type == idx.type; + } + + /** {@inheritDoc} */ + @Override public int hashCode() { + return Objects.hash(name, fields, type, inlineSize); + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(QueryIndex.class, this); + } +} diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java new file mode 100644 index 0000000000000..326e725c0f186 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java @@ -0,0 +1,704 @@ +/* + * 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.cluster; + +import org.apache.ignite.IgniteCluster; +import org.apache.ignite.configuration.IgniteConfiguration; + +/** + * This class represents runtime information on a cluster. Apart from obvious + * statistical value, this information is used for implementation of + * load balancing, failover, and collision SPIs. For example, collision SPI + * in combination with fail-over SPI could check if other nodes don't have + * any active or waiting jobs and fail-over some jobs to those nodes. + *

+ * Node metrics for any node can be accessed via {@link ClusterNode#metrics()} + * method. Keep in mind that there will be a certain network delay (usually + * equal to metrics update delay) for the accuracy of node metrics. However, when accessing + * metrics on local node {@link IgniteCluster#localNode() IgniteCluster.localNode().getMetrics()} + * the metrics are always accurate and up to date. + *

+ * Local node metrics are registered as {@code MBean} and can be accessed from + * any JMX management console. The simplest way is to use standard {@code jconsole} + * that comes with JDK as it also provides ability to view any node parameter + * as a graph. + */ +public interface ClusterMetrics { + /** + * Gets last update time of this node metrics. + * + * @return Last update time. + */ + public long getLastUpdateTime(); + + /** + * Gets maximum number of jobs that ever ran concurrently on this node. + * Note that this different from {@link #getTotalExecutedJobs()} + * metric and only reflects maximum number of jobs that ran at the same time. + *

+ * Note: all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + *

    + *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • + *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • + *
+ * + * @return Maximum number of jobs that ever ran concurrently on this node. + */ + public int getMaximumActiveJobs(); + + /** + * Gets number of currently active jobs concurrently executing on the node. + * + * @return Number of currently active jobs concurrently executing on the node. + */ + public int getCurrentActiveJobs(); + + /** + * Gets average number of active jobs concurrently executing on the node. + *

+ * Note: all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + *

    + *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • + *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • + *
+ * + * @return Average number of active jobs. + */ + public float getAverageActiveJobs(); + + /** + * Gets maximum number of waiting jobs this node had. + *

+ * Note: all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + *

    + *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • + *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • + *
+ * + * @return Maximum number of waiting jobs. + */ + public int getMaximumWaitingJobs(); + + /** + * Gets number of queued jobs currently waiting to be executed. + * + * @return Number of queued jobs currently waiting to be executed. + */ + public int getCurrentWaitingJobs(); + + /** + * Gets average number of waiting jobs this node had queued. + *

+ * Note: all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + *

    + *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • + *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • + *
+ * + * @return Average number of waiting jobs. + */ + public float getAverageWaitingJobs(); + + /** + * Gets maximum number of jobs rejected at once during a single collision resolution + * operation. + *

+ * Note: all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + *

    + *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • + *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • + *
+ * + * @return Maximum number of jobs rejected at once. + */ + public int getMaximumRejectedJobs(); + + /** + * Gets number of jobs rejected after more recent collision resolution operation. + * + * @return Number of jobs rejected after more recent collision resolution operation. + */ + public int getCurrentRejectedJobs(); + + /** + * Gets average number of jobs this node rejects during collision resolution operations. + *

+ * Note: all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of grid configuration settings: + *

    + *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • + *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • + *
+ * + * @return Average number of jobs this node rejects during collision resolution operations. + */ + public float getAverageRejectedJobs(); + + /** + * Gets total number of jobs this node rejects during collision resolution operations since node startup. + *

+ * Note: Unlike most of other aggregation metrics this metric is not calculated over history + * but over the entire node life. + * + * @return Total number of jobs this node rejects during collision resolution + * operations since node startup. + */ + public int getTotalRejectedJobs(); + + /** + * Gets maximum number of cancelled jobs this node ever had running + * concurrently. + * + * @return Maximum number of cancelled jobs. + */ + public int getMaximumCancelledJobs(); + + /** + * Gets number of cancelled jobs that are still running. Just like + * regular java threads, jobs will receive cancel notification, but + * it's ultimately up to the job itself to gracefully exit. + * + * @return Number of cancelled jobs that are still running. + */ + public int getCurrentCancelledJobs(); + + /** + * Gets average number of cancelled jobs this node ever had running + * concurrently. + *

+ * Note: all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + *

    + *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • + *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • + *
+ * + * @return Average number of cancelled jobs. + */ + public float getAverageCancelledJobs(); + + /** + * Gets number of cancelled jobs since node startup. + *

+ * Note: Unlike most of other aggregation metrics this metric is not calculated over history + * but over the entire node life. + * + * @return Total number of cancelled jobs since node startup. + */ + public int getTotalCancelledJobs(); + + /** + * Gets total number of jobs handled by the node since node startup. + *

+ * Note: Unlike most of other aggregation metrics this metric is not calculated over history + * but over the entire node life. + * + * @return Total number of jobs handled by the node since node startup. + */ + public int getTotalExecutedJobs(); + + /** + * Gets total time all finished jobs takes to execute on the node since node startup. + *

+ * Note: Unlike most of other aggregation metrics this metric is not calculated over history + * but over the entire node life. + * + * @return Total jobs execution time. + */ + public long getTotalJobsExecutionTime(); + + /** + * Gets maximum time a job ever spent waiting in a queue to be executed. + *

+ * Note: all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + *

    + *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • + *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • + *
+ * + * @return Maximum waiting time. + */ + public long getMaximumJobWaitTime(); + + /** + * Gets current time an oldest jobs has spent waiting to be executed. + * + * @return Current wait time of oldest job. + */ + public long getCurrentJobWaitTime(); + + /** + * Gets average time jobs spend waiting in the queue to be executed. + *

+ * Note: all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + *

    + *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • + *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • + *
+ * + * @return Average job wait time. + */ + public double getAverageJobWaitTime(); + + /** + * Gets time it took to execute the longest job on the node. + *

+ * Note: all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + *

    + *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • + *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • + *
+ * + * @return Time it took to execute the longest job on the node. + */ + public long getMaximumJobExecuteTime(); + + /** + * Gets longest time a current job has been executing for. + * + * @return Longest time a current job has been executing for. + */ + public long getCurrentJobExecuteTime(); + + /** + * Gets average time a job takes to execute on the node. + *

+ * Note: all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + *

    + *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • + *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • + *
+ * + * @return Average job execution time. + */ + public double getAverageJobExecuteTime(); + + /** + * Gets total number of tasks handled by the node. + *

+ * Note: all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + *

    + *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • + *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • + *
+ * + * @return Total number of jobs handled by the node. + */ + public int getTotalExecutedTasks(); + + /** + * Gets total time this node spent executing jobs. + * + * @return Total time this node spent executing jobs. + */ + public long getTotalBusyTime(); + + /** + * Gets total time this node spent idling (not executing any jobs). + * + * @return Gets total time this node spent idling. + */ + public long getTotalIdleTime(); + + /** + * Gets time this node spend idling since executing last job. + * + * @return Time this node spend idling since executing last job. + */ + public long getCurrentIdleTime(); + + /** + * Gets percentage of time this node is busy executing jobs vs. idling. + * + * @return Percentage of time this node is busy (value is less than + * or equal to {@code 1} and greater than or equal to {@code 0}) + */ + public float getBusyTimePercentage(); + + /** + * Gets percentage of time this node is idling vs. executing jobs. + * + * @return Percentage of time this node is idle (value is less than + * or equal to {@code 1} and greater than or equal to {@code 0}) + */ + public float getIdleTimePercentage(); + + /** + * Returns the number of CPUs available to the Java Virtual Machine. + * This method is equivalent to the {@link Runtime#availableProcessors()} + * method. + *

+ * Note that this value may change during successive invocations of the + * virtual machine. + * + * @return The number of processors available to the virtual + * machine, never smaller than one. + */ + public int getTotalCpus(); + + /** + * Returns the CPU usage in {@code [0, 1]} range. + * The exact way how this number is calculated depends on SPI implementation. + *

+ * If the CPU usage is not available, a negative value is returned. + *

+ * This method is designed to provide a hint about the system load + * and may be queried frequently. The load average may be unavailable on + * some platform where it is expensive to implement this method. + * + * @return The estimated CPU usage in {@code [0, 1]} range. + * Negative value if not available. + */ + public double getCurrentCpuLoad(); + + /** + * Gets average of CPU load values over all metrics kept in the history. + *

+ * Note: all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + *

    + *
  • {@link IgniteConfiguration#getMetricsExpireTime()}
  • + *
  • {@link IgniteConfiguration#getMetricsHistorySize()}
  • + *
+ * + * @return Average of CPU load value in {@code [0, 1]} range over all metrics kept + * in the history. + */ + public double getAverageCpuLoad(); + + /** + * Returns average time spent in CG since the last update. + * + * @return Average time spent in CG since the last update. + */ + public double getCurrentGcCpuLoad(); + + /** + * Returns the amount of heap memory in bytes that the JVM + * initially requests from the operating system for memory management. + * This method returns {@code -1} if the initial memory size is undefined. + *

+ * This value represents a setting of the heap memory for Java VM and is + * not a sum of all initial heap values for all memory pools. + *

+ * Note: this is not an aggregated metric and it's calculated + * from the time of the node's startup. + * + * @return The initial size of memory in bytes; {@code -1} if undefined. + */ + public long getHeapMemoryInitialized(); + + /** + * Returns the current heap size that is used for object allocation. + * The heap consists of one or more memory pools. This value is + * the sum of {@code used} heap memory values of all heap memory pools. + *

+ * The amount of used memory in the returned is the amount of memory + * occupied by both live objects and garbage objects that have not + * been collected, if any. + *

+ * Note: this is not an aggregated metric and it's calculated + * from the time of the node's startup. + * + * @return Amount of heap memory used. + */ + public long getHeapMemoryUsed(); + + /** + * Returns the amount of heap memory in bytes that is committed for + * the JVM to use. This amount of memory is + * guaranteed for the JVM to use. + * The heap consists of one or more memory pools. This value is + * the sum of {@code committed} heap memory values of all heap memory pools. + *

+ * Note: this is not an aggregated metric and it's calculated + * from the time of the node's startup. + * + * @return The amount of committed memory in bytes. + */ + public long getHeapMemoryCommitted(); + + /** + * Returns the maximum amount of heap memory in bytes that can be + * used for memory management. This method returns {@code -1} + * if the maximum memory size is undefined. + *

+ * This amount of memory is not guaranteed to be available + * for memory management if it is greater than the amount of + * committed memory. The JVM may fail to allocate + * memory even if the amount of used memory does not exceed this + * maximum size. + *

+ * This value represents a setting of the heap memory for Java VM and is + * not a sum of all initial heap values for all memory pools. + *

+ * Note: this is not an aggregated metric and it's calculated + * from the time of the node's startup. + * + * @return The maximum amount of memory in bytes; {@code -1} if undefined. + */ + public long getHeapMemoryMaximum(); + + /** + * Returns the total amount of heap memory in bytes. This method returns {@code -1} + * if the total memory size is undefined. + *

+ * This amount of memory is not guaranteed to be available + * for memory management if it is greater than the amount of + * committed memory. The JVM may fail to allocate + * memory even if the amount of used memory does not exceed this + * maximum size. + *

+ * This value represents a setting of the heap memory for Java VM and is + * not a sum of all initial heap values for all memory pools. + *

+ * Note: this is not an aggregated metric and it's calculated + * from the time of the node's startup. + * + * @return The total amount of memory in bytes; {@code -1} if undefined. + */ + public long getHeapMemoryTotal(); + + /** + * Returns the amount of non-heap memory in bytes that the JVM + * initially requests from the operating system for memory management. + * This method returns {@code -1} if the initial memory size is undefined. + *

+ * This value represents a setting of non-heap memory for Java VM and is + * not a sum of all initial heap values for all memory pools. + *

+ * Note: this is not an aggregated metric and it's calculated + * from the time of the node's startup. + * + * @return The initial size of memory in bytes; {@code -1} if undefined. + */ + public long getNonHeapMemoryInitialized(); + + /** + * Returns the current non-heap memory size that is used by Java VM. + * The non-heap memory consists of one or more memory pools. This value is + * the sum of {@code used} non-heap memory values of all non-heap memory pools. + *

+ * Note: this is not an aggregated metric and it's calculated + * from the time of the node's startup. + *

+ * Note: this is not an aggregated metric and it's calculated + * from the time of the node's startup. + * + * @return Amount of none-heap memory used. + */ + public long getNonHeapMemoryUsed(); + + /** + * Returns the amount of non-heap memory in bytes that is committed for + * the JVM to use. This amount of memory is + * guaranteed for the JVM to use. + * The non-heap memory consists of one or more memory pools. This value is + * the sum of {@code committed} non-heap memory values of all non-heap memory pools. + *

+ * Note: this is not an aggregated metric and it's calculated + * from the time of the node's startup. + * + * @return The amount of committed memory in bytes. + */ + public long getNonHeapMemoryCommitted(); + + /** + * Returns the maximum amount of non-heap memory in bytes that can be + * used for memory management. This method returns {@code -1} + * if the maximum memory size is undefined. + *

+ * This amount of memory is not guaranteed to be available + * for memory management if it is greater than the amount of + * committed memory. The JVM may fail to allocate + * memory even if the amount of used memory does not exceed this + * maximum size. + *

+ * This value represents a setting of the non-heap memory for Java VM and is + * not a sum of all initial non-heap values for all memory pools. + *

+ * Note: this is not an aggregated metric and it's calculated + * from the time of the node's startup. + * + * @return The maximum amount of memory in bytes; {@code -1} if undefined. + */ + public long getNonHeapMemoryMaximum(); + + /** + * Returns the total amount of non-heap memory in bytes that can be + * used for memory management. This method returns {@code -1} + * if the total memory size is undefined. + *

+ * This amount of memory is not guaranteed to be available + * for memory management if it is greater than the amount of + * committed memory. The JVM may fail to allocate + * memory even if the amount of used memory does not exceed this + * maximum size. + *

+ * This value represents a setting of the non-heap memory for Java VM and is + * not a sum of all initial non-heap values for all memory pools. + *

+ * Note: this is not an aggregated metric and it's calculated + * from the time of the node's startup. + * + * @return The total amount of memory in bytes; {@code -1} if undefined. + */ + public long getNonHeapMemoryTotal(); + + /** + * Returns the uptime of the JVM in milliseconds. + * + * @return Uptime of the JVM in milliseconds. + */ + public long getUpTime(); + + /** + * Returns the start time of the JVM in milliseconds. + * This method returns the approximate time when the Java virtual + * machine started. + * + * @return Start time of the JVM in milliseconds. + */ + public long getStartTime(); + + /** + * Returns the start time of grid node in milliseconds. + * There can be several grid nodes started in one JVM, so JVM start time will be + * the same for all of them, but node start time will be different. + * + * @return Start time of the grid node in milliseconds. + */ + public long getNodeStartTime(); + + /** + * Returns the current number of live threads including both + * daemon and non-daemon threads. + * + * @return Current number of live threads. + */ + public int getCurrentThreadCount(); + + /** + * Returns the maximum live thread count since the JVM + * started or peak was reset. + *

+ * Note: this is not an aggregated metric and it's calculated + * from the time of the node's startup. + * + * @return The peak live thread count. + */ + public int getMaximumThreadCount(); + + /** + * Returns the total number of threads created and also started + * since the JVM started. + *

+ * Note: this is not an aggregated metric and it's calculated + * from the time of the node's startup. + * + * @return The total number of threads started. + */ + public long getTotalStartedThreadCount(); + + /** + * Returns the current number of live daemon threads. + * + * @return Current number of live daemon threads. + */ + public int getCurrentDaemonThreadCount(); + + /** + * In-Memory Data Grid assigns incremental versions to all cache operations. This method provides + * the latest data version on the node. + * + * @return Last data version. + */ + public long getLastDataVersion(); + + /** + * Gets sent messages count. + * + * @return Sent messages count. + */ + public int getSentMessagesCount(); + + /** + * Gets sent bytes count. + * + * @return Sent bytes count. + */ + public long getSentBytesCount(); + + /** + * Gets received messages count. + * + * @return Received messages count. + */ + public int getReceivedMessagesCount(); + + /** + * Gets received bytes count. + * + * @return Received bytes count. + */ + public long getReceivedBytesCount(); + + /** + * Gets outbound messages queue size. + * + * @return Outbound messages queue size. + */ + public int getOutboundMessagesQueueSize(); + + /** + * Gets total number of nodes. + * + * @return Total number of nodes. + */ + public int getTotalNodes(); + + /** + * Gets execution duration for current partition map exchange in milliseconds. + * + * @return Gets execution duration for current partition map exchange in milliseconds. {@code 0} if there is no running PME. + */ + public long getCurrentPmeDuration(); +} diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java new file mode 100644 index 0000000000000..bc698c38889ea --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java @@ -0,0 +1,255 @@ +/* + * 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.cluster; + +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.apache.ignite.Ignite; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.internal.IgniteNodeAttributes; +import org.apache.ignite.lang.IgniteExperimental; +import org.apache.ignite.lang.IgniteProductVersion; +import org.jetbrains.annotations.Nullable; + +/** + * Interface representing a single cluster node. Use {@link #attribute(String)} or + * {@link #metrics()} to get static and dynamic information about cluster nodes. + * {@code ClusterNode} list, which includes all nodes within task topology, is provided + * to {@link org.apache.ignite.compute.ComputeTask#map(List, Object)} method. + *

+ *

Cluster Node Attributes

+ * You can use cluster node attributes to provide static information about a node. + * This information is initialized once within a cluster, during the node startup, and + * remains the same throughout the lifetime of a node. Use + * {@link IgniteConfiguration#getUserAttributes()} method to initialize your custom + * node attributes at startup. Here is an example of how to assign an attribute to a node at startup: + *
+ * <bean class="org.apache.ignite.configuration.IgniteConfiguration">
+ *     ...
+ *     <property name="userAttributes">
+ *         <map>
+ *             <entry key="worker" value="true"/>
+ *         </map>
+ *     </property>
+ *     ...
+ * </bean>
+ * 
+ *

+ * The system adds the following attributes automatically: + *

    + *
  • {@code {@link System#getProperties()}} - All system properties.
  • + *
  • {@code {@link System#getenv(String)}} - All environment properties.
  • + *
  • {@code org.ignite.build.ver} - Ignite build version.
  • + *
  • {@code org.apache.ignite.jit.name} - Name of JIT compiler used.
  • + *
  • {@code org.apache.ignite.net.itf.name} - Name of network interface.
  • + *
  • {@code org.apache.ignite.user.name} - Operating system user name.
  • + *
  • {@code org.apache.ignite.ignite.name} - Ignite name (see {@link Ignite#name()}).
  • + *
  • + * {@code spiName.org.apache.ignite.spi.class} - SPI implementation class for every SPI, + * where {@code spiName} is the name of the SPI (see {@link org.apache.ignite.spi.IgniteSpi#getName()}. + *
  • + *
  • + * {@code spiName.org.apache.ignite.spi.ver} - SPI version for every SPI, + * where {@code spiName} is the name of the SPI (see {@link org.apache.ignite.spi.IgniteSpi#getName()}. + *
  • + *
+ *

+ * Note that all System and Environment properties for all nodes are automatically included + * into node attributes. This gives you an ability to get any information specified + * in {@link System#getProperties()} about any node. So for example, in order to print out + * information about Operating System for all nodes you would do the following: + *

+ * for (ClusterNode node : ignite.cluster().nodes()) {
+ *     System.out.println("Operating system name: " + node.getAttribute("os.name"));
+ *     System.out.println("Operating system architecture: " + node.getAttribute("os.arch"));
+ *     System.out.println("Operating system version: " + node.getAttribute("os.version"));
+ * }
+ * 
+ *

+ *

Cluster Node Metrics

+ * Cluster node metrics (see {@link #metrics()}) are updated frequently for all nodes + * and can be used to get dynamic information about a node. The frequency of update + * is controlled by {@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsUpdateFrequency()} parameter. + * The metrics data will be updated every {@code 2} seconds by default. + *

+ * Grid node metrics provide information that can frequently change, + * such as Heap and Non-Heap memory utilization, CPU load, number of active and waiting + * grid jobs, etc... This information can become useful during job collision resolution or + * {@link org.apache.ignite.compute.ComputeTask#map(List, Object)} operation when jobs are + * assigned to remote nodes for execution. + *

+ * Local node metrics are registered as {@code MBean} and can be accessed from + * any JMX management console. The simplest way is to use standard {@code jconsole} + * that comes with JDK as it also provides ability to view any node parameter + * as a graph. + */ +public interface ClusterNode extends BaselineNode { + /** + * Gets globally unique node ID. A new ID is generated every time a node restarts. + * + * @return Globally unique node ID. + */ + public UUID id(); + + /** + * Gets consistent globally unique node ID. Unlike {@link #id()} method, + * this method returns consistent node ID which survives node restarts. + * + * @return Consistent globally unique node ID. + */ + @Override public Object consistentId(); + + /** + * Gets a node attribute. Attributes are assigned to nodes at startup + * via {@link IgniteConfiguration#getUserAttributes()} method. + *

+ * The system adds the following attributes automatically: + *

    + *
  • {@code {@link System#getProperties()}} - All system properties.
  • + *
  • {@code {@link System#getenv(String)}} - All environment properties.
  • + *
  • All attributes defined in {@link org.apache.ignite.internal.IgniteNodeAttributes}
  • + *
+ *

+ * Note that attributes cannot be changed at runtime. + * + * @param Attribute Type. + * @param name Attribute name. Note that attribute names starting with + * {@code org.apache.ignite} are reserved for internal use. + * @return Attribute value or {@code null}. + */ + @Override @Nullable public T attribute(String name); + + /** + * Gets metrics snapshot for this node. Note that node metrics are constantly updated + * and provide up to date information about nodes. For example, you can get + * an idea about CPU load on remote node via {@link ClusterMetrics#getCurrentCpuLoad()} + * method and use it during {@link org.apache.ignite.compute.ComputeTask#map(List, Object)} or during collision + * resolution. + *

+ * Node metrics are updated with some delay which is controlled by + * {@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsUpdateFrequency()} parameter. + * By default the update will happen every {@code 2} seconds. + * + * @return Runtime metrics snapshot for this node. + */ + public ClusterMetrics metrics(); + + /** + * Gets all node attributes. Attributes are assigned to nodes at startup + * via {@link IgniteConfiguration#getUserAttributes()} method. + *

+ * The system adds the following attributes automatically: + *

    + *
  • {@code {@link System#getProperties()}} - All system properties.
  • + *
  • {@code {@link System#getenv(String)}} - All environment properties.
  • + *
  • All attributes defined in {@link org.apache.ignite.internal.IgniteNodeAttributes}
  • + *
+ *

+ * Note that attributes cannot be changed at runtime. + * + * @return All node attributes. + */ + @Override public Map attributes(); + + /** + * Gets the Data Center ID where the node is located. In a cluster deployed in only one data center, this method + * returns {@code null}. + *

+ * The data center ID is resolved at node startup and is used for optimizing operations like: + *

    + *
  • Minimizing cross-data center communication;
  • + *
  • Improving fault tolerance and redundancy strategies;
  • + *
  • Supporting affinity-based task execution within the same data center;
  • + *
  • Providing input to discovery SPIs for topology-aware node grouping.
  • + *
+ * + * @return The Data Center ID of the node, or {@code null} if the cluster is deployed in a single DC. + */ + @IgniteExperimental + @Nullable public default String dataCenterId() { + return attribute(IgniteNodeAttributes.ATTR_DATA_CENTER_ID); + } + + /** + * Gets collection of addresses this node is known by. + *

+ * If {@link IgniteConfiguration#getLocalHost()} value isn't {@code null} node will try to use that + * address for all communications and returned collection will contain only that address. + * If it is {@code null} then local wildcard address will be used, and Ignite + * will make the best effort to supply all addresses of that node in returned collection. + * + * @return Collection of addresses. + */ + public Collection addresses(); + + /** + * Gets collection of host names this node is known by. + *

+ * If {@link IgniteConfiguration#getLocalHost()} value isn't {@code null} node will try to use + * the host name of that resolved address for all communications and + * returned collection will contain only that host name. + * If that host name can not be resolved then ip address returned by method {@link #addresses()} is used. + *

+ * If {@link IgniteConfiguration#getLocalHost()} value is {@code null} then local wildcard address will be used, + * and this method returns host names of all addresses of that node. + *

+ * Note: the loopback address will be omitted in results. + * + * @return Collection of host names. + */ + public Collection hostNames(); + + /** + * Node order within grid topology. Discovery SPIs that support node ordering will + * assign a proper order to each node and will guarantee that discovery event notifications + * for new nodes will come in proper order. All other SPIs not supporting ordering + * may choose to return node startup time here. + *

+ * NOTE: in cases when discovery SPI doesn't support ordering Ignite cannot + * guarantee that orders on all nodes will be unique or chronologically correct. + * If such guarantee is required - make sure use discovery SPI that provides ordering. + * + * @return Node startup order. + */ + public long order(); + + /** + * Gets node version. + * + * @return Node version. + */ + public IgniteProductVersion version(); + + /** + * Tests whether or not this node is a local node. + * + * @return {@code True} if this node is a local node, {@code false} otherwise. + */ + public boolean isLocal(); + + /** + * Whether this node is cache client (see {@link IgniteConfiguration#isClientMode()}). + * + * @return {@code True if client}. + * + * @see IgniteConfiguration#isClientMode() + */ + public boolean isClient(); +} From 9321063ce8b6937a63c6385ad292ffa53e435158 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 22 May 2026 17:27:43 +0300 Subject: [PATCH 21/44] IGNITE-28207 Thin client API extraction --- .../ignite/internal/IgniteVersionUtils.java | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 modules/core/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java new file mode 100644 index 0000000000000..58f0887b0d593 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.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; + +import java.time.Instant; +import java.time.LocalDate; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.util.Locale; +import org.apache.ignite.lang.IgniteProductVersion; + +/** + * Ignite version utils. + */ +public class IgniteVersionUtils { + /** Ignite version in String form. */ + public static final String VER_STR; + + /** Ignite version. */ + public static final IgniteProductVersion VER; + + /** UTC build date formatter. */ + private static final DateTimeFormatter BUILD_TSTAMP_DATE_FORMATTER; + + /** Formatted build date. */ + public static final String BUILD_TSTAMP_STR; + + /** Build timestamp in seconds. */ + public static final long BUILD_TSTAMP; + + /** Build timestamp string property value. */ + private static final String BUILD_TSTAMP_FROM_PROPERTY; + + /** Revision hash. */ + public static final String REV_HASH_STR; + + /** Release date. */ + public static final LocalDate RELEASE_DATE; + + /** Compound version. */ + public static final String ACK_VER_STR; + + /** Copyright blurb. */ + public static final String COPYRIGHT; + + /** + * Static initializer. + */ + static { + VER_STR = IgniteProperties.get("ignite.version") + .replace(".a", "-a") // Backward compatibility fix. + .replace(".b", "-b") + .replace(".final", "-final"); + + BUILD_TSTAMP_FROM_PROPERTY = IgniteProperties.get("ignite.build"); + + //Development ignite.properties file contains ignite.build = 0, so we will add the check for it. + BUILD_TSTAMP = !BUILD_TSTAMP_FROM_PROPERTY.isEmpty() && Long.parseLong(BUILD_TSTAMP_FROM_PROPERTY) != 0 + ? Long.parseLong(BUILD_TSTAMP_FROM_PROPERTY) : System.currentTimeMillis() / 1000; + + BUILD_TSTAMP_DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd").withZone(ZoneId.of("UTC")); + + BUILD_TSTAMP_STR = formatBuildTimeStamp(BUILD_TSTAMP * 1000); + + COPYRIGHT = BUILD_TSTAMP_STR.substring(0, 4) + " Copyright(C) Apache Software Foundation"; + + REV_HASH_STR = IgniteProperties.get("ignite.revision"); + + String releaseDateStr = IgniteProperties.get("ignite.rel.date"); + + DateTimeFormatter releaseDateFormatter = DateTimeFormatter.ofPattern("ddMMyyyy", Locale.US); + + RELEASE_DATE = LocalDate.parse(releaseDateStr, releaseDateFormatter); + + String rev = REV_HASH_STR.length() > 8 ? REV_HASH_STR.substring(0, 8) : REV_HASH_STR; + + ACK_VER_STR = VER_STR + '#' + BUILD_TSTAMP_STR + "-sha1:" + rev; + + VER = IgniteProductVersion.fromString(VER_STR + '-' + BUILD_TSTAMP + '-' + REV_HASH_STR); + } + + /** + * Builds string date representation in "yyyyMMdd" format. + * + * @param ts Timestamp. + * @return Timestamp date in UTC timezone. + */ + public static String formatBuildTimeStamp(long ts) { + return BUILD_TSTAMP_DATE_FORMATTER.format(Instant.ofEpochMilli(ts)); + } + + /** + * Private constructor. + */ + private IgniteVersionUtils() { + // No-op. + } +} From 28fe58c22d8d667a2168cacb73a7e2345ecfbe63 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 22 May 2026 17:33:54 +0300 Subject: [PATCH 22/44] IGNITE-28207 Thin client API extraction --- .../src/main/java/org/apache/ignite/cache/QueryIndex.java | 1 - .../main/java/org/apache/ignite/cluster/ClusterMetrics.java | 3 --- .../src/main/java/org/apache/ignite/cluster/ClusterNode.java | 2 -- .../java/org/apache/ignite/internal/IgniteVersionUtils.java | 0 4 files changed, 6 deletions(-) rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/QueryIndex.java (99%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java (99%) rename modules/{core => commons}/src/main/java/org/apache/ignite/cluster/ClusterNode.java (99%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java (100%) diff --git a/modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java b/modules/commons/src/main/java/org/apache/ignite/cache/QueryIndex.java similarity index 99% rename from modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java rename to modules/commons/src/main/java/org/apache/ignite/cache/QueryIndex.java index df24cf9bcadc1..b51719ab8913b 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/QueryIndex.java @@ -21,7 +21,6 @@ import java.util.Collection; import java.util.LinkedHashMap; import java.util.Objects; -import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.internal.util.tostring.GridToStringInclude; import org.apache.ignite.internal.util.typedef.internal.S; diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java b/modules/commons/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java similarity index 99% rename from modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java rename to modules/commons/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java index 326e725c0f186..7f46e9d2763e6 100644 --- a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java +++ b/modules/commons/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java @@ -17,9 +17,6 @@ package org.apache.ignite.cluster; -import org.apache.ignite.IgniteCluster; -import org.apache.ignite.configuration.IgniteConfiguration; - /** * This class represents runtime information on a cluster. Apart from obvious * statistical value, this information is used for implementation of diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java b/modules/commons/src/main/java/org/apache/ignite/cluster/ClusterNode.java similarity index 99% rename from modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java rename to modules/commons/src/main/java/org/apache/ignite/cluster/ClusterNode.java index bc698c38889ea..1aa43fbbfc0c5 100644 --- a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java +++ b/modules/commons/src/main/java/org/apache/ignite/cluster/ClusterNode.java @@ -21,8 +21,6 @@ import java.util.List; import java.util.Map; import java.util.UUID; -import org.apache.ignite.Ignite; -import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteNodeAttributes; import org.apache.ignite.lang.IgniteExperimental; import org.apache.ignite.lang.IgniteProductVersion; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java b/modules/commons/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java rename to modules/commons/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java From 4781cc5672b90ad33b95453431f35d97d7cef78b Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Wed, 27 May 2026 15:41:16 +0300 Subject: [PATCH 23/44] IGNITE-28720 Remove Message interface from IgniteProductVersion --- .../org/apache/ignite/lang/IgniteProductVersion.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/commons/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java b/modules/commons/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java index 8feac017ab891..1449151aa0bc1 100644 --- a/modules/commons/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java +++ b/modules/commons/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java @@ -25,9 +25,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.internal.CoreMessagesProvider; import org.apache.ignite.internal.IgniteVersionUtils; -import org.apache.ignite.internal.util.typedef.internal.U; +import org.apache.ignite.internal.util.CommonUtils; import org.jetbrains.annotations.NotNull; /** @@ -254,7 +253,7 @@ public int compareToIgnoreTimestamp(@NotNull IgniteProductVersion o) { out.writeByte(minor); out.writeByte(maintenance); out.writeLong(revTs); - U.writeByteArray(out, revHash); + CommonUtils.writeByteArray(out, revHash); } /** {@inheritDoc} */ @@ -263,14 +262,14 @@ public int compareToIgnoreTimestamp(@NotNull IgniteProductVersion o) { minor = in.readByte(); maintenance = in.readByte(); revTs = in.readLong(); - revHash = U.readByteArray(in); + revHash = CommonUtils.readByteArray(in); } /** {@inheritDoc} */ @Override public String toString() { String revTsStr = IgniteVersionUtils.formatBuildTimeStamp(revTs * 1000); - String hash = U.byteArray2HexString(revHash).toLowerCase(); + String hash = CommonUtils.byteArray2HexString(revHash).toLowerCase(); hash = hash.length() > 8 ? hash.substring(0, 8) : hash; @@ -310,7 +309,7 @@ public static IgniteProductVersion fromString(String verStr) { byte[] revHash = null; if (match.group(9) != null) - revHash = U.decodeHex(match.group(10).toCharArray()); + revHash = CommonUtils.decodeHex(match.group(10).toCharArray()); return new IgniteProductVersion(major, minor, maintenance, stage, revTs, revHash); } From 8b7e26fe0ec295d46243c7f0d7ff1a001931321a Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Wed, 27 May 2026 15:52:22 +0300 Subject: [PATCH 24/44] IGNITE-28720 Remove Message interface from IgniteProductVersion --- .../java/org/apache/ignite/internal/CoreMessagesProvider.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java b/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java index ce441c1d97843..9da592635d229 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java @@ -336,8 +336,8 @@ public CoreMessagesProvider(Marshaller dfltMarsh, Marshaller schemaAwareMarsh, C this.factory = factory; - // [-44, 0..2, 42, 200..204, 210, 302] - Use in tests. - // [300..307, 350..352] - CalciteMessageFactory. + // [-44, 0..2, 42, 200..204, 210] - Use in tests. + // [300 - 500] - CalciteMessageFactory. // [-4..-22, -30..-35, -54..-57] - SQL // [5000 - 5500]: Utility messages. Most of them originally come from Discovery. From 50bac4c50ec3dcdc17224cce4d42bcfce24391a6 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 28 May 2026 10:06:49 +0300 Subject: [PATCH 25/44] IGNITE-28720 Remove Message interface from IgniteProductVersion --- .../ignite/cache/CacheAtomicityMode.java | 10 ++-- .../org/apache/ignite/cache/CacheMode.java | 9 ++-- .../apache/ignite/cache/CachePeekMode.java | 8 +-- .../ignite/cache/CacheRebalanceMode.java | 6 +-- .../cache/CacheWriteSynchronizationMode.java | 5 +- .../ignite/cache/PartitionLossPolicy.java | 7 ++- .../org/apache/ignite/cache/QueryEntity.java | 2 +- .../org/apache/ignite/cache/QueryIndex.java | 8 +-- .../cache/affinity/AffinityKeyMapped.java | 20 +++---- .../cache/query/AbstractContinuousQuery.java | 11 ++-- .../ignite/cache/query/ContinuousQuery.java | 36 +++++++------ .../org/apache/ignite/cache/query/Query.java | 4 +- .../apache/ignite/cache/query/ScanQuery.java | 2 +- .../ignite/cache/query/SqlFieldsQuery.java | 2 +- .../query/annotations/QueryGroupIndex.java | 4 +- .../query/annotations/QuerySqlField.java | 12 ++--- .../query/annotations/QueryTextField.java | 4 +- .../apache/ignite/cluster/BaselineNode.java | 4 +- .../apache/ignite/cluster/ClusterMetrics.java | 54 +++++++++---------- .../apache/ignite/cluster/ClusterNode.java | 39 +++++++------- .../ignite/lang/IgniteProductVersion.java | 2 +- .../client/ClientAtomicConfiguration.java | 4 +- .../client/ClientCacheConfiguration.java | 34 ++++++------ .../ignite/client/ClientClusterGroup.java | 10 ++-- .../apache/ignite/client/ClientCompute.java | 16 +++--- .../ClientPartitionAwarenessMapper.java | 12 +++-- ...ClientPartitionAwarenessMapperFactory.java | 7 +-- .../client/ClientServiceDescriptor.java | 2 +- .../ignite/client/ClientTransactions.java | 4 +- .../configuration/ClientConfiguration.java | 23 ++++---- .../ClientTransactionConfiguration.java | 2 +- 31 files changed, 188 insertions(+), 175 deletions(-) diff --git a/modules/commons/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java b/modules/commons/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java index 37d4a8379736b..78da32a183fd2 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java @@ -26,14 +26,14 @@ * used whenever transactions and explicit locking are not needed. Note that in {@link #ATOMIC} * mode cache will still maintain full data consistency across all cache nodes. *

- * Cache atomicity may be set via {@link org.apache.ignite.configuration.CacheConfiguration#getAtomicityMode()} + * Cache atomicity may be set via {@ignitelink org.apache.ignite.configuration.CacheConfiguration#getAtomicityMode()} * configuration property. */ public enum CacheAtomicityMode { /** * Enables fully {@code ACID}-compliant transactional cache behavior for the key-value API. *

- * See {@link Transaction} for more information about transactions. + * See {@ignitelink org.apache.ignite.transactions.Transaction} for more information about transactions. */ TRANSACTIONAL, @@ -45,7 +45,7 @@ public enum CacheAtomicityMode { * In addition to transactions and locking, one of the main differences in {@code ATOMIC} mode * is that bulk writes, such as {@code putAll(...)}, {@code removeAll(...)}, and {@code transformAll(...)} * methods, become simple batch operations which can partially fail. In case of partial - * failure {@link CachePartialUpdateException} will be thrown + * failure {@ignitelink org.apache.ignite.cache.CachePartialUpdateException} will be thrown * which will contain a list of keys for which the update failed. It is recommended that bulk writes are used * whenever multiple keys need to be inserted or updated in cache, as they reduce number of network trips and * provide better performance. @@ -75,7 +75,7 @@ public enum CacheAtomicityMode { *

  • * For operations {@code putIfAbsent(K, V)}, {@code replace(K, V, V)} and {@code remove(K, V)} return * value on primary node crash may be incorrect because of the automatic retries. It is recommended - * to disable retries with {@link IgniteCache#withNoRetries()} and manually restore primary-backup + * to disable retries with {@ignitelink org.apache.ignite.IgniteCache#withNoRetries()} and manually restore primary-backup * consistency in case of update failure. *
  • * @@ -85,7 +85,7 @@ public enum CacheAtomicityMode { *

    * Note! Consistency behavior of atomic cache will be improved in future releases. * - * @see IgniteCache#withNoRetries() + * @see {@ignitelink org.apache.ignite.IgniteCache#withNoRetries()} */ ATOMIC; diff --git a/modules/commons/src/main/java/org/apache/ignite/cache/CacheMode.java b/modules/commons/src/main/java/org/apache/ignite/cache/CacheMode.java index 69d6be9a5c9c0..178b43d6db3f2 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cache/CacheMode.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/CacheMode.java @@ -21,14 +21,14 @@ import org.jetbrains.annotations.Nullable; /** - * Enumeration of all supported caching modes. Cache mode is specified in {@link org.apache.ignite.configuration.CacheConfiguration} + * Enumeration of all supported caching modes. Cache mode is specified in {@ignitelink org.apache.ignite.configuration.CacheConfiguration} * and cannot be changed after cache has started. */ public enum CacheMode { /** * Specifies fully replicated cache behavior. In this mode all the keys are distributed * to all participating nodes. User still has affinity control - * over subset of nodes for any given key via {@link AffinityFunction} + * over subset of nodes for any given key via {@ignitelink org.apache.ignite.cache.affinity.AffinityFunction} * configuration. */ REPLICATED((byte)1), @@ -37,12 +37,13 @@ public enum CacheMode { * Specifies partitioned cache behaviour. In this mode the overall * key set will be divided into partitions and all partitions will be split * equally between participating nodes. User has affinity - * control over key assignment via {@link AffinityFunction} + * control over key assignment via {@ignitelink org.apache.ignite.cache.affinity.AffinityFunction} * configuration. *

    * Note that partitioned cache is always fronted by local * {@code 'near'} cache which stores most recent data. You - * can configure the size of near cache via {@link NearCacheConfiguration#getNearEvictionPolicyFactory()} + * can configure the size of near cache via + * {@ignitelink org.apache.ignite.configuration.NearCacheConfiguration#getNearEvictionPolicyFactory()} * configuration property. */ PARTITIONED((byte)2); diff --git a/modules/commons/src/main/java/org/apache/ignite/cache/CachePeekMode.java b/modules/commons/src/main/java/org/apache/ignite/cache/CachePeekMode.java index ff281f546720c..18ec76ca70650 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cache/CachePeekMode.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/CachePeekMode.java @@ -21,10 +21,10 @@ /** * Enumeration of all supported cache peek modes. Peek modes can be passed - * into {@link IgniteCache#localPeek(Object, CachePeekMode...)}, - * {@link IgniteCache#localEntries(CachePeekMode...)}, - * {@link IgniteCache#localSize(CachePeekMode...)} and - * {@link IgniteCache#size(CachePeekMode...)} methods. + * into {@ignitelink org.apache.ignite.IgniteCache#localPeek(Object, CachePeekMode...)}, + * {@ignitelink org.apache.ignite.IgniteCache#localEntries(CachePeekMode...)}, + * {@ignitelink org.apache.ignite.IgniteCache#localSize(CachePeekMode...)} and + * {@ignitelink org.apache.ignite.IgniteCache#size(CachePeekMode...)} methods. *

    * The following modes are supported: *

      diff --git a/modules/commons/src/main/java/org/apache/ignite/cache/CacheRebalanceMode.java b/modules/commons/src/main/java/org/apache/ignite/cache/CacheRebalanceMode.java index 2f2f360b49885..e9204fb318602 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cache/CacheRebalanceMode.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/CacheRebalanceMode.java @@ -22,11 +22,11 @@ /** * Cache rebalance mode. When rebalancing is enabled (i.e. has value other than {@link #NONE}), distributed caches * will attempt to rebalance all necessary values from other grid nodes. This enumeration is used to configure - * rebalancing via {@link org.apache.ignite.configuration.CacheConfiguration#getRebalanceMode()} configuration property. If not configured - * explicitly, then {@link org.apache.ignite.configuration.CacheConfiguration#DFLT_REBALANCE_MODE} is used. + * rebalancing via {@ignitelink org.apache.ignite.configuration.CacheConfiguration#getRebalanceMode()} configuration property. + * If not configured explicitly, then {@ignitelink org.apache.ignite.configuration.CacheConfiguration#DFLT_REBALANCE_MODE} is used. *

      * Replicated caches will try to load the full set of cache entries from other nodes (or as defined by - * pluggable {@link AffinityFunction}), while partitioned caches will only load the entries for which + * pluggable {@ignitelink org.apache.ignite.cache.affinity.AffinityFunction}), while partitioned caches will only load the entries for which * current node is primary or back up. *

      * Note that rebalance mode only makes sense for {@link CacheMode#REPLICATED} and {@link CacheMode#PARTITIONED} diff --git a/modules/commons/src/main/java/org/apache/ignite/cache/CacheWriteSynchronizationMode.java b/modules/commons/src/main/java/org/apache/ignite/cache/CacheWriteSynchronizationMode.java index 8b4b7c4645d21..ce6be42b9771d 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cache/CacheWriteSynchronizationMode.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/CacheWriteSynchronizationMode.java @@ -27,7 +27,8 @@ * Note that regardless of write synchronization mode, cache data will always remain fully * consistent across all participating nodes. *

      - * Write synchronization mode may be configured via {@link org.apache.ignite.configuration.CacheConfiguration#getWriteSynchronizationMode()} + * Write synchronization mode may be configured via + * {@ignitelink org.apache.ignite.configuration.CacheConfiguration#getWriteSynchronizationMode()} * configuration property. */ public enum CacheWriteSynchronizationMode { @@ -41,7 +42,7 @@ public enum CacheWriteSynchronizationMode { /** * Flag indicating that Ignite will not wait for write or commit responses from participating nodes, * which means that remote nodes may get their state updated a bit after any of the cache write methods - * complete, or after {@link Transaction#commit()} method completes. + * complete, or after {@ignitelink org.apache.ignite.transactions.Transaction#commit()} method completes. */ FULL_ASYNC, diff --git a/modules/commons/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java b/modules/commons/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java index 46287be78480e..abc6c60e2405b 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java @@ -17,7 +17,6 @@ package org.apache.ignite.cache; -import java.util.Collection; import org.jetbrains.annotations.Nullable; /** @@ -27,14 +26,14 @@ * A partition is considered lost if all owning nodes had left a topology. *

      * All *_SAFE policies prevent a user from interaction with partial data in lost partitions until - * {@link Ignite#resetLostPartitions(Collection)} method is called. *_ALL policies allow working with + * {@ignitelink org.apache.ignite.Ignite#resetLostPartitions(Collection)} method is called. *_ALL policies allow working with * partial data in lost partitions. *

      * READ_ONLY_* and READ_WRITE_* policies do not automatically change partition state * and thus do not change rebalancing assignments for such partitions. * - * @see Ignite#resetLostPartitions(Collection) - * @see IgniteCache#lostPartitions() + * @see {@ignitelink org.apache.ignite.Ignite#resetLostPartitions(Collection)} + * @see {@ignitelink org.apache.ignite.IgniteCache#lostPartitions()} */ public enum PartitionLossPolicy { /** diff --git a/modules/commons/src/main/java/org/apache/ignite/cache/QueryEntity.java b/modules/commons/src/main/java/org/apache/ignite/cache/QueryEntity.java index 933ba1f1cc2d9..b306372e9119a 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cache/QueryEntity.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/QueryEntity.java @@ -46,7 +46,7 @@ import org.jetbrains.annotations.Nullable; /** - * Query entity is a description of {@link org.apache.ignite.IgniteCache cache} entry (composed of key and value) + * Query entity is a description of {@ignitelink org.apache.ignite.IgniteCache cache} entry (composed of key and value) * in a way of how it must be indexed and can be queried. */ public class QueryEntity implements Serializable { diff --git a/modules/commons/src/main/java/org/apache/ignite/cache/QueryIndex.java b/modules/commons/src/main/java/org/apache/ignite/cache/QueryIndex.java index b51719ab8913b..e176267aeda64 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cache/QueryIndex.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/QueryIndex.java @@ -261,8 +261,8 @@ public QueryIndex setIndexType(QueryIndexType type) { *

    • positive value - fixed index inline
    • *
    * When set to {@code -1}, Ignite will try to detect inline size automatically. It will be no more than - * {@link CacheConfiguration#getSqlIndexMaxInlineSize()}. Index inline will be enabled for all fixed-length types, - * but will not be enabled for {@code String}. + * {@ignitelink org.apache.ignite.configuration.CacheConfiguration#getSqlIndexMaxInlineSize()}. + * Index inline will be enabled for all fixed-length types, but will not be enabled for {@code String}. * * @return Index inline size in bytes. */ @@ -281,8 +281,8 @@ public int getInlineSize() { *
  • positive value - fixed index inline
  • * * When set to {@code -1}, Ignite will try to detect inline size automatically. It will be no more than - * {@link CacheConfiguration#getSqlIndexMaxInlineSize()}. Index inline will be enabled for all fixed-length types, - * but will not be enabled for {@code String}. + * {@ignitelink org.apache.ignite.configuration.CacheConfiguration#getSqlIndexMaxInlineSize()}. + * Index inline will be enabled for all fixed-length types, but will not be enabled for {@code String}. * * @param inlineSize Inline size. * @return {@code this} for chaining. diff --git a/modules/commons/src/main/java/org/apache/ignite/cache/affinity/AffinityKeyMapped.java b/modules/commons/src/main/java/org/apache/ignite/cache/affinity/AffinityKeyMapped.java index 0e4dfb1f0f2ca..3b628a57abc97 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cache/affinity/AffinityKeyMapped.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/affinity/AffinityKeyMapped.java @@ -37,7 +37,7 @@ * otherwise known as {@code Collocation Of Computations And Data}. *

    *

    Mapping Cache Keys

    - * The default implementation of {@link AffinityKeyMapper}, which will be used + * The default implementation of {@ignitelink org.apache.ignite.cache.affinity.AffinityKeyMapper}, which will be used * if no explicit affinity mapper is specified in cache configuration, will first look * for any field annotated with {@code @AffinityKeyMapped} annotation. * If such field is not found, then the cache key itself will be used for @@ -74,8 +74,8 @@ * *

    *

    AffinityKey

    - * For convenience, you can also optionally use {@link AffinityKey} class. Here is how a - * {@code PersonKey} defined above would look using {@link AffinityKey}: + * For convenience, you can also optionally use {@ignitelink org.apache.ignite.cache.affinity.AffinityKey} class. Here is how a + * {@code PersonKey} defined above would look using {@ignitelink org.apache.ignite.cache.affinity.AffinityKey}: *
      * Object personKey1 = new AffinityKey("myPersonId1", "myCompanyId");
      * Object personKey2 = new AffinityKey("myPersonId2", "myCompanyId");
    @@ -90,21 +90,21 @@
      * It is also possible to route computations to the nodes where the data is cached. This concept
      * is otherwise known as {@code Collocation Of Computations And Data}. In this case,
      * {@code @AffinityKeyMapped} annotation allows to specify a routing affinity key for a
    - * {@link org.apache.ignite.compute.ComputeJob} or any other grid computation, such as {@link Runnable},
    + * {@ignitelink org.apache.ignite.compute.ComputeJob} or any other grid computation, such as {@link Runnable},
      * {@link Callable}, or {@link org.apache.ignite.lang.IgniteClosure}. It should be attached to a field
      * that provides affinity key for the computation. Only one annotation per class is allowed.
    - * Whenever such annotation is detected, then {@link org.apache.ignite.spi.loadbalancing.LoadBalancingSpi}
    + * Whenever such annotation is detected, then {@ignitelink org.apache.ignite.spi.loadbalancing.LoadBalancingSpi}
      * will be bypassed, and computation will be routed to the grid node where the specified affinity key is cached.
      * 

    - * For more information about cache affinity also see {@link AffinityKeyMapper} and - * {@link AffinityFunction} documentation. + * For more information about cache affinity also see {@ignitelink org.apache.ignite.cache.affinity.AffinityKeyMapper} and + * {@ignitelink org.apache.ignite.cache.affinity.AffinityFunction} documentation. * Affinity for a key can be found from any node, regardless of whether it has cache started * or not. If cache is not started, affinity function will be fetched from the remote node * which does have the cache running. * - * @see AffinityFunction - * @see AffinityKeyMapper - * @see AffinityKey + * @see {@ignitelink org.apache.ignite.cache.affinity.AffinityFunction} + * @see {@ignitelink org.apache.ignite.cache.affinity.AffinityKeyMapper} + * @see {@ignitelink org.apache.ignite.cache.affinity.AffinityKey} */ @Documented @Retention(RetentionPolicy.RUNTIME) diff --git a/modules/commons/src/main/java/org/apache/ignite/cache/query/AbstractContinuousQuery.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/AbstractContinuousQuery.java index 5fdbe09399ed9..034be1fc27d4c 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cache/query/AbstractContinuousQuery.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/AbstractContinuousQuery.java @@ -26,7 +26,7 @@ * Base class for continuous query. * * @see ContinuousQuery - * @see ContinuousQueryWithTransformer + * @see {@ignitelink org.apache.ignite.cache.query.ContinuousQueryWithTransformer} */ public abstract class AbstractContinuousQuery extends Query> { /** @@ -92,13 +92,14 @@ public Query> getInitialQuery() { * (e.g., synchronization or transactional cache operations), should be executed asynchronously * without blocking the thread that called the filter. Otherwise, you can get deadlocks. *

    - * If remote filter are annotated with {@link IgniteAsyncCallback} then it is executed in async callback - * pool (see {@link IgniteConfiguration#getAsyncCallbackPoolSize()}) that allow to perform a cache operations. + * If remote filter are annotated with {@ignitelink org.apache.ignite.lang.IgniteAsyncCallback} then it is executed in async callback + * pool (see {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getAsyncCallbackPoolSize()}) + * that allow to perform a cache operations. * * @param rmtFilterFactory Key-value filter factory. * @return {@code this} for chaining. - * @see IgniteAsyncCallback - * @see IgniteConfiguration#getAsyncCallbackPoolSize() + * @see {@ignitelink org.apache.ignite.lang.IgniteAsyncCallback} + * @see {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getAsyncCallbackPoolSize()} */ public AbstractContinuousQuery setRemoteFilterFactory( Factory> rmtFilterFactory) { diff --git a/modules/commons/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java index bbf5d4d410c4a..c8eea75e86cce 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java @@ -34,7 +34,7 @@ * Query can be of any type (SQL, TEXT or SCAN) and can be set via {@link #setInitialQuery(Query)} * method. *

    - * Query can be executed either on all nodes in topology using {@link IgniteCache#query(Query)} + * Query can be executed either on all nodes in topology using {@ignitelink org.apache.ignite.IgniteCache#query(Query)} * method, or only on the local node, if {@link Query#setLocal(boolean)} parameter is set to {@code true}. * Note that if the query is distributed and a new node joins, it will get the remote * filter for the query during discovery process before it actually joins a topology, @@ -92,16 +92,16 @@ * be empty in this case, but it will still unregister listeners when {@link QueryCursor#close()} * is called. *

    - * {@link IgniteAsyncCallback} annotation is supported for {@link CacheEntryEventFilter} + * {@ignitelink org.apache.ignite.lang.IgniteAsyncCallback} annotation is supported for {@link CacheEntryEventFilter} * (see {@link #setRemoteFilterFactory(Factory)}) and {@link CacheEntryUpdatedListener} * (see {@link #setLocalListener(CacheEntryUpdatedListener)}). - * If a filter and/or listener are annotated with {@link IgniteAsyncCallback} then the annotated callback - * is executed in an async callback pool (see {@link IgniteConfiguration#getAsyncCallbackPoolSize()}) + * If a filter and/or listener are annotated with {@ignitelink org.apache.ignite.lang.IgniteAsyncCallback} then the annotated callback + * is executed in an async callback pool (see {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getAsyncCallbackPoolSize()}) * and a notification order is kept the same as an update order for a given cache key. * - * @see ContinuousQueryWithTransformer - * @see IgniteAsyncCallback - * @see IgniteConfiguration#getAsyncCallbackPoolSize() + * @see {@ignitelink org.apache.ignite.cache.query.ContinuousQueryWithTransformer} + * @see {@ignitelink org.apache.ignite.lang.IgniteAsyncCallback} + * @see {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getAsyncCallbackPoolSize()} */ public final class ContinuousQuery extends AbstractContinuousQuery { /** */ @@ -137,14 +137,16 @@ public ContinuousQuery() { * synchronization or transactional cache operations), should be executed asynchronously without * blocking the thread that called the callback. Otherwise, you can get deadlocks. *

    - * If local listener are annotated with {@link IgniteAsyncCallback} then it is executed in an async callback pool - * (see {@link IgniteConfiguration#getAsyncCallbackPoolSize()}) that allow to perform a cache operations. + * If local listener are annotated with {@ignitelink org.apache.ignite.lang.IgniteAsyncCallback} then + * it is executed in an async callback pool + * (see {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getAsyncCallbackPoolSize()} + * that allow to perform a cache operations. * * @param locLsnr Local callback. * @return {@code this} for chaining. - * @see IgniteAsyncCallback - * @see IgniteConfiguration#getAsyncCallbackPoolSize() - * @see ContinuousQueryWithTransformer#setLocalListener(EventListener) + * @see {@ignitelink org.apache.ignite.lang.IgniteAsyncCallback} + * @see {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getAsyncCallbackPoolSize()} + * @see {@ignitelink org.apache.ignite.cache.query.ContinuousQueryWithTransformer#setLocalListener(EventListener)} */ public ContinuousQuery setLocalListener(CacheEntryUpdatedListener locLsnr) { this.locLsnr = locLsnr; @@ -166,15 +168,17 @@ public CacheEntryUpdatedListener getLocalListener() { * (e.g., synchronization or transactional cache operations), should be executed asynchronously * without blocking the thread that called the filter. Otherwise, you can get deadlocks. *

    - * If remote filter are annotated with {@link IgniteAsyncCallback} then it is executed in async callback - * pool (see {@link IgniteConfiguration#getAsyncCallbackPoolSize()}) that allow to perform a cache operations. + * If remote filter are annotated with {@ignitelink org.apache.ignite.lang.IgniteAsyncCallback} + * then it is executed in async callback + * pool (see {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getAsyncCallbackPoolSize()}) + * that allow to perform a cache operations. * * @param rmtFilter Key-value filter. * @return {@code this} for chaining. * * @deprecated Use {@link #setRemoteFilterFactory(Factory)} instead. - * @see IgniteAsyncCallback - * @see IgniteConfiguration#getAsyncCallbackPoolSize() + * @see {@ignitelink org.apache.ignite.lang.IgniteAsyncCallback} + * @see {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getAsyncCallbackPoolSize()} */ @Deprecated public ContinuousQuery setRemoteFilter(CacheEntryEventSerializableFilter rmtFilter) { diff --git a/modules/commons/src/main/java/org/apache/ignite/cache/query/Query.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/Query.java index 0d79db9e777d4..9138f79008f21 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cache/query/Query.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/Query.java @@ -31,14 +31,14 @@ *

  • SQL Fields query.Provides SQL way with full syntax to access cache data. * See {@link SqlFieldsQuery} for details.
  • *
  • Full-text query. Uses full-text search engine based on Apache Lucene engine. - * See {@link TextQuery} for details.
  • + * See {@ignitelink org.apache.ignite.cache.query.TextQuery} for details. *
  • Scan query. Provides effective and flexible way to full cache\partition scan. * See {@link ScanQuery} for details.
  • *
  • Continuous query. Provides flexible way to process all existed cache data and all future cache updates as well. * See {@link ContinuousQuery} for details.
  • * * - * @see IgniteCache#query(Query) + * @see {@ignitelink org.apache.ignite.IgniteCache#query(Query)} */ public abstract class Query implements Serializable { /** */ diff --git a/modules/commons/src/main/java/org/apache/ignite/cache/query/ScanQuery.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/ScanQuery.java index eeef1f6052021..952dce46f4989 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cache/query/ScanQuery.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/ScanQuery.java @@ -25,7 +25,7 @@ /** * Scan query over cache entries. Will accept all the entries if no predicate was set. * - * @see IgniteCache#query(Query) + * @see {@ignitelink org.apache.ignite.IgniteCache#query(Query)} */ public final class ScanQuery extends Query> { /** */ diff --git a/modules/commons/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java index af001e570e7c1..c2882242bcd6e 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java @@ -41,7 +41,7 @@ * the remote nodes and bring back only the small data set specified within the 'limit' clause, * instead of the whole query result as would happen in a non-collocated execution. * - * @see IgniteCache#query(Query) + * @see {@ignitelink org.apache.ignite.IgniteCache#query(Query)} */ public class SqlFieldsQuery extends Query> { /** */ diff --git a/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QueryGroupIndex.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QueryGroupIndex.java index 3c76347ececba..303b1d0d5a8d6 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QueryGroupIndex.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QueryGroupIndex.java @@ -47,8 +47,8 @@ *
  • positive value - fixed index inline
  • * * When set to {@code -1}, Ignite will try to detect inline size automatically. It will be no more than - * {@link CacheConfiguration#getSqlIndexMaxInlineSize()}. Index inline will be enabled for all fixed-length types, - * but will not be enabled for {@code String}. + * {@ignitelink org.apache.ignite.configuration.CacheConfiguration#getSqlIndexMaxInlineSize()}. + * Index inline will be enabled for all fixed-length types, but will not be enabled for {@code String}. * * @return Index inline size in bytes. */ diff --git a/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlField.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlField.java index 64550aed6e7a9..2c9c5e27685ab 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlField.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlField.java @@ -25,9 +25,9 @@ import org.apache.ignite.cache.QueryIndex; /** - * Annotates fields for SQL queries. All fields that will be involved in SQL clauses must have - * this annotation. For more information about cache queries see {@link CacheQuery} documentation. - * @see CacheQuery + * Annotates fields for SQL queries. All fields that will be involved in SQL clauses must have this annotation. + * For more information about cache queries see {@ignitelink org.apache.ignite.internal.processors.cache.query.CacheQuery} documentation. + * @see {@ignitelink org.apache.ignite.internal.processors.cache.query.CacheQuery} */ @Documented @Retention(RetentionPolicy.RUNTIME) @@ -118,9 +118,9 @@ *
  • {@code 0} - index inline is disabled (not recommended)
  • *
  • positive value - fixed index inline
  • * - * When set to {@code -1}, Ignite will try to detect inline size automatically. It will be no more than - * {@link CacheConfiguration#getSqlIndexMaxInlineSize()}. Index inline will be enabled for all fixed-length types, - * but will not be enabled for {@code String}. + * When set to {@code -1}, Ignite will try to detect inline size automatically. + * It will be no more than {@ignitelink org.apache.ignite.configuration.CacheConfiguration#getSqlIndexMaxInlineSize()}. + * Index inline will be enabled for all fixed-length types, but will not be enabled for {@code String}. *

    * When index group is used, inline size must be defined in {@link QueryGroupIndex#inlineSize()}. Any value * except of {@code -1} defined on a specific column will lead to exception. diff --git a/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QueryTextField.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QueryTextField.java index 6fdae549eba74..5d819fe94ebd3 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QueryTextField.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/annotations/QueryTextField.java @@ -26,8 +26,8 @@ /** * Annotation for fields to be indexed for full text * search using Lucene. For more information - * refer to {@link CacheQuery} documentation. - * @see CacheQuery + * refer to {@ignitelink org.apache.ignite.internal.processors.cache.query.CacheQuery} documentation. + * @see {@ignitelink org.apache.ignite.internal.processors.cache.query.CacheQuery} */ @Documented @Retention(RetentionPolicy.RUNTIME) diff --git a/modules/commons/src/main/java/org/apache/ignite/cluster/BaselineNode.java b/modules/commons/src/main/java/org/apache/ignite/cluster/BaselineNode.java index 57c5f0f2bb5da..25d9550c593e7 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cluster/BaselineNode.java +++ b/modules/commons/src/main/java/org/apache/ignite/cluster/BaselineNode.java @@ -34,7 +34,7 @@ public interface BaselineNode { /** * Gets a node attribute. Attributes are assigned to nodes at startup - * via {@link IgniteConfiguration#getUserAttributes()} method. + * via {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getUserAttributes()} method. *

    * The system adds the following attributes automatically: *

      @@ -55,7 +55,7 @@ public interface BaselineNode { /** * Gets all node attributes. Attributes are assigned to nodes at startup - * via {@link IgniteConfiguration#getUserAttributes()} method. + * via {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getUserAttributes()} method. *

      * The system adds the following attributes automatically: *

        diff --git a/modules/commons/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java b/modules/commons/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java index 7f46e9d2763e6..7ef30f98f3b4b 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java +++ b/modules/commons/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java @@ -27,7 +27,7 @@ * Node metrics for any node can be accessed via {@link ClusterNode#metrics()} * method. Keep in mind that there will be a certain network delay (usually * equal to metrics update delay) for the accuracy of node metrics. However, when accessing - * metrics on local node {@link IgniteCluster#localNode() IgniteCluster.localNode().getMetrics()} + * metrics on local node {@ignitelink org.apache.ignite.IgniteCluster#localNode() IgniteCluster.localNode().getMetrics()} * the metrics are always accurate and up to date. *

        * Local node metrics are registered as {@code MBean} and can be accessed from @@ -52,8 +52,8 @@ public interface ClusterMetrics { * calculated over all the metrics kept in history. The * history size is set via either one or both of configuration settings: *

          - *
        • {@link IgniteConfiguration#getMetricsExpireTime()}
        • - *
        • {@link IgniteConfiguration#getMetricsHistorySize()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}
        • *
        * * @return Maximum number of jobs that ever ran concurrently on this node. @@ -74,8 +74,8 @@ public interface ClusterMetrics { * calculated over all the metrics kept in history. The * history size is set via either one or both of configuration settings: *
          - *
        • {@link IgniteConfiguration#getMetricsExpireTime()}
        • - *
        • {@link IgniteConfiguration#getMetricsHistorySize()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}
        • *
        * * @return Average number of active jobs. @@ -89,8 +89,8 @@ public interface ClusterMetrics { * calculated over all the metrics kept in history. The * history size is set via either one or both of configuration settings: *
          - *
        • {@link IgniteConfiguration#getMetricsExpireTime()}
        • - *
        • {@link IgniteConfiguration#getMetricsHistorySize()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}
        • *
        * * @return Maximum number of waiting jobs. @@ -111,8 +111,8 @@ public interface ClusterMetrics { * calculated over all the metrics kept in history. The * history size is set via either one or both of configuration settings: *
          - *
        • {@link IgniteConfiguration#getMetricsExpireTime()}
        • - *
        • {@link IgniteConfiguration#getMetricsHistorySize()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}
        • *
        * * @return Average number of waiting jobs. @@ -127,8 +127,8 @@ public interface ClusterMetrics { * calculated over all the metrics kept in history. The * history size is set via either one or both of configuration settings: *
          - *
        • {@link IgniteConfiguration#getMetricsExpireTime()}
        • - *
        • {@link IgniteConfiguration#getMetricsHistorySize()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}
        • *
        * * @return Maximum number of jobs rejected at once. @@ -149,8 +149,8 @@ public interface ClusterMetrics { * calculated over all the metrics kept in history. The * history size is set via either one or both of grid configuration settings: *
          - *
        • {@link IgniteConfiguration#getMetricsExpireTime()}
        • - *
        • {@link IgniteConfiguration#getMetricsHistorySize()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}
        • *
        * * @return Average number of jobs this node rejects during collision resolution operations. @@ -193,8 +193,8 @@ public interface ClusterMetrics { * calculated over all the metrics kept in history. The * history size is set via either one or both of configuration settings: *
          - *
        • {@link IgniteConfiguration#getMetricsExpireTime()}
        • - *
        • {@link IgniteConfiguration#getMetricsHistorySize()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}
        • *
        * * @return Average number of cancelled jobs. @@ -238,8 +238,8 @@ public interface ClusterMetrics { * calculated over all the metrics kept in history. The * history size is set via either one or both of configuration settings: *
          - *
        • {@link IgniteConfiguration#getMetricsExpireTime()}
        • - *
        • {@link IgniteConfiguration#getMetricsHistorySize()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}
        • *
        * * @return Maximum waiting time. @@ -260,8 +260,8 @@ public interface ClusterMetrics { * calculated over all the metrics kept in history. The * history size is set via either one or both of configuration settings: *
          - *
        • {@link IgniteConfiguration#getMetricsExpireTime()}
        • - *
        • {@link IgniteConfiguration#getMetricsHistorySize()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}
        • *
        * * @return Average job wait time. @@ -275,8 +275,8 @@ public interface ClusterMetrics { * calculated over all the metrics kept in history. The * history size is set via either one or both of configuration settings: *
          - *
        • {@link IgniteConfiguration#getMetricsExpireTime()}
        • - *
        • {@link IgniteConfiguration#getMetricsHistorySize()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}
        • *
        * * @return Time it took to execute the longest job on the node. @@ -297,8 +297,8 @@ public interface ClusterMetrics { * calculated over all the metrics kept in history. The * history size is set via either one or both of configuration settings: *
          - *
        • {@link IgniteConfiguration#getMetricsExpireTime()}
        • - *
        • {@link IgniteConfiguration#getMetricsHistorySize()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}
        • *
        * * @return Average job execution time. @@ -312,8 +312,8 @@ public interface ClusterMetrics { * calculated over all the metrics kept in history. The * history size is set via either one or both of configuration settings: *
          - *
        • {@link IgniteConfiguration#getMetricsExpireTime()}
        • - *
        • {@link IgniteConfiguration#getMetricsHistorySize()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}
        • *
        * * @return Total number of jobs handled by the node. @@ -392,8 +392,8 @@ public interface ClusterMetrics { * calculated over all the metrics kept in history. The * history size is set via either one or both of configuration settings: *
          - *
        • {@link IgniteConfiguration#getMetricsExpireTime()}
        • - *
        • {@link IgniteConfiguration#getMetricsHistorySize()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}
        • + *
        • {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}
        • *
        * * @return Average of CPU load value in {@code [0, 1]} range over all metrics kept diff --git a/modules/commons/src/main/java/org/apache/ignite/cluster/ClusterNode.java b/modules/commons/src/main/java/org/apache/ignite/cluster/ClusterNode.java index 1aa43fbbfc0c5..87bb03630be3b 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cluster/ClusterNode.java +++ b/modules/commons/src/main/java/org/apache/ignite/cluster/ClusterNode.java @@ -18,7 +18,6 @@ package org.apache.ignite.cluster; import java.util.Collection; -import java.util.List; import java.util.Map; import java.util.UUID; import org.apache.ignite.internal.IgniteNodeAttributes; @@ -30,13 +29,13 @@ * Interface representing a single cluster node. Use {@link #attribute(String)} or * {@link #metrics()} to get static and dynamic information about cluster nodes. * {@code ClusterNode} list, which includes all nodes within task topology, is provided - * to {@link org.apache.ignite.compute.ComputeTask#map(List, Object)} method. + * to {@ignitelink org.apache.ignite.compute.ComputeTask#map(List, Object)} method. *

        *

        Cluster Node Attributes

        * You can use cluster node attributes to provide static information about a node. * This information is initialized once within a cluster, during the node startup, and * remains the same throughout the lifetime of a node. Use - * {@link IgniteConfiguration#getUserAttributes()} method to initialize your custom + * {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getUserAttributes()} method to initialize your custom * node attributes at startup. Here is an example of how to assign an attribute to a node at startup: *
          * <bean class="org.apache.ignite.configuration.IgniteConfiguration">
        @@ -58,14 +57,14 @@
          * 
      • {@code org.apache.ignite.jit.name} - Name of JIT compiler used.
      • *
      • {@code org.apache.ignite.net.itf.name} - Name of network interface.
      • *
      • {@code org.apache.ignite.user.name} - Operating system user name.
      • - *
      • {@code org.apache.ignite.ignite.name} - Ignite name (see {@link Ignite#name()}).
      • + *
      • {@code org.apache.ignite.ignite.name} - Ignite name (see {@ignitelink org.apache.ignite.Ignite#name()}).
      • *
      • * {@code spiName.org.apache.ignite.spi.class} - SPI implementation class for every SPI, - * where {@code spiName} is the name of the SPI (see {@link org.apache.ignite.spi.IgniteSpi#getName()}. + * where {@code spiName} is the name of the SPI (see {@ignitelink org.apache.ignite.spi.IgniteSpi#getName()}. *
      • *
      • * {@code spiName.org.apache.ignite.spi.ver} - SPI version for every SPI, - * where {@code spiName} is the name of the SPI (see {@link org.apache.ignite.spi.IgniteSpi#getName()}. + * where {@code spiName} is the name of the SPI (see {@ignitelink org.apache.ignite.spi.IgniteSpi#getName()}. *
      • *
      *

      @@ -84,13 +83,13 @@ *

      Cluster Node Metrics

      * Cluster node metrics (see {@link #metrics()}) are updated frequently for all nodes * and can be used to get dynamic information about a node. The frequency of update - * is controlled by {@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsUpdateFrequency()} parameter. + * is controlled by {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsUpdateFrequency()} parameter. * The metrics data will be updated every {@code 2} seconds by default. *

      * Grid node metrics provide information that can frequently change, * such as Heap and Non-Heap memory utilization, CPU load, number of active and waiting * grid jobs, etc... This information can become useful during job collision resolution or - * {@link org.apache.ignite.compute.ComputeTask#map(List, Object)} operation when jobs are + * {@ignitelink org.apache.ignite.compute.ComputeTask#map(List, Object)} operation when jobs are * assigned to remote nodes for execution. *

      * Local node metrics are registered as {@code MBean} and can be accessed from @@ -116,7 +115,7 @@ public interface ClusterNode extends BaselineNode { /** * Gets a node attribute. Attributes are assigned to nodes at startup - * via {@link IgniteConfiguration#getUserAttributes()} method. + * via {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getUserAttributes()} method. *

      * The system adds the following attributes automatically: *

        @@ -138,12 +137,12 @@ public interface ClusterNode extends BaselineNode { * Gets metrics snapshot for this node. Note that node metrics are constantly updated * and provide up to date information about nodes. For example, you can get * an idea about CPU load on remote node via {@link ClusterMetrics#getCurrentCpuLoad()} - * method and use it during {@link org.apache.ignite.compute.ComputeTask#map(List, Object)} or during collision + * method and use it during {@ignitelink org.apache.ignite.compute.ComputeTask#map(List, Object)} or during collision * resolution. *

        * Node metrics are updated with some delay which is controlled by - * {@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsUpdateFrequency()} parameter. - * By default the update will happen every {@code 2} seconds. + * {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getMetricsUpdateFrequency()} parameter. + * By default, the update will happen every {@code 2} seconds. * * @return Runtime metrics snapshot for this node. */ @@ -151,7 +150,7 @@ public interface ClusterNode extends BaselineNode { /** * Gets all node attributes. Attributes are assigned to nodes at startup - * via {@link IgniteConfiguration#getUserAttributes()} method. + * via {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getUserAttributes()} method. *

        * The system adds the following attributes automatically: *

          @@ -188,8 +187,8 @@ public interface ClusterNode extends BaselineNode { /** * Gets collection of addresses this node is known by. *

          - * If {@link IgniteConfiguration#getLocalHost()} value isn't {@code null} node will try to use that - * address for all communications and returned collection will contain only that address. + * If {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getLocalHost()} value isn't {@code null} + * node will try to use that address for all communications and returned collection will contain only that address. * If it is {@code null} then local wildcard address will be used, and Ignite * will make the best effort to supply all addresses of that node in returned collection. * @@ -200,13 +199,13 @@ public interface ClusterNode extends BaselineNode { /** * Gets collection of host names this node is known by. *

          - * If {@link IgniteConfiguration#getLocalHost()} value isn't {@code null} node will try to use + * If {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getLocalHost()} value isn't {@code null} node will try to use * the host name of that resolved address for all communications and * returned collection will contain only that host name. * If that host name can not be resolved then ip address returned by method {@link #addresses()} is used. *

          - * If {@link IgniteConfiguration#getLocalHost()} value is {@code null} then local wildcard address will be used, - * and this method returns host names of all addresses of that node. + * If {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getLocalHost()} value is {@code null} + * then local wildcard address will be used, and this method returns host names of all addresses of that node. *

          * Note: the loopback address will be omitted in results. * @@ -243,11 +242,11 @@ public interface ClusterNode extends BaselineNode { public boolean isLocal(); /** - * Whether this node is cache client (see {@link IgniteConfiguration#isClientMode()}). + * Whether this node is cache client (see {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#isClientMode()}). * * @return {@code True if client}. * - * @see IgniteConfiguration#isClientMode() + * @see {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#isClientMode()} */ public boolean isClient(); } diff --git a/modules/commons/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java b/modules/commons/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java index 1449151aa0bc1..3bd6a10980587 100644 --- a/modules/commons/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java +++ b/modules/commons/src/main/java/org/apache/ignite/lang/IgniteProductVersion.java @@ -70,7 +70,7 @@ public class IgniteProductVersion implements Comparable, E protected byte[] revHash; /** - * Empty constructor required by {@link Externalizable} and {@link CoreMessagesProvider}. + * Empty constructor required by {@link Externalizable} and {@ignitelink org.apache.ignite.internal.CoreMessagesProvider}. */ public IgniteProductVersion() { // No-op. diff --git a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAtomicConfiguration.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAtomicConfiguration.java index 8d0ab76905ca2..2129a174bb5cc 100644 --- a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAtomicConfiguration.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientAtomicConfiguration.java @@ -89,7 +89,7 @@ public ClientAtomicConfiguration setCacheMode(CacheMode cacheMode) { } /** - * Gets default number of sequence values reserved for {@link IgniteAtomicSequence} instances. After + * Gets default number of sequence values reserved for {@ignitelink org.apache.ignite.IgniteAtomicSequence} instances. After * a certain number has been reserved, consequent increments of sequence will happen locally, * without communication with other nodes, until the next reservation has to be made. *

          @@ -102,7 +102,7 @@ public int getAtomicSequenceReserveSize() { } /** - * Sets default number of sequence values reserved for {@link IgniteAtomicSequence} instances. After a certain + * Sets default number of sequence values reserved for {@ignitelink org.apache.ignite.IgniteAtomicSequence} instances. After a certain * number has been reserved, consequent increments of sequence will happen locally, without communication with other * nodes, until the next reservation has to be made. * diff --git a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java index 04e8b597e124d..bfe3edd4ee577 100644 --- a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java @@ -135,18 +135,18 @@ public final class ClientCacheConfiguration implements Serializable { /** * Root directories where partition files are stored. - * @see DataStorageConfiguration#setStoragePath(String) - * @see DataStorageConfiguration#setExtraStoragePaths(String[]) - * @see CacheConfiguration#setStoragePaths(String...) + * @see {@ignitelink org.apache.ignite.configuration.DataStorageConfiguration#setStoragePath(String)} + * @see {@ignitelink org.apache.ignite.configuration.DataStorageConfiguration#setExtraStoragePaths(String[])} + * @see {@ignitelink org.apache.ignite.configuration.CacheConfiguration#setStoragePaths(String...)} */ @IgniteExperimental @Nullable private String[] storagePaths; /** * Root directory where index file are stored. - * @see DataStorageConfiguration#setStoragePath(String) - * @see DataStorageConfiguration#setExtraStoragePaths(String[]) - * @see CacheConfiguration#setIndexPath(String) + * @see {@ignitelink org.apache.ignite.configuration.DataStorageConfiguration#setStoragePath(String)} + * @see {@ignitelink org.apache.ignite.configuration.DataStorageConfiguration#setExtraStoragePaths(String[])} + * @see {@ignitelink org.apache.ignite.configuration.CacheConfiguration#setIndexPath(String)} */ @IgniteExperimental @Nullable private String idxPath; @@ -372,7 +372,7 @@ public ClientCacheConfiguration setReadFromBackup(boolean readFromBackup) { * @return Size (in number bytes) to be loaded within a single rebalance message. * Rebalancing algorithm will split total data set on every node into multiple * batches prior to sending data. - * @deprecated Use {@link IgniteConfiguration#getRebalanceBatchSize()} instead. + * @deprecated Use {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getRebalanceBatchSize()} instead. */ @Deprecated public int getRebalanceBatchSize() { @@ -382,7 +382,7 @@ public int getRebalanceBatchSize() { /** * @param rebalanceBatchSize Rebalance batch size. * @return {@code this} for chaining. - * @deprecated Use {@link IgniteConfiguration#setRebalanceBatchSize(int)} instead. + * @deprecated Use {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#setRebalanceBatchSize(int)} instead. */ @Deprecated public ClientCacheConfiguration setRebalanceBatchSize(int rebalanceBatchSize) { @@ -397,7 +397,7 @@ public ClientCacheConfiguration setRebalanceBatchSize(int rebalanceBatchSize) { * * @return Number of batches generated by supply node at rebalancing start. * Minimum is 1. - * @deprecated Use {@link IgniteConfiguration#getRebalanceBatchesPrefetchCount()} instead + * @deprecated Use {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getRebalanceBatchesPrefetchCount()} instead */ @Deprecated public long getRebalanceBatchesPrefetchCount() { @@ -407,7 +407,7 @@ public long getRebalanceBatchesPrefetchCount() { /** * @param rebalanceBatchesPrefetchCnt Rebalance batches prefetch count. * @return {@code this} for chaining. - * @deprecated Use {@link IgniteConfiguration#getRebalanceBatchesPrefetchCount()} instead + * @deprecated Use {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getRebalanceBatchesPrefetchCount()} instead */ @Deprecated public ClientCacheConfiguration setRebalanceBatchesPrefetchCount(long rebalanceBatchesPrefetchCnt) { @@ -500,7 +500,7 @@ public ClientCacheConfiguration setRebalanceOrder(int rebalanceOrder) { *

          * Default value of {@code 0} means that throttling is disabled. *

          - * @deprecated Use {@link IgniteConfiguration#getRebalanceThrottle()} instead. + * @deprecated Use {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getRebalanceThrottle()} instead. */ @Deprecated public long getRebalanceThrottle() { @@ -510,7 +510,7 @@ public long getRebalanceThrottle() { /** * @param newVal Rebalance throttle. * @return {@code this} for chaining. - * @deprecated Use {@link IgniteConfiguration#setRebalanceThrottle(long)} instead. + * @deprecated Use {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#setRebalanceThrottle(long)} instead. */ @Deprecated public ClientCacheConfiguration setRebalanceThrottle(long newVal) { @@ -521,7 +521,7 @@ public ClientCacheConfiguration setRebalanceThrottle(long newVal) { /** * @return Rebalance timeout (ms). - * @deprecated Use {@link IgniteConfiguration#getRebalanceTimeout()} instead. + * @deprecated Use {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getRebalanceTimeout()} instead. */ @Deprecated public long getRebalanceTimeout() { @@ -531,7 +531,7 @@ public long getRebalanceTimeout() { /** * @param newVal Rebalance timeout. * @return {@code this} for chaining. - * @deprecated Use {@link IgniteConfiguration#getRebalanceTimeout()} instead. + * @deprecated Use {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getRebalanceTimeout()} instead. */ @Deprecated public ClientCacheConfiguration setRebalanceTimeout(long newVal) { @@ -827,7 +827,8 @@ public ClientCacheConfiguration setAffinityConfiguration(ClientAffinityConfigura /** * Sets a path to the root directory where the Persistent Store will persist data. - * By default, the Persistent Store's files are located under {@link DataStorageConfiguration#getStoragePath()}. + * By default, the Persistent Store's files are located under + * {@ignitelink org.apache.ignite.configuration.DataStorageConfiguration#getStoragePath()}. * * @param storagePaths Persistence store path. * @return {@code this} for chaining. @@ -849,7 +850,8 @@ public ClientCacheConfiguration setStoragePaths(String... storagePaths) { /** * Sets a path to the root directory where the Persistent Store will persist index partition. - * By default, the Persistent Store's files are located under {@link DataStorageConfiguration#getStoragePath()}. + * By default, the Persistent Store's files are located under + * {@ignitelink org.apache.ignite.configuration.DataStorageConfiguration#getStoragePath()}. * * @param idxPath Index path. * @return {@code this} for chaining. diff --git a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientClusterGroup.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientClusterGroup.java index bde1c9b54083b..69db615c0c9c5 100644 --- a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientClusterGroup.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientClusterGroup.java @@ -92,7 +92,7 @@ public interface ClientClusterGroup { * specified in user attributes. *

          * User attributes for every node are optional and can be specified in - * grid node configuration. See {@link IgniteConfiguration#getUserAttributes()} + * grid node configuration. See {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#getUserAttributes()} * for more information. * * @param name Name of the attribute. @@ -104,8 +104,8 @@ public interface ClientClusterGroup { /** * Creates a cluster group of nodes started in server mode. * - * @see Ignition#setClientMode(boolean) - * @see IgniteConfiguration#setClientMode(boolean) + * @see {@ignitelink org.apache.ignite.Ignition#setClientMode(boolean)} + * @see {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#setClientMode(boolean)} * @return Cluster group of nodes started in server mode. */ public ClientClusterGroup forServers(); @@ -113,8 +113,8 @@ public interface ClientClusterGroup { /** * Creates a cluster group of nodes started in client mode. - * @see Ignition#setClientMode(boolean) - * @see IgniteConfiguration#setClientMode(boolean) + * @see {@ignitelink org.apache.ignite.Ignition#setClientMode(boolean)} + * @see {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#setClientMode(boolean)} * @return Cluster group of nodes started in client mode. */ public ClientClusterGroup forClients(); diff --git a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCompute.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCompute.java index ab307c44169b7..8f294ef0923e8 100644 --- a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCompute.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCompute.java @@ -34,7 +34,7 @@ public interface ClientCompute { /** * Executes given task within the cluster group. For step-by-step explanation of task execution process - * refer to {@link ComputeTask} documentation. + * refer to {@ignitelink org.apache.ignite.compute.ComputeTask} documentation. * * @param taskName Name of the task to execute. * @param arg Optional argument of task execution, can be {@code null}. @@ -43,13 +43,13 @@ public interface ClientCompute { * @return Task result. * @throws ClientException If task failed. * @throws InterruptedException If the wait for task completion was interrupted. - * @see ComputeTask for information about task execution. + * @see {@ignitelink org.apache.ignite.compute.ComputeTask} for information about task execution. */ public R execute(String taskName, @Nullable T arg) throws ClientException, InterruptedException; /** * Executes given task asynchronously within the cluster group. For step-by-step explanation of task execution - * process refer to {@link ComputeTask} documentation. + * process refer to {@ignitelink org.apache.ignite.compute.ComputeTask} documentation. * * @param taskName Name of the task to execute. * @param arg Optional argument of task execution, can be {@code null}. @@ -57,7 +57,7 @@ public interface ClientCompute { * @param Type of the task result. * @return A Future representing pending completion of the task. * @throws ClientException If task failed. - * @see ComputeTask for information about task execution. + * @see {@ignitelink org.apache.ignite.compute.ComputeTask} for information about task execution. * @deprecated Use {@link #executeAsync2(String, Object)} instead. * This method calls {@link #executeAsync2(String, Object)} internally, but returns a more limited * Future interface. @@ -67,7 +67,7 @@ public interface ClientCompute { /** * Executes given task asynchronously within the cluster group. For step-by-step explanation of task execution - * process refer to {@link ComputeTask} documentation. + * process refer to {@ignitelink org.apache.ignite.compute.ComputeTask} documentation. * * @param taskName Name of the task to execute. * @param arg Optional argument of task execution, can be {@code null}. @@ -75,7 +75,7 @@ public interface ClientCompute { * @param Type of the task result. * @return A Future representing pending completion of the task. * @throws ClientException If task failed. - * @see ComputeTask for information about task execution. + * @see {@ignitelink org.apache.ignite.compute.ComputeTask} for information about task execution. */ public IgniteClientFuture executeAsync2(String taskName, @Nullable T arg) throws ClientException; @@ -90,7 +90,7 @@ public interface ClientCompute { /** * Sets no-failover flag for tasks executed by returned {@code ClientCompute} instance. * If flag is set, job will be never failed over even if remote node crashes or rejects execution. - * See {@link ComputeTask} documentation for more information about jobs failover. + * See {@ignitelink org.apache.ignite.compute.ComputeTask} documentation for more information about jobs failover. * * @return {@code ClientCompute} instance with no-failover flag. */ @@ -98,7 +98,7 @@ public interface ClientCompute { /** * Disables result caching for tasks executed by returned {@code ClientCompute} instance. - * See {@link ComputeTask} documentation for more information tasks result caching. + * See {@ignitelink org.apache.ignite.compute.ComputeTask} documentation for more information tasks result caching. * * @return {@code ClientCompute} instance with "no result cache" flag. */ diff --git a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapper.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapper.java index dc9af29bad0e7..6c65d1945edf8 100644 --- a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapper.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapper.java @@ -20,17 +20,19 @@ /** * This function calculates the cache key to a partition mapping for each cache key. It is used only for local calculation on a client side. *

          - * When the {@link ClientConfiguration#isPartitionAwarenessEnabled()} and the cache was created with a custom {@link AffinityFunction} - * or a {@link AffinityKeyMapper} this function will be used to calculate mappings. Be sure that a key maps to the same partition - * produced by the {@link AffinityFunction#partition(Object)} method. + * When the {@ignitelink org.apache.ignite.configuration.ClientConfiguration#isPartitionAwarenessEnabled()} + * and the cache was created with a custom {@ignitelink org.apache.ignite.cache.affinity.AffinityFunction} + * or a {@ignitelink org.apache.ignite.cache.affinity.AffinityKeyMapper} this function will be used to calculate mappings. + * Be sure that a key maps to the same partition + * produced by the {@ignitelink org.apache.ignite.cache.affinity.AffinityFunction#partition(Object)} method. * - * @see AffinityFunction#partition(Object) + * @see {@ignitelink org.apache.ignite.cache.affinity.AffinityFunction#partition(Object)} * @since 2.14 */ public interface ClientPartitionAwarenessMapper { /** * Gets a partition number for a given key starting from {@code 0}. Be sure that a key maps to the same partition - * produced by the {@link AffinityFunction#partition(Object)} method. + * produced by the {@ignitelink org.apache.ignite.cache.affinity.AffinityFunction#partition(Object)} method. * * @param key Key to get partition for. * @return Partition number for a given key. diff --git a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapperFactory.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapperFactory.java index d49aba72e7cf8..bafab678a300c 100644 --- a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapperFactory.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientPartitionAwarenessMapperFactory.java @@ -23,8 +23,9 @@ * The thin client will update all 'partitions-to-node' mappings on every cluster topology change and the 'key-to-partition' * mapping will be calculated on the client side. *

          - * The case described above will not be possible (and in turn partition awareness won't work) when a custom {@link AffinityFunction} or - * a {@link AffinityKeyMapper} was previously used for a cache creation. The partition awareness mapper factory is used to solve this + * The case described above will not be possible (and in turn partition awareness won't work) when a custom + * {@ignitelink org.apache.ignite.cache.affinity.AffinityFunction} or a {@ignitelink org.apache.ignite.cache.affinity.AffinityKeyMapper} + * was previously used for a cache creation. The partition awareness mapper factory is used to solve this * issue. All 'partition-to-node' mappings will still be requested and received from a server node, however, if a custom AffinityFunction * or a custom AffinityKeyMapper was used a ClientPartitionAwarenessMapper produced by this factory will calculate mapping a key to * a partition. @@ -32,7 +33,7 @@ * These key to partition mapping functions produced by the factory are used only for local calculations, they will not be passed * to a server node. * - * @see AffinityFunction + * @see {@ignitelink org.apache.ignite.cache.affinity.AffinityFunction} * @since 2.14 */ public interface ClientPartitionAwarenessMapperFactory { diff --git a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientServiceDescriptor.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientServiceDescriptor.java index 75fe4621a8f3b..6b90ac04e8081 100644 --- a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientServiceDescriptor.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientServiceDescriptor.java @@ -22,7 +22,7 @@ import org.jetbrains.annotations.Nullable; /** - * Descriptor of {@link Service}. + * Descriptor of {@ignitelink org.apache.ignite.services.Service}. */ public interface ClientServiceDescriptor { /** diff --git a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientTransactions.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientTransactions.java index 183439d4b88ba..7b7eea5a1f5ca 100644 --- a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientTransactions.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientTransactions.java @@ -30,9 +30,9 @@ * Transactions are {@link AutoCloseable}, so they will automatically rollback unless explicitly committed. *

          * Default values for transaction isolation level, concurrency and timeout can be configured via - * {@link ClientConfiguration#setTransactionConfiguration(ClientTransactionConfiguration)} property. + * {@ignitelink org.apache.ignite.configuration.ClientConfiguration#setTransactionConfiguration(ClientTransactionConfiguration)} property. * - * @see ClientTransactionConfiguration + * @see {@ignitelink org.apache.ignite.configuration.ClientConfiguration} */ public interface ClientTransactions { /** diff --git a/modules/thin-client/api/src/main/java/org/apache/ignite/configuration/ClientConfiguration.java b/modules/thin-client/api/src/main/java/org/apache/ignite/configuration/ClientConfiguration.java index 58b99f92429dd..e63fe4dbe7161 100644 --- a/modules/thin-client/api/src/main/java/org/apache/ignite/configuration/ClientConfiguration.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/configuration/ClientConfiguration.java @@ -40,7 +40,7 @@ import org.apache.ignite.internal.util.typedef.internal.S; /** - * {@link TcpIgniteClient} configuration. + * {@ignitelink org.apache.ignite.internal.client.thin.TcpIgniteClient} configuration. */ @SuppressWarnings("AssignmentOrReturnOfFieldWithMutableType") public final class ClientConfiguration implements Serializable { @@ -188,7 +188,8 @@ public String[] getAddresses() { /** * Set addresses of Ignite server nodes within a cluster. An address can be IPv4 address or hostname, with or * without port. If port is not set then Ignite will generate multiple addresses for default port range. See - * {@link ClientConnectorConfiguration#DFLT_PORT}, {@link ClientConnectorConfiguration#DFLT_PORT_RANGE}. + * {@ignitelink org.apache.ignite.internal.client.thin.ClientConnectorConfiguration#DFLT_PORT}, + * {@ignitelink org.apache.ignite.internal.client.thin.ClientConnectorConfiguration#DFLT_PORT_RANGE}. * * @param addrs Host addresses. * @return {@code this} for chaining. @@ -604,7 +605,8 @@ public ClientConfiguration setTransactionConfiguration(ClientTransactionConfigur *

            *
          • 1. Single-key operations API, like put(), get(), etc. However, the functionality has no effect on those * operations within explicit transactions {@link ClientTransactions#txStart()}.
          • - *
          • 2. {@link ScanQuery#setPartition(Integer)} and {@link IndexQuery#setPartition(Integer)} accept a + *
          • 2. {@link ScanQuery#setPartition(Integer)} and + * {@ignitelink org.apache.ignite.cache.query.IndexQuery#setPartition(Integer)} accept a * partition number as a parameter with which the query is routed to a particular server node that stores * the requested data.
          • *
          @@ -625,7 +627,8 @@ public boolean isPartitionAwarenessEnabled() { *
            *
          • 1. Single-key operations API, like put(), get(), etc. However, the functionality has no effect on * those operations within explicit transactions {@link ClientTransactions#txStart()}.
          • - *
          • 2. {@link ScanQuery#setPartition(Integer)} and {@link IndexQuery#setPartition(Integer)} accept + *
          • 2. {@link ScanQuery#setPartition(Integer)} and + * {@ignitelink org.apache.ignite.cache.query.IndexQuery#setPartition(Integer)} accept * a partition number as a parameter with which the query is routed to a particular server node that stores * the requested data.
          • *
          @@ -771,8 +774,8 @@ public Map getUserAttributes() { * Sets user attributes which can be used to send additional info to the server nodes. * * Sent attributes can be accessed on server nodes from - * {@link org.apache.ignite.internal.processors.rest.request.GridRestRequest GridRestRequest} or - * {@link org.apache.ignite.internal.processors.odbc.ClientListenerAbstractConnectionContext + * {@ignitelink org.apache.ignite.internal.processors.rest.request.GridRestRequest GridRestRequest} or + * {@ignitelink org.apache.ignite.internal.processors.odbc.ClientListenerAbstractConnectionContext * ClientListenerAbstractConnectionContext} (depends on client type). * * @param userAttrs User attributes. @@ -853,8 +856,8 @@ public ClientConfiguration setHeartbeatEnabled(boolean heartbeatEnabled) { /** * Gets the heartbeat message interval, in milliseconds. Default is 30_000. *

          - * When server-side {@link ClientConnectorConfiguration#getIdleTimeout()} is not zero, effective heartbeat - * interval is set to min(heartbeatInterval, idleTimeout / 3). + * When server-side {@ignitelink org.apache.ignite.configuration.ClientConnectorConfiguration#getIdleTimeout()} is not zero, + * effective heartbeat interval is set to min(heartbeatInterval, idleTimeout / 3). *

          * When thin client connection is idle (no operations are performed), heartbeat messages are sent periodically * to keep the connection alive and detect potential half-open state. * @@ -868,8 +871,8 @@ public long getHeartbeatInterval() { /** * Sets the heartbeat message interval, in milliseconds. Default is 30_000. *

          - * When server-side {@link ClientConnectorConfiguration#getIdleTimeout()} is not zero, effective heartbeat - * interval is set to min(heartbeatInterval, idleTimeout / 3). + * When server-side {@ignitelink org.apache.ignite.configuration.ClientConnectorConfiguration#getIdleTimeout()} is not zero, + * effective heartbeat interval is set to min(heartbeatInterval, idleTimeout / 3). *

          * When thin client connection is idle (no operations are performed), heartbeat messages are sent periodically * to keep the connection alive and detect potential half-open state. * diff --git a/modules/thin-client/api/src/main/java/org/apache/ignite/configuration/ClientTransactionConfiguration.java b/modules/thin-client/api/src/main/java/org/apache/ignite/configuration/ClientTransactionConfiguration.java index ddde73b1c7b75..3927de539e94f 100644 --- a/modules/thin-client/api/src/main/java/org/apache/ignite/configuration/ClientTransactionConfiguration.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/configuration/ClientTransactionConfiguration.java @@ -90,7 +90,7 @@ public ClientTransactionConfiguration setDefaultTxConcurrency(TransactionConcurr * Default value is defined by {@link #DFLT_TX_ISOLATION}. * * @return Default transaction isolation. - * @see Transaction + * @see {@ignitelink org.apache.ignite.transactions.Transaction} */ public TransactionIsolation getDefaultTxIsolation() { return dfltIsolation; From f539f2e4126b46c2a34aafae61cb43ff8c4a1394 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 28 May 2026 11:36:12 +0300 Subject: [PATCH 26/44] IGNITE-28733 Move QueryEntityPatch to internal --- .../org/apache/ignite/cache/QueryEntity.java | 21 +- .../internal/processors/query/QueryUtils.java | 225 ------------------ 2 files changed, 10 insertions(+), 236 deletions(-) diff --git a/modules/commons/src/main/java/org/apache/ignite/cache/QueryEntity.java b/modules/commons/src/main/java/org/apache/ignite/cache/QueryEntity.java index 7ab4e306db046..933ba1f1cc2d9 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cache/QueryEntity.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/QueryEntity.java @@ -37,12 +37,11 @@ import org.apache.ignite.internal.processors.cache.query.QueryEntityClassProperty; import org.apache.ignite.internal.processors.cache.query.QueryEntityTypeDescriptor; import org.apache.ignite.internal.processors.query.GridQueryIndexDescriptor; -import org.apache.ignite.internal.processors.query.QueryUtils; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.tostring.GridToStringInclude; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -493,7 +492,7 @@ private static QueryEntity convert(QueryEntityTypeDescriptor desc) { entity.setValueType(desc.valueClass().getName()); for (QueryEntityClassProperty prop : desc.properties().values()) - entity.addQueryField(prop.fullName(), U.box(prop.type()).getName(), prop.alias()); + entity.addQueryField(prop.fullName(), CommonUtils.box(prop.type()).getName(), prop.alias()); entity.setKeyFields(desc.keyProperties()); @@ -539,10 +538,10 @@ private static QueryEntity convert(QueryEntityTypeDescriptor desc) { txtIdx.setIndexType(QueryIndexType.FULLTEXT); - txtIdx.setFieldNames(Arrays.asList(QueryUtils.VAL_FIELD_NAME), true); + txtIdx.setFieldNames(Arrays.asList(CommonUtils.VAL_FIELD_NAME), true); } else - txtIdx.getFields().put(QueryUtils.VAL_FIELD_NAME, true); + txtIdx.getFields().put(CommonUtils.VAL_FIELD_NAME, true); } if (txtIdx != null) @@ -590,14 +589,14 @@ private static QueryEntityTypeDescriptor processKeyAndValueClasses( */ private static void processAnnotationsInClass(boolean key, Class cls, QueryEntityTypeDescriptor type, @Nullable QueryEntityClassProperty parent) { - if (U.isJdk(cls) || U.isGeometryClass(cls)) { - if (parent == null && !key && QueryUtils.isSqlType(cls)) { // We have to index primitive _val. - String idxName = cls.getSimpleName() + "_" + QueryUtils.VAL_FIELD_NAME + "_idx"; + if (CommonUtils.isJdk(cls) || CommonUtils.isGeometryClass(cls)) { + if (parent == null && !key && CommonUtils.isSqlType(cls)) { // We have to index primitive _val. + String idxName = cls.getSimpleName() + "_" + CommonUtils.VAL_FIELD_NAME + "_idx"; - type.addIndex(idxName, U.isGeometryClass(cls) ? + type.addIndex(idxName, CommonUtils.isGeometryClass(cls) ? QueryIndexType.GEOSPATIAL : QueryIndexType.SORTED, QueryIndex.DFLT_INLINE_SIZE); - type.addFieldToIndex(idxName, QueryUtils.VAL_FIELD_NAME, 0, false); + type.addFieldToIndex(idxName, CommonUtils.VAL_FIELD_NAME, 0, false); } return; @@ -673,7 +672,7 @@ private static void processAnnotation(boolean key, QuerySqlField sqlAnn, QueryTe if (cls != curCls) idxName = cls.getSimpleName() + "_" + idxName; - desc.addIndex(idxName, U.isGeometryClass(prop.type()) ? + desc.addIndex(idxName, CommonUtils.isGeometryClass(prop.type()) ? QueryIndexType.GEOSPATIAL : QueryIndexType.SORTED, sqlAnn.inlineSize()); desc.addFieldToIndex(idxName, prop.fullName(), 0, sqlAnn.descending()); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java index 75a86bdaa5fd6..332a7d1ab2780 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java @@ -37,7 +37,6 @@ import org.apache.ignite.IgniteSystemProperties; import org.apache.ignite.binary.BinaryField; import org.apache.ignite.cache.QueryEntity; -import org.apache.ignite.cache.QueryEntityPatch; import org.apache.ignite.cache.QueryIndex; import org.apache.ignite.cache.QueryIndexType; import org.apache.ignite.cache.affinity.AffinityKeyMapper; @@ -62,9 +61,6 @@ import org.apache.ignite.internal.processors.query.property.QueryPropertyAccessor; import org.apache.ignite.internal.processors.query.property.QueryReadOnlyMethodsAccessor; import org.apache.ignite.internal.processors.query.schema.SchemaOperationException; -import org.apache.ignite.internal.processors.query.schema.operation.SchemaAbstractOperation; -import org.apache.ignite.internal.processors.query.schema.operation.SchemaAlterTableAddColumnOperation; -import org.apache.ignite.internal.processors.query.schema.operation.SchemaIndexCreateOperation; import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.X; @@ -1757,227 +1753,6 @@ public static IgniteInternalCache cacheForDML(IgniteInternalCache qryFieldsToAdd = checkFields(locEntity, target, conflicts); - - Collection indexesToAdd = checkIndexes(locEntity, target, conflicts); - - if (conflicts.length() != 0) - return QueryEntityPatch.conflict(locEntity.getTableName() + " conflict: \n" + conflicts.toString()); - - Collection patchOperations = new ArrayList<>(); - - if (!qryFieldsToAdd.isEmpty()) - patchOperations.add(new SchemaAlterTableAddColumnOperation( - UUID.randomUUID(), - null, - null, - locEntity.getTableName(), - qryFieldsToAdd, - true, - true - )); - - if (!indexesToAdd.isEmpty()) { - for (QueryIndex idx : indexesToAdd) { - patchOperations.add(new SchemaIndexCreateOperation( - UUID.randomUUID(), - null, - null, - locEntity.getTableName(), - idx, - true, - 0 - )); - } - } - - return QueryEntityPatch.patch(patchOperations); - } - - /** - * Comparing local entity fields and target entity fields. - * - * @param target Query entity for check. - * @param conflicts Storage of conflicts. - * @return Fields which exist in target and not exist in local. - */ - private static List checkFields(QueryEntity locEntity, QueryEntity target, StringBuilder conflicts) { - List qryFieldsToAdd = new ArrayList<>(); - - for (Map.Entry targetField : target.getFields().entrySet()) { - String targetFieldName = targetField.getKey(); - String targetFieldType = targetField.getValue(); - String targetFieldAlias = target.getAliases().get(targetFieldName); - - if (locEntity.getFields().containsKey(targetFieldName)) { - checkEquals( - conflicts, - "alias of " + targetFieldName, - locEntity.getAliases().get(targetFieldName), - targetFieldAlias - ); - - checkEquals( - conflicts, - "fieldType of " + targetFieldName, - locEntity.getFields().get(targetFieldName), - targetFieldType - ); - - checkEquals( - conflicts, - "nullable of " + targetFieldName, - contains(locEntity.getNotNullFields(), targetFieldName), - contains(target.getNotNullFields(), targetFieldName) - ); - - checkEquals( - conflicts, - "default value of " + targetFieldName, - getFromMap(locEntity.getDefaultFieldValues(), targetFieldName), - getFromMap(target.getDefaultFieldValues(), targetFieldName) - ); - - checkEquals(conflicts, - "precision of " + targetFieldName, - getFromMap(locEntity.getFieldsPrecision(), targetFieldName), - getFromMap(target.getFieldsPrecision(), targetFieldName)); - - checkEquals( - conflicts, - "scale of " + targetFieldName, - getFromMap(locEntity.getFieldsScale(), targetFieldName), - getFromMap(target.getFieldsScale(), targetFieldName)); - } - else { - boolean isAliasConflictsFound = findAliasConflicts(locEntity, targetFieldAlias, targetFieldName, conflicts); - - if (!isAliasConflictsFound) { - Integer precision = getFromMap(target.getFieldsPrecision(), targetFieldName); - Integer scale = getFromMap(target.getFieldsScale(), targetFieldName); - - qryFieldsToAdd.add(new QueryField( - targetFieldName, - targetFieldType, - targetFieldAlias, - !contains(target.getNotNullFields(), targetFieldName), - precision == null ? -1 : precision, - scale == null ? -1 : scale - )); - } - } - } - - return qryFieldsToAdd; - } - - /** - * Comparing local fields and target fields. - * - * @param target Query entity for check. - * @param conflicts Storage of conflicts. - * @return Indexes which exist in target and not exist in local. - */ - @NotNull private static Collection checkIndexes(QueryEntity locEntity, QueryEntity target, StringBuilder conflicts) { - HashSet indexesToAdd = new HashSet<>(); - - Map curIndexes = new HashMap<>(); - - for (QueryIndex idx : locEntity.getIndexes()) { - if (curIndexes.put(idx.getName(), idx) != null) - throw new IllegalStateException("Duplicate key"); - } - - for (QueryIndex qryIdx : target.getIndexes()) { - if (curIndexes.containsKey(qryIdx.getName())) { - checkEquals( - conflicts, - "index " + qryIdx.getName(), - curIndexes.get(qryIdx.getName()), - qryIdx - ); - } - else - indexesToAdd.add(qryIdx); - } - return indexesToAdd; - } - - /** - * @param collection Collection for checking. - * @param elementToCheck Element for checking to containing in collection. - * @return {@code true} if collection contain elementToCheck. - */ - private static boolean contains(Collection collection, String elementToCheck) { - return collection != null && collection.contains(elementToCheck); - } - - /** - * @return Value from sourceMap or null if map is null. - */ - private static V getFromMap(Map sourceMap, String key) { - return sourceMap == null ? null : sourceMap.get(key); - } - - /** - * Comparing two objects and add formatted text to conflicts if needed. - * - * @param conflicts Storage of conflicts resulting error message. - * @param name Name of comparing object. - * @param local Local object. - * @param received Received object. - */ - private static void checkEquals(StringBuilder conflicts, String name, V local, V received) { - if (!Objects.equals(local, received)) - conflicts.append(String.format("%s is different: local=%s, received=%s\n", name, local, received)); - } - - /** - * Checks if received query entity field has the alias which is already used by a field on the local node. - * - * @return Whether conflicts were found. - */ - private static boolean findAliasConflicts( - QueryEntity locEntity, - String targetFieldAlias, - String targetFieldName, - StringBuilder conflicts - ) { - for (Map.Entry entry : locEntity.getAliases().entrySet()) { - if (Objects.equals(entry.getValue(), targetFieldAlias)) { - conflicts.append(String.format( - "multiple fields are associated with the same alias: alias=%s, localField=%s, receivedField=%s\n", - targetFieldAlias, - entry.getKey(), - targetFieldName) - ); - - return true; - } - } - - return false; - } - /** * Private constructor. */ From b9680d22abc1b6e3a5dad580b6b50613f9874f43 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 28 May 2026 11:41:12 +0300 Subject: [PATCH 27/44] IGNITE-28733 Move QueryEntityPatch to internal --- modules/thin-client/api/README.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/thin-client/api/README.txt b/modules/thin-client/api/README.txt index a3562700500f6..33ccb7b94612e 100644 --- a/modules/thin-client/api/README.txt +++ b/modules/thin-client/api/README.txt @@ -1,4 +1,4 @@ -Apache Ignite Binary API Module +Apache Ignite Thin Client API Module ------------------------ ignite-thin-client-api module is internal module to separate thin-client API and implementation. From 496246daf6f34869fca35a27d768de23d13ebdd8 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 28 May 2026 12:14:10 +0300 Subject: [PATCH 28/44] IGNITE-28733 Move QueryEntityPatch to internal --- .../IgniteConfigurationDefaults.java | 33 ------------ .../configuration/CacheConfiguration.java | 51 ++++++++++++++++++- .../configuration/IgniteConfiguration.java | 14 ++++- .../client/ClientCacheConfiguration.java | 29 +++++++---- 4 files changed, 83 insertions(+), 44 deletions(-) delete mode 100644 modules/commons/src/main/java/org/apache/ignite/configuration/IgniteConfigurationDefaults.java diff --git a/modules/commons/src/main/java/org/apache/ignite/configuration/IgniteConfigurationDefaults.java b/modules/commons/src/main/java/org/apache/ignite/configuration/IgniteConfigurationDefaults.java deleted file mode 100644 index 25b8e7ced9418..0000000000000 --- a/modules/commons/src/main/java/org/apache/ignite/configuration/IgniteConfigurationDefaults.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.configuration; - -/** */ -public interface IgniteConfigurationDefaults { - /** Default rebalance batch size in bytes (value is {@code 512Kb}). */ - public static final int DFLT_REBALANCE_BATCH_SIZE = 512 * 1024; // 512K - - /** Default rebalance batches prefetch count (value is {@code 3}). */ - public static final long DFLT_REBALANCE_BATCHES_PREFETCH_COUNT = 3; - - /** Time to wait between rebalance messages in milliseconds to avoid overloading CPU (value is {@code 0}). */ - public static final long DFLT_REBALANCE_THROTTLE = 0; - - /** Default rebalance message timeout in milliseconds (value is {@code 10000}). */ - public static final long DFLT_REBALANCE_TIMEOUT = 10000; -} diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java index 4a8d52e81e770..7140c603e5cd8 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java @@ -79,10 +79,13 @@ * can be configured from Spring XML files (or other DI frameworks).

          Note that absolutely all configuration * properties are optional, so users should only change what they need. */ -public class CacheConfiguration extends MutableConfiguration implements CacheConfigurationDefaults { +public class CacheConfiguration extends MutableConfiguration { /** */ private static final long serialVersionUID = 0L; + /** Maximum number of partitions. */ + public static final int MAX_PARTITIONS_COUNT = 65000; + /** * Default size of rebalance thread pool. * @deprecated Use {@link IgniteConfiguration#DFLT_REBALANCE_THREAD_POOL_SIZE} instead. @@ -111,15 +114,37 @@ public class CacheConfiguration extends MutableConfiguration impleme @Deprecated public static final long DFLT_REBALANCE_THROTTLE = IgniteConfiguration.DFLT_REBALANCE_THROTTLE; + /** Default number of backups. */ + public static final int DFLT_BACKUPS = 0; + + /** Default caching mode. */ + public static final CacheMode DFLT_CACHE_MODE = CacheMode.PARTITIONED; + + /** Default atomicity mode. */ + public static final CacheAtomicityMode DFLT_CACHE_ATOMICITY_MODE = CacheAtomicityMode.ATOMIC; + + /** + * Default lock timeout. + * @deprecated Default lock timeout configuration property has no effect. + */ + @Deprecated + public static final long DFLT_LOCK_TIMEOUT = 0; + /** Default cache size to use with eviction policy. */ public static final int DFLT_CACHE_SIZE = 100000; + /** Default maximum inline size for sql indexes. */ + public static final int DFLT_SQL_INDEX_MAX_INLINE_SIZE = -1; + /** Initial default near cache size. */ public static final int DFLT_NEAR_START_SIZE = 1500000 / 4; /** Default value for 'invalidate' flag that indicates if this is invalidation-based cache. */ public static final boolean DFLT_INVALIDATE = false; + /** Default rebalance mode for distributed cache. */ + public static final CacheRebalanceMode DFLT_REBALANCE_MODE = CacheRebalanceMode.ASYNC; + /** * Default rebalance batch size in bytes. * @deprecated Use {@link IgniteConfiguration#DFLT_REBALANCE_BATCH_SIZE} instead. @@ -127,6 +152,12 @@ public class CacheConfiguration extends MutableConfiguration impleme @Deprecated public static final int DFLT_REBALANCE_BATCH_SIZE = IgniteConfiguration.DFLT_REBALANCE_BATCH_SIZE; + /** Default value for eager ttl flag. */ + public static final boolean DFLT_EAGER_TTL = true; + + /** Default value for 'maxConcurrentAsyncOps'. */ + public static final int DFLT_MAX_CONCURRENT_ASYNC_OPS = 500; + /** Default value for 'writeBehindEnabled' flag. */ public static final boolean DFLT_WRITE_BEHIND_ENABLED = false; @@ -148,9 +179,15 @@ public class CacheConfiguration extends MutableConfiguration impleme /** Default write coalescing for write-behind cache store. */ public static final boolean DFLT_WRITE_BEHIND_COALESCING = true; + /** Default maximum number of query iterators that can be stored. */ + public static final int DFLT_MAX_QUERY_ITERATOR_CNT = 1024; + /** Default value for load previous value flag. */ public static final boolean DFLT_LOAD_PREV_VAL = false; + /** Default value for 'readFromBackup' flag. */ + public static final boolean DFLT_READ_FROM_BACKUP = true; + /** Filter that accepts all nodes. */ public static final IgnitePredicate ALL_NODES = new IgniteAllNodesPredicate(); @@ -158,6 +195,9 @@ public class CacheConfiguration extends MutableConfiguration impleme @Deprecated public static final long DFLT_LONG_QRY_WARN_TIMEOUT = 3000; + /** Default number of queries detail metrics to collect. */ + public static final int DFLT_QRY_DETAIL_METRICS_SIZE = 0; + /** Default value for keep binary in store behavior . */ @SuppressWarnings({"UnnecessaryBoxing", "BooleanConstructorCall"}) public static final Boolean DFLT_STORE_KEEP_BINARY = new Boolean(false); @@ -165,6 +205,12 @@ public class CacheConfiguration extends MutableConfiguration impleme /** Default threshold for concurrent loading of keys from {@link CacheStore}. */ public static final int DFLT_CONCURRENT_LOAD_ALL_THRESHOLD = 5; + /** Default partition loss policy. */ + public static final PartitionLossPolicy DFLT_PARTITION_LOSS_POLICY = PartitionLossPolicy.IGNORE; + + /** Default query parallelism. */ + public static final int DFLT_QUERY_PARALLELISM = 1; + /** Default value for events disabled flag. */ public static final boolean DFLT_EVENTS_DISABLED = false; @@ -228,6 +274,9 @@ public class CacheConfiguration extends MutableConfiguration impleme /** Platform cache configuration. Enables native cache in platforms (.NET, ...). */ private PlatformCacheConfiguration platformCfg; + /** Default value for 'copyOnRead' flag. */ + public static final boolean DFLT_COPY_ON_READ = true; + /** Write synchronization mode. */ private CacheWriteSynchronizationMode writeSync; diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java index 481bbdeae118a..16d0bac76cf53 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java @@ -105,7 +105,7 @@ * For more information about grid configuration and startup refer to {@link Ignition} * documentation. */ -public class IgniteConfiguration implements IgniteConfigurationDefaults { +public class IgniteConfiguration { /** Courtesy notice log category. */ public static final String COURTESY_LOGGER_NAME = "org.apache.ignite.CourtesyConfigNotice"; @@ -166,6 +166,18 @@ public class IgniteConfiguration implements IgniteConfigurationDefaults { /** Default limit of threads used for rebalance. */ public static final int DFLT_REBALANCE_THREAD_POOL_SIZE = min(4, max(1, AVAILABLE_PROC_CNT / 4)); + /** Default rebalance message timeout in milliseconds (value is {@code 10000}). */ + public static final long DFLT_REBALANCE_TIMEOUT = 10000; + + /** Default rebalance batches prefetch count (value is {@code 3}). */ + public static final long DFLT_REBALANCE_BATCHES_PREFETCH_COUNT = 3; + + /** Time to wait between rebalance messages in milliseconds to avoid overloading CPU (value is {@code 0}). */ + public static final long DFLT_REBALANCE_THROTTLE = 0; + + /** Default rebalance batch size in bytes (value is {@code 512Kb}). */ + public static final int DFLT_REBALANCE_BATCH_SIZE = 512 * 1024; // 512K + /** Default size of system thread pool. */ public static final int DFLT_SYSTEM_CORE_THREAD_CNT = DFLT_PUBLIC_THREAD_CNT; diff --git a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java index bfe3edd4ee577..e896a0314561c 100644 --- a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java @@ -27,7 +27,6 @@ import org.apache.ignite.cache.PartitionLossPolicy; import org.apache.ignite.cache.QueryEntity; import org.apache.ignite.configuration.CacheConfigurationDefaults; -import org.apache.ignite.configuration.IgniteConfigurationDefaults; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.lang.IgniteExperimental; import org.jetbrains.annotations.Nullable; @@ -64,11 +63,17 @@ public final class ClientCacheConfiguration implements Serializable { /** @serial Read from backup. */ private boolean readFromBackup = CacheConfigurationDefaults.DFLT_READ_FROM_BACKUP; - /** @serial Rebalance batch size. */ - private int rebalanceBatchSize = IgniteConfigurationDefaults.DFLT_REBALANCE_BATCH_SIZE; + /** + * @serial Rebalance batch size. + * {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#DFLT_REBALANCE_BATCH_SIZE} + */ + private int rebalanceBatchSize = 512 * 1024; // 512K - /** @serial Rebalance batches prefetch count. */ - private long rebalanceBatchesPrefetchCnt = IgniteConfigurationDefaults.DFLT_REBALANCE_BATCHES_PREFETCH_COUNT; + /** + * @serial Rebalance batches prefetch count. + * {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#DFLT_REBALANCE_BATCHES_PREFETCH_COUNT} + */ + private long rebalanceBatchesPrefetchCnt = 3; /** @serial Rebalance delay. */ private long rebalanceDelay = 0; @@ -79,11 +84,17 @@ public final class ClientCacheConfiguration implements Serializable { /** @serial Rebalance order. */ private int rebalanceOrder = 0; - /** @serial Rebalance throttle. */ - private long rebalanceThrottle = IgniteConfigurationDefaults.DFLT_REBALANCE_THROTTLE; + /** + * @serial Rebalance throttle. + * {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#DFLT_REBALANCE_THROTTLE} + */ + private long rebalanceThrottle = 0; - /** @serial Rebalance timeout. */ - private long rebalanceTimeout = IgniteConfigurationDefaults.DFLT_REBALANCE_TIMEOUT; + /** + * @serial Rebalance timeout. + * {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#DFLT_REBALANCE_TIMEOUT} + */ + private long rebalanceTimeout = 10000; /** @serial Write synchronization mode. */ private CacheWriteSynchronizationMode writeSynchronizationMode = CacheWriteSynchronizationMode.PRIMARY_SYNC; From 7986e120df6c86073641bfdc151743e088167ff4 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 28 May 2026 12:34:35 +0300 Subject: [PATCH 29/44] IGNITE-28733 Move QueryEntityPatch to internal --- .../org/apache/ignite/cache/query/Query.java | 3 +- .../CacheConfigurationDefaults.java | 75 ------------------- .../client/ClientCacheConfiguration.java | 29 ++++--- 3 files changed, 15 insertions(+), 92 deletions(-) delete mode 100644 modules/commons/src/main/java/org/apache/ignite/configuration/CacheConfigurationDefaults.java diff --git a/modules/commons/src/main/java/org/apache/ignite/cache/query/Query.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/Query.java index 9138f79008f21..18383c0be38cf 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cache/query/Query.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/Query.java @@ -19,7 +19,6 @@ import java.io.Serializable; import java.util.Arrays; -import org.apache.ignite.configuration.CacheConfigurationDefaults; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.S; @@ -126,7 +125,7 @@ protected int[] prepare(int[] parts) { else if (sorted) validateDups(parts[i], parts[i + 1]); - A.ensure(0 <= parts[i] && parts[i] < CacheConfigurationDefaults.MAX_PARTITIONS_COUNT, "Illegal partition"); + A.ensure(0 <= parts[i] && parts[i] < 65000, "Illegal partition"); } // Sort and validate again. diff --git a/modules/commons/src/main/java/org/apache/ignite/configuration/CacheConfigurationDefaults.java b/modules/commons/src/main/java/org/apache/ignite/configuration/CacheConfigurationDefaults.java deleted file mode 100644 index ef940114c3e12..0000000000000 --- a/modules/commons/src/main/java/org/apache/ignite/configuration/CacheConfigurationDefaults.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.configuration; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.CacheRebalanceMode; -import org.apache.ignite.cache.PartitionLossPolicy; - -/** */ -public interface CacheConfigurationDefaults { - /** Default atomicity mode. */ - public static final CacheAtomicityMode DFLT_CACHE_ATOMICITY_MODE = CacheAtomicityMode.ATOMIC; - - /** Default number of backups. */ - public static final int DFLT_BACKUPS = 0; - - /** Default caching mode. */ - public static final CacheMode DFLT_CACHE_MODE = CacheMode.PARTITIONED; - - /** Default value for eager ttl flag. */ - public static final boolean DFLT_EAGER_TTL = true; - - /** - * Default lock timeout. - * @deprecated Default lock timeout configuration property has no effect. - */ - @Deprecated - public static final long DFLT_LOCK_TIMEOUT = 0; - - /** Default partition loss policy. */ - public static final PartitionLossPolicy DFLT_PARTITION_LOSS_POLICY = PartitionLossPolicy.IGNORE; - - /** Default value for 'readFromBackup' flag. */ - public static final boolean DFLT_READ_FROM_BACKUP = true; - - /** Default rebalance mode for distributed cache. */ - public static final CacheRebalanceMode DFLT_REBALANCE_MODE = CacheRebalanceMode.ASYNC; - - /** Default value for 'copyOnRead' flag. */ - public static final boolean DFLT_COPY_ON_READ = true; - - /** Default value for 'maxConcurrentAsyncOps'. */ - public static final int DFLT_MAX_CONCURRENT_ASYNC_OPS = 500; - - /** Default maximum number of query iterators that can be stored. */ - public static final int DFLT_MAX_QUERY_ITERATOR_CNT = 1024; - - /** Default number of queries detail metrics to collect. */ - public static final int DFLT_QRY_DETAIL_METRICS_SIZE = 0; - - /** Default query parallelism. */ - public static final int DFLT_QUERY_PARALLELISM = 1; - - /** Default maximum inline size for sql indexes. */ - public static final int DFLT_SQL_INDEX_MAX_INLINE_SIZE = -1; - - /** Maximum number of partitions. */ - public static final int MAX_PARTITIONS_COUNT = 65000; -} diff --git a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java index e896a0314561c..a400cf3c1420d 100644 --- a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java @@ -26,7 +26,6 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode; import org.apache.ignite.cache.PartitionLossPolicy; import org.apache.ignite.cache.QueryEntity; -import org.apache.ignite.configuration.CacheConfigurationDefaults; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.lang.IgniteExperimental; import org.jetbrains.annotations.Nullable; @@ -40,28 +39,28 @@ public final class ClientCacheConfiguration implements Serializable { private String name; /** @serial Atomicity mode. */ - private CacheAtomicityMode atomicityMode = CacheConfigurationDefaults.DFLT_CACHE_ATOMICITY_MODE; + private CacheAtomicityMode atomicityMode = CacheAtomicityMode.ATOMIC; /** @serial Backups. */ - private int backups = CacheConfigurationDefaults.DFLT_BACKUPS; + private int backups = 0; /** @serial Cache mode. */ - private CacheMode cacheMode = CacheConfigurationDefaults.DFLT_CACHE_MODE; + private CacheMode cacheMode = CacheMode.PARTITIONED; /** @serial Eager TTL flag. */ - private boolean eagerTtl = CacheConfigurationDefaults.DFLT_EAGER_TTL; + private boolean eagerTtl = true; /** @serial Group name. */ private String grpName = null; /** @serial Default lock timeout. */ - private long dfltLockTimeout = CacheConfigurationDefaults.DFLT_LOCK_TIMEOUT; + private long dfltLockTimeout = 0; /** @serial Partition loss policy. */ - private PartitionLossPolicy partLossPlc = CacheConfigurationDefaults.DFLT_PARTITION_LOSS_POLICY; + private PartitionLossPolicy partLossPlc = PartitionLossPolicy.IGNORE; /** @serial Read from backup. */ - private boolean readFromBackup = CacheConfigurationDefaults.DFLT_READ_FROM_BACKUP; + private boolean readFromBackup = true; /** * @serial Rebalance batch size. @@ -79,7 +78,7 @@ public final class ClientCacheConfiguration implements Serializable { private long rebalanceDelay = 0; /** @serial Rebalance mode. */ - private CacheRebalanceMode rebalanceMode = CacheConfigurationDefaults.DFLT_REBALANCE_MODE; + private CacheRebalanceMode rebalanceMode = CacheRebalanceMode.ASYNC; /** @serial Rebalance order. */ private int rebalanceOrder = 0; @@ -100,7 +99,7 @@ public final class ClientCacheConfiguration implements Serializable { private CacheWriteSynchronizationMode writeSynchronizationMode = CacheWriteSynchronizationMode.PRIMARY_SYNC; /** @serial Copy on read. */ - private boolean cpOnRead = CacheConfigurationDefaults.DFLT_COPY_ON_READ; + private boolean cpOnRead = true; /** @serial Data region name. */ private String dataRegionName = null; @@ -109,25 +108,25 @@ public final class ClientCacheConfiguration implements Serializable { private boolean statisticsEnabled = false; /** @serial Max concurrent async operations. */ - private int maxConcurrentAsyncOperations = CacheConfigurationDefaults.DFLT_MAX_CONCURRENT_ASYNC_OPS; + private int maxConcurrentAsyncOperations = 500; /** @serial Max query iterators count. */ - private int maxQryIteratorsCnt = CacheConfigurationDefaults.DFLT_MAX_QUERY_ITERATOR_CNT; + private int maxQryIteratorsCnt = 1024; /** @serial Onheap cache enabled. */ private boolean onheapCacheEnabled = false; /** @serial Query detail metrics size. */ - private int qryDetailMetricsSize = CacheConfigurationDefaults.DFLT_QRY_DETAIL_METRICS_SIZE; + private int qryDetailMetricsSize = 0; /** @serial Query parallelism. */ - private int qryParallelism = CacheConfigurationDefaults.DFLT_QUERY_PARALLELISM; + private int qryParallelism = 1; /** @serial Sql escape all. */ private boolean sqlEscapeAll = false; /** @serial Sql index max inline size. */ - private int sqlIdxMaxInlineSize = CacheConfigurationDefaults.DFLT_SQL_INDEX_MAX_INLINE_SIZE; + private int sqlIdxMaxInlineSize = -1; /** @serial Sql schema. */ private String sqlSchema = null; From 62a51560968e4b996e081db559d74113694118f4 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 28 May 2026 14:07:00 +0300 Subject: [PATCH 30/44] Revert "IGNITE-28733 Move QueryEntityPatch to internal" This reverts commit 496246daf6f34869fca35a27d768de23d13ebdd8. --- .../IgniteConfigurationDefaults.java | 33 +++++++++++ .../configuration/CacheConfiguration.java | 51 +--------------- .../configuration/IgniteConfiguration.java | 14 +---- .../client/ClientCacheConfiguration.java | 58 ++++++++----------- 4 files changed, 59 insertions(+), 97 deletions(-) create mode 100644 modules/commons/src/main/java/org/apache/ignite/configuration/IgniteConfigurationDefaults.java diff --git a/modules/commons/src/main/java/org/apache/ignite/configuration/IgniteConfigurationDefaults.java b/modules/commons/src/main/java/org/apache/ignite/configuration/IgniteConfigurationDefaults.java new file mode 100644 index 0000000000000..25b8e7ced9418 --- /dev/null +++ b/modules/commons/src/main/java/org/apache/ignite/configuration/IgniteConfigurationDefaults.java @@ -0,0 +1,33 @@ +/* + * 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.configuration; + +/** */ +public interface IgniteConfigurationDefaults { + /** Default rebalance batch size in bytes (value is {@code 512Kb}). */ + public static final int DFLT_REBALANCE_BATCH_SIZE = 512 * 1024; // 512K + + /** Default rebalance batches prefetch count (value is {@code 3}). */ + public static final long DFLT_REBALANCE_BATCHES_PREFETCH_COUNT = 3; + + /** Time to wait between rebalance messages in milliseconds to avoid overloading CPU (value is {@code 0}). */ + public static final long DFLT_REBALANCE_THROTTLE = 0; + + /** Default rebalance message timeout in milliseconds (value is {@code 10000}). */ + public static final long DFLT_REBALANCE_TIMEOUT = 10000; +} diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java index 7140c603e5cd8..4a8d52e81e770 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java @@ -79,13 +79,10 @@ * can be configured from Spring XML files (or other DI frameworks).

          Note that absolutely all configuration * properties are optional, so users should only change what they need. */ -public class CacheConfiguration extends MutableConfiguration { +public class CacheConfiguration extends MutableConfiguration implements CacheConfigurationDefaults { /** */ private static final long serialVersionUID = 0L; - /** Maximum number of partitions. */ - public static final int MAX_PARTITIONS_COUNT = 65000; - /** * Default size of rebalance thread pool. * @deprecated Use {@link IgniteConfiguration#DFLT_REBALANCE_THREAD_POOL_SIZE} instead. @@ -114,37 +111,15 @@ public class CacheConfiguration extends MutableConfiguration { @Deprecated public static final long DFLT_REBALANCE_THROTTLE = IgniteConfiguration.DFLT_REBALANCE_THROTTLE; - /** Default number of backups. */ - public static final int DFLT_BACKUPS = 0; - - /** Default caching mode. */ - public static final CacheMode DFLT_CACHE_MODE = CacheMode.PARTITIONED; - - /** Default atomicity mode. */ - public static final CacheAtomicityMode DFLT_CACHE_ATOMICITY_MODE = CacheAtomicityMode.ATOMIC; - - /** - * Default lock timeout. - * @deprecated Default lock timeout configuration property has no effect. - */ - @Deprecated - public static final long DFLT_LOCK_TIMEOUT = 0; - /** Default cache size to use with eviction policy. */ public static final int DFLT_CACHE_SIZE = 100000; - /** Default maximum inline size for sql indexes. */ - public static final int DFLT_SQL_INDEX_MAX_INLINE_SIZE = -1; - /** Initial default near cache size. */ public static final int DFLT_NEAR_START_SIZE = 1500000 / 4; /** Default value for 'invalidate' flag that indicates if this is invalidation-based cache. */ public static final boolean DFLT_INVALIDATE = false; - /** Default rebalance mode for distributed cache. */ - public static final CacheRebalanceMode DFLT_REBALANCE_MODE = CacheRebalanceMode.ASYNC; - /** * Default rebalance batch size in bytes. * @deprecated Use {@link IgniteConfiguration#DFLT_REBALANCE_BATCH_SIZE} instead. @@ -152,12 +127,6 @@ public class CacheConfiguration extends MutableConfiguration { @Deprecated public static final int DFLT_REBALANCE_BATCH_SIZE = IgniteConfiguration.DFLT_REBALANCE_BATCH_SIZE; - /** Default value for eager ttl flag. */ - public static final boolean DFLT_EAGER_TTL = true; - - /** Default value for 'maxConcurrentAsyncOps'. */ - public static final int DFLT_MAX_CONCURRENT_ASYNC_OPS = 500; - /** Default value for 'writeBehindEnabled' flag. */ public static final boolean DFLT_WRITE_BEHIND_ENABLED = false; @@ -179,15 +148,9 @@ public class CacheConfiguration extends MutableConfiguration { /** Default write coalescing for write-behind cache store. */ public static final boolean DFLT_WRITE_BEHIND_COALESCING = true; - /** Default maximum number of query iterators that can be stored. */ - public static final int DFLT_MAX_QUERY_ITERATOR_CNT = 1024; - /** Default value for load previous value flag. */ public static final boolean DFLT_LOAD_PREV_VAL = false; - /** Default value for 'readFromBackup' flag. */ - public static final boolean DFLT_READ_FROM_BACKUP = true; - /** Filter that accepts all nodes. */ public static final IgnitePredicate ALL_NODES = new IgniteAllNodesPredicate(); @@ -195,9 +158,6 @@ public class CacheConfiguration extends MutableConfiguration { @Deprecated public static final long DFLT_LONG_QRY_WARN_TIMEOUT = 3000; - /** Default number of queries detail metrics to collect. */ - public static final int DFLT_QRY_DETAIL_METRICS_SIZE = 0; - /** Default value for keep binary in store behavior . */ @SuppressWarnings({"UnnecessaryBoxing", "BooleanConstructorCall"}) public static final Boolean DFLT_STORE_KEEP_BINARY = new Boolean(false); @@ -205,12 +165,6 @@ public class CacheConfiguration extends MutableConfiguration { /** Default threshold for concurrent loading of keys from {@link CacheStore}. */ public static final int DFLT_CONCURRENT_LOAD_ALL_THRESHOLD = 5; - /** Default partition loss policy. */ - public static final PartitionLossPolicy DFLT_PARTITION_LOSS_POLICY = PartitionLossPolicy.IGNORE; - - /** Default query parallelism. */ - public static final int DFLT_QUERY_PARALLELISM = 1; - /** Default value for events disabled flag. */ public static final boolean DFLT_EVENTS_DISABLED = false; @@ -274,9 +228,6 @@ public class CacheConfiguration extends MutableConfiguration { /** Platform cache configuration. Enables native cache in platforms (.NET, ...). */ private PlatformCacheConfiguration platformCfg; - /** Default value for 'copyOnRead' flag. */ - public static final boolean DFLT_COPY_ON_READ = true; - /** Write synchronization mode. */ private CacheWriteSynchronizationMode writeSync; diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java index 16d0bac76cf53..481bbdeae118a 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java @@ -105,7 +105,7 @@ * For more information about grid configuration and startup refer to {@link Ignition} * documentation. */ -public class IgniteConfiguration { +public class IgniteConfiguration implements IgniteConfigurationDefaults { /** Courtesy notice log category. */ public static final String COURTESY_LOGGER_NAME = "org.apache.ignite.CourtesyConfigNotice"; @@ -166,18 +166,6 @@ public class IgniteConfiguration { /** Default limit of threads used for rebalance. */ public static final int DFLT_REBALANCE_THREAD_POOL_SIZE = min(4, max(1, AVAILABLE_PROC_CNT / 4)); - /** Default rebalance message timeout in milliseconds (value is {@code 10000}). */ - public static final long DFLT_REBALANCE_TIMEOUT = 10000; - - /** Default rebalance batches prefetch count (value is {@code 3}). */ - public static final long DFLT_REBALANCE_BATCHES_PREFETCH_COUNT = 3; - - /** Time to wait between rebalance messages in milliseconds to avoid overloading CPU (value is {@code 0}). */ - public static final long DFLT_REBALANCE_THROTTLE = 0; - - /** Default rebalance batch size in bytes (value is {@code 512Kb}). */ - public static final int DFLT_REBALANCE_BATCH_SIZE = 512 * 1024; // 512K - /** Default size of system thread pool. */ public static final int DFLT_SYSTEM_CORE_THREAD_CNT = DFLT_PUBLIC_THREAD_CNT; diff --git a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java index a400cf3c1420d..bfe3edd4ee577 100644 --- a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java @@ -26,6 +26,8 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode; import org.apache.ignite.cache.PartitionLossPolicy; import org.apache.ignite.cache.QueryEntity; +import org.apache.ignite.configuration.CacheConfigurationDefaults; +import org.apache.ignite.configuration.IgniteConfigurationDefaults; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.lang.IgniteExperimental; import org.jetbrains.annotations.Nullable; @@ -39,67 +41,55 @@ public final class ClientCacheConfiguration implements Serializable { private String name; /** @serial Atomicity mode. */ - private CacheAtomicityMode atomicityMode = CacheAtomicityMode.ATOMIC; + private CacheAtomicityMode atomicityMode = CacheConfigurationDefaults.DFLT_CACHE_ATOMICITY_MODE; /** @serial Backups. */ - private int backups = 0; + private int backups = CacheConfigurationDefaults.DFLT_BACKUPS; /** @serial Cache mode. */ - private CacheMode cacheMode = CacheMode.PARTITIONED; + private CacheMode cacheMode = CacheConfigurationDefaults.DFLT_CACHE_MODE; /** @serial Eager TTL flag. */ - private boolean eagerTtl = true; + private boolean eagerTtl = CacheConfigurationDefaults.DFLT_EAGER_TTL; /** @serial Group name. */ private String grpName = null; /** @serial Default lock timeout. */ - private long dfltLockTimeout = 0; + private long dfltLockTimeout = CacheConfigurationDefaults.DFLT_LOCK_TIMEOUT; /** @serial Partition loss policy. */ - private PartitionLossPolicy partLossPlc = PartitionLossPolicy.IGNORE; + private PartitionLossPolicy partLossPlc = CacheConfigurationDefaults.DFLT_PARTITION_LOSS_POLICY; /** @serial Read from backup. */ - private boolean readFromBackup = true; + private boolean readFromBackup = CacheConfigurationDefaults.DFLT_READ_FROM_BACKUP; - /** - * @serial Rebalance batch size. - * {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#DFLT_REBALANCE_BATCH_SIZE} - */ - private int rebalanceBatchSize = 512 * 1024; // 512K + /** @serial Rebalance batch size. */ + private int rebalanceBatchSize = IgniteConfigurationDefaults.DFLT_REBALANCE_BATCH_SIZE; - /** - * @serial Rebalance batches prefetch count. - * {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#DFLT_REBALANCE_BATCHES_PREFETCH_COUNT} - */ - private long rebalanceBatchesPrefetchCnt = 3; + /** @serial Rebalance batches prefetch count. */ + private long rebalanceBatchesPrefetchCnt = IgniteConfigurationDefaults.DFLT_REBALANCE_BATCHES_PREFETCH_COUNT; /** @serial Rebalance delay. */ private long rebalanceDelay = 0; /** @serial Rebalance mode. */ - private CacheRebalanceMode rebalanceMode = CacheRebalanceMode.ASYNC; + private CacheRebalanceMode rebalanceMode = CacheConfigurationDefaults.DFLT_REBALANCE_MODE; /** @serial Rebalance order. */ private int rebalanceOrder = 0; - /** - * @serial Rebalance throttle. - * {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#DFLT_REBALANCE_THROTTLE} - */ - private long rebalanceThrottle = 0; + /** @serial Rebalance throttle. */ + private long rebalanceThrottle = IgniteConfigurationDefaults.DFLT_REBALANCE_THROTTLE; - /** - * @serial Rebalance timeout. - * {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#DFLT_REBALANCE_TIMEOUT} - */ - private long rebalanceTimeout = 10000; + /** @serial Rebalance timeout. */ + private long rebalanceTimeout = IgniteConfigurationDefaults.DFLT_REBALANCE_TIMEOUT; /** @serial Write synchronization mode. */ private CacheWriteSynchronizationMode writeSynchronizationMode = CacheWriteSynchronizationMode.PRIMARY_SYNC; /** @serial Copy on read. */ - private boolean cpOnRead = true; + private boolean cpOnRead = CacheConfigurationDefaults.DFLT_COPY_ON_READ; /** @serial Data region name. */ private String dataRegionName = null; @@ -108,25 +98,25 @@ public final class ClientCacheConfiguration implements Serializable { private boolean statisticsEnabled = false; /** @serial Max concurrent async operations. */ - private int maxConcurrentAsyncOperations = 500; + private int maxConcurrentAsyncOperations = CacheConfigurationDefaults.DFLT_MAX_CONCURRENT_ASYNC_OPS; /** @serial Max query iterators count. */ - private int maxQryIteratorsCnt = 1024; + private int maxQryIteratorsCnt = CacheConfigurationDefaults.DFLT_MAX_QUERY_ITERATOR_CNT; /** @serial Onheap cache enabled. */ private boolean onheapCacheEnabled = false; /** @serial Query detail metrics size. */ - private int qryDetailMetricsSize = 0; + private int qryDetailMetricsSize = CacheConfigurationDefaults.DFLT_QRY_DETAIL_METRICS_SIZE; /** @serial Query parallelism. */ - private int qryParallelism = 1; + private int qryParallelism = CacheConfigurationDefaults.DFLT_QUERY_PARALLELISM; /** @serial Sql escape all. */ private boolean sqlEscapeAll = false; /** @serial Sql index max inline size. */ - private int sqlIdxMaxInlineSize = -1; + private int sqlIdxMaxInlineSize = CacheConfigurationDefaults.DFLT_SQL_INDEX_MAX_INLINE_SIZE; /** @serial Sql schema. */ private String sqlSchema = null; From e00ca4ec3afe396975125779a072087fcd95dea5 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 28 May 2026 14:07:15 +0300 Subject: [PATCH 31/44] Revert "IGNITE-28733 Move QueryEntityPatch to internal" This reverts commit 7986e120 --- .../org/apache/ignite/cache/query/Query.java | 3 +- .../CacheConfigurationDefaults.java | 75 +++++++++++++++++++ .../clients/JavaThinCompatibilityTest.java | 1 + modules/core/pom.xml | 2 +- .../client/ClientCacheConfiguration.java | 29 ++++--- 5 files changed, 99 insertions(+), 11 deletions(-) create mode 100644 modules/commons/src/main/java/org/apache/ignite/configuration/CacheConfigurationDefaults.java diff --git a/modules/commons/src/main/java/org/apache/ignite/cache/query/Query.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/Query.java index 18383c0be38cf..9138f79008f21 100644 --- a/modules/commons/src/main/java/org/apache/ignite/cache/query/Query.java +++ b/modules/commons/src/main/java/org/apache/ignite/cache/query/Query.java @@ -19,6 +19,7 @@ import java.io.Serializable; import java.util.Arrays; +import org.apache.ignite.configuration.CacheConfigurationDefaults; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.S; @@ -125,7 +126,7 @@ protected int[] prepare(int[] parts) { else if (sorted) validateDups(parts[i], parts[i + 1]); - A.ensure(0 <= parts[i] && parts[i] < 65000, "Illegal partition"); + A.ensure(0 <= parts[i] && parts[i] < CacheConfigurationDefaults.MAX_PARTITIONS_COUNT, "Illegal partition"); } // Sort and validate again. diff --git a/modules/commons/src/main/java/org/apache/ignite/configuration/CacheConfigurationDefaults.java b/modules/commons/src/main/java/org/apache/ignite/configuration/CacheConfigurationDefaults.java new file mode 100644 index 0000000000000..ef940114c3e12 --- /dev/null +++ b/modules/commons/src/main/java/org/apache/ignite/configuration/CacheConfigurationDefaults.java @@ -0,0 +1,75 @@ +/* + * 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.configuration; + +import org.apache.ignite.cache.CacheAtomicityMode; +import org.apache.ignite.cache.CacheMode; +import org.apache.ignite.cache.CacheRebalanceMode; +import org.apache.ignite.cache.PartitionLossPolicy; + +/** */ +public interface CacheConfigurationDefaults { + /** Default atomicity mode. */ + public static final CacheAtomicityMode DFLT_CACHE_ATOMICITY_MODE = CacheAtomicityMode.ATOMIC; + + /** Default number of backups. */ + public static final int DFLT_BACKUPS = 0; + + /** Default caching mode. */ + public static final CacheMode DFLT_CACHE_MODE = CacheMode.PARTITIONED; + + /** Default value for eager ttl flag. */ + public static final boolean DFLT_EAGER_TTL = true; + + /** + * Default lock timeout. + * @deprecated Default lock timeout configuration property has no effect. + */ + @Deprecated + public static final long DFLT_LOCK_TIMEOUT = 0; + + /** Default partition loss policy. */ + public static final PartitionLossPolicy DFLT_PARTITION_LOSS_POLICY = PartitionLossPolicy.IGNORE; + + /** Default value for 'readFromBackup' flag. */ + public static final boolean DFLT_READ_FROM_BACKUP = true; + + /** Default rebalance mode for distributed cache. */ + public static final CacheRebalanceMode DFLT_REBALANCE_MODE = CacheRebalanceMode.ASYNC; + + /** Default value for 'copyOnRead' flag. */ + public static final boolean DFLT_COPY_ON_READ = true; + + /** Default value for 'maxConcurrentAsyncOps'. */ + public static final int DFLT_MAX_CONCURRENT_ASYNC_OPS = 500; + + /** Default maximum number of query iterators that can be stored. */ + public static final int DFLT_MAX_QUERY_ITERATOR_CNT = 1024; + + /** Default number of queries detail metrics to collect. */ + public static final int DFLT_QRY_DETAIL_METRICS_SIZE = 0; + + /** Default query parallelism. */ + public static final int DFLT_QUERY_PARALLELISM = 1; + + /** Default maximum inline size for sql indexes. */ + public static final int DFLT_SQL_INDEX_MAX_INLINE_SIZE = -1; + + /** Maximum number of partitions. */ + public static final int MAX_PARTITIONS_COUNT = 65000; +} diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/clients/JavaThinCompatibilityTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/clients/JavaThinCompatibilityTest.java index 271a45a8660a7..2f822592cea7c 100644 --- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/clients/JavaThinCompatibilityTest.java +++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/clients/JavaThinCompatibilityTest.java @@ -184,6 +184,7 @@ private void testCacheConfiguration( if (checkExpiryPlc) ccfg.setExpiryPolicy(new PlatformExpiryPolicy(10, 20, 30)); + //X.println(">>> Cache config: " + ccfg); client.createCache(ccfg); ClientCacheConfiguration ccfg1 = client.cache(cacheName).getConfiguration(); diff --git a/modules/core/pom.xml b/modules/core/pom.xml index 1bc7767adac0d..959a706488e3c 100644 --- a/modules/core/pom.xml +++ b/modules/core/pom.xml @@ -72,7 +72,7 @@ ${project.groupId} ignite-binary-impl - runtime + compile diff --git a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java index bfe3edd4ee577..e896a0314561c 100644 --- a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java @@ -27,7 +27,6 @@ import org.apache.ignite.cache.PartitionLossPolicy; import org.apache.ignite.cache.QueryEntity; import org.apache.ignite.configuration.CacheConfigurationDefaults; -import org.apache.ignite.configuration.IgniteConfigurationDefaults; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.lang.IgniteExperimental; import org.jetbrains.annotations.Nullable; @@ -64,11 +63,17 @@ public final class ClientCacheConfiguration implements Serializable { /** @serial Read from backup. */ private boolean readFromBackup = CacheConfigurationDefaults.DFLT_READ_FROM_BACKUP; - /** @serial Rebalance batch size. */ - private int rebalanceBatchSize = IgniteConfigurationDefaults.DFLT_REBALANCE_BATCH_SIZE; + /** + * @serial Rebalance batch size. + * {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#DFLT_REBALANCE_BATCH_SIZE} + */ + private int rebalanceBatchSize = 512 * 1024; // 512K - /** @serial Rebalance batches prefetch count. */ - private long rebalanceBatchesPrefetchCnt = IgniteConfigurationDefaults.DFLT_REBALANCE_BATCHES_PREFETCH_COUNT; + /** + * @serial Rebalance batches prefetch count. + * {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#DFLT_REBALANCE_BATCHES_PREFETCH_COUNT} + */ + private long rebalanceBatchesPrefetchCnt = 3; /** @serial Rebalance delay. */ private long rebalanceDelay = 0; @@ -79,11 +84,17 @@ public final class ClientCacheConfiguration implements Serializable { /** @serial Rebalance order. */ private int rebalanceOrder = 0; - /** @serial Rebalance throttle. */ - private long rebalanceThrottle = IgniteConfigurationDefaults.DFLT_REBALANCE_THROTTLE; + /** + * @serial Rebalance throttle. + * {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#DFLT_REBALANCE_THROTTLE} + */ + private long rebalanceThrottle = 0; - /** @serial Rebalance timeout. */ - private long rebalanceTimeout = IgniteConfigurationDefaults.DFLT_REBALANCE_TIMEOUT; + /** + * @serial Rebalance timeout. + * {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#DFLT_REBALANCE_TIMEOUT} + */ + private long rebalanceTimeout = 10000; /** @serial Write synchronization mode. */ private CacheWriteSynchronizationMode writeSynchronizationMode = CacheWriteSynchronizationMode.PRIMARY_SYNC; From 5266b2fcc4c1593785acef49e183d6055319a60a Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 28 May 2026 14:38:22 +0300 Subject: [PATCH 32/44] Fix compatibility tests --- modules/compatibility/pom.xml | 6 ++++++ .../junits/IgniteCompatibilityAbstractTest.java | 17 +++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/modules/compatibility/pom.xml b/modules/compatibility/pom.xml index cd6bdf794dec6..232cd0b635f2b 100644 --- a/modules/compatibility/pom.xml +++ b/modules/compatibility/pom.xml @@ -70,6 +70,12 @@ test + + ${project.groupId} + ignite-commons + test + + ${project.groupId} ignite-tools diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java index 6266ea6f9899d..b5bf5d91595b1 100644 --- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java +++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java @@ -289,10 +289,23 @@ protected Set getExcluded(String ver, Collection dependencie // Exclude all modules necessary to compile the current version of core module to avoid conflicts with previous versions. // When building with TeamCity, JAR files named according to their artifact IDs are added to the classpath. - excluded.addAll(Set.of("ignite-binary-api", "ignite-binary-impl", "ignite-commons", "ignite-grid-unsafe")); + excluded.addAll(Set.of( + "ignite-binary-api", + "ignite-binary-impl", + "ignite-commons", + "ignite-grid-unsafe", + "ignite-thin-client-api" + )); // During local development, classes from the target directory (for example, ignite/modules/commons/target/classes) // are included in the classpath. - excluded.addAll(Set.of("modules/core", "modules/binary/api", "modules/binary/impl", "modules/commons", "modules/unsafe")); + excluded.addAll(Set.of( + "modules/core", + "modules/binary/api", + "modules/binary/impl", + "modules/commons", + "modules/unsafe", + "modules/thin-client/api" + )); return excluded; } From 8994bbda267ddb3b4ff56aa08eed76b2e10ddbd7 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 28 May 2026 14:42:47 +0300 Subject: [PATCH 33/44] Fix compatibility tests --- .../client/ClientCacheConfiguration.java | 29 ++++++------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java index e896a0314561c..bfe3edd4ee577 100644 --- a/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java +++ b/modules/thin-client/api/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java @@ -27,6 +27,7 @@ import org.apache.ignite.cache.PartitionLossPolicy; import org.apache.ignite.cache.QueryEntity; import org.apache.ignite.configuration.CacheConfigurationDefaults; +import org.apache.ignite.configuration.IgniteConfigurationDefaults; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.lang.IgniteExperimental; import org.jetbrains.annotations.Nullable; @@ -63,17 +64,11 @@ public final class ClientCacheConfiguration implements Serializable { /** @serial Read from backup. */ private boolean readFromBackup = CacheConfigurationDefaults.DFLT_READ_FROM_BACKUP; - /** - * @serial Rebalance batch size. - * {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#DFLT_REBALANCE_BATCH_SIZE} - */ - private int rebalanceBatchSize = 512 * 1024; // 512K + /** @serial Rebalance batch size. */ + private int rebalanceBatchSize = IgniteConfigurationDefaults.DFLT_REBALANCE_BATCH_SIZE; - /** - * @serial Rebalance batches prefetch count. - * {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#DFLT_REBALANCE_BATCHES_PREFETCH_COUNT} - */ - private long rebalanceBatchesPrefetchCnt = 3; + /** @serial Rebalance batches prefetch count. */ + private long rebalanceBatchesPrefetchCnt = IgniteConfigurationDefaults.DFLT_REBALANCE_BATCHES_PREFETCH_COUNT; /** @serial Rebalance delay. */ private long rebalanceDelay = 0; @@ -84,17 +79,11 @@ public final class ClientCacheConfiguration implements Serializable { /** @serial Rebalance order. */ private int rebalanceOrder = 0; - /** - * @serial Rebalance throttle. - * {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#DFLT_REBALANCE_THROTTLE} - */ - private long rebalanceThrottle = 0; + /** @serial Rebalance throttle. */ + private long rebalanceThrottle = IgniteConfigurationDefaults.DFLT_REBALANCE_THROTTLE; - /** - * @serial Rebalance timeout. - * {@ignitelink org.apache.ignite.configuration.IgniteConfiguration#DFLT_REBALANCE_TIMEOUT} - */ - private long rebalanceTimeout = 10000; + /** @serial Rebalance timeout. */ + private long rebalanceTimeout = IgniteConfigurationDefaults.DFLT_REBALANCE_TIMEOUT; /** @serial Write synchronization mode. */ private CacheWriteSynchronizationMode writeSynchronizationMode = CacheWriteSynchronizationMode.PRIMARY_SYNC; From 34f1dd758e03ce38b9acc227ca81c2381c910765 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 28 May 2026 14:48:06 +0300 Subject: [PATCH 34/44] Fix compatibility tests --- .../ignite/compatibility/clients/JavaThinCompatibilityTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/clients/JavaThinCompatibilityTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/clients/JavaThinCompatibilityTest.java index 2f822592cea7c..271a45a8660a7 100644 --- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/clients/JavaThinCompatibilityTest.java +++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/clients/JavaThinCompatibilityTest.java @@ -184,7 +184,6 @@ private void testCacheConfiguration( if (checkExpiryPlc) ccfg.setExpiryPolicy(new PlatformExpiryPolicy(10, 20, 30)); - //X.println(">>> Cache config: " + ccfg); client.createCache(ccfg); ClientCacheConfiguration ccfg1 = client.cache(cacheName).getConfiguration(); From 4f2a9929df972229caa0da70cd316b04147f852f Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 29 May 2026 09:16:04 +0300 Subject: [PATCH 35/44] Fix compatibility tests --- .../platforms/dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs index a869e8e25ae44..68ccbc5e957d4 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs @@ -98,6 +98,7 @@ private static void AppendHomeClasspath(string ggHome, bool forceTestClasspath, AppendTestClasses(Path.Combine(ggHome, "examples"), cpStr); AppendTestClasses(Path.Combine(ggHome, "modules"), cpStr); AppendTestClasses(Path.Combine(ggHome, "modules", "binary"), cpStr); + AppendTestClasses(Path.Combine(ggHome, "modules", "thin-client"), cpStr); AppendTestClasses(Path.Combine(ggHome, "modules", "extdata", "platform"), cpStr); } From 160c9a9a8312870f193c6bd1fee2d31b0ea8a312 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 29 May 2026 09:27:47 +0300 Subject: [PATCH 36/44] Fix compatibility tests --- .../internal/processors/affinity/AffinityTopologyVersion.java | 0 .../org/apache/ignite/internal/client/thin/ClientChannel.java | 0 .../apache/ignite/internal/client/thin/PayloadInputChannel.java | 0 .../apache/ignite/internal/client/thin/PayloadOutputChannel.java | 0 .../org/apache/ignite/internal/client/thin/ReliableChannelEx.java | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/processors/affinity/AffinityTopologyVersion.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientChannel.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/PayloadInputChannel.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/PayloadOutputChannel.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ReliableChannelEx.java (100%) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/AffinityTopologyVersion.java b/modules/commons/src/main/java/org/apache/ignite/internal/processors/affinity/AffinityTopologyVersion.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/AffinityTopologyVersion.java rename to modules/commons/src/main/java/org/apache/ignite/internal/processors/affinity/AffinityTopologyVersion.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientChannel.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientChannel.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientChannel.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientChannel.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/PayloadInputChannel.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/PayloadInputChannel.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/PayloadInputChannel.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/PayloadInputChannel.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/PayloadOutputChannel.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/PayloadOutputChannel.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/PayloadOutputChannel.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/PayloadOutputChannel.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ReliableChannelEx.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ReliableChannelEx.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ReliableChannelEx.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ReliableChannelEx.java From b0019c14cbd20ce50e278bcef7c0f43458025467 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 29 May 2026 09:32:28 +0300 Subject: [PATCH 37/44] Fix compatibility tests --- .../src/main/java/org/apache/ignite/logger/NullLogger.java | 0 .../internal/client/monitoring/EventListenerDemultiplexer.java | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename modules/{core => commons}/src/main/java/org/apache/ignite/logger/NullLogger.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/monitoring/EventListenerDemultiplexer.java (100%) diff --git a/modules/core/src/main/java/org/apache/ignite/logger/NullLogger.java b/modules/commons/src/main/java/org/apache/ignite/logger/NullLogger.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/logger/NullLogger.java rename to modules/commons/src/main/java/org/apache/ignite/logger/NullLogger.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/monitoring/EventListenerDemultiplexer.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/monitoring/EventListenerDemultiplexer.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/monitoring/EventListenerDemultiplexer.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/monitoring/EventListenerDemultiplexer.java From 8abe658c88f3a057a4a4ffc94328a6f666cf90c0 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 29 May 2026 09:43:29 +0300 Subject: [PATCH 38/44] Fix compatibility tests --- .../internal/client/thin/ClientInternalBinaryConfiguration.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientInternalBinaryConfiguration.java (100%) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientInternalBinaryConfiguration.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientInternalBinaryConfiguration.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientInternalBinaryConfiguration.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientInternalBinaryConfiguration.java From 6450ec011d48bd5959bed17156b3c90d04ae3620 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 29 May 2026 09:51:43 +0300 Subject: [PATCH 39/44] Fix compatibility tests --- .../org/apache/ignite/internal/util/CommonUtils.java | 9 +++++++++ .../apache/ignite/ssl/AbstractSslContextFactory.java | 3 ++- .../java/org/apache/ignite/ssl/SslContextFactory.java | 7 ++++--- .../ignite/internal/client/thin/ClientSslUtils.java | 10 ++++------ 4 files changed, 19 insertions(+), 10 deletions(-) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientSslUtils.java (97%) diff --git a/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java index e87513b9b0aae..d8601993142e0 100644 --- a/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java +++ b/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java @@ -241,6 +241,15 @@ public abstract class CommonUtils { /** Field name for value. */ public static final String VAL_FIELD_NAME = "_VAL"; + /** Default key / trust store type. */ + public static final String DFLT_STORE_TYPE = System.getProperty("javax.net.ssl.keyStoreType", "JKS"); + + /** Default SSL protocol. */ + public static final String DFLT_SSL_PROTOCOL = "TLS"; + + /** Default key manager / trust manager algorithm. Specifying different trust manager algorithm is not supported. */ + public static final String DFLT_KEY_ALGORITHM = System.getProperty("ssl.KeyManagerFactory.algorithm", "SunX509"); + /** Byte bit-mask. */ private static final int MASK = 0xf; diff --git a/modules/core/src/main/java/org/apache/ignite/ssl/AbstractSslContextFactory.java b/modules/core/src/main/java/org/apache/ignite/ssl/AbstractSslContextFactory.java index 77dedf84eba78..61a291a85fa6b 100644 --- a/modules/core/src/main/java/org/apache/ignite/ssl/AbstractSslContextFactory.java +++ b/modules/core/src/main/java/org/apache/ignite/ssl/AbstractSslContextFactory.java @@ -27,6 +27,7 @@ import javax.net.ssl.SSLParameters; import javax.net.ssl.TrustManager; import org.apache.ignite.IgniteException; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.typedef.internal.A; /** @@ -39,7 +40,7 @@ public abstract class AbstractSslContextFactory implements Factory { private static final long serialVersionUID = 0L; /** Default SSL protocol. */ - public static final String DFLT_SSL_PROTOCOL = "TLS"; + public static final String DFLT_SSL_PROTOCOL = CommonUtils.DFLT_SSL_PROTOCOL; /** SSL protocol. */ protected String proto = DFLT_SSL_PROTOCOL; diff --git a/modules/core/src/main/java/org/apache/ignite/ssl/SslContextFactory.java b/modules/core/src/main/java/org/apache/ignite/ssl/SslContextFactory.java index af7d140b01f2f..12a876a9e5076 100644 --- a/modules/core/src/main/java/org/apache/ignite/ssl/SslContextFactory.java +++ b/modules/core/src/main/java/org/apache/ignite/ssl/SslContextFactory.java @@ -34,6 +34,7 @@ import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.typedef.internal.A; /** @@ -56,13 +57,13 @@ public class SslContextFactory extends AbstractSslContextFactory { private static final long serialVersionUID = 0L; /** Default key / trust store type. */ - public static final String DFLT_STORE_TYPE = System.getProperty("javax.net.ssl.keyStoreType", "JKS"); + public static final String DFLT_STORE_TYPE = CommonUtils.DFLT_STORE_TYPE; /** Default SSL protocol. */ - public static final String DFLT_SSL_PROTOCOL = AbstractSslContextFactory.DFLT_SSL_PROTOCOL; + public static final String DFLT_SSL_PROTOCOL = CommonUtils.DFLT_SSL_PROTOCOL; /** Default key manager / trust manager algorithm. Specifying different trust manager algorithm is not supported. */ - public static final String DFLT_KEY_ALGORITHM = System.getProperty("ssl.KeyManagerFactory.algorithm", "SunX509"); + public static final String DFLT_KEY_ALGORITHM = CommonUtils.DFLT_KEY_ALGORITHM; /** Key manager algorithm. */ protected String keyAlgorithm = DFLT_KEY_ALGORITHM; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientSslUtils.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientSslUtils.java similarity index 97% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientSslUtils.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientSslUtils.java index 4264aa1c3a344..bf701bf8c962c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientSslUtils.java +++ b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientSslUtils.java @@ -43,9 +43,7 @@ import org.apache.ignite.client.SslMode; import org.apache.ignite.client.SslProtocol; import org.apache.ignite.configuration.ClientConfiguration; - -import static org.apache.ignite.ssl.SslContextFactory.DFLT_KEY_ALGORITHM; -import static org.apache.ignite.ssl.SslContextFactory.DFLT_STORE_TYPE; +import org.apache.ignite.internal.util.CommonUtils; /** */ public class ClientSslUtils { @@ -100,7 +98,7 @@ public static SSLContext getSslContext(ClientConfiguration cfg) { String keyStoreType = or.apply( cfg.getSslClientCertificateKeyStoreType(), - or.apply(System.getProperty("javax.net.ssl.keyStoreType"), DFLT_STORE_TYPE) + or.apply(System.getProperty("javax.net.ssl.keyStoreType"), CommonUtils.DFLT_STORE_TYPE) ); String keyStorePwd = or.apply( @@ -115,7 +113,7 @@ public static SSLContext getSslContext(ClientConfiguration cfg) { String trustStoreType = or.apply( cfg.getSslTrustCertificateKeyStoreType(), - or.apply(System.getProperty("javax.net.ssl.trustStoreType"), DFLT_STORE_TYPE) + or.apply(System.getProperty("javax.net.ssl.trustStoreType"), CommonUtils.DFLT_STORE_TYPE) ); String trustStorePwd = or.apply( @@ -123,7 +121,7 @@ public static SSLContext getSslContext(ClientConfiguration cfg) { System.getProperty("javax.net.ssl.trustStorePassword") ); - String algorithm = or.apply(cfg.getSslKeyAlgorithm(), DFLT_KEY_ALGORITHM); + String algorithm = or.apply(cfg.getSslKeyAlgorithm(), CommonUtils.DFLT_KEY_ALGORITHM); String proto = toString(cfg.getSslProtocol()); From 5b983de3bf1e808e4ed20a4b29763382ec1dbda0 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 29 May 2026 11:24:27 +0300 Subject: [PATCH 40/44] Fix compatibility tests --- .../RendezvousAffinityFunctionHelper.java | 51 +++++++++++++++++++ .../cache/query/CacheEntryEventAdapter.java | 0 .../cache/expiry/PlatformExpiryPolicy.java | 0 .../platform/client/ClientStatus.java | 0 .../client/IgniteClientException.java | 0 .../ignite/internal/util/CommonUtils.java | 45 ++++++++++++++++ .../internal/util/lang/ClusterNodeFunc.java | 0 .../gridfunc/ContainsNodeIdsPredicate.java | 0 .../EqualsClusterNodeIdPredicate.java | 0 .../lang/gridfunc/HasEqualIdPredicate.java | 0 .../lang/gridfunc/HasNotEqualIdPredicate.java | 0 .../plugin/security/SecurityException.java | 0 .../RendezvousAffinityFunction.java | 33 +----------- .../processors/cache/GridCacheUtils.java | 8 +-- .../DataStructuresProcessor.java | 5 +- .../affinity/PartitionClientContext.java | 6 +-- .../ignite/internal/util/IgniteUtils.java | 43 +--------------- .../testframework/junits/IgniteMock.java | 2 +- .../client/thin/ClientAtomicLongImpl.java | 6 +-- .../internal/client/thin/ClientBinary.java | 0 .../client/thin/ClientBinaryMarshaller.java | 0 .../thin/ClientCacheAffinityContext.java | 4 +- .../thin/ClientCacheAffinityMapping.java | 14 ++--- .../thin/ClientCacheEntryListenerHandler.java | 7 ++- .../ClientCacheEntryListenersRegistry.java | 0 .../thin/ClientChannelConfiguration.java | 0 .../client/thin/ClientClusterGroupImpl.java | 6 +-- .../client/thin/ClientClusterImpl.java | 0 .../client/thin/ClientClusterNodeImpl.java | 0 .../thin/ClientContinuousQueryCursor.java | 6 +-- .../client/thin/ClientFieldsQueryPager.java | 0 .../client/thin/ClientIgniteSetImpl.java | 0 .../client/thin/ClientQueryPager.java | 0 .../thin/ClientServiceDescriptorImpl.java | 0 .../internal/client/thin/ClientUtils.java | 0 .../client/thin/GenericQueryPager.java | 0 .../client/thin/TcpClientTransactions.java | 0 37 files changed, 132 insertions(+), 104 deletions(-) create mode 100644 modules/commons/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunctionHelper.java rename modules/{core => commons}/src/main/java/org/apache/ignite/cache/query/CacheEntryEventAdapter.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/processors/platform/cache/expiry/PlatformExpiryPolicy.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientStatus.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/processors/platform/client/IgniteClientException.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/util/lang/ClusterNodeFunc.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/ContainsNodeIdsPredicate.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/EqualsClusterNodeIdPredicate.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/HasEqualIdPredicate.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/HasNotEqualIdPredicate.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/plugin/security/SecurityException.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientAtomicLongImpl.java (94%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientBinary.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientBinaryMarshaller.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheAffinityContext.java (99%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheAffinityMapping.java (96%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheEntryListenerHandler.java (97%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheEntryListenersRegistry.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientChannelConfiguration.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientClusterGroupImpl.java (99%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientClusterImpl.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientClusterNodeImpl.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientContinuousQueryCursor.java (93%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientFieldsQueryPager.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientIgniteSetImpl.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientQueryPager.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientServiceDescriptorImpl.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientUtils.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/GenericQueryPager.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/TcpClientTransactions.java (100%) diff --git a/modules/commons/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunctionHelper.java b/modules/commons/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunctionHelper.java new file mode 100644 index 0000000000000..9d517d46f80ff --- /dev/null +++ b/modules/commons/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunctionHelper.java @@ -0,0 +1,51 @@ +/* + * 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.cache.affinity.rendezvous; + +import org.apache.ignite.internal.util.CommonUtils; + +/** */ +public class RendezvousAffinityFunctionHelper { + /** + * Helper method to calculates mask. + * + * @param parts Number of partitions. + * @return Mask to use in calculation when partitions count is power of 2. + */ + public static int calculateMask(int parts) { + return (parts & (parts - 1)) == 0 ? parts - 1 : -1; + } + + /** + * Helper method to calculate partition. + * + * @param key – Key to get partition for. + * @param mask Mask to use in calculation when partitions count is power of 2. + * @param parts Number of partitions. + * @return Partition number for a given key. + */ + public static int calculatePartition(Object key, int mask, int parts) { + if (mask >= 0) { + int h; + + return ((h = key.hashCode()) ^ (h >>> 16)) & mask; + } + + return CommonUtils.safeAbs(key.hashCode() % parts); + } +} diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/CacheEntryEventAdapter.java b/modules/commons/src/main/java/org/apache/ignite/cache/query/CacheEntryEventAdapter.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/cache/query/CacheEntryEventAdapter.java rename to modules/commons/src/main/java/org/apache/ignite/cache/query/CacheEntryEventAdapter.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/expiry/PlatformExpiryPolicy.java b/modules/commons/src/main/java/org/apache/ignite/internal/processors/platform/cache/expiry/PlatformExpiryPolicy.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/expiry/PlatformExpiryPolicy.java rename to modules/commons/src/main/java/org/apache/ignite/internal/processors/platform/cache/expiry/PlatformExpiryPolicy.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientStatus.java b/modules/commons/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientStatus.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientStatus.java rename to modules/commons/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientStatus.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/IgniteClientException.java b/modules/commons/src/main/java/org/apache/ignite/internal/processors/platform/client/IgniteClientException.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/IgniteClientException.java rename to modules/commons/src/main/java/org/apache/ignite/internal/processors/platform/client/IgniteClientException.java diff --git a/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java index d8601993142e0..46a8483b0485b 100644 --- a/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java +++ b/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java @@ -250,6 +250,12 @@ public abstract class CommonUtils { /** Default key manager / trust manager algorithm. Specifying different trust manager algorithm is not supported. */ public static final String DFLT_KEY_ALGORITHM = System.getProperty("ssl.KeyManagerFactory.algorithm", "SunX509"); + /** */ + public static final String DEFAULT_DS_GROUP_NAME = "default-ds-group"; + + /** Atomics system cache name. */ + public static final String ATOMICS_CACHE_NAME = "ignite-sys-atomic-cache"; + /** Byte bit-mask. */ private static final int MASK = 0xf; @@ -1141,6 +1147,21 @@ public static void close(@Nullable URLClassLoader clsLdr, @Nullable IgniteLogger } } + /** + * Quietly closes given resource ignoring possible checked exception. + * + * @param rsrc Resource to close. If it's {@code null} - it's no-op. + */ + public static void closeQuiet(@Nullable AutoCloseable rsrc) { + if (rsrc != null) + try { + rsrc.close(); + } + catch (Exception ignored) { + // No-op. + } + } + /** * Depending on whether log is provided and quiet mode is enabled logs given * messages as quiet message or normal log WARN message. If {@code log} is {@code null} @@ -2334,6 +2355,30 @@ public static int toDigit(char ch, int idx) throws IgniteCheckedException { return digit; } + /** + * Gets absolute value for integer. If integer is {@link Integer#MIN_VALUE}, then {@code 0} is returned. + * + * @param i Integer. + * @return Absolute value. + */ + public static int safeAbs(int i) { + i = Math.abs(i); + + return i < 0 ? 0 : i; + } + + /** + * Gets absolute value for long. If argument is {@link Long#MIN_VALUE}, then {@code 0} is returned. + * + * @param i Argument. + * @return Absolute value. + */ + public static long safeAbs(long i) { + i = Math.abs(i); + + return i < 0 ? 0 : i; + } + /** * Creates SQL types set. * diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/ClusterNodeFunc.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/lang/ClusterNodeFunc.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/util/lang/ClusterNodeFunc.java rename to modules/commons/src/main/java/org/apache/ignite/internal/util/lang/ClusterNodeFunc.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/ContainsNodeIdsPredicate.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/ContainsNodeIdsPredicate.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/ContainsNodeIdsPredicate.java rename to modules/commons/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/ContainsNodeIdsPredicate.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/EqualsClusterNodeIdPredicate.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/EqualsClusterNodeIdPredicate.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/EqualsClusterNodeIdPredicate.java rename to modules/commons/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/EqualsClusterNodeIdPredicate.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/HasEqualIdPredicate.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/HasEqualIdPredicate.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/HasEqualIdPredicate.java rename to modules/commons/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/HasEqualIdPredicate.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/HasNotEqualIdPredicate.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/HasNotEqualIdPredicate.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/HasNotEqualIdPredicate.java rename to modules/commons/src/main/java/org/apache/ignite/internal/util/lang/gridfunc/HasNotEqualIdPredicate.java diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityException.java b/modules/commons/src/main/java/org/apache/ignite/plugin/security/SecurityException.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityException.java rename to modules/commons/src/main/java/org/apache/ignite/plugin/security/SecurityException.java diff --git a/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java b/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java index 3c14f5d2615f0..e184e952b6e28 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java @@ -42,7 +42,6 @@ import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.LT; import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteBiPredicate; import org.apache.ignite.lang.IgniteBiTuple; import org.apache.ignite.resources.IgniteInstanceResource; @@ -110,34 +109,6 @@ public class RendezvousAffinityFunction implements AffinityFunction, Serializabl @IgniteInstanceResource private transient IgniteEx ignite; - /** - * Helper method to calculates mask. - * - * @param parts Number of partitions. - * @return Mask to use in calculation when partitions count is power of 2. - */ - public static int calculateMask(int parts) { - return (parts & (parts - 1)) == 0 ? parts - 1 : -1; - } - - /** - * Helper method to calculate partition. - * - * @param key – Key to get partition for. - * @param mask Mask to use in calculation when partitions count is power of 2. - * @param parts Number of partitions. - * @return Partition number for a given key. - */ - public static int calculatePartition(Object key, int mask, int parts) { - if (mask >= 0) { - int h; - - return ((h = key.hashCode()) ^ (h >>> 16)) & mask; - } - - return U.safeAbs(key.hashCode() % parts); - } - /** * Empty constructor with all defaults. */ @@ -237,7 +208,7 @@ public RendezvousAffinityFunction setPartitions(int parts) { this.parts = parts; - mask = calculateMask(parts); + mask = RendezvousAffinityFunctionHelper.calculateMask(parts); return this; } @@ -506,7 +477,7 @@ private static long hash(int key0, int key1) { throw new IllegalArgumentException("Null key is passed for a partition calculation. " + "Make sure that an affinity key that is used is initialized properly."); - return calculatePartition(key, mask, parts); + return RendezvousAffinityFunctionHelper.calculatePartition(key, mask, parts); } /** {@inheritDoc} */ 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 9437762372485..dbb4ce1a68821 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 @@ -2190,16 +2190,16 @@ public static Map, WarmUpStrategy> warmUpSt } /** - * @param cfg Ignite configuration. + * @param keyCfgs Key configurations. * @return Type name to affinity key field name mapping. */ - public static Map affinityFields(@Nullable IgniteConfiguration cfg) { + public static Map affinityFields(CacheKeyConfiguration[] keyCfgs) { Map affFields = new HashMap<>(); - if (cfg == null || F.isEmpty(cfg.getCacheKeyConfiguration())) + if (F.isEmpty(keyCfgs)) return affFields; - for (CacheKeyConfiguration keyCfg : cfg.getCacheKeyConfiguration()) + for (CacheKeyConfiguration keyCfg : keyCfgs) affFields.put(keyCfg.getTypeName(), keyCfg.getAffinityKeyFieldName()); return affFields; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java index 5f81792151696..6900102982072 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java @@ -75,6 +75,7 @@ import org.apache.ignite.internal.systemview.ReentrantLockViewWalker; import org.apache.ignite.internal.systemview.SemaphoreViewWalker; import org.apache.ignite.internal.systemview.SetViewWalker; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.lang.GridPlainCallable; import org.apache.ignite.internal.util.lang.IgniteClosureX; import org.apache.ignite.internal.util.lang.IgniteInClosureX; @@ -137,13 +138,13 @@ public final class DataStructuresProcessor extends GridProcessorAdapter implemen public static final String VOLATILE_GRP_NAME = DEFAULT_VOLATILE_DS_GROUP_NAME + "@" + VOLATILE_DATA_REGION_NAME; /** */ - public static final String DEFAULT_DS_GROUP_NAME = "default-ds-group"; + public static final String DEFAULT_DS_GROUP_NAME = CommonUtils.DEFAULT_DS_GROUP_NAME; /** */ private static final String DS_CACHE_NAME_PREFIX = "datastructures_"; /** Atomics system cache name. */ - public static final String ATOMICS_CACHE_NAME = "ignite-sys-atomic-cache"; + public static final String ATOMICS_CACHE_NAME = CommonUtils.ATOMICS_CACHE_NAME; /** */ public static final String QUEUES_VIEW = metricName("ds", "queues"); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionClientContext.java b/modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionClientContext.java index fca178adb78ec..60859b4df889e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionClientContext.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionClientContext.java @@ -16,7 +16,7 @@ */ package org.apache.ignite.internal.sql.optimizer.affinity; -import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction; +import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunctionHelper; import org.apache.ignite.configuration.CacheConfiguration; import org.jetbrains.annotations.Nullable; @@ -41,7 +41,7 @@ public PartitionClientContext(int parts) { this.parts = parts; - mask = RendezvousAffinityFunction.calculateMask(parts); + mask = RendezvousAffinityFunctionHelper.calculateMask(parts); } /** @@ -63,6 +63,6 @@ public PartitionClientContext(int parts) { if (key == null) return null; - return RendezvousAffinityFunction.calculatePartition(key, mask, parts); + return RendezvousAffinityFunctionHelper.calculatePartition(key, mask, parts); } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java index 1513346138589..6c8e6dc76363c 100755 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java @@ -2796,21 +2796,6 @@ public static void closeWithSuppressingException(@Nullable AutoCloseable rsrc, @ } } - /** - * Quietly closes given resource ignoring possible checked exception. - * - * @param rsrc Resource to close. If it's {@code null} - it's no-op. - */ - public static void closeQuiet(@Nullable AutoCloseable rsrc) { - if (rsrc != null) - try { - rsrc.close(); - } - catch (Exception ignored) { - // No-op. - } - } - /** * Quietly closes given {@link Socket} ignoring possible checked exception. * @@ -5648,30 +5633,6 @@ public static void removeJavaNoOpLogger(Collection rmvHnds) { } } - /** - * Gets absolute value for integer. If integer is {@link Integer#MIN_VALUE}, then {@code 0} is returned. - * - * @param i Integer. - * @return Absolute value. - */ - public static int safeAbs(int i) { - i = Math.abs(i); - - return i < 0 ? 0 : i; - } - - /** - * Gets absolute value for long. If argument is {@link Long#MIN_VALUE}, then {@code 0} is returned. - * - * @param i Argument. - * @return Absolute value. - */ - public static long safeAbs(long i) { - i = Math.abs(i); - - return i < 0 ? 0 : i; - } - /** * When {@code long} value given is positive returns that value, otherwise returns provided default value. * @@ -7906,7 +7867,7 @@ public static BinaryContext binaryContext( bcfg.getIdMapper(), bcfg.getNameMapper(), bcfg.getTypeConfigurations(), - CU.affinityFields(cfg), + CU.affinityFields(cfg.getCacheKeyConfiguration()), bcfg.isCompactFooter(), CU::affinityFieldName, log @@ -7920,7 +7881,7 @@ public static BinaryContext binaryContext( bcfg.getIdMapper(), bcfg.getNameMapper(), bcfg.getTypeConfigurations(), - CU.affinityFields(cfg), + CU.affinityFields(cfg.getCacheKeyConfiguration()), bcfg.isCompactFooter(), CU::affinityFieldName, log diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java index 152b209a533a7..4d871f022023d 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java @@ -478,7 +478,7 @@ public IgniteMock(String name, String locHost, UUID nodeId, Marshaller marshalle bcfg.getIdMapper(), bcfg.getNameMapper(), bcfg.getTypeConfigurations(), - CU.affinityFields(configuration()), + CU.affinityFields(configuration().getCacheKeyConfiguration()), bcfg.isCompactFooter(), CU::affinityFieldName, NullLogger.INSTANCE diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientAtomicLongImpl.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientAtomicLongImpl.java similarity index 94% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientAtomicLongImpl.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientAtomicLongImpl.java index f7f6f521b2659..29055ea3d3fc3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientAtomicLongImpl.java +++ b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientAtomicLongImpl.java @@ -21,7 +21,7 @@ import org.apache.ignite.client.ClientAtomicLong; import org.apache.ignite.internal.binary.BinaryUtils; import org.apache.ignite.internal.binary.BinaryWriterEx; -import org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor; +import org.apache.ignite.internal.util.CommonUtils; import org.jetbrains.annotations.Nullable; /** @@ -53,8 +53,8 @@ public ClientAtomicLongImpl(String name, @Nullable String groupName, ReliableCha this.groupName = groupName; this.ch = ch; - String grpNameInternal = groupName == null ? DataStructuresProcessor.DEFAULT_DS_GROUP_NAME : groupName; - cacheId = ClientUtils.cacheId(DataStructuresProcessor.ATOMICS_CACHE_NAME + "@" + grpNameInternal); + String grpNameInternal = groupName == null ? CommonUtils.DEFAULT_DS_GROUP_NAME : groupName; + cacheId = ClientUtils.cacheId(CommonUtils.ATOMICS_CACHE_NAME + "@" + grpNameInternal); } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientBinary.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientBinary.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientBinary.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientBinary.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientBinaryMarshaller.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientBinaryMarshaller.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientBinaryMarshaller.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientBinaryMarshaller.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheAffinityContext.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheAffinityContext.java similarity index 99% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheAffinityContext.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheAffinityContext.java index 9ac655460ef71..fb3877dbdee6d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheAffinityContext.java +++ b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheAffinityContext.java @@ -38,8 +38,8 @@ import org.apache.ignite.internal.binary.BinaryUtils; import org.apache.ignite.internal.binary.BinaryWriterEx; import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.GridConcurrentHashSet; -import org.apache.ignite.internal.util.typedef.internal.U; import org.jetbrains.annotations.Nullable; import static org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion.NONE; @@ -365,7 +365,7 @@ public void registerCache(String cacheName) { ClientPartitionAwarenessMapperHolder hld = cacheKeyMapperFactoryMap.computeIfAbsent(ClientUtils.cacheId(cacheName), id -> new ClientPartitionAwarenessMapperHolder(cacheName)); - hld.ts = U.currentTimeMillis(); + hld.ts = CommonUtils.currentTimeMillis(); } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheAffinityMapping.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheAffinityMapping.java similarity index 96% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheAffinityMapping.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheAffinityMapping.java index 4a944e0c6915e..6487fd9d6f1d7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheAffinityMapping.java +++ b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheAffinityMapping.java @@ -26,7 +26,7 @@ import java.util.UUID; import java.util.function.Function; import org.apache.ignite.IgniteBinary; -import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction; +import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunctionHelper; import org.apache.ignite.client.ClientFeatureNotSupportedByServerException; import org.apache.ignite.client.ClientPartitionAwarenessMapper; import org.apache.ignite.internal.binary.BinaryReaderEx; @@ -34,8 +34,8 @@ import org.apache.ignite.internal.binary.BinaryWriterEx; import org.apache.ignite.internal.binary.streams.BinaryOutputStream; import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.internal.util.typedef.internal.U; import static org.apache.ignite.internal.client.thin.ProtocolBitmaskFeature.ALL_AFFINITY_MAPPINGS; import static org.apache.ignite.internal.client.thin.ProtocolBitmaskFeature.DC_AWARE; @@ -211,7 +211,7 @@ public static ClientCacheAffinityMapping readResponse( int cachesCnt = in.readInt(); if (applicable) { // Partition awareness is applicable for these caches. - Map> cacheKeyCfg = U.newHashMap(cachesCnt); + Map> cacheKeyCfg = CommonUtils.newHashMap(cachesCnt); for (int j = 0; j < cachesCnt; j++) cacheKeyCfg.put(in.readInt(), readCacheKeyConfiguration(in)); @@ -264,7 +264,7 @@ public static ClientCacheAffinityMapping readResponse( private static Map readCacheKeyConfiguration(BinaryReaderEx in) { int keyCfgCnt = in.readInt(); - Map keyCfg = U.newHashMap(keyCfgCnt); + Map keyCfg = CommonUtils.newHashMap(keyCfgCnt); for (int i = 0; i < keyCfgCnt; i++) keyCfg.put(in.readInt(), in.readInt()); @@ -298,7 +298,7 @@ private static UUID[] readNodePartitions(BinaryReaderEx in) { // Expand partToNode if needed. if (part >= partToNode.length) - partToNode = Arrays.copyOf(partToNode, U.ceilPow2(part + 1)); + partToNode = Arrays.copyOf(partToNode, CommonUtils.ceilPow2(part + 1)); } partToNode[part] = nodeId; @@ -384,12 +384,12 @@ private static class RendezvousAffinityKeyMapper implements ClientPartitionAware */ private RendezvousAffinityKeyMapper(int parts) { this.parts = parts; - affinityMask = RendezvousAffinityFunction.calculateMask(parts); + affinityMask = RendezvousAffinityFunctionHelper.calculateMask(parts); } /** {@inheritDoc} */ @Override public int partition(Object key) { - return RendezvousAffinityFunction.calculatePartition(key, affinityMask, parts); + return RendezvousAffinityFunctionHelper.calculatePartition(key, affinityMask, parts); } } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheEntryListenerHandler.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheEntryListenerHandler.java similarity index 97% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheEntryListenerHandler.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheEntryListenerHandler.java index 72142323a2546..24eb09e210ef0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheEntryListenerHandler.java +++ b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheEntryListenerHandler.java @@ -36,11 +36,10 @@ import org.apache.ignite.internal.binary.streams.BinaryInputStream; import org.apache.ignite.internal.binary.streams.BinaryOutputStream; import org.apache.ignite.internal.binary.streams.BinaryStreams; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.typedef.T2; -import org.apache.ignite.internal.util.typedef.internal.U; import static org.apache.ignite.internal.client.thin.ClientNotificationType.CONTINUOUS_QUERY_EVENT; -import static org.apache.ignite.internal.client.thin.TcpClientCache.JAVA_PLATFORM; /** * Handler for {@link ContinuousQuery} listeners and JCache cache entry listeners. @@ -118,7 +117,7 @@ public synchronized void startListen( out.writeByte(GridBinaryMarshaller.NULL); else { utils.writeObject(out, rmtFilterFactory); - out.writeByte(JAVA_PLATFORM); + out.writeByte(TcpClientCache.JAVA_PLATFORM); } }; @@ -176,7 +175,7 @@ public synchronized void startListen( if (lsnr != null) lsnr.onDisconnected(reason); - U.closeQuiet(this); + CommonUtils.closeQuiet(this); } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheEntryListenersRegistry.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheEntryListenersRegistry.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheEntryListenersRegistry.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheEntryListenersRegistry.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientChannelConfiguration.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientChannelConfiguration.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientChannelConfiguration.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientChannelConfiguration.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientClusterGroupImpl.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientClusterGroupImpl.java similarity index 99% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientClusterGroupImpl.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientClusterGroupImpl.java index 838aecc92a33a..fbca7b15caa04 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientClusterGroupImpl.java +++ b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientClusterGroupImpl.java @@ -42,10 +42,10 @@ import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.internal.binary.BinaryReaderEx; import org.apache.ignite.internal.binary.BinaryWriterEx; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.lang.ClusterNodeFunc; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.A; -import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteProductVersion; import org.jetbrains.annotations.Nullable; @@ -121,7 +121,7 @@ private ClientClusterGroupImpl(ReliableChannelEx ch, ClientUtils utils, @Override public ClientClusterGroup forOthers(ClusterNode node, ClusterNode... nodes) { A.notNull(node, "node"); - Collection nodes0 = collection(U::newHashSet, node, nodes); + Collection nodes0 = collection(CommonUtils::newHashSet, node, nodes); return forPredicate(n -> !nodes0.contains(n)); } @@ -221,7 +221,7 @@ private ClientClusterGroupImpl(ReliableChannelEx ch, ClientUtils utils, @Override public ClientClusterGroup forHost(String host, String... hosts) { A.notNull(host, "host"); - Collection hosts0 = collection(U::newHashSet, host, hosts); + Collection hosts0 = collection(CommonUtils::newHashSet, host, hosts); return forPredicate(n -> { for (String hostName : n.hostNames()) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientClusterImpl.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientClusterImpl.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientClusterImpl.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientClusterImpl.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientClusterNodeImpl.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientClusterNodeImpl.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientClusterNodeImpl.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientClusterNodeImpl.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientContinuousQueryCursor.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientContinuousQueryCursor.java similarity index 93% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientContinuousQueryCursor.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientContinuousQueryCursor.java index 0ff1f41782e61..7a5e1447b5e25 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientContinuousQueryCursor.java +++ b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientContinuousQueryCursor.java @@ -21,7 +21,7 @@ import java.util.Iterator; import java.util.List; import org.apache.ignite.cache.query.QueryCursor; -import org.apache.ignite.internal.util.typedef.internal.U; +import org.apache.ignite.internal.util.CommonUtils; import org.jetbrains.annotations.NotNull; /** @@ -50,8 +50,8 @@ class ClientContinuousQueryCursor implements QueryCursor { /** {@inheritDoc} */ @Override public void close() { - U.closeQuiet(initQryCursor); - U.closeQuiet(lsnrHnd); + CommonUtils.closeQuiet(initQryCursor); + CommonUtils.closeQuiet(lsnrHnd); } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientFieldsQueryPager.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientFieldsQueryPager.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientFieldsQueryPager.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientFieldsQueryPager.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientIgniteSetImpl.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientIgniteSetImpl.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientIgniteSetImpl.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientIgniteSetImpl.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientQueryPager.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientQueryPager.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientQueryPager.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientQueryPager.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientServiceDescriptorImpl.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientServiceDescriptorImpl.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientServiceDescriptorImpl.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientServiceDescriptorImpl.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientUtils.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientUtils.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientUtils.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientUtils.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/GenericQueryPager.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/GenericQueryPager.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/GenericQueryPager.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/GenericQueryPager.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpClientTransactions.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/TcpClientTransactions.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpClientTransactions.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/TcpClientTransactions.java From e1c23a80f5d8fa684f2ef247f6af6922c294b7b8 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 29 May 2026 12:01:01 +0300 Subject: [PATCH 41/44] Fix compatibility tests --- .../ignite/internal/binary/BinaryUtils.java | 176 ++++++++++++++++++ .../configuration/CacheConfiguration.java | 4 +- .../processors/cache/GridCacheUtils.java | 33 ---- .../CacheObjectBinaryProcessorImpl.java | 2 +- .../ignite/internal/util/IgniteUtils.java | 143 +------------- .../testframework/junits/IgniteMock.java | 5 +- ...tadataConcurrentUpdateWithIndexesTest.java | 9 +- .../client/thin/ClientBinaryMarshaller.java | 10 +- .../thin/ClientServiceDescriptorImpl.java | 1 - 9 files changed, 201 insertions(+), 182 deletions(-) diff --git a/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java b/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java index 92740e7966227..47cc6bb29bf79 100644 --- a/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java +++ b/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java @@ -27,6 +27,7 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.lang.reflect.Array; +import java.lang.reflect.Field; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Modifier; @@ -62,13 +63,21 @@ import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteCommonsSystemProperties; import org.apache.ignite.IgniteException; +import org.apache.ignite.IgniteLogger; import org.apache.ignite.binary.BinaryCollectionFactory; +import org.apache.ignite.binary.BinaryIdMapper; import org.apache.ignite.binary.BinaryInvalidTypeException; import org.apache.ignite.binary.BinaryMapFactory; +import org.apache.ignite.binary.BinaryNameMapper; import org.apache.ignite.binary.BinaryObject; import org.apache.ignite.binary.BinaryObjectException; +import org.apache.ignite.binary.BinarySerializer; import org.apache.ignite.binary.BinaryType; +import org.apache.ignite.binary.BinaryTypeConfiguration; import org.apache.ignite.binary.Binarylizable; +import org.apache.ignite.cache.CacheKeyConfiguration; +import org.apache.ignite.cache.affinity.AffinityKeyMapped; +import org.apache.ignite.configuration.BinaryConfiguration; import org.apache.ignite.internal.binary.streams.BinaryInputStream; import org.apache.ignite.internal.binary.streams.BinaryOutputStream; import org.apache.ignite.internal.util.CommonUtils; @@ -176,6 +185,10 @@ TreeSet.class, new BinaryTreeSetWriteReplacer() /** FNV1 hash prime. */ private static final int FNV1_PRIME = 0x01000193; + /** For tests. */ + @SuppressWarnings("PublicField") + public static boolean useTestBinaryCtx; + /** */ public static final BinariesFactory binariesFactory; @@ -3067,6 +3080,169 @@ public static int hashCode(byte[] data, int startPos, int endPos) { return hash; } + /** @return Empty binary context instance. */ + public static BinaryContext binaryContext( + BinaryMetadataHandler metaHnd, + BinaryMarshaller marsh, + BinaryConfiguration bcfg, + String igniteInstanceName, + ClassLoader clsLdr, + CacheKeyConfiguration[] cacheKeyCfgs, + IgniteLogger log + ) { + return useTestBinaryCtx + ? new TestBinaryContext( + metaHnd, + marsh, + igniteInstanceName, + clsLdr, + bcfg.getSerializer(), + bcfg.getIdMapper(), + bcfg.getNameMapper(), + bcfg.getTypeConfigurations(), + affinityFields(cacheKeyCfgs), + bcfg.isCompactFooter(), + BinaryUtils::affinityFieldName, + log + ) + : new BinaryContext( + metaHnd, + marsh, + igniteInstanceName, + clsLdr, + bcfg.getSerializer(), + bcfg.getIdMapper(), + bcfg.getNameMapper(), + bcfg.getTypeConfigurations(), + affinityFields(cacheKeyCfgs), + bcfg.isCompactFooter(), + BinaryUtils::affinityFieldName, + log + ); + } + + /** + * @param keyCfgs Key configurations. + * @return Type name to affinity key field name mapping. + */ + public static Map affinityFields(CacheKeyConfiguration[] keyCfgs) { + Map affFields = new HashMap<>(); + + if (F.isEmpty(keyCfgs)) + return affFields; + + for (CacheKeyConfiguration keyCfg : keyCfgs) + affFields.put(keyCfg.getTypeName(), keyCfg.getAffinityKeyFieldName()); + + return affFields; + } + + /** + * @param cls Class to get affinity field for. + * @return Affinity field name or {@code null} if field name was not found. + */ + public static String affinityFieldName(Class cls) { + for (; cls != Object.class && cls != null; cls = cls.getSuperclass()) { + for (Field f : cls.getDeclaredFields()) { + if (f.getAnnotation(AffinityKeyMapped.class) != null) + return f.getName(); + } + } + + return null; + } + + /** */ + @SuppressWarnings("PublicInnerClass") + public static class TestBinaryContext extends BinaryContext { + /** */ + private List listeners; + + /** */ + public TestBinaryContext( + BinaryMetadataHandler metaHnd, + @Nullable BinaryMarshaller marsh, + @Nullable String igniteInstanceName, + @Nullable ClassLoader clsLdr, + @Nullable BinarySerializer dfltSerializer, + @Nullable BinaryIdMapper idMapper, + @Nullable BinaryNameMapper nameMapper, + @Nullable Collection typeCfgs, + Map affFlds, + boolean compactFooter, + Function, String> affFldNameProvider, + IgniteLogger log + ) { + super( + metaHnd, + marsh, + igniteInstanceName, + clsLdr, + dfltSerializer, + idMapper, + nameMapper, + typeCfgs, + affFlds, + compactFooter, + affFldNameProvider, + log + ); + } + + + /** {@inheritDoc} */ + @Nullable @Override public BinaryType metadata(int typeId) throws BinaryObjectException { + BinaryType metadata = super.metadata(typeId); + + if (listeners != null) { + for (TestBinaryContextListener listener : listeners) + listener.onAfterMetadataRequest(typeId, metadata); + } + + return metadata; + } + + /** {@inheritDoc} */ + @Override public void updateMetadata(int typeId, BinaryMetadata meta, boolean failIfUnregistered) throws BinaryObjectException { + if (listeners != null) { + for (TestBinaryContextListener listener : listeners) + listener.onBeforeMetadataUpdate(typeId, meta); + } + + super.updateMetadata(typeId, meta, failIfUnregistered); + } + + /** */ + public interface TestBinaryContextListener { + /** + * @param typeId Type id. + * @param type Type. + */ + void onAfterMetadataRequest(int typeId, BinaryType type); + + /** + * @param typeId Type id. + * @param metadata Metadata. + */ + void onBeforeMetadataUpdate(int typeId, BinaryMetadata metadata); + } + + /** @param lsnr Listener. */ + public void addListener(TestBinaryContextListener lsnr) { + if (listeners == null) + listeners = new ArrayList<>(); + + if (!listeners.contains(lsnr)) + listeners.add(lsnr); + } + + /** */ + public void clearAllListener() { + if (listeners != null) + listeners.clear(); + } + } + /** * Enum type. */ diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java index 4a8d52e81e770..ce1bc69c9b77d 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java @@ -52,10 +52,10 @@ import org.apache.ignite.cache.store.CacheStore; import org.apache.ignite.cache.store.CacheStoreSessionListener; import org.apache.ignite.cluster.ClusterNode; +import org.apache.ignite.internal.binary.BinaryUtils; import org.apache.ignite.internal.processors.query.QueryUtils; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.A; -import org.apache.ignite.internal.util.typedef.internal.CU; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteExperimental; @@ -1984,7 +1984,7 @@ public CacheConfiguration setIndexedTypes(Class... indexedTypes) { qryEntities.add(newEntity); // Set key configuration if needed. - String affFieldName = CU.affinityFieldName(keyCls); + String affFieldName = BinaryUtils.affinityFieldName(keyCls); if (affFieldName != null) { CacheKeyConfiguration newKeyCfg = new CacheKeyConfiguration(newEntity.getKeyType(), affFieldName); 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 dbb4ce1a68821..ce469a139383b 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 @@ -17,7 +17,6 @@ package org.apache.ignite.internal.processors.cache; -import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -53,7 +52,6 @@ import org.apache.ignite.cache.CacheServerNotFoundException; import org.apache.ignite.cache.QueryEntity; import org.apache.ignite.cache.affinity.AffinityFunction; -import org.apache.ignite.cache.affinity.AffinityKeyMapped; import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction; import org.apache.ignite.cache.store.CacheStoreSessionListener; import org.apache.ignite.cluster.ClusterNode; @@ -2189,37 +2187,6 @@ public static Map, WarmUpStrategy> warmUpSt return strategies; } - /** - * @param keyCfgs Key configurations. - * @return Type name to affinity key field name mapping. - */ - public static Map affinityFields(CacheKeyConfiguration[] keyCfgs) { - Map affFields = new HashMap<>(); - - if (F.isEmpty(keyCfgs)) - return affFields; - - for (CacheKeyConfiguration keyCfg : keyCfgs) - affFields.put(keyCfg.getTypeName(), keyCfg.getAffinityKeyFieldName()); - - return affFields; - } - - /** - * @param cls Class to get affinity field for. - * @return Affinity field name or {@code null} if field name was not found. - */ - public static String affinityFieldName(Class cls) { - for (; cls != Object.class && cls != null; cls = cls.getSuperclass()) { - for (Field f : cls.getDeclaredFields()) { - if (f.getAnnotation(AffinityKeyMapped.class) != null) - return f.getName(); - } - } - - return null; - } - /** * */ 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 8867e576ec8af..b67cafda2cad4 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 @@ -116,9 +116,9 @@ import static org.apache.ignite.IgniteSystemProperties.IGNITE_WAIT_SCHEMA_UPDATE; import static org.apache.ignite.IgniteSystemProperties.getBoolean; import static org.apache.ignite.internal.GridComponent.DiscoveryDataExchangeType.BINARY_PROC; +import static org.apache.ignite.internal.binary.BinaryUtils.affinityFieldName; import static org.apache.ignite.internal.binary.BinaryUtils.mergeMetadata; import static org.apache.ignite.internal.processors.metric.impl.MetricUtils.metricName; -import static org.apache.ignite.internal.util.typedef.internal.CU.affinityFieldName; /** * Binary processor implementation. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java index 6c8e6dc76363c..73f04eab90ccc 100755 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java @@ -114,7 +114,6 @@ import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.ReadWriteLock; import java.util.function.Consumer; -import java.util.function.Function; import java.util.jar.JarFile; import java.util.logging.ConsoleHandler; import java.util.logging.Handler; @@ -144,13 +143,7 @@ import org.apache.ignite.IgniteLogger; import org.apache.ignite.IgniteSystemProperties; import org.apache.ignite.binary.BinaryField; -import org.apache.ignite.binary.BinaryIdMapper; -import org.apache.ignite.binary.BinaryNameMapper; import org.apache.ignite.binary.BinaryObjectBuilder; -import org.apache.ignite.binary.BinaryObjectException; -import org.apache.ignite.binary.BinarySerializer; -import org.apache.ignite.binary.BinaryType; -import org.apache.ignite.binary.BinaryTypeConfiguration; import org.apache.ignite.cluster.ClusterGroupEmptyException; import org.apache.ignite.cluster.ClusterMetrics; import org.apache.ignite.cluster.ClusterNode; @@ -171,7 +164,6 @@ import org.apache.ignite.internal.IgniteNodeAttributes; import org.apache.ignite.internal.binary.BinaryContext; import org.apache.ignite.internal.binary.BinaryMarshaller; -import org.apache.ignite.internal.binary.BinaryMetadata; import org.apache.ignite.internal.binary.BinaryMetadataHandler; import org.apache.ignite.internal.binary.BinaryUtils; import org.apache.ignite.internal.binary.builder.BinaryObjectBuilderEx; @@ -209,7 +201,6 @@ import org.apache.ignite.internal.util.typedef.P1; import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.internal.util.typedef.internal.A; -import org.apache.ignite.internal.util.typedef.internal.CU; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.internal.util.typedef.internal.SB; import org.apache.ignite.internal.util.worker.GridWorker; @@ -413,10 +404,6 @@ public abstract class IgniteUtils extends CommonUtils { public static boolean IGNITE_TEST_FEATURES_ENABLED = IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_TEST_FEATURES_ENABLED); - /** For tests. */ - @SuppressWarnings("PublicField") - public static boolean useTestBinaryCtx; - /** */ private static final boolean assertionsEnabled; @@ -7856,36 +7843,15 @@ public static BinaryContext binaryContext( IgniteLogger log ) { BinaryConfiguration bcfg = cfg.getBinaryConfiguration() == null ? new BinaryConfiguration() : cfg.getBinaryConfiguration(); - - return useTestBinaryCtx - ? new TestBinaryContext( - metaHnd, - marsh, - cfg.getIgniteInstanceName(), - cfg.getClassLoader(), - bcfg.getSerializer(), - bcfg.getIdMapper(), - bcfg.getNameMapper(), - bcfg.getTypeConfigurations(), - CU.affinityFields(cfg.getCacheKeyConfiguration()), - bcfg.isCompactFooter(), - CU::affinityFieldName, - log - ) - : new BinaryContext( - metaHnd, - marsh, - cfg.getIgniteInstanceName(), - cfg.getClassLoader(), - bcfg.getSerializer(), - bcfg.getIdMapper(), - bcfg.getNameMapper(), - bcfg.getTypeConfigurations(), - CU.affinityFields(cfg.getCacheKeyConfiguration()), - bcfg.isCompactFooter(), - CU::affinityFieldName, - log - ); + return BinaryUtils.binaryContext( + metaHnd, + marsh, + bcfg, + cfg.getIgniteInstanceName(), + cfg.getClassLoader(), + cfg.getCacheKeyConfiguration(), + log + ); } /** @@ -7970,97 +7936,6 @@ public static IgniteThread newThread(GridWorker worker) { return new IgniteThread(worker.igniteInstanceName(), worker.name(), worker); } - /** */ - @SuppressWarnings("PublicInnerClass") - public static class TestBinaryContext extends BinaryContext { - /** */ - private List listeners; - - /** */ - public TestBinaryContext( - BinaryMetadataHandler metaHnd, - @Nullable BinaryMarshaller marsh, - @Nullable String igniteInstanceName, - @Nullable ClassLoader clsLdr, - @Nullable BinarySerializer dfltSerializer, - @Nullable BinaryIdMapper idMapper, - @Nullable BinaryNameMapper nameMapper, - @Nullable Collection typeCfgs, - Map affFlds, - boolean compactFooter, - Function, String> affFldNameProvider, - IgniteLogger log - ) { - super( - metaHnd, - marsh, - igniteInstanceName, - clsLdr, - dfltSerializer, - idMapper, - nameMapper, - typeCfgs, - affFlds, - compactFooter, - affFldNameProvider, - log - ); - } - - - /** {@inheritDoc} */ - @Nullable @Override public BinaryType metadata(int typeId) throws BinaryObjectException { - BinaryType metadata = super.metadata(typeId); - - if (listeners != null) { - for (TestBinaryContextListener listener : listeners) - listener.onAfterMetadataRequest(typeId, metadata); - } - - return metadata; - } - - /** {@inheritDoc} */ - @Override public void updateMetadata(int typeId, BinaryMetadata meta, boolean failIfUnregistered) throws BinaryObjectException { - if (listeners != null) { - for (TestBinaryContextListener listener : listeners) - listener.onBeforeMetadataUpdate(typeId, meta); - } - - super.updateMetadata(typeId, meta, failIfUnregistered); - } - - /** */ - public interface TestBinaryContextListener { - /** - * @param typeId Type id. - * @param type Type. - */ - void onAfterMetadataRequest(int typeId, BinaryType type); - - /** - * @param typeId Type id. - * @param metadata Metadata. - */ - void onBeforeMetadataUpdate(int typeId, BinaryMetadata metadata); - } - - /** @param lsnr Listener. */ - public void addListener(TestBinaryContextListener lsnr) { - if (listeners == null) - listeners = new ArrayList<>(); - - if (!listeners.contains(lsnr)) - listeners.add(lsnr); - } - - /** */ - public void clearAllListener() { - if (listeners != null) - listeners.clear(); - } - } - /** */ public static final IgniteDataTransferObjectSerializer EMPTY_DTO_SERIALIZER = new IgniteDataTransferObjectSerializer() { /** {@inheritDoc} */ diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java index 4d871f022023d..c5890eb1248a6 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java @@ -78,7 +78,6 @@ import org.apache.ignite.internal.processors.cacheobject.NoOpBinary; import org.apache.ignite.internal.processors.subscription.GridInternalSubscriptionProcessor; import org.apache.ignite.internal.processors.tracing.configuration.NoopTracingConfigurationManager; -import org.apache.ignite.internal.util.typedef.internal.CU; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteBiTuple; import org.apache.ignite.lang.IgnitePredicate; @@ -478,9 +477,9 @@ public IgniteMock(String name, String locHost, UUID nodeId, Marshaller marshalle bcfg.getIdMapper(), bcfg.getNameMapper(), bcfg.getTypeConfigurations(), - CU.affinityFields(configuration().getCacheKeyConfiguration()), + BinaryUtils.affinityFields(configuration().getCacheKeyConfiguration()), bcfg.isCompactFooter(), - CU::affinityFieldName, + BinaryUtils::affinityFieldName, NullLogger.INSTANCE ) { @Override public int typeId(String typeName) { diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinaryMetadataConcurrentUpdateWithIndexesTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinaryMetadataConcurrentUpdateWithIndexesTest.java index 1a4403a307acd..8e9bbd48ca383 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinaryMetadataConcurrentUpdateWithIndexesTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinaryMetadataConcurrentUpdateWithIndexesTest.java @@ -44,10 +44,11 @@ import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.binary.BinaryMetadata; +import org.apache.ignite.internal.binary.BinaryUtils; +import org.apache.ignite.internal.binary.BinaryUtils.TestBinaryContext; +import org.apache.ignite.internal.binary.BinaryUtils.TestBinaryContext.TestBinaryContextListener; import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl; import org.apache.ignite.internal.processors.cache.binary.MetadataUpdateProposedMessage; -import org.apache.ignite.internal.util.IgniteUtils.TestBinaryContext; -import org.apache.ignite.internal.util.IgniteUtils.TestBinaryContext.TestBinaryContextListener; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.spi.discovery.tcp.BlockTcpDiscoverySpi; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; @@ -343,14 +344,14 @@ protected BinaryObject build(Ignite ignite, String prefix, int... fields) { @Override protected void beforeTest() throws Exception { super.beforeTest(); - U.useTestBinaryCtx = true; + BinaryUtils.useTestBinaryCtx = true; } /** {@inheritDoc} */ @Override protected void afterTest() throws Exception { super.afterTest(); - U.useTestBinaryCtx = false; + BinaryUtils.useTestBinaryCtx = false; stopAllGrids(); } diff --git a/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientBinaryMarshaller.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientBinaryMarshaller.java index a496265c5b18e..80063cc55b835 100644 --- a/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientBinaryMarshaller.java +++ b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientBinaryMarshaller.java @@ -18,13 +18,12 @@ package org.apache.ignite.internal.client.thin; import org.apache.ignite.configuration.BinaryConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.binary.BinaryContext; import org.apache.ignite.internal.binary.BinaryMarshaller; import org.apache.ignite.internal.binary.BinaryMetadataHandler; +import org.apache.ignite.internal.binary.BinaryUtils; import org.apache.ignite.internal.binary.GridBinaryMarshaller; import org.apache.ignite.internal.binary.streams.BinaryInputStream; -import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.logger.NullLogger; import org.apache.ignite.marshaller.MarshallerContext; @@ -108,10 +107,13 @@ private GridBinaryMarshaller createImpl(BinaryConfiguration binCfg) { marsh.setContext(marshCtx); - BinaryContext ctx = U.binaryContext( + BinaryContext ctx = BinaryUtils.binaryContext( metaHnd, marsh, - new IgniteConfiguration().setBinaryConfiguration(binCfg), + binCfg, + null, + null, + null, NullLogger.INSTANCE ); diff --git a/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientServiceDescriptorImpl.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientServiceDescriptorImpl.java index 51a1eea708b93..580c7963676d7 100644 --- a/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientServiceDescriptorImpl.java +++ b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientServiceDescriptorImpl.java @@ -20,7 +20,6 @@ import java.util.UUID; import org.apache.ignite.client.ClientServiceDescriptor; import org.apache.ignite.platform.PlatformType; -import org.apache.ignite.services.Service; import org.jetbrains.annotations.Nullable; /** From 20d387e3ee1d558c1d55c1994c773b8a539bec9a Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 29 May 2026 12:35:18 +0300 Subject: [PATCH 42/44] Fix compatibility tests --- .../org/apache/ignite/internal/ClassSet.java | 0 .../IgniteMarshallerClassFilter.java | 0 .../marshaller/IgniteObjectInputFilter.java | 0 .../ignite/marshaller/MarshallerUtils.java | 11 ++- .../ignite/marshaller/package-info.java | 0 .../ignite/IgniteCommonsSystemProperties.java | 32 ++++++++ .../apache/ignite/failure/FailureType.java | 0 ...ClientConnectionNodeRecoveryException.java | 0 .../odbc/ClientListenerRequest.java | 0 .../platform/client/ClientFlag.java | 0 .../ignite/internal/util/CommonUtils.java | 75 +++++++++++++++++++ .../internal/util/HostAndPortRange.java | 0 .../util/future/GridFinishedFuture.java | 4 +- .../util/future/GridFutureAdapter.java | 8 +- .../util/future/GridFutureChainListener.java | 0 .../internal/util/nio/GridNioParser.java | 0 .../util/nio/GridNioRecoveryDescriptor.java | 2 +- .../util/nio/GridNioServerListener.java | 0 .../internal/util/nio/GridNioSession.java | 0 .../util/nio/GridNioSessionMetaKey.java | 0 .../util/nio/SessionWriteRequest.java | 0 .../platform/PlatformServiceMethod.java | 0 .../apache/ignite/IgniteSystemProperties.java | 32 -------- .../ClientConnectorConfiguration.java | 5 +- .../ignite/internal/util/IgniteUtils.java | 69 ----------------- .../client/thin/ClientComputeImpl.java | 4 +- .../client/thin/ClientDiscoveryContext.java | 6 +- .../client/thin/ClientServicesImpl.java | 4 +- .../client/thin/ReliableChannelImpl.java | 10 +-- .../internal/client/thin/TcpClientCache.java | 0 .../client/thin/TcpClientChannel.java | 3 +- .../internal/client/thin/TcpIgniteClient.java | 5 +- .../GridNioClientConnection.java | 0 .../GridNioClientConnectionMultiplexer.java | 0 .../gridnioserver/GridNioClientListener.java | 0 .../io/gridnioserver/GridNioClientParser.java | 0 36 files changed, 139 insertions(+), 131 deletions(-) rename modules/{core => binary/api}/src/main/java/org/apache/ignite/internal/ClassSet.java (100%) rename modules/{core => binary/api}/src/main/java/org/apache/ignite/marshaller/IgniteMarshallerClassFilter.java (100%) rename modules/{core => binary/api}/src/main/java/org/apache/ignite/marshaller/IgniteObjectInputFilter.java (100%) rename modules/{core => binary/api}/src/main/java/org/apache/ignite/marshaller/MarshallerUtils.java (94%) rename modules/{core => binary/api}/src/main/java/org/apache/ignite/marshaller/package-info.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/failure/FailureType.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/processors/odbc/ClientConnectionNodeRecoveryException.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerRequest.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientFlag.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/util/HostAndPortRange.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/util/future/GridFinishedFuture.java (98%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java (98%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/util/future/GridFutureChainListener.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/util/nio/GridNioParser.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java (99%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/util/nio/GridNioServerListener.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/util/nio/GridNioSession.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/util/nio/GridNioSessionMetaKey.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/internal/util/nio/SessionWriteRequest.java (100%) rename modules/{core => commons}/src/main/java/org/apache/ignite/platform/PlatformServiceMethod.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientComputeImpl.java (99%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientDiscoveryContext.java (97%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ClientServicesImpl.java (98%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/ReliableChannelImpl.java (99%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/TcpClientCache.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/TcpClientChannel.java (99%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/TcpIgniteClient.java (99%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/io/gridnioserver/GridNioClientConnection.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/io/gridnioserver/GridNioClientConnectionMultiplexer.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/io/gridnioserver/GridNioClientListener.java (100%) rename modules/{core => thin-client/impl}/src/main/java/org/apache/ignite/internal/client/thin/io/gridnioserver/GridNioClientParser.java (100%) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/ClassSet.java b/modules/binary/api/src/main/java/org/apache/ignite/internal/ClassSet.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/ClassSet.java rename to modules/binary/api/src/main/java/org/apache/ignite/internal/ClassSet.java diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/IgniteMarshallerClassFilter.java b/modules/binary/api/src/main/java/org/apache/ignite/marshaller/IgniteMarshallerClassFilter.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/marshaller/IgniteMarshallerClassFilter.java rename to modules/binary/api/src/main/java/org/apache/ignite/marshaller/IgniteMarshallerClassFilter.java diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/IgniteObjectInputFilter.java b/modules/binary/api/src/main/java/org/apache/ignite/marshaller/IgniteObjectInputFilter.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/marshaller/IgniteObjectInputFilter.java rename to modules/binary/api/src/main/java/org/apache/ignite/marshaller/IgniteObjectInputFilter.java diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/MarshallerUtils.java b/modules/binary/api/src/main/java/org/apache/ignite/marshaller/MarshallerUtils.java similarity index 94% rename from modules/core/src/main/java/org/apache/ignite/marshaller/MarshallerUtils.java rename to modules/binary/api/src/main/java/org/apache/ignite/marshaller/MarshallerUtils.java index 4d474aa826a46..1a237d23bb5f4 100644 --- a/modules/core/src/main/java/org/apache/ignite/marshaller/MarshallerUtils.java +++ b/modules/binary/api/src/main/java/org/apache/ignite/marshaller/MarshallerUtils.java @@ -31,14 +31,13 @@ import java.util.Objects; import java.util.function.Consumer; import org.apache.ignite.IgniteCheckedException; +import org.apache.ignite.IgniteCommonsSystemProperties; import org.apache.ignite.IgniteException; -import org.apache.ignite.IgniteSystemProperties; import org.apache.ignite.internal.ClassSet; import org.apache.ignite.plugin.PluginProvider; import org.jetbrains.annotations.Nullable; -import static org.apache.ignite.IgniteSystemProperties.IGNITE_ENABLE_OBJECT_INPUT_FILTER_AUTOCONFIGURATION; -import static org.apache.ignite.IgniteSystemProperties.IGNITE_MARSHALLER_BLACKLIST; +import static org.apache.ignite.IgniteCommonsSystemProperties.IGNITE_ENABLE_OBJECT_INPUT_FILTER_AUTOCONFIGURATION; /** * Utility marshaller methods. @@ -81,7 +80,7 @@ public static IgniteMarshallerClassFilter classNameFilter(ClassLoader clsLdr) th * @throws IgniteCheckedException if autoconfiguration failed. */ public static void autoconfigureObjectInputFilter(IgniteMarshallerClassFilter clsFilter) throws IgniteCheckedException { - if (!IgniteSystemProperties.getBoolean(IGNITE_ENABLE_OBJECT_INPUT_FILTER_AUTOCONFIGURATION, true)) + if (!IgniteCommonsSystemProperties.getBoolean(IGNITE_ENABLE_OBJECT_INPUT_FILTER_AUTOCONFIGURATION, true)) return; synchronized (MUX) { @@ -116,7 +115,7 @@ else if (objFilter instanceof IgniteObjectInputFilter) { private static ClassSet classWhiteList(ClassLoader clsLdr) throws IgniteCheckedException { ClassSet clsSet = null; - String fileName = IgniteSystemProperties.getString(IgniteSystemProperties.IGNITE_MARSHALLER_WHITELIST); + String fileName = IgniteCommonsSystemProperties.getString(IgniteCommonsSystemProperties.IGNITE_MARSHALLER_WHITELIST); if (fileName != null) { clsSet = new ClassSet(); @@ -139,7 +138,7 @@ private static ClassSet classBlackList(ClassLoader clsLdr) throws IgniteCheckedE addClassNames(DEFAULT_BLACKLIST_CLS_NAMES_FILE, clsSet, clsLdr); - String blackListFileName = IgniteSystemProperties.getString(IGNITE_MARSHALLER_BLACKLIST); + String blackListFileName = IgniteCommonsSystemProperties.getString(IgniteCommonsSystemProperties.IGNITE_MARSHALLER_BLACKLIST); if (blackListFileName != null) addClassNames(blackListFileName, clsSet, clsLdr); diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/package-info.java b/modules/binary/api/src/main/java/org/apache/ignite/marshaller/package-info.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/marshaller/package-info.java rename to modules/binary/api/src/main/java/org/apache/ignite/marshaller/package-info.java diff --git a/modules/commons/src/main/java/org/apache/ignite/IgniteCommonsSystemProperties.java b/modules/commons/src/main/java/org/apache/ignite/IgniteCommonsSystemProperties.java index 6aa8c01e95744..085569ab30698 100644 --- a/modules/commons/src/main/java/org/apache/ignite/IgniteCommonsSystemProperties.java +++ b/modules/commons/src/main/java/org/apache/ignite/IgniteCommonsSystemProperties.java @@ -19,6 +19,7 @@ import java.io.Serializable; import org.apache.ignite.internal.util.GridLogThrottle; +import org.apache.ignite.lang.IgniteExperimental; import org.jetbrains.annotations.Nullable; import static org.apache.ignite.internal.util.CommonUtils.DFLT_MARSHAL_BUFFERS_PER_THREAD_POOL_SIZE; @@ -153,6 +154,37 @@ public class IgniteCommonsSystemProperties { "memory block is released. This will help to recognize cases when already released memory is accessed") public static final String IGNITE_OFFHEAP_SAFE_RELEASE = "IGNITE_OFFHEAP_SAFE_RELEASE"; + /** Human-readable ID of a data center where the node is running. */ + @IgniteExperimental + @SystemProperty(value = "Data Center ID where local node is running. Not required for a single Data Center deployments", + type = String.class) + public static final String IGNITE_DATA_CENTER_ID = "IGNITE_DATA_CENTER_ID"; + + /** + * If this parameter is set to true, Ignite will automatically configure an ObjectInputFilter instance for the + * current JVM it is running in. + * Default value is {@code true}. + */ + @SystemProperty( + value = "If this parameter is set to true, Ignite will automatically configure an ObjectInputFilter" + + " instance for the current JVM it is running in. Filtering is based on class lists defined by the" + + " `IGNITE_MARSHALLER_WHITELIST` and `IGNITE_MARSHALLER_BLACKLIST` system properties or their default values." + + " Disabling it is not recommended because the Ignite host may be vulnerable to RCE attacks based on Java" + + " serialization mechanisms", + defaults = "true" + ) + public static final String IGNITE_ENABLE_OBJECT_INPUT_FILTER_AUTOCONFIGURATION = "IGNITE_ENABLE_OBJECT_INPUT_FILTER_AUTOCONFIGURATION"; + + /** Defines path to the file that contains list of classes allowed to safe deserialization.*/ + @SystemProperty(value = "Path to the file that contains list of classes allowed to safe deserialization", + type = String.class) + public static final String IGNITE_MARSHALLER_WHITELIST = "IGNITE_MARSHALLER_WHITELIST"; + + /** Defines path to the file that contains list of classes disallowed to safe deserialization.*/ + @SystemProperty(value = "Path to the file that contains list of classes disallowed to safe deserialization", + type = String.class) + public static final String IGNITE_MARSHALLER_BLACKLIST = "IGNITE_MARSHALLER_BLACKLIST"; + /** * @param enumCls Enum type. * @param name Name of the system property or environment variable. diff --git a/modules/core/src/main/java/org/apache/ignite/failure/FailureType.java b/modules/commons/src/main/java/org/apache/ignite/failure/FailureType.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/failure/FailureType.java rename to modules/commons/src/main/java/org/apache/ignite/failure/FailureType.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientConnectionNodeRecoveryException.java b/modules/commons/src/main/java/org/apache/ignite/internal/processors/odbc/ClientConnectionNodeRecoveryException.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientConnectionNodeRecoveryException.java rename to modules/commons/src/main/java/org/apache/ignite/internal/processors/odbc/ClientConnectionNodeRecoveryException.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerRequest.java b/modules/commons/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerRequest.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerRequest.java rename to modules/commons/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerRequest.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientFlag.java b/modules/commons/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientFlag.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientFlag.java rename to modules/commons/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientFlag.java diff --git a/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java index 46a8483b0485b..1e2417fc01453 100644 --- a/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java +++ b/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java @@ -79,6 +79,7 @@ import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException; import org.apache.ignite.internal.IgniteInterruptedCheckedException; import org.apache.ignite.internal.processors.cache.CacheClassLoaderMarker; +import org.apache.ignite.internal.util.lang.GridClosureException; import org.apache.ignite.internal.util.lang.GridTuple; import org.apache.ignite.internal.util.typedef.C1; import org.apache.ignite.internal.util.typedef.F; @@ -256,6 +257,12 @@ public abstract class CommonUtils { /** Atomics system cache name. */ public static final String ATOMICS_CACHE_NAME = "ignite-sys-atomic-cache"; + /** Default port. */ + public static final int DFLT_PORT = 10800; + + /** Default port range. */ + public static final int DFLT_PORT_RANGE = 100; + /** Byte bit-mask. */ private static final int MASK = 0xf; @@ -2379,6 +2386,74 @@ public static long safeAbs(long i) { return i < 0 ? 0 : i; } + /** + * Casts the passed {@code Throwable t} to {@link IgniteCheckedException}.
          + * If {@code t} is a {@link GridClosureException}, it is unwrapped and then cast to {@link IgniteCheckedException}. + * If {@code t} is an {@link IgniteCheckedException}, it is returned. + * If {@code t} is not a {@link IgniteCheckedException}, a new {@link IgniteCheckedException} caused by {@code t} + * is returned. + * + * @param t Throwable to cast. + * @return {@code t} cast to {@link IgniteCheckedException}. + */ + public static IgniteCheckedException cast(Throwable t) { + assert t != null; + + t = unwrap(t); + + return t instanceof IgniteCheckedException + ? (IgniteCheckedException)t + : new IgniteCheckedException(t); + } + + /** + * Unwraps closure exceptions. + * + * @param t Exception. + * @return Unwrapped exception. + */ + public static Exception unwrap(Throwable t) { + assert t != null; + + while (true) { + if (t instanceof Error) + throw (Error)t; + + if (t instanceof GridClosureException) { + t = ((GridClosureException)t).unwrap(); + + continue; + } + + return (Exception)t; + } + } + + /** + * Utility method to add the given throwable error to the given throwable root error. If the given + * suppressed throwable is an {@code Error}, but the root error is not, will change the root to the {@code Error}. + * + * @param root Root error to add suppressed error to. + * @param err Error to add. + * @return New root error. + */ + public static T addSuppressed(T root, T err) { + assert err != null; + + if (root == null) + return err; + + if (err instanceof Error && !(root instanceof Error)) { + err.addSuppressed(root); + + root = err; + } + else + root.addSuppressed(err); + + return root; + } + /** * Creates SQL types set. * diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/HostAndPortRange.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/HostAndPortRange.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/util/HostAndPortRange.java rename to modules/commons/src/main/java/org/apache/ignite/internal/util/HostAndPortRange.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFinishedFuture.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/future/GridFinishedFuture.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFinishedFuture.java rename to modules/commons/src/main/java/org/apache/ignite/internal/util/future/GridFinishedFuture.java index 2b42c4bb2f58d..cc6d57dfeb884 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFinishedFuture.java +++ b/modules/commons/src/main/java/org/apache/ignite/internal/util/future/GridFinishedFuture.java @@ -21,9 +21,9 @@ import java.util.concurrent.TimeUnit; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.IgniteInternalFuture; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.lang.GridClosureException; import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteClosure; import org.apache.ignite.lang.IgniteInClosure; import org.apache.ignite.lang.IgniteOutClosure; @@ -100,7 +100,7 @@ public GridFinishedFuture(Throwable err) { /** {@inheritDoc} */ @Override public T get() throws IgniteCheckedException { if (resFlag == ERR) - throw U.cast((Throwable)res); + throw CommonUtils.cast((Throwable)res); return (T)res; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java rename to modules/commons/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java index c932a9c3f8ffc..6f301814f1b01 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java +++ b/modules/commons/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java @@ -29,11 +29,11 @@ import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.IgniteInterruptedCheckedException; import org.apache.ignite.internal.thread.context.function.OperationContextAwareInClosure; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.lang.GridClosureException; import org.apache.ignite.internal.util.tostring.GridToStringExclude; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteClosure; import org.apache.ignite.lang.IgniteInClosure; import org.apache.ignite.lang.IgniteOutClosure; @@ -263,7 +263,7 @@ private R resolve() throws IgniteCheckedException { if (state == null || state.getClass() != ErrorWrapper.class) return (R)state; - throw U.cast(((ErrorWrapper)state).error); + throw CommonUtils.cast(((ErrorWrapper)state).error); } /** @@ -477,11 +477,11 @@ private void notifyListener(IgniteInClosure> lsn lsnr.apply(this); } catch (IllegalStateException e) { - U.error(logger(), "Failed to notify listener (is grid stopped?) [fut=" + this + + CommonUtils.error(logger(), "Failed to notify listener (is grid stopped?) [fut=" + this + ", lsnr=" + lsnr + ", err=" + e.getMessage() + ']', e); } catch (RuntimeException | Error e) { - U.error(logger(), "Failed to notify listener: " + lsnr, e); + CommonUtils.error(logger(), "Failed to notify listener: " + lsnr, e); throw e; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureChainListener.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/future/GridFutureChainListener.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureChainListener.java rename to modules/commons/src/main/java/org/apache/ignite/internal/util/future/GridFutureChainListener.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioParser.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/nio/GridNioParser.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioParser.java rename to modules/commons/src/main/java/org/apache/ignite/internal/util/nio/GridNioParser.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java similarity index 99% rename from modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java rename to modules/commons/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java index 1cedb7d800ee4..811b1ccb4513f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java +++ b/modules/commons/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java @@ -41,7 +41,7 @@ public class GridNioRecoveryDescriptor { /** Timeout for outgoing recovery descriptor reservation. */ private static final long DESC_RESERVATION_TIMEOUT = Math.max(1_000, - IgniteSystemProperties.getLong(IGNITE_NIO_RECOVERY_DESCRIPTOR_RESERVATION_TIMEOUT, + IgniteSystemProperties.getLong(IgniteSystemProperties.IGNITE_NIO_RECOVERY_DESCRIPTOR_RESERVATION_TIMEOUT, DFLT_NIO_RECOVERY_DESCRIPTOR_RESERVATION_TIMEOUT)); /** Number of acknowledged messages. */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServerListener.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/nio/GridNioServerListener.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServerListener.java rename to modules/commons/src/main/java/org/apache/ignite/internal/util/nio/GridNioServerListener.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioSession.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/nio/GridNioSession.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioSession.java rename to modules/commons/src/main/java/org/apache/ignite/internal/util/nio/GridNioSession.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioSessionMetaKey.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/nio/GridNioSessionMetaKey.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioSessionMetaKey.java rename to modules/commons/src/main/java/org/apache/ignite/internal/util/nio/GridNioSessionMetaKey.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/SessionWriteRequest.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/nio/SessionWriteRequest.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/util/nio/SessionWriteRequest.java rename to modules/commons/src/main/java/org/apache/ignite/internal/util/nio/SessionWriteRequest.java diff --git a/modules/core/src/main/java/org/apache/ignite/platform/PlatformServiceMethod.java b/modules/commons/src/main/java/org/apache/ignite/platform/PlatformServiceMethod.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/platform/PlatformServiceMethod.java rename to modules/commons/src/main/java/org/apache/ignite/platform/PlatformServiceMethod.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 b1c36a9015827..18b3e0f86fb6c 100644 --- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java @@ -41,7 +41,6 @@ import org.apache.ignite.internal.processors.query.schema.SchemaIndexCachePartitionWorker; import org.apache.ignite.internal.processors.rest.GridRestCommand; import org.apache.ignite.internal.util.IgniteUtils; -import org.apache.ignite.lang.IgniteExperimental; import org.apache.ignite.mxbean.MetricsMxBean; import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi; import org.apache.ignite.spi.metric.ReadOnlyMetricRegistry; @@ -744,12 +743,6 @@ public final class IgniteSystemProperties extends IgniteCommonsSystemProperties defaults = "" + DFLT_DISCOVERY_HISTORY_SIZE) public static final String IGNITE_DISCOVERY_HISTORY_SIZE = "IGNITE_DISCOVERY_HISTORY_SIZE"; - /** Human-readable ID of a data center where the node is running. */ - @IgniteExperimental - @SystemProperty(value = "Data Center ID where local node is running. Not required for a single Data Center deployments", - type = String.class) - public static final String IGNITE_DATA_CENTER_ID = "IGNITE_DATA_CENTER_ID"; - /** Maximum number of discovery message history used to support client reconnect. */ @SystemProperty(value = "Maximum number of discovery message history used to support client reconnect", type = Integer.class, defaults = "" + DFLT_DISCOVERY_CLIENT_RECONNECT_HISTORY_SIZE) @@ -814,31 +807,6 @@ public final class IgniteSystemProperties extends IgniteCommonsSystemProperties @SystemProperty("Enables local store keeps primary only. Backward compatibility flag") public static final String IGNITE_LOCAL_STORE_KEEPS_PRIMARY_ONLY = "IGNITE_LOCAL_STORE_KEEPS_PRIMARY_ONLY"; - /** Defines path to the file that contains list of classes allowed to safe deserialization.*/ - @SystemProperty(value = "Path to the file that contains list of classes allowed to safe deserialization", - type = String.class) - public static final String IGNITE_MARSHALLER_WHITELIST = "IGNITE_MARSHALLER_WHITELIST"; - - /** Defines path to the file that contains list of classes disallowed to safe deserialization.*/ - @SystemProperty(value = "Path to the file that contains list of classes disallowed to safe deserialization", - type = String.class) - public static final String IGNITE_MARSHALLER_BLACKLIST = "IGNITE_MARSHALLER_BLACKLIST"; - - /** - * If this parameter is set to true, Ignite will automatically configure an ObjectInputFilter instance for the - * current JVM it is running in. - * Default value is {@code true}. - */ - @SystemProperty( - value = "If this parameter is set to true, Ignite will automatically configure an ObjectInputFilter" + - " instance for the current JVM it is running in. Filtering is based on class lists defined by the" + - " `IGNITE_MARSHALLER_WHITELIST` and `IGNITE_MARSHALLER_BLACKLIST` system properties or their default values." + - " Disabling it is not recommended because the Ignite host may be vulnerable to RCE attacks based on Java" + - " serialization mechanisms", - defaults = "true" - ) - public static final String IGNITE_ENABLE_OBJECT_INPUT_FILTER_AUTOCONFIGURATION = "IGNITE_ENABLE_OBJECT_INPUT_FILTER_AUTOCONFIGURATION"; - /** * If set to {@code true}, then default selected keys set is used inside * {@code GridNioServer} which lead to some extra garbage generation when diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/ClientConnectorConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/ClientConnectorConfiguration.java index 8a993bcc5304d..9f5b62b25e729 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/ClientConnectorConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/ClientConnectorConfiguration.java @@ -19,6 +19,7 @@ import javax.cache.configuration.Factory; import javax.net.ssl.SSLContext; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.ssl.SslContextFactory; @@ -29,10 +30,10 @@ */ public class ClientConnectorConfiguration { /** Default port. */ - public static final int DFLT_PORT = 10800; + public static final int DFLT_PORT = CommonUtils.DFLT_PORT; /** Default port range. */ - public static final int DFLT_PORT_RANGE = 100; + public static final int DFLT_PORT_RANGE = CommonUtils.DFLT_PORT_RANGE; /** Default socket send and receive buffer size. */ public static final int DFLT_SOCK_BUF_SIZE = 0; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java index 73f04eab90ccc..2cd60ab9f305d 100755 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java @@ -192,7 +192,6 @@ import org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException; import org.apache.ignite.internal.util.future.GridFutureAdapter; import org.apache.ignite.internal.util.future.IgniteFutureImpl; -import org.apache.ignite.internal.util.lang.GridClosureException; import org.apache.ignite.internal.util.lang.GridPeerDeployAware; import org.apache.ignite.internal.util.lang.IgniteThrowableFunction; import org.apache.ignite.internal.util.typedef.C1; @@ -4852,49 +4851,6 @@ public static JMException jmException(Throwable e) { return new JMException(e.getMessage()); } - /** - * Unwraps closure exceptions. - * - * @param t Exception. - * @return Unwrapped exception. - */ - public static Exception unwrap(Throwable t) { - assert t != null; - - while (true) { - if (t instanceof Error) - throw (Error)t; - - if (t instanceof GridClosureException) { - t = ((GridClosureException)t).unwrap(); - - continue; - } - - return (Exception)t; - } - } - - /** - * Casts the passed {@code Throwable t} to {@link IgniteCheckedException}.
          - * If {@code t} is a {@link GridClosureException}, it is unwrapped and then cast to {@link IgniteCheckedException}. - * If {@code t} is an {@link IgniteCheckedException}, it is returned. - * If {@code t} is not a {@link IgniteCheckedException}, a new {@link IgniteCheckedException} caused by {@code t} - * is returned. - * - * @param t Throwable to cast. - * @return {@code t} cast to {@link IgniteCheckedException}. - */ - public static IgniteCheckedException cast(Throwable t) { - assert t != null; - - t = unwrap(t); - - return t instanceof IgniteCheckedException - ? (IgniteCheckedException)t - : new IgniteCheckedException(t); - } - /** * Checks if class loader is an internal P2P class loader. * @@ -7237,31 +7193,6 @@ private static Collection doInParallel( return results; } - /** - * Utility method to add the given throwable error to the given throwable root error. If the given - * suppressed throwable is an {@code Error}, but the root error is not, will change the root to the {@code Error}. - * - * @param root Root error to add suppressed error to. - * @param err Error to add. - * @return New root error. - */ - public static T addSuppressed(T root, T err) { - assert err != null; - - if (root == null) - return err; - - if (err instanceof Error && !(root instanceof Error)) { - err.addSuppressed(root); - - root = err; - } - else - root.addSuppressed(err); - - return root; - } - /** * @return {@code true} if local node is coordinator. */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientComputeImpl.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientComputeImpl.java similarity index 99% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientComputeImpl.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientComputeImpl.java index 7234473597c2e..d3fbf8744ffae 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientComputeImpl.java +++ b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientComputeImpl.java @@ -37,9 +37,9 @@ import org.apache.ignite.internal.binary.BinaryWriterEx; import org.apache.ignite.internal.binary.streams.BinaryStreams; import org.apache.ignite.internal.processors.platform.client.ClientStatus; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.future.GridFutureAdapter; import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.internal.util.typedef.internal.U; import org.jetbrains.annotations.Nullable; import static org.apache.ignite.internal.client.thin.ClientNotificationType.COMPUTE_TASK_FINISHED; @@ -266,7 +266,7 @@ private static boolean cancelGridFuture(GridFutureAdapter fut, Boolean mayInt return mayInterruptIfRunning ? fut.cancel() : fut.onCancelled(); } catch (IgniteCheckedException e) { - throw U.convertException(e); + throw CommonUtils.convertException(e); } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientDiscoveryContext.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientDiscoveryContext.java similarity index 97% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientDiscoveryContext.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientDiscoveryContext.java index 928c00349c860..b09a119d731ea 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientDiscoveryContext.java +++ b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientDiscoveryContext.java @@ -37,8 +37,8 @@ import org.apache.ignite.client.ClientAddressFinder; import org.apache.ignite.client.ClientException; import org.apache.ignite.configuration.ClientConfiguration; -import org.apache.ignite.configuration.ClientConnectorConfiguration; import org.apache.ignite.internal.binary.BinaryReaderEx; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.HostAndPortRange; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.logger.NullLogger; @@ -231,8 +231,8 @@ private static Set> parsedAddresses(String[] addrs) thro try { ranges.add(HostAndPortRange.parse( a, - ClientConnectorConfiguration.DFLT_PORT, - ClientConnectorConfiguration.DFLT_PORT + ClientConnectorConfiguration.DFLT_PORT_RANGE, + CommonUtils.DFLT_PORT, + CommonUtils.DFLT_PORT + CommonUtils.DFLT_PORT_RANGE, "Failed to parse Ignite server address" )); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientServicesImpl.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientServicesImpl.java similarity index 98% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientServicesImpl.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientServicesImpl.java index 6cda195ddf72a..342ce8f630c5f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientServicesImpl.java +++ b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ClientServicesImpl.java @@ -40,9 +40,9 @@ import org.apache.ignite.internal.binary.BinaryWriterEx; import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; import org.apache.ignite.internal.processors.service.ServiceCallContextImpl; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.A; -import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.platform.PlatformServiceMethod; import org.apache.ignite.platform.PlatformType; import org.apache.ignite.services.ServiceCallContext; @@ -218,7 +218,7 @@ private ServiceTopology(String name) { */ private boolean isUpdateRequired(AffinityTopologyVersion curAffTop) { return lastAffTop == null || curAffTop.topologyVersion() > lastAffTop.topologyVersion() - || U.nanosToMillis(System.nanoTime() - lastUpdateRequestTime) >= SRV_TOP_UPDATE_PERIOD; + || CommonUtils.nanosToMillis(System.nanoTime() - lastUpdateRequestTime) >= SRV_TOP_UPDATE_PERIOD; } /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ReliableChannelImpl.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ReliableChannelImpl.java similarity index 99% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/ReliableChannelImpl.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ReliableChannelImpl.java index ec6e96cb0f979..b29bb69629fe3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ReliableChannelImpl.java +++ b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/ReliableChannelImpl.java @@ -39,8 +39,8 @@ import java.util.function.Function; import java.util.stream.Collectors; import org.apache.ignite.IgniteBinary; +import org.apache.ignite.IgniteCommonsSystemProperties; import org.apache.ignite.IgniteLogger; -import org.apache.ignite.IgniteSystemProperties; import org.apache.ignite.client.ClientAuthenticationException; import org.apache.ignite.client.ClientConnectionException; import org.apache.ignite.client.ClientException; @@ -52,8 +52,8 @@ import org.apache.ignite.configuration.ClientConfiguration; import org.apache.ignite.internal.client.thin.io.ClientConnectionMultiplexer; import org.apache.ignite.internal.client.thin.io.gridnioserver.GridNioClientConnectionMultiplexer; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.logger.NullLogger; import org.jetbrains.annotations.Nullable; @@ -141,10 +141,10 @@ final class ReliableChannelImpl implements ReliableChannelEx { partitionAwarenessEnabled = clientCfg.isPartitionAwarenessEnabled(); - String dcId = IgniteSystemProperties.getString(IgniteSystemProperties.IGNITE_DATA_CENTER_ID); + String dcId = IgniteCommonsSystemProperties.getString(IgniteCommonsSystemProperties.IGNITE_DATA_CENTER_ID); if (dcId == null && !F.isEmpty(clientCfg.getUserAttributes())) - dcId = clientCfg.getUserAttributes().get(IgniteSystemProperties.IGNITE_DATA_CENTER_ID); + dcId = clientCfg.getUserAttributes().get(IgniteCommonsSystemProperties.IGNITE_DATA_CENTER_ID); affinityCtx = new ClientCacheAffinityContext( binary, @@ -1133,7 +1133,7 @@ private ClientChannel getOrCreateChannel(boolean ignoreThrottling) */ private synchronized void closeChannel() { if (ch != null) { - U.closeQuiet(ch); + CommonUtils.closeQuiet(ch); ch = null; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpClientCache.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/TcpClientCache.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpClientCache.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/TcpClientCache.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpClientChannel.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/TcpClientChannel.java similarity index 99% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpClientChannel.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/TcpClientChannel.java index 00a6c56c59e88..ba84b69cde13e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpClientChannel.java +++ b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/TcpClientChannel.java @@ -68,6 +68,7 @@ import org.apache.ignite.internal.processors.odbc.ClientListenerRequest; import org.apache.ignite.internal.processors.platform.client.ClientFlag; import org.apache.ignite.internal.processors.platform.client.ClientStatus; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.future.GridFutureAdapter; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.T2; @@ -217,7 +218,7 @@ class TcpClientChannel implements ClientChannel, ClientMessageHandler, ClientCon catch (ClientConnectionException e) { log.info("Can't establish connection with " + addr); - connectionEx = U.addSuppressed(connectionEx, e); + connectionEx = CommonUtils.addSuppressed(connectionEx, e); continue; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpIgniteClient.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/TcpIgniteClient.java similarity index 99% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpIgniteClient.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/TcpIgniteClient.java index b21eca8578160..ee7ec14795ca1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpIgniteClient.java +++ b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/TcpIgniteClient.java @@ -71,6 +71,7 @@ import org.apache.ignite.internal.client.thin.io.ClientConnectionMultiplexer; import org.apache.ignite.internal.processors.platform.client.ClientStatus; import org.apache.ignite.internal.processors.platform.client.IgniteClientException; +import org.apache.ignite.internal.util.CommonUtils; import org.apache.ignite.internal.util.GridArgumentCheck; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.U; @@ -792,7 +793,7 @@ private class ClientMarshallerContext implements MarshallerContext { */ public ClientMarshallerContext() { try { - MarshallerUtils.processSystemClasses(U.gridClassLoader(), null, sysTypes::add); + MarshallerUtils.processSystemClasses(CommonUtils.gridClassLoader(), null, sysTypes::add); } catch (IOException e) { throw new IllegalStateException("Failed to initialize marshaller context.", e); @@ -858,7 +859,7 @@ public ClientMarshallerContext() { @Override public Class getClass(int typeId, ClassLoader ldr) throws ClassNotFoundException, IgniteCheckedException { - return U.forName(getClassName(MarshallerPlatformIds.JAVA_ID, typeId), ldr, null); + return CommonUtils.forName(getClassName(MarshallerPlatformIds.JAVA_ID, typeId), ldr, null); } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/io/gridnioserver/GridNioClientConnection.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/io/gridnioserver/GridNioClientConnection.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/io/gridnioserver/GridNioClientConnection.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/io/gridnioserver/GridNioClientConnection.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/io/gridnioserver/GridNioClientConnectionMultiplexer.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/io/gridnioserver/GridNioClientConnectionMultiplexer.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/io/gridnioserver/GridNioClientConnectionMultiplexer.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/io/gridnioserver/GridNioClientConnectionMultiplexer.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/io/gridnioserver/GridNioClientListener.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/io/gridnioserver/GridNioClientListener.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/io/gridnioserver/GridNioClientListener.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/io/gridnioserver/GridNioClientListener.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/io/gridnioserver/GridNioClientParser.java b/modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/io/gridnioserver/GridNioClientParser.java similarity index 100% rename from modules/core/src/main/java/org/apache/ignite/internal/client/thin/io/gridnioserver/GridNioClientParser.java rename to modules/thin-client/impl/src/main/java/org/apache/ignite/internal/client/thin/io/gridnioserver/GridNioClientParser.java From 65d30b83a1f588bdfd52d35c9b62d70ce4a68c97 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Wed, 3 Jun 2026 11:40:41 +0300 Subject: [PATCH 43/44] Fix compatibility tests --- .../org/apache/ignite/IgniteCommonsSystemProperties.java | 9 +++++++++ .../internal/util/nio/GridNioRecoveryDescriptor.java | 8 +++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/modules/commons/src/main/java/org/apache/ignite/IgniteCommonsSystemProperties.java b/modules/commons/src/main/java/org/apache/ignite/IgniteCommonsSystemProperties.java index 085569ab30698..b5ab3a858f365 100644 --- a/modules/commons/src/main/java/org/apache/ignite/IgniteCommonsSystemProperties.java +++ b/modules/commons/src/main/java/org/apache/ignite/IgniteCommonsSystemProperties.java @@ -26,6 +26,7 @@ import static org.apache.ignite.internal.util.CommonUtils.DFLT_MARSHAL_BUFFERS_RECHECK; import static org.apache.ignite.internal.util.CommonUtils.DFLT_MEMORY_PER_BYTE_COPY_THRESHOLD; import static org.apache.ignite.internal.util.GridLogThrottle.DFLT_LOG_THROTTLE_CAPACITY; +import static org.apache.ignite.internal.util.nio.GridNioRecoveryDescriptor.DFLT_NIO_RECOVERY_DESCRIPTOR_RESERVATION_TIMEOUT; import static org.apache.ignite.internal.util.tostring.GridToStringBuilder.DFLT_TO_STRING_COLLECTION_LIMIT; import static org.apache.ignite.internal.util.tostring.GridToStringBuilder.DFLT_TO_STRING_INCLUDE_SENSITIVE; import static org.apache.ignite.internal.util.tostring.GridToStringBuilder.DFLT_TO_STRING_MAX_LENGTH; @@ -185,6 +186,14 @@ public class IgniteCommonsSystemProperties { type = String.class) public static final String IGNITE_MARSHALLER_BLACKLIST = "IGNITE_MARSHALLER_BLACKLIST"; + /** + * Sets timeout for TCP client recovery descriptor reservation. + */ + @SystemProperty(value = "Timeout for TCP client recovery descriptor reservation in milliseconds", + type = Long.class, defaults = "" + DFLT_NIO_RECOVERY_DESCRIPTOR_RESERVATION_TIMEOUT) + public static final String IGNITE_NIO_RECOVERY_DESCRIPTOR_RESERVATION_TIMEOUT = + "IGNITE_NIO_RECOVERY_DESCRIPTOR_RESERVATION_TIMEOUT"; + /** * @param enumCls Enum type. * @param name Name of the system property or environment variable. diff --git a/modules/commons/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java b/modules/commons/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java index 811b1ccb4513f..6cf8bdf74fb76 100644 --- a/modules/commons/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java +++ b/modules/commons/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java @@ -20,9 +20,9 @@ import java.io.IOException; import java.util.ArrayDeque; import java.util.Deque; +import org.apache.ignite.IgniteCommonsSystemProperties; import org.apache.ignite.IgniteException; import org.apache.ignite.IgniteLogger; -import org.apache.ignite.IgniteSystemProperties; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.internal.util.tostring.GridToStringExclude; import org.apache.ignite.internal.util.typedef.internal.S; @@ -30,18 +30,16 @@ import org.apache.ignite.lang.IgniteInClosure; import org.jetbrains.annotations.Nullable; -import static org.apache.ignite.IgniteSystemProperties.IGNITE_NIO_RECOVERY_DESCRIPTOR_RESERVATION_TIMEOUT; - /** * Recovery information for single node. */ public class GridNioRecoveryDescriptor { - /** @see IgniteSystemProperties#IGNITE_NIO_RECOVERY_DESCRIPTOR_RESERVATION_TIMEOUT */ + /** @see IgniteCommonsSystemProperties#IGNITE_NIO_RECOVERY_DESCRIPTOR_RESERVATION_TIMEOUT */ public static final int DFLT_NIO_RECOVERY_DESCRIPTOR_RESERVATION_TIMEOUT = 5_000; /** Timeout for outgoing recovery descriptor reservation. */ private static final long DESC_RESERVATION_TIMEOUT = Math.max(1_000, - IgniteSystemProperties.getLong(IgniteSystemProperties.IGNITE_NIO_RECOVERY_DESCRIPTOR_RESERVATION_TIMEOUT, + IgniteCommonsSystemProperties.getLong(IgniteCommonsSystemProperties.IGNITE_NIO_RECOVERY_DESCRIPTOR_RESERVATION_TIMEOUT, DFLT_NIO_RECOVERY_DESCRIPTOR_RESERVATION_TIMEOUT)); /** Number of acknowledged messages. */ From 197d45125f569d41e7313fc59d1656c54a28b6c9 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Wed, 3 Jun 2026 11:40:50 +0300 Subject: [PATCH 44/44] Fix compatibility tests --- .../java/org/apache/ignite/IgniteSystemProperties.java | 8 -------- 1 file changed, 8 deletions(-) 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 18b3e0f86fb6c..7671efe66ef8b 100644 --- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java @@ -1319,14 +1319,6 @@ public final class IgniteSystemProperties extends IgniteCommonsSystemProperties public static final String IGNITE_DISABLE_REBALANCING_CANCELLATION_OPTIMIZATION = "IGNITE_DISABLE_REBALANCING_CANCELLATION_OPTIMIZATION"; - /** - * Sets timeout for TCP client recovery descriptor reservation. - */ - @SystemProperty(value = "Timeout for TCP client recovery descriptor reservation in milliseconds", - type = Long.class, defaults = "" + DFLT_NIO_RECOVERY_DESCRIPTOR_RESERVATION_TIMEOUT) - public static final String IGNITE_NIO_RECOVERY_DESCRIPTOR_RESERVATION_TIMEOUT = - "IGNITE_NIO_RECOVERY_DESCRIPTOR_RESERVATION_TIMEOUT"; - /** * When set to {@code true}, Ignite will skip partitions sizes check on partition validation after rebalance has finished. * Partitions sizes may differs on nodes when Expiry Policy is in use and it is ok due to lazy entry eviction mechanics.