Skip to content

Commit 344e6c4

Browse files
committed
merge from upstream
2 parents d912c3c + d0a1ae0 commit 344e6c4

151 files changed

Lines changed: 902 additions & 2206 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

modules/calcite/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<jsonpath.version>2.9.0</jsonpath.version>
4848
<reflections.version>0.10.2</reflections.version>
4949
<commons.math.version>3.6.1</commons.math.version>
50-
<commons.text.version>1.11.0</commons.text.version>
50+
<commons.text.version>1.15.0</commons.text.version>
5151
<io.trino.tpch.version>1.2</io.trino.tpch.version>
5252
</properties>
5353

modules/clients/src/test/java/org/apache/ignite/common/NodeSslConnectionMetricTest.java

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,14 @@ public class NodeSslConnectionMetricTest extends GridCommonAbstractTest {
6969
/** Cipher suite not supported by cluster nodes. */
7070
private static final String UNSUPPORTED_CIPHER_SUITE = "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256";
7171

72+
/** Local client host. */
73+
private static final String LOCAL_CLIENT_HOST = "127.0.0.1";
74+
75+
/** Local client port. */
76+
private static final String LOCAL_CLIENT_PORT = "10800";
77+
7278
/** Local server address. */
73-
private static final String LOCAL_CLIENT_ADDRESS = "127.0.0.1:10800";
79+
private static final String LOCAL_CLIENT_ADDRESS = LOCAL_CLIENT_HOST + ":" + LOCAL_CLIENT_PORT;
7480

7581
/** Metric timeout. */
7682
private static final long TIMEOUT = 7_000;
@@ -252,7 +258,7 @@ public void testClientConnector() throws Exception {
252258
startClient(clientConfiguration("client", "trustboth", CIPHER_SUITE, "TLSv1.2")),
253259
ClientConnectionException.class);
254260

255-
assertContains(log, ex.getMessage(), LOCAL_CLIENT_ADDRESS);
261+
assertLocalClientAddressPresent(ex.getMessage());
256262

257263
checkSslCommunicationMetrics(reg, 2, 0, 1);
258264

@@ -262,7 +268,7 @@ public void testClientConnector() throws Exception {
262268
ClientConnectionException.class
263269
);
264270

265-
assertContains(log, ex.getMessage(), LOCAL_CLIENT_ADDRESS);
271+
assertLocalClientAddressPresent(ex.getMessage());
266272

267273
checkSslCommunicationMetrics(reg, 3, 0, 2);
268274

@@ -272,7 +278,7 @@ public void testClientConnector() throws Exception {
272278
ClientConnectionException.class
273279
);
274280

275-
assertContains(log, ex.getMessage(), LOCAL_CLIENT_ADDRESS);
281+
assertLocalClientAddressPresent(ex.getMessage());
276282

277283
checkSslCommunicationMetrics(reg, 4, 0, 3);
278284
}
@@ -396,6 +402,16 @@ private void waitForMetricGreaterOrEqual(String name, int expected, Supplier<Int
396402
waitForCondition(() -> expected <= supplier.get(), TIMEOUT));
397403
}
398404

405+
/**
406+
* Checks that local client host and port are present in the message regardless of address rendering format.
407+
*
408+
* @param msg Exception message.
409+
*/
410+
private void assertLocalClientAddressPresent(String msg) {
411+
assertContains(log, msg, LOCAL_CLIENT_HOST);
412+
assertContains(log, msg, LOCAL_CLIENT_PORT);
413+
}
414+
399415
/** Creates {@link SslContextFactory} with specified options. */
400416
private SslContextFactory sslContextFactory(String keyStore, String trustStore, String cipherSuite, String protocol) {
401417
SslContextFactory res = (SslContextFactory)sslTrustedFactory(keyStore, trustStore);

modules/codegen/src/main/java/org/apache/ignite/internal/MessageProcessor.java

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@
1818
package org.apache.ignite.internal;
1919

2020
import java.util.ArrayList;
21+
import java.util.Arrays;
2122
import java.util.Comparator;
2223
import java.util.HashMap;
2324
import java.util.List;
2425
import java.util.Map;
26+
import java.util.Objects;
2527
import java.util.Set;
28+
import java.util.stream.Collectors;
2629
import javax.annotation.processing.AbstractProcessor;
2730
import javax.annotation.processing.RoundEnvironment;
2831
import javax.annotation.processing.SupportedAnnotationTypes;
@@ -70,10 +73,14 @@ public class MessageProcessor extends AbstractProcessor {
7073
static final String COMPRESSED_MESSAGE_INTERFACE = "org.apache.ignite.internal.managers.communication.CompressedMessage";
7174

7275
/** Externalizable message. */
73-
static final String MARSHALLABLE_MESSAGE_INTERFACE = "org.apache.ignite.plugin.extensions.communication.MarshallableMessage";
76+
static final String MARSHALLABLE_MESSAGE_INTERFACE = "org.apache.ignite.internal.MarshallableMessage";
7477

75-
/** This is the only message with zero fields. A serializer must be generated due to restrictions in our communication process. */
76-
static final String HANDSHAKE_WAIT_MESSAGE = "org.apache.ignite.spi.communication.tcp.messages.HandshakeWaitMessage";
78+
/** Messages with no fields. A serializer must be generated due to restrictions in our communication process. */
79+
static final String[] EMPTY_MESSAGES = {
80+
"org.apache.ignite.spi.communication.tcp.messages.HandshakeWaitMessage",
81+
"org.apache.ignite.spi.discovery.zk.internal.ZkNoServersMessage",
82+
"org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2Null",
83+
};
7784

7885
/** */
7986
private final Map<String, IgniteBiTuple<String, String>> enumMappersInUse = new HashMap<>();
@@ -83,7 +90,11 @@ public class MessageProcessor extends AbstractProcessor {
8390
*/
8491
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
8592
TypeMirror msgType = processingEnv.getElementUtils().getTypeElement(MESSAGE_INTERFACE).asType();
86-
TypeMirror handshakeWaitMsgType = processingEnv.getElementUtils().getTypeElement(HANDSHAKE_WAIT_MESSAGE).asType();
93+
List<TypeMirror> emptyMsgs = Arrays.stream(EMPTY_MESSAGES)
94+
.map(cls -> processingEnv.getElementUtils().getTypeElement(cls))
95+
.filter(Objects::nonNull)
96+
.map(Element::asType)
97+
.collect(Collectors.toList());
8798

8899
Map<TypeElement, List<VariableElement>> msgFields = new HashMap<>();
89100

@@ -101,7 +112,7 @@ public class MessageProcessor extends AbstractProcessor {
101112

102113
List<VariableElement> fields = orderedFields(clazz);
103114

104-
if (!fields.isEmpty() || processingEnv.getTypeUtils().isAssignable(clazz.asType(), handshakeWaitMsgType))
115+
if (!fields.isEmpty() || emptyMsgs.stream().anyMatch(t -> processingEnv.getTypeUtils().isAssignable(clazz.asType(), t)))
105116
msgFields.put(clazz, fields);
106117
}
107118

modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java

Lines changed: 53 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@
232232
import org.apache.ignite.lang.IgniteProductVersion;
233233
import org.apache.ignite.marshaller.Marshaller;
234234
import org.apache.ignite.marshaller.jdk.JdkMarshaller;
235-
import org.apache.ignite.plugin.extensions.communication.MarshallableMessage;
236235
import org.apache.ignite.plugin.extensions.communication.Message;
237236
import org.apache.ignite.plugin.extensions.communication.MessageFactory;
238237
import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
@@ -256,7 +255,6 @@
256255
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientPingRequest;
257256
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientPingResponse;
258257
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientReconnectMessage;
259-
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryCollectionMessage;
260258
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryConnectionCheckMessage;
261259
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryCustomEventMessage;
262260
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryDiscardMessage;
@@ -317,7 +315,7 @@ public CoreMessagesProvider(Marshaller schemaAwareMarhaller, Marshaller schemaLe
317315
this.resolvedClsLdr = resolvedClsLdr;
318316
}
319317

320-
/** {@inheritDoc} */
318+
/** The order is important. If wish to remove a message, put 'msgIdx++' on its place. */
321319
@Override public void registerAll(MessageFactory factory) {
322320
assert this.factory == null;
323321

@@ -342,9 +340,6 @@ public CoreMessagesProvider(Marshaller schemaAwareMarhaller, Marshaller schemaLe
342340
withNoSchema(GridCacheVersion.class);
343341
withNoSchema(GridCacheVersionEx.class);
344342

345-
msgIdx = 5500;
346-
withNoSchema(TcpDiscoveryCollectionMessage.class);
347-
348343
// [5700 - 5900]: Discovery originated messages.
349344
msgIdx = 5700;
350345
withNoSchema(TcpDiscoveryHandshakeRequest.class);
@@ -395,7 +390,7 @@ public CoreMessagesProvider(Marshaller schemaAwareMarhaller, Marshaller schemaLe
395390
// [6300 - 6400]: Services messages. Most of them originally come from Discovery.
396391
msgIdx = 6300;
397392
withNoSchema(ServiceDeploymentProcessId.class);
398-
withNoSchema(ServiceSingleNodeDeploymentResult.class);
393+
withSchema(ServiceSingleNodeDeploymentResult.class);
399394
withNoSchema(ServiceClusterDeploymentResult.class);
400395
withNoSchema(ServiceDeploymentRequest.class);
401396
withNoSchema(ServiceUndeploymentRequest.class);
@@ -435,73 +430,73 @@ public CoreMessagesProvider(Marshaller schemaAwareMarhaller, Marshaller schemaLe
435430
withNoSchema(ClientCacheChangeDummyDiscoveryMessage.class);
436431
withNoSchemaResolvedClassLoader(DynamicCacheChangeBatch.class);
437432

438-
// [10000 - 10200]: Transaction and lock related messages. Most of the originally comes from Communication.
433+
// [10000 - 10200]: Transaction and lock related messages. Most of them originally comes from Communication.
439434
msgIdx = 10000;
440435
withNoSchema(TxInfo.class);
441-
withNoSchema(TxEntriesInfo.class);
436+
withSchema(TxEntriesInfo.class);
442437
withNoSchema(TxLock.class);
443-
withNoSchema(TxLocksRequest.class);
444-
withNoSchema(TxLocksResponse.class);
445-
withNoSchema(IgniteTxKey.class);
446-
withNoSchema(IgniteTxEntry.class);
447-
withNoSchema(TxEntryValueHolder.class);
438+
withSchema(TxLocksRequest.class);
439+
withSchema(TxLocksResponse.class);
440+
withSchema(IgniteTxKey.class);
441+
withSchema(IgniteTxEntry.class);
442+
withSchema(TxEntryValueHolder.class);
448443
withNoSchema(GridCacheTxRecoveryRequest.class);
449444
withNoSchema(GridCacheTxRecoveryResponse.class);
450445
withNoSchema(GridDistributedTxFinishRequest.class);
451446
withNoSchema(GridDistributedTxFinishResponse.class);
452-
withNoSchema(GridDistributedTxPrepareRequest.class);
447+
withSchema(GridDistributedTxPrepareRequest.class);
453448
withNoSchema(GridDistributedTxPrepareResponse.class);
454449
withNoSchema(GridDhtTxFinishRequest.class);
455-
withNoSchema(GridDhtTxFinishResponse.class);
456-
withNoSchema(GridDhtTxPrepareRequest.class);
457-
withNoSchema(GridDhtTxPrepareResponse.class);
450+
withSchema(GridDhtTxFinishResponse.class);
451+
withSchema(GridDhtTxPrepareRequest.class);
452+
withSchema(GridDhtTxPrepareResponse.class);
458453
withNoSchema(GridNearTxFinishRequest.class);
459454
withNoSchema(GridNearTxFinishResponse.class);
460455
withNoSchema(GridNearTxPrepareRequest.class);
461-
withNoSchema(GridNearTxPrepareResponse.class);
462-
withNoSchema(GridDhtLockRequest.class);
463-
withNoSchema(GridDhtLockResponse.class);
464-
withNoSchema(GridDhtUnlockRequest.class);
456+
withSchema(GridNearTxPrepareResponse.class);
457+
withSchema(GridDhtLockRequest.class);
458+
withSchema(GridDhtLockResponse.class);
459+
withSchema(GridDhtUnlockRequest.class);
465460
withNoSchema(GridNearLockRequest.class);
466461
withNoSchema(GridNearLockResponse.class);
467-
withNoSchema(GridNearUnlockRequest.class);
468-
withNoSchema(GridDistributedLockRequest.class);
469-
withNoSchema(GridDistributedLockResponse.class);
462+
withSchema(GridNearUnlockRequest.class);
463+
withSchema(GridDistributedLockRequest.class);
464+
withSchema(GridDistributedLockResponse.class);
470465
withNoSchema(GridDhtTxOnePhaseCommitAckRequest.class);
471-
withNoSchema(TransactionAttributesAwareRequest.class);
466+
withSchema(TransactionAttributesAwareRequest.class);
472467

473468
// [10300 - 10500]: Cache, DHT messages.
474469
msgIdx = 10300;
475-
withNoSchema(GridDhtForceKeysRequest.class);
476-
withNoSchema(GridDhtForceKeysResponse.class);
470+
withSchema(GridDhtForceKeysRequest.class);
471+
withSchema(GridDhtForceKeysResponse.class);
477472
withNoSchema(GridDhtAtomicDeferredUpdateResponse.class);
478-
withNoSchema(GridDhtAtomicUpdateRequest.class);
479-
withNoSchema(GridDhtAtomicUpdateResponse.class);
480-
withNoSchema(GridNearAtomicFullUpdateRequest.class);
481-
withNoSchema(GridDhtAtomicSingleUpdateRequest.class);
482-
withNoSchema(GridNearAtomicUpdateResponse.class);
483-
withNoSchema(GridNearAtomicSingleUpdateRequest.class);
484-
withNoSchema(GridNearAtomicSingleUpdateInvokeRequest.class);
485-
withNoSchema(GridNearAtomicSingleUpdateFilterRequest.class);
473+
withSchema(GridDhtAtomicUpdateRequest.class);
474+
withSchema(GridDhtAtomicUpdateResponse.class);
475+
withSchema(GridNearAtomicFullUpdateRequest.class);
476+
withSchema(GridDhtAtomicSingleUpdateRequest.class);
477+
withSchema(GridNearAtomicUpdateResponse.class);
478+
withSchema(GridNearAtomicSingleUpdateRequest.class);
479+
withSchema(GridNearAtomicSingleUpdateInvokeRequest.class);
480+
withSchema(GridNearAtomicSingleUpdateFilterRequest.class);
486481
withNoSchema(GridNearAtomicCheckUpdateRequest.class);
487-
withNoSchema(NearCacheUpdates.class);
488-
withNoSchema(GridNearGetRequest.class);
489-
withNoSchema(GridNearGetResponse.class);
490-
withNoSchema(GridNearSingleGetRequest.class);
491-
withNoSchema(GridNearSingleGetResponse.class);
482+
withSchema(NearCacheUpdates.class);
483+
withSchema(GridNearGetRequest.class);
484+
withSchema(GridNearGetResponse.class);
485+
withSchema(GridNearSingleGetRequest.class);
486+
withSchema(GridNearSingleGetResponse.class);
492487
withNoSchema(GridDhtAtomicNearResponse.class);
493-
withNoSchema(GridCacheTtlUpdateRequest.class);
494-
withNoSchema(GridCacheReturn.class);
495-
withNoSchema(GridCacheEntryInfo.class);
496-
withNoSchema(CacheInvokeDirectResult.class);
488+
withSchema(GridCacheTtlUpdateRequest.class);
489+
withSchema(GridCacheReturn.class);
490+
withSchema(GridCacheEntryInfo.class);
491+
withSchema(CacheInvokeDirectResult.class);
497492
withNoSchema(GridCacheRawVersionedEntry.class);
498-
withNoSchema(CacheEvictionEntry.class);
499-
withNoSchema(CacheEntryPredicateAdapter.class);
493+
withSchema(CacheEvictionEntry.class);
494+
withSchema(CacheEntryPredicateAdapter.class);
500495
withNoSchema(GridContinuousMessage.class);
501496
withNoSchema(ContinuousRoutineStartResultMessage.class);
502-
withNoSchema(UpdateErrors.class);
497+
withSchema(UpdateErrors.class);
503498
withNoSchema(LatchAckMessage.class);
504-
withNoSchema(AtomicApplicationAttributesAwareRequest.class);
499+
withSchema(AtomicApplicationAttributesAwareRequest.class);
505500
withNoSchema(StartRequestData.class);
506501
withNoSchema(StartRoutineDiscoveryMessage.class);
507502
withNoSchema(StartRoutineAckDiscoveryMessage.class);
@@ -524,7 +519,7 @@ public CoreMessagesProvider(Marshaller schemaAwareMarhaller, Marshaller schemaLe
524519
withNoSchema(GridDhtPartitionExchangeId.class);
525520
withNoSchema(GridCheckpointRequest.class);
526521
withNoSchema(GridDhtPartitionDemandMessage.class);
527-
withNoSchema(GridDhtPartitionSupplyMessage.class);
522+
withSchema(GridDhtPartitionSupplyMessage.class);
528523
withNoSchema(GridDhtPartitionsFullMessage.class);
529524
withNoSchema(GridDhtPartitionsSingleMessage.class);
530525
withNoSchema(GridDhtPartitionsSingleRequest.class);
@@ -541,8 +536,8 @@ public CoreMessagesProvider(Marshaller schemaAwareMarhaller, Marshaller schemaLe
541536
withNoSchema(SchemaFinishDiscoveryMessage.class);
542537
withNoSchema(QueryField.class);
543538
withNoSchema(GridCacheSqlQuery.class);
544-
withNoSchema(GridCacheQueryRequest.class);
545-
withNoSchema(GridCacheQueryResponse.class);
539+
withSchema(GridCacheQueryRequest.class);
540+
withSchema(GridCacheQueryResponse.class);
546541
withNoSchema(GridQueryCancelRequest.class);
547542
withNoSchema(GridQueryFailResponse.class);
548543
withNoSchema(GridQueryNextPageRequest.class);
@@ -559,7 +554,7 @@ public CoreMessagesProvider(Marshaller schemaAwareMarhaller, Marshaller schemaLe
559554
withNoSchema(StatisticsRequest.class);
560555
withNoSchema(StatisticsResponse.class);
561556
withNoSchema(CacheContinuousQueryBatchAck.class);
562-
withNoSchema(CacheContinuousQueryEntry.class);
557+
withSchema(CacheContinuousQueryEntry.class);
563558

564559
// [11200 - 11300]: Compute, distributed process messages.
565560
msgIdx = 11200;
@@ -580,18 +575,18 @@ public CoreMessagesProvider(Marshaller schemaAwareMarhaller, Marshaller schemaLe
580575
withNoSchema(NodeIdMessage.class);
581576
withNoSchema(HandshakeMessage.class);
582577
withNoSchema(HandshakeWaitMessage.class);
583-
withNoSchema(GridIoMessage.class);
578+
withSchema(GridIoMessage.class);
584579
withNoSchema(IgniteIoTestMessage.class);
585-
withNoSchema(GridIoUserMessage.class);
586-
withNoSchema(GridIoSecurityAwareMessage.class);
580+
withSchema(GridIoUserMessage.class);
581+
withSchema(GridIoSecurityAwareMessage.class);
587582
withNoSchema(RecoveryLastReceivedMessage.class);
588583
withNoSchema(TcpInverseConnectionResponseMessage.class);
589584
withNoSchema(SessionChannelMessage.class);
590585

591586
// [11700 - 11800]: Datastreamer messages.
592587
msgIdx = 11700;
593588
withNoSchema(DataStreamerUpdatesHandlerResult.class);
594-
withNoSchema(DataStreamerEntry.class);
589+
withSchema(DataStreamerEntry.class);
595590
withNoSchema(DataStreamerRequest.class);
596591
withNoSchema(DataStreamerResponse.class);
597592

@@ -638,7 +633,7 @@ public CoreMessagesProvider(Marshaller schemaAwareMarhaller, Marshaller schemaLe
638633
withSchema(GridEventStorageMessage.class);
639634
withNoSchema(ChangeGlobalStateMessage.class);
640635
withNoSchema(GridChangeGlobalStateMessageResponse.class);
641-
withNoSchema(IgniteDiagnosticRequest.class);
636+
withSchema(IgniteDiagnosticRequest.class);
642637
withNoSchema(IgniteDiagnosticResponse.class);
643638
withNoSchema(WalStateAckMessage.class);
644639

modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@
2323
import org.apache.ignite.internal.util.typedef.internal.S;
2424
import org.apache.ignite.internal.util.typedef.internal.U;
2525
import org.apache.ignite.marshaller.Marshaller;
26-
import org.apache.ignite.plugin.extensions.communication.Message;
2726
import org.jetbrains.annotations.Nullable;
2827

2928
/**
3029
* Job siblings response.
3130
*/
32-
public class GridJobSiblingsResponse implements Message {
31+
public class GridJobSiblingsResponse implements MarshallableMessage {
3332
/** */
3433
private @Nullable Collection<ComputeJobSibling> siblings;
3534

@@ -58,23 +57,14 @@ public GridJobSiblingsResponse(@Nullable Collection<ComputeJobSibling> siblings)
5857
return siblings;
5958
}
6059

61-
/**
62-
* Marshals siblings to byte array.
63-
*
64-
* @param marsh Marshaller.
65-
* @throws IgniteCheckedException In case of error.
66-
*/
67-
public void marshalSiblings(Marshaller marsh) throws IgniteCheckedException {
68-
siblingsBytes = U.marshal(marsh, siblings);
60+
/** {@inheritDoc} */
61+
@Override public void prepareMarshal(Marshaller marsh) throws IgniteCheckedException {
62+
if (siblings != null)
63+
siblingsBytes = U.marshal(marsh, siblings);
6964
}
7065

71-
/**
72-
* Unmarshals siblings from byte array.
73-
*
74-
* @param marsh Marshaller.
75-
* @throws IgniteCheckedException In case of error.
76-
*/
77-
public void unmarshalSiblings(Marshaller marsh) throws IgniteCheckedException {
66+
/** {@inheritDoc} */
67+
@Override public void finishUnmarshal(Marshaller marsh, ClassLoader clsLdr) throws IgniteCheckedException {
7868
assert marsh != null;
7969

8070
if (siblingsBytes != null) {
@@ -84,7 +74,6 @@ public void unmarshalSiblings(Marshaller marsh) throws IgniteCheckedException {
8474
}
8575
}
8676

87-
8877
/** {@inheritDoc} */
8978
@Override public String toString() {
9079
return S.toString(GridJobSiblingsResponse.class, this);

0 commit comments

Comments
 (0)