From 0c0b7a3390489d20af286984e09aba2b6340db2f Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 22 May 2026 17:16:57 +0300 Subject: [PATCH 01/17] 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 02/17] 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 03/17] 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 04/17] 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 05/17] 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 06/17] 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 07/17] 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 08/17] 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 09/17] 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 10/17] 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 11/17] 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 12/17] 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 13/17] 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 14/17] 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 15/17] 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 16/17] 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 17/17] 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); }