Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGNITE-12109 The distributed metastorage must support read/write operation on an inactive cluster. #6873

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -59,7 +59,6 @@
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersionManager;
import org.apache.ignite.internal.processors.cluster.IgniteChangeGlobalStateSupport;
import org.apache.ignite.internal.processors.metastorage.persistence.DistributedMetaStorageImpl;
import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
import org.apache.ignite.internal.util.GridIntList;
import org.apache.ignite.internal.util.future.GridCompoundFuture;
Expand Down Expand Up @@ -300,8 +299,6 @@ public void activate() throws IgniteCheckedException {

if (msgLog.isInfoEnabled())
msgLog.info("Components activation performed in " + (System.currentTimeMillis() - time) + " ms.");

((DistributedMetaStorageImpl)kernalCtx.distributedMetastorage()).inMemoryReadyForWrite();
}

/**
Expand Down
Expand Up @@ -1143,15 +1143,6 @@ private ExchangeType onClusterStateChangeRequest(boolean crd) {
cctx.exchange().exchangerBlockingSectionEnd();
}

cctx.exchange().exchangerBlockingSectionBegin();

try {
((IgniteChangeGlobalStateSupport)kctx.distributedMetastorage()).onActivate(kctx);
}
finally {
cctx.exchange().exchangerBlockingSectionEnd();
}

assert registerCachesFuture == null : "No caches registration should be scheduled before new caches have started.";

cctx.exchange().exchangerBlockingSectionBegin();
Expand Down
Expand Up @@ -34,7 +34,7 @@ public interface DistributedMetaStorage extends ReadableDistributedMetaStorage {
*
* @param key The key.
* @param val Value to write. Must not be null.
* @throws IgniteCheckedException If cluster is in deactivated state.
* @throws IgniteCheckedException In case of marshalling error or some other unexpected exception.
*/
void write(@NotNull String key, @NotNull Serializable val) throws IgniteCheckedException;

Expand All @@ -43,15 +43,15 @@ public interface DistributedMetaStorage extends ReadableDistributedMetaStorage {
*
* @param key The key.
* @param val Value to write. Must not be null.
* @throws IgniteCheckedException If cluster is in deactivated state.
* @throws IgniteCheckedException In case of marshalling error or some other unexpected exception.
*/
GridFutureAdapter<?> writeAsync(@NotNull String key, @NotNull Serializable val) throws IgniteCheckedException;

/**
* Remove value from distributed metastorage.
*
* @param key The key.
* @throws IgniteCheckedException If cluster is in deactivated state.
* @throws IgniteCheckedException In case of marshalling error or some other unexpected exception.
*/
void remove(@NotNull String key) throws IgniteCheckedException;

Expand All @@ -61,7 +61,7 @@ public interface DistributedMetaStorage extends ReadableDistributedMetaStorage {
* @param key The key.
* @param expVal Expected value. Might be null.
* @param newVal Value to write. Must not be null.
* @throws IgniteCheckedException If cluster is in deactivated state.
* @throws IgniteCheckedException In case of marshalling error or some other unexpected exception.
* @return {@code True} if expected value matched the actual one and write was completed successfully.
* {@code False} otherwise.
*/
Expand All @@ -77,7 +77,7 @@ boolean compareAndSet(
* @param key The key.
* @param expVal Expected value. Might be null.
* @param newVal Value to write. Must not be null.
* @throws IgniteCheckedException If cluster is in deactivated state.
* @throws IgniteCheckedException In case of marshalling error or some other unexpected exception.
* @return {@code True} if expected value matched the actual one and write was completed successfully.
* {@code False} otherwise.
*/
Expand All @@ -92,7 +92,7 @@ GridFutureAdapter<Boolean> compareAndSetAsync(
*
* @param key The key.
* @param expVal Expected value. Must not be null.
* @throws IgniteCheckedException If cluster is in deactivated state.
* @throws IgniteCheckedException In case of marshalling error or some other unexpected exception.
* @return {@code True} if expected value matched the actual one and remove was completed successfully.
* {@code False} otherwise.
*/
Expand Down
Expand Up @@ -32,9 +32,9 @@ public interface DistributedMetaStorageListener<T extends Serializable> {
/**
* Invoked in two cases:
* <ul>
* <li>data was dinamicaly updated;</li>
* <li>node was activated. In this case {@code oldVal} and {@code newVal} might be different only if new data
* was received from cluster before activation</li>
* <li>data was dynamicaly updated;</li>
* <li>node was started. In this case {@code oldVal} and {@code newVal} might be different only if new data
* was received from cluster</li>
* </ul>
*
* @param key The key.
Expand Down
Expand Up @@ -33,9 +33,8 @@ public interface DistributedMetastorageLifecycleListener {
default void onReadyForRead(ReadableDistributedMetaStorage metastorage) {}

/**
* Called when global metastorage is available for writing. Given instance guaranteed to be
* valid until cluster deactivation. In such case this method will be invoked once cluster
* is reactivated.
* Called when global metastorage is available for writing. In persistent mode this method will be invoked every
* time cluster is reactivated.
*
* @param metastorage Global metastorage instance.
*/
Expand Down
Expand Up @@ -60,7 +60,7 @@ public static boolean isSupported(GridKernalContext ctx) {
long getUpdatesCount();

/**
* Get value by the key. Should be consistent for all nodes in cluster when it's in active state.
* Get value by the key. Should be consistent for all nodes.
*
* @param key The key.
* @return Value associated with the key.
Expand Down

This file was deleted.

Expand Up @@ -22,7 +22,7 @@
/**
* Distributed metastorage data that cluster sends to joining node.
*/
@SuppressWarnings("PublicField")
@SuppressWarnings({"PublicField", "AssignmentOrReturnOfFieldWithMutableType"})
class DistributedMetaStorageClusterNodeData implements Serializable {
/** */
private static final long serialVersionUID = 0L;
Expand Down Expand Up @@ -56,6 +56,9 @@ public DistributedMetaStorageClusterNodeData(
DistributedMetaStorageHistoryItem[] hist,
DistributedMetaStorageHistoryItem[] updates
) {
assert ver != null;
assert fullData == null || hist != null;

this.fullData = fullData;
this.ver = ver;
this.hist = hist;
Expand Down