Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
26d8c83
IGN-1049 Backup filter for RendezvousAffinityFunction
Jul 2, 2020
051d727
IGN-627 Fix incorrect subject identifier for thin client
Jun 3, 2020
7f599cd
IGNITE-14071 .NET: RegisterSameJavaType mode enabled for messaging
nizhikov Feb 2, 2021
8b83dd7
IGN-2583 .NET: RegisterSameJavaType mode enabled when reading message
nizhikov Feb 4, 2021
a0a5321
IGN-2681 .NET: Enable RegisterSameJavaType for Cache API
nizhikov Feb 17, 2021
3cc5c5d
IGN-2745 .NET: RegisterSameJavaType mode for Scan Query
nizhikov Feb 25, 2021
a818bc9
IGN-2810 .Net: Enable RegisterSameJavaType mode for platform cache up…
nizhikov Mar 5, 2021
f1e280c
IGN-2851 Add thin client compatibility for 4.281.3 and 4.290 (both se…
Mar 17, 2021
ee621ec
IGN-3030 Запуск ducktape тестов для ISE. Исключение ненужных модулей
nizhikov Apr 2, 2021
23c8a9d
IGNITE-15099 Fix concurrent heartbeat update while in blocking sectio…
Aug 13, 2021
aac933f
IGNITE-14292 Change permissions required to create/destroy caches in …
nizhikov Sep 27, 2021
69b5f2a
IGNITE-15951 Fixes preconfigured service deployment authorization. (#…
petrov-mg Nov 23, 2021
c88d699
IGNITE-15767 Fixed spontaneous SocketTimeoutException in server socke…
ibessonov Nov 23, 2021
20f24e4
IGNITE-15924 Thin client cache for OptimizedMarshaller class names (#…
nizhikov Nov 22, 2021
fe59797
IGNITE-15781 GridDhtPartitionMap#get use primitive int (#9518)
timoninmaxim Nov 18, 2021
abb4d5b
Merge branch 'IGNITE-15924_to_4.2110.1' into HF_to_4.2110.1
Sega76 Nov 23, 2021
bc37d13
Merge branch 'IGNITE-15781_to_4.2110.1' into HF_to_4.2110.1
Sega76 Nov 23, 2021
128a08b
Merge branch 'IGNITE-15951_to_4.2110.1' into HF_to_4.2110.1
Sega76 Nov 23, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions bin/include/build-classpath.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,24 @@ includeToClassPath() {

for file in $1/*
do
if [ -d ${file} ] && [ -d "${file}/target" ]; then
if [ -d "${file}/target/classes" ]; then
IGNITE_LIBS=${IGNITE_LIBS}${SEP}${file}/target/classes
fi
if [[ -z "${EXCLUDE_MODULES:-}" ]] || [[ ${EXCLUDE_MODULES:-} != *"`basename $file`"* ]]; then
if [ -d ${file} ] && [ -d "${file}/target" ]; then
if [ -d "${file}/target/classes" ]; then
IGNITE_LIBS=${IGNITE_LIBS}${SEP}${file}/target/classes
fi

if [ -d "${file}/target/test-classes" ]; then
IGNITE_LIBS=${IGNITE_LIBS}${SEP}${file}/target/test-classes
fi
if [[ -z "${EXCLUDE_TEST_CLASSES:-}" ]]; then
if [ -d "${file}/target/test-classes" ]; then
IGNITE_LIBS=${IGNITE_LIBS}${SEP}${file}/target/test-classes
fi
fi

if [ -d "${file}/target/libs" ]; then
IGNITE_LIBS=${IGNITE_LIBS}${SEP}${file}/target/libs/*
fi
if [ -d "${file}/target/libs" ]; then
IGNITE_LIBS=${IGNITE_LIBS}${SEP}${file}/target/libs/*
fi
fi
else
echo "$file excluded by EXCLUDE_MODULES settings"
fi
done

Expand Down
1 change: 1 addition & 0 deletions modules/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@
<excludes>
<!-- Parent's pom.xml includes all Ignite test classes (tests, suites) in the surefire plugin.
So need to exclude all of them to test only JCache tests. -->
<exclude>**/com/sbt/sbergrid/**/*Test.java</exclude>
<exclude>**/org/apache/ignite/**/*.java</exclude>
<exclude>**/annotation/*Test.java</exclude>
<exclude>**/ClientServerTest.java</exclude>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
* 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 com.sbt.sbergrid.extras;

import java.util.List;
import java.util.Objects;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.lang.IgniteBiPredicate;

/**
* This class can be used as a {@link RendezvousAffinityFunction#setAffinityBackupFilter } to create
* cache templates in Spring that force each partition's primary and backup to be co-located on nodes with the same
* attribute value.
* <p>
* This implementation will discard backups rather than place copies on nodes with different attribute values. This
* avoids trying to cram more data onto remaining nodes when some have failed.
* <p>
* A node attribute to compare is provided on construction. Note: "All cluster nodes,
* on startup, automatically register all the environment and system properties as node attributes."
* <p>
* This class is constructed with a node attribute name, and a candidate node will be rejected if previously selected
* nodes for a partition have a different value for attribute on the candidate node.
* </pre>
* <h2 class="header">Spring Example</h2>
* Create a partitioned cache template plate with 1 backup, where the backup will be placed in the same cell
* as the primary. Note: This example requires that the environment variable "CELL" be set appropriately on
* each node via some means external to Ignite.
* <pre name="code" class="xml">
* &lt;property name="cacheConfiguration"&gt;
* &lt;list&gt;
* &lt;bean id="cache-template-bean" abstract="true" class="org.apache.ignite.configuration.CacheConfiguration"&gt;
* &lt;property name="name" value="JobcaseDefaultCacheConfig*"/&gt;
* &lt;property name="cacheMode" value="PARTITIONED" /&gt;
* &lt;property name="backups" value="1" /&gt;
* &lt;property name="affinity"&gt;
* &lt;bean class="org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction"&gt;
* &lt;property name="affinityBackupFilter"&gt;
* &lt;bean class="com.sbt.sbergrid.extras.ClusterNodeAttributeColocatedBackupFilter"&gt;
* &lt;!-- Backups must go to the same CELL as primary --&gt;
* &lt;constructor-arg value="CELL" /&gt;
* &lt;/bean&gt;
* &lt;/property&gt;
* &lt;/bean&gt;
* &lt;/property&gt;
* &lt;/bean&gt;
* &lt;/list&gt;
* &lt;/property&gt;
* </pre>
* <p>
*
* @deprecated Use {@link org.apache.ignite.cache.affinity.rendezvous.ClusterNodeAttributeColocatedBackupFilter}
* instead.
*/
@Deprecated
public class ClusterNodeAttributeColocatedBackupFilter implements IgniteBiPredicate<ClusterNode, List<ClusterNode>> {
/** */
private static final long serialVersionUID = 1L;

/** Attribute name. */
private final String attributeName;

/**
* @param attributeName The attribute name for the attribute to compare.
*/
public ClusterNodeAttributeColocatedBackupFilter(String attributeName) {
this.attributeName = attributeName;
}

/**
* Defines a predicate which returns {@code true} if a node is acceptable for a backup
* or {@code false} otherwise. An acceptable node is one where its attribute value
* is exact match with previously selected nodes. If an attribute does not
* exist on exactly one node of a pair, then the attribute does not match. If the attribute
* does not exist both nodes of a pair, then the attribute matches.
*
* @param candidate A node that is a candidate for becoming a backup node for a partition.
* @param previouslySelected A list of primary/backup nodes already chosen for a partition.
* The primary is first.
*/
@Override public boolean apply(ClusterNode candidate, List<ClusterNode> previouslySelected) {
for (ClusterNode node : previouslySelected)
return Objects.equals(candidate.attribute(attributeName), node.attribute(attributeName));

return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2012,6 +2012,16 @@ public final class IgniteSystemProperties {
"stopped when the threshold is exceeded", type = Integer.class, defaults = "" + DFLT_CACHED_STRINGS_THRESHOLD)
public static final String IGNITE_PERF_STAT_CACHED_STRINGS_THRESHOLD = "IGNITE_PERF_STAT_CACHED_STRINGS_THRESHOLD";

/**
* Flag for compatibility of Ignite SE 4.290+ thin clients with Ignite SE 4.280/4.281 servers.
* NOTE: in order to enable client compatibility mode, this option must be set to <code>true</code> only
* on the <em>thin client side</em>. Default value is <code>false</code>.
*/
@SystemProperty(value = "Flag for compatibility of Ignite SE 4.290+ thin clients with " +
"Ignite SE 4.280/4.281 servers. In order to enable client compatibility mode, this option must be set to " +
"'true' only on the thin client side", defaults = "false")
public static final String IGNITE_SE_281_THIN_CLIENT_COMPATIBLE = "IGNITE_SE_281_THIN_CLIENT_COMPATIBLE";

/**
* Enforces singleton.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
package org.apache.ignite.internal.client.thin;

import java.util.EnumSet;
import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.client.ClientFeatureNotSupportedByServerException;

import static org.apache.ignite.IgniteSystemProperties.IGNITE_SE_281_THIN_CLIENT_COMPATIBLE;

/**
* Protocol Context.
*/
Expand All @@ -30,13 +33,26 @@ public class ProtocolContext {
/** Features. */
private final EnumSet<ProtocolBitmaskFeature> features;

/** */
private final boolean ise281Compatible;

/**
* @param ver Protocol version.
* @param features Supported features.
*/
public ProtocolContext(ProtocolVersion ver, EnumSet<ProtocolBitmaskFeature> features) {
this(ver, features, false);
}

/**
* @param ver Protocol version.
* @param features Supported features.
* @param ise281Compatible Ignite SE 4.281 compatibility flag.
*/
public ProtocolContext(ProtocolVersion ver, EnumSet<ProtocolBitmaskFeature> features, boolean ise281Compatible) {
this.ver = ver;
this.features = features != null ? features : EnumSet.noneOf(ProtocolBitmaskFeature.class);
this.ise281Compatible = ise281Compatible;
}

/**
Expand Down Expand Up @@ -87,4 +103,17 @@ public ProtocolVersion version() {
public static boolean isFeatureSupported(ProtocolVersion ver, ProtocolVersionFeature feature) {
return ver.compareTo(feature.verIntroduced()) >= 0;
}

/** */
public boolean isIse281Compatible() {
return ise281Compatible;
}

/**
* @param ver Protocol version.
*/
public static boolean isIse281Compatible(ProtocolVersion ver) {
return IgniteSystemProperties.getBoolean(IGNITE_SE_281_THIN_CLIENT_COMPATIBLE, false) &&
ProtocolVersion.V1_7_0.equals(ver);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ private void handshakeReq(ProtocolVersion proposedVer, String user, String pwd,

writer.writeByte(ClientListenerNioListener.THIN_CLIENT);

if (protocolCtx.isFeatureSupported(BITMAP_FEATURES)) {
if (protocolCtx.isFeatureSupported(BITMAP_FEATURES) && !protocolCtx.isIse281Compatible()) {
byte[] features = ProtocolBitmaskFeature.featuresAsBytes(protocolCtx.features());
writer.writeByteArray(features);
}
Expand All @@ -615,10 +615,17 @@ private void handshakeReq(ProtocolVersion proposedVer, String user, String pwd,
*/
private ProtocolContext protocolContextFromVersion(ProtocolVersion ver) {
EnumSet<ProtocolBitmaskFeature> features = null;
if (ProtocolContext.isFeatureSupported(ver, BITMAP_FEATURES))
features = ProtocolBitmaskFeature.allFeaturesAsEnumSet();

return new ProtocolContext(ver, features);
final boolean isIse281Compatible = ProtocolContext.isIse281Compatible(ver);

if (ProtocolContext.isFeatureSupported(ver, BITMAP_FEATURES)) {
if (isIse281Compatible)
features = EnumSet.of(USER_ATTRIBUTES);
else
features = ProtocolBitmaskFeature.allFeaturesAsEnumSet();
}

return new ProtocolContext(ver, features, isIse281Compatible);
}

/** Receive and handle handshake response. */
Expand All @@ -630,12 +637,18 @@ private void handshakeRes(ByteBuffer buf, ProtocolVersion proposedVer, String us
boolean success = res.readBoolean();

if (success) {
byte[] features = EMPTY_BYTES;
EnumSet<ProtocolBitmaskFeature> features = null;

if (ProtocolContext.isFeatureSupported(proposedVer, BITMAP_FEATURES))
features = reader.readByteArray();
final boolean ise281Compatible = ProtocolContext.isIse281Compatible(proposedVer);

if (ProtocolContext.isFeatureSupported(proposedVer, BITMAP_FEATURES)) {
if (ise281Compatible)
features = EnumSet.of(USER_ATTRIBUTES);
else
features = ProtocolBitmaskFeature.enumSet(reader.readByteArray());
}

protocolCtx = new ProtocolContext(proposedVer, ProtocolBitmaskFeature.enumSet(features));
protocolCtx = new ProtocolContext(proposedVer, features, ise281Compatible);

if (protocolCtx.isFeatureSupported(PARTITION_AWARENESS)) {
// Reading server UUID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,9 @@ public ClientMarshallerContext() {
catch (ClientException e) {
throw new IgniteCheckedException(e);
}

if (clsName != null)
cache.putIfAbsent(typeId, clsName);
}

if (clsName == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
import static org.apache.ignite.events.EventType.EVT_NODE_JOINED;
import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
import static org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState.OWNING;
import static org.apache.ignite.internal.processors.security.SecurityUtils.withContextIfNeed;
import static org.apache.ignite.internal.processors.tracing.SpanType.AFFINITY_CALCULATION;

/**
Expand Down Expand Up @@ -882,7 +883,8 @@ public IgniteInternalFuture<?> onCacheChangeRequest(

fut.timeBag().finishGlobalStage("Update caches registry");

processCacheStartRequests(fut, crd, exchActions);
withContextIfNeed(exchActions.securitySubjectId(), cctx.kernalContext(),
() -> processCacheStartRequests(fut, crd, exchActions));

Set<Integer> stoppedGrps = processCacheStopRequests(fut, crd, exchActions, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.util.Collection;
import java.util.Set;
import java.util.UUID;
import org.apache.ignite.internal.managers.discovery.DiscoCache;
import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
Expand Down Expand Up @@ -58,6 +59,9 @@ public class DynamicCacheChangeBatch implements DiscoveryCustomMessage {
@GridToStringExclude
@Nullable private transient ServiceDeploymentActions serviceDeploymentActions;

/** Security subject id. */
private UUID secSubjId;

/**
* @param reqs Requests.
*/
Expand Down Expand Up @@ -115,6 +119,8 @@ public ExchangeActions exchangeActions() {
void exchangeActions(ExchangeActions exchangeActions) {
assert exchangeActions != null && !exchangeActions.empty() : exchangeActions;

exchangeActions.securitySubjectId(securitySubjectId());

this.exchangeActions = exchangeActions;
}

Expand Down Expand Up @@ -155,6 +161,21 @@ public Set<String> restartingCaches() {
return restartingCaches;
}

/**
* Sets Security subject id.
* @param id
*/
public void securitySubjectId(UUID id) {
secSubjId = id;
}

/**
* @return Security subject id.
*/
public UUID securitySubjectId() {
return secSubjId;
}

/**
* @param startCaches {@code True} if required to start all caches on client node.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ public class ExchangeActions {
/** */
private StateChangeRequest stateChangeReq;

/** Security subject id. */
private UUID secSubjId;

/**
* @param grpId Group ID.
* @return Always {@code true}, fails with assert error if inconsistent.
Expand Down Expand Up @@ -110,6 +113,20 @@ public Collection<CacheActionData> cacheStopRequests() {
return cachesToStop != null ? cachesToStop.values() : Collections.emptyList();
}

/**
* @return Security subject id.
*/
public UUID securitySubjectId() {
return secSubjId;
}

/**
* Sets Security subject id.
*/
public void securitySubjectId(UUID secSubjId) {
this.secSubjId = secSubjId;
}

/**
* @param ctx Context.
* @param err Error if any.
Expand Down
Loading