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
5 changes: 4 additions & 1 deletion .idea/checkstyle-idea.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
org.gradle.configureondemand=true
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.caching=true

#signing.keyId=*INSERT KEY HERE LAST 8 CHARS*
#signing.password=*INSERT PASSWORD HERE*
Expand Down
3 changes: 3 additions & 0 deletions modules/cluster-management/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies {
implementation project(':ignite-configuration')
implementation project(':ignite-configuration-api')
implementation project(':ignite-configuration-presentation')
implementation project(':ignite-configuration-system')
implementation project(':ignite-failure-handler')
implementation project(':ignite-network')
implementation project(':ignite-raft-api')
Expand All @@ -46,6 +47,8 @@ dependencies {
implementation libs.jetbrains.annotations
implementation libs.fastutil.core
implementation libs.auto.service.annotations
implementation libs.jakarta.inject
implementation libs.micronaut.inject

testImplementation project(':ignite-core')
testImplementation project(':ignite-configuration')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
import static java.util.stream.Collectors.toUnmodifiableSet;
import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;

import jakarta.inject.Inject;
import jakarta.inject.Named;
import jakarta.inject.Singleton;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -55,6 +58,7 @@
/**
* Class for performing cluster initialization.
*/
@Singleton
public class ClusterInitializer {
private static final IgniteLogger LOG = Loggers.forClass(ClusterInitializer.class);

Expand All @@ -69,10 +73,11 @@ public class ClusterInitializer {
private final CmgMessagesFactory msgFactory = new CmgMessagesFactory();

/** Constructor. */
@Inject
public ClusterInitializer(
ClusterService clusterService,
ConfigurationDynamicDefaultsPatcher configurationDynamicDefaultsPatcher,
ConfigurationValidator clusterConfigurationValidator
@Named("distributedWithDefaults") ConfigurationValidator clusterConfigurationValidator
) {
this.clusterService = clusterService;
this.configurationDynamicDefaultsPatcher = configurationDynamicDefaultsPatcher;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
import static org.apache.ignite.internal.util.IgniteUtils.failOrConsume;
import static org.apache.ignite.lang.ErrorGroups.Common.NODE_STOPPING_ERR;

import io.micronaut.core.annotation.Creator;
import jakarta.inject.Inject;
import jakarta.inject.Named;
import jakarta.inject.Singleton;
import java.util.Collection;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -75,6 +79,7 @@
import org.apache.ignite.internal.event.AbstractEventProducer;
import org.apache.ignite.internal.event.EventParameters;
import org.apache.ignite.internal.failure.FailureContext;
import org.apache.ignite.internal.failure.FailureManager;
import org.apache.ignite.internal.failure.FailureProcessor;
import org.apache.ignite.internal.lang.IgniteInternalException;
import org.apache.ignite.internal.lang.IgniteStringFormatter;
Expand Down Expand Up @@ -113,6 +118,7 @@
* <a href="https://cwiki.apache.org/confluence/display/IGNITE/IEP-77%3A+Node+Join+Protocol+and+Initialization+for+Ignite+3">IEP-77</a>
* for the description of the Cluster Management Group and its responsibilities.
*/
@Singleton
public class ClusterManagementGroupManager extends AbstractEventProducer<ClusterManagerGroupEvent, EventParameters>
implements IgniteComponent {
private static final IgniteLogger LOG = Loggers.forClass(ClusterManagementGroupManager.class);
Expand Down Expand Up @@ -277,6 +283,58 @@ public ClusterManagementGroupManager(
this.onConfigurationCommittedListener = onConfigurationCommittedListener;
}

/**
* Creates and initializes an instance of {@code ClusterManagementGroupManager}.
*
* @param vault The Vault Manager responsible for managing secrets and secure storage.
* @param clusterResetStorage The cluster reset storage interface for handling cluster reset states.
* @param clusterService The cluster service providing access to cluster-related operations.
* @param clusterInitializer The cluster initializer responsible for cluster setup processes.
* @param raftManager The Raft Manager handling consensus-related operations.
* @param clusterStateStorageMgr The manager for cluster-wide state storage.
* @param logicalTopology The logical topology interface representing the cluster's logical structure.
* @param validationManager The manager responsible for validation processes within the cluster.
* @param nodeAttributesCollector The collector for node-specific attributes.
* @param failureManager The manager for handling cluster failure scenarios.
* @param clusterIdService The service for managing the cluster's unique identifier.
* @param cmgRaftConfigurer The Raft Group Options Configurer specific to CMG operations.
* @param metricManager The Metric Manager for managing and reporting metrics.
* @return A fully initialized {@code ClusterManagementGroupManager} instance.
*/
@Creator
@Inject
public static ClusterManagementGroupManager create(
VaultManager vault,
ClusterResetStorage clusterResetStorage,
ClusterService clusterService,
ClusterInitializer clusterInitializer,
RaftManager raftManager,
ClusterStateStorageManager clusterStateStorageMgr,
LogicalTopology logicalTopology,
ValidationManager validationManager,
NodeAttributesCollector nodeAttributesCollector,
FailureManager failureManager,
ClusterIdStore clusterIdService,
@Named("cmgRaftConfigurer") RaftGroupOptionsConfigurer cmgRaftConfigurer,
MetricManager metricManager
) {
return new ClusterManagementGroupManager(
vault,
clusterResetStorage,
clusterService,
clusterInitializer,
raftManager,
clusterStateStorageMgr,
logicalTopology,
validationManager,
nodeAttributesCollector,
failureManager,
clusterIdService,
cmgRaftConfigurer,
metricManager
);
}

private CmgMessageHandler createMessageHandler() {
var messageCallback = new CmgMessageCallback() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

package org.apache.ignite.internal.cluster.management;

import io.micronaut.core.annotation.Creator;
import jakarta.annotation.PostConstruct;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand All @@ -25,13 +29,17 @@
import org.apache.ignite.configuration.NamedListView;
import org.apache.ignite.internal.cluster.management.configuration.NodeAttributeView;
import org.apache.ignite.internal.cluster.management.configuration.NodeAttributesConfiguration;
import org.apache.ignite.internal.cluster.management.configuration.NodeAttributesExtensionConfiguration;
import org.apache.ignite.internal.configuration.ConfigurationRegistry;
import org.apache.ignite.internal.storage.configurations.StorageConfiguration;
import org.apache.ignite.internal.storage.configurations.StorageExtensionConfiguration;
import org.apache.ignite.internal.storage.configurations.StorageProfileView;

/**
* This class is responsible for retrieving local node attributes
* from system components before the local node joins the cluster.
*/
@Singleton
public class NodeAttributesCollector implements NodeAttributes {
private final List<NodeAttributesProvider> systemAttributesProviders = new ArrayList<>();

Expand All @@ -47,6 +55,42 @@ public NodeAttributesCollector(
this.storageProfilesConfiguration = storageProfilesConfiguration;
}

/**
* Creates and returns an instance of {@code NodeAttributesCollector}.
*
* @param registry The configuration registry containing the configurations
* required to initialize the {@code NodeAttributesCollector}.
* @return A new instance of {@code NodeAttributesCollector} initialized
* with the configurations from the provided registry.
*/
@Creator
@Inject
public static NodeAttributesCollector create(ConfigurationRegistry registry) {
NodeAttributesConfiguration nodeAttributesConfiguration =
registry.getConfiguration(NodeAttributesExtensionConfiguration.KEY).nodeAttributes();

StorageConfiguration storageConfiguration = registry.getConfiguration(StorageExtensionConfiguration.KEY).storage();

return new NodeAttributesCollector(nodeAttributesConfiguration, storageConfiguration);
}

/**
* Initializes the {@code NodeAttributesCollector} by registering the provided list of
* {@code NodeAttributesProvider} instances.
*
* @param nodeProperties A list of {@code NodeAttributesProvider} instances that provide
* attribute information for the node. These providers are registered
* to ensure their attributes are included in the logical topology of
* the cluster.
*/
@PostConstruct
@Inject
public void init(List<NodeAttributesProvider> nodeProperties) {
for (NodeAttributesProvider nodePropertiesProvider : nodeProperties) {
register(nodePropertiesProvider);
}
}

/**
* Registers system attributes provider.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import static org.apache.ignite.internal.util.ByteUtils.longToBytes;
import static org.apache.ignite.internal.util.ByteUtils.uuidToBytes;

import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import java.nio.ByteBuffer;
import java.nio.file.Path;
import java.util.List;
Expand All @@ -37,6 +39,7 @@
/**
* A wrapper around a {@link ClusterStateStorage} which provides convenient methods.
*/
@Singleton
public class ClusterStateStorageManager {
/** Storage key for the CMG state. */
private static final byte[] CMG_STATE_KEY = "cmg_state".getBytes(UTF_8);
Expand All @@ -48,6 +51,7 @@ public class ClusterStateStorageManager {

private final ClusterStateStorage storage;

@Inject
public ClusterStateStorageManager(ClusterStateStorage storage) {
this.storage = storage;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
import static org.apache.ignite.internal.util.IgniteUtils.inBusyLock;
import static org.apache.ignite.internal.util.IgniteUtils.inBusyLockAsync;

import io.micronaut.core.annotation.Creator;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
Expand All @@ -36,6 +39,8 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.BiFunction;
import org.apache.ignite.internal.IgniteNodeDetails;
import org.apache.ignite.internal.configuration.ComponentWorkingDir;
import org.apache.ignite.internal.logger.IgniteLogger;
import org.apache.ignite.internal.logger.Loggers;
import org.apache.ignite.internal.manager.ComponentContext;
Expand All @@ -58,6 +63,7 @@
/**
* {@link ClusterStateStorage} implementation based on RocksDB.
*/
@Singleton
public class RocksDbClusterStateStorage implements ClusterStateStorage {
private static final IgniteLogger LOG = Loggers.forClass(RocksDbClusterStateStorage.class);

Expand Down Expand Up @@ -98,6 +104,22 @@ public RocksDbClusterStateStorage(Path dbPath, String nodeName) {
);
}

/**
* Creates and initializes an instance of {@code RocksDbClusterStateStorage}.
*
* @param nodeDetails Contains details about the Ignite node, including its name and working directory.
* @param cmgComponentWorkingDir Provides the working directory structure for the component, including the database path.
* @return A newly created {@code RocksDbClusterStateStorage} configured with the database path and node name.
*/
@Creator
@Inject
public static RocksDbClusterStateStorage clusterStateStorage(
IgniteNodeDetails nodeDetails,
ComponentWorkingDir cmgComponentWorkingDir
) {
return new RocksDbClusterStateStorage(cmgComponentWorkingDir.dbPath(), nodeDetails.nodeName());
}

@Override
public CompletableFuture<Void> startAsync(ComponentContext componentContext) {
return inBusyLockAsync(busyLock, () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import static java.util.stream.Collectors.toSet;
import static org.apache.ignite.internal.lang.IgniteSystemProperties.COLOCATION_FEATURE_FLAG;

import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import java.util.Collection;
import java.util.Comparator;
import java.util.Set;
Expand All @@ -42,11 +44,13 @@
* After the node finishes local recovery procedures, it sends a {@link JoinReadyCommand} containing the validation token. If the local
* token and the received token match, the node will be added to the logical topology and the token will be invalidated.
*/
@Singleton
public class ValidationManager {
protected final ClusterStateStorageManager storageManager;
private final ClusterStateStorageManager storageManager;

protected final LogicalTopology logicalTopology;
private final LogicalTopology logicalTopology;

@Inject
public ValidationManager(ClusterStateStorageManager storageManager, LogicalTopology logicalTopology) {
this.storageManager = storageManager;
this.logicalTopology = logicalTopology;
Expand Down
Loading