From 0c0b7a3390489d20af286984e09aba2b6340db2f Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 22 May 2026 17:16:57 +0300 Subject: [PATCH] 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