Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@
import org.apache.ignite.internal.processors.query.stat.messages.StatisticsResponse;
import org.apache.ignite.internal.processors.rest.handlers.task.GridTaskResultRequest;
import org.apache.ignite.internal.processors.rest.handlers.task.GridTaskResultResponse;
import org.apache.ignite.internal.processors.rollingupgrade.RollingUpgradeNodeData;
import org.apache.ignite.internal.processors.rollingupgrade.RollingUpgradeClusterData;
import org.apache.ignite.internal.processors.rollingupgrade.feature.IgniteComponentFeatures;
import org.apache.ignite.internal.processors.rollingupgrade.feature.IgniteFeatureSet;
import org.apache.ignite.internal.processors.rollingupgrade.feature.IgniteProductFeatures;
import org.apache.ignite.internal.processors.service.ServiceChangeBatchRequest;
import org.apache.ignite.internal.processors.service.ServiceClusterDeploymentResult;
import org.apache.ignite.internal.processors.service.ServiceClusterDeploymentResultBatch;
Expand Down Expand Up @@ -692,8 +692,8 @@ public CoreMessagesProvider(Marshaller dfltMarsh, Marshaller schemaAwareMarsh, C
// [13500 - 13600]: Rolling Upgrade messages.
msgIdx = 13500;
withNoSchema(IgniteFeatureSet.class);
withNoSchema(IgniteProductFeatures.class);
withNoSchema(RollingUpgradeNodeData.class);
withNoSchema(IgniteComponentFeatures.class);
withNoSchema(RollingUpgradeClusterData.class);

assert msgIdx <= MAX_MESSAGE_ID;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
* 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.processors.rollingupgrade;

import org.apache.ignite.lang.IgniteProductVersion;
import org.jetbrains.annotations.Nullable;

import static org.apache.ignite.internal.IgniteVersionUtils.semanticVersion;

/** */
class IgniteComponentUpgradeState {
/** */
final String cmpName;

/** */
@Nullable final IgniteProductVersion srcVer;

/** */
@Nullable final IgniteProductVersion targetVer;

/** Whether all cluster nodes hold the same Ignite component version. */
final boolean isClusterVerHomogenous;

/** */
IgniteComponentUpgradeState(
String cmpName,
@Nullable IgniteProductVersion srcVer,
@Nullable IgniteProductVersion targetVer,
boolean isClusterVerHomogenous
) {
this.cmpName = cmpName;
this.srcVer = srcVer;
this.targetVer = targetVer;
this.isClusterVerHomogenous = isClusterVerHomogenous;
}

/** */
boolean isCompatible(IgniteProductVersion joiningNodeCmpVer) {
if (isClusterVerHomogenous)
return srcVer == null || srcVer.compareTo(joiningNodeCmpVer) <= 0;

return joiningNodeCmpVer.equals(srcVer) || joiningNodeCmpVer.equals(targetVer);
}

/** {@inheritDoc} */
@Override public String toString() {
StringBuilder sb = new StringBuilder("[componentName=");

sb.append(cmpName);

sb.append(", compatibleComponentVersions=");

if (isClusterVerHomogenous)
if (srcVer == null)
sb.append("[any]");
else
sb.append("[").append(semanticVersion(srcVer)).append(" or greater]");
else {
sb.append("[");

if (srcVer != null)
sb.append(srcVer);

if (targetVer != null) {
if (srcVer != null)
sb.append(", ");

sb.append(targetVer);
}

sb.append("]");
}

sb.append("]");

return sb.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,36 @@

package org.apache.ignite.internal.processors.rollingupgrade;

import java.util.Collection;
import org.apache.ignite.internal.Order;
import org.apache.ignite.internal.processors.rollingupgrade.feature.IgniteProductFeatures;
import org.apache.ignite.internal.processors.rollingupgrade.feature.IgniteComponentFeatures;
import org.apache.ignite.plugin.extensions.communication.Message;

/** */
public class RollingUpgradeNodeData implements Message {
public class RollingUpgradeClusterData implements Message {
/** */
@Order(0)
boolean isVersionUpgradeEnabled;

/** */
@Order(1)
IgniteProductFeatures activeFeatures;
Collection<IgniteComponentFeatures> activeFeatures;

/** */
@Order(2)
boolean isNodeFenceActive;

/** */
public RollingUpgradeNodeData() {
public RollingUpgradeClusterData() {
// No-op.
}

/** */
public RollingUpgradeNodeData(boolean isVersionUpgradeEnabled, boolean isNodeFenceActive, IgniteProductFeatures activeFeatures) {
public RollingUpgradeClusterData(
boolean isVersionUpgradeEnabled,
boolean isNodeFenceActive,
Collection<IgniteComponentFeatures> activeFeatures
) {
this.isVersionUpgradeEnabled = isVersionUpgradeEnabled;
this.isNodeFenceActive = isNodeFenceActive;
this.activeFeatures = activeFeatures;
Expand Down
Loading
Loading