Skip to content
Merged
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 @@ -63,15 +63,13 @@ abstract class AbstractSnapshotOperationRequest implements Serializable {
* @param snpName Snapshot name.
* @param snpPath Snapshot directory path.
* @param grps Collection of cache group names.
* @param incIdx Incremental snapshot index.
* @param nodes IDs of the nodes that must be alive to complete the operation.
*/
protected AbstractSnapshotOperationRequest(
UUID reqId,
String snpName,
String snpPath,
@Nullable Collection<String> grps,
int incIdx,
Collection<UUID> nodes
) {
this.reqId = reqId;
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class SnapshotCheckProcessRequest extends AbstractSnapshotOperationReques
*
* @param reqId Request ID.
* @param snpName Snapshot name.
* @param nodes Baseline node IDs that must be alive to complete the operation..
* @param nodes Baseline node IDs that must be alive to complete the operation.
* @param snpPath Snapshot directory path.
* @param grps List of cache group names.
* @param fullCheck If {@code true}, additionally calculates partition hashes. Otherwise, checks only snapshot integrity
Expand All @@ -73,7 +73,7 @@ public class SnapshotCheckProcessRequest extends AbstractSnapshotOperationReques
int incIdx,
boolean allRestoreHandlers
) {
super(reqId, snpName, snpPath, grps, 0, nodes);
super(reqId, snpName, snpPath, grps, nodes);

assert !F.isEmpty(nodes);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,117 @@

package org.apache.ignite.internal.processors.cache.persistence.snapshot;

import java.io.Serializable;
import java.util.Set;
import java.util.List;
import org.apache.ignite.internal.processors.cache.persistence.filename.SnapshotFileTree;
import org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.typedef.internal.S;

/**
* Initial snapshot operation interface.
* Current snapshot operation on local node.
*/
public interface SnapshotOperation extends Serializable {
public class SnapshotOperation {
/** */
private final SnapshotOperationRequest req;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we rename to SnapshotOperationStartRequest since we have SnapshotOperationEndRequest ?


/** Snapshot file tree. */
@GridToStringExclude
private final SnapshotFileTree sft;

/** Snapshot metadata. */
@GridToStringExclude
private SnapshotMetadata meta;

/** Exception occurred during snapshot operation processing. */
private volatile Throwable err;

/** Warning flag of concurrent inconsistent-by-nature streamer updates. */
@GridToStringExclude
private volatile boolean streamerWrn;

/**
* Cache group ids included to this snapshot.
*
* @return Cache group identifiers.
* Snapshot operation warnings. Warnings do not interrupt snapshot process but raise exception at the end to make
* the operation status 'not OK' if no other error occurred.
*/
public Set<Integer> cacheGroupIds();
private volatile List<String> warnings;

/** Flag indicating that the {@link DistributedProcessType#START_SNAPSHOT} phase has completed. */
private volatile boolean startStageEnded;

/** */
public SnapshotOperation(SnapshotOperationRequest req, SnapshotFileTree sft) {
this.req = req;
this.sft = sft;
}

/** */
public SnapshotOperationRequest request() {
return req;
}

/** @return Snapshot file tree. */
public SnapshotFileTree snapshotFileTree() {
return sft;
}

/** @return Snapshot metadata. */
public SnapshotMetadata meta() {
return meta;
}

/** Stores snapshot metadata. */
public void meta(SnapshotMetadata meta) {
this.meta = meta;
}

/** @return Exception occurred during snapshot operation processing. */
public Throwable error() {
return err;
}

/** @param err Exception occurred during snapshot operation processing. */
public void error(Throwable err) {
this.err = err;
}

/** {@code True} If the streamer warning flag is set. {@code False} otherwise. */
public boolean streamerWarning() {
return streamerWrn;
}

/** Sets the streamer warning flag. */
public boolean streamerWarning(boolean val) {
return streamerWrn = val;
}

/** @return Warnings of snapshot operation. */
public List<String> warnings() {
return warnings;
}

/** @param warnings Warnings of snapshot operation. */
public void warnings(List<String> warnings) {
assert this.warnings == null;

this.warnings = warnings;
}

/**
* @return Cache names included to this snapshot.
* @return Flag indicating that the {@link DistributedProcessType#START_SNAPSHOT} phase has completed.
*/
public Set<String> cacheNames();
protected boolean startStageEnded() {
return startStageEnded;
}

/**
* @return Any custom extra parameter.
* In case Map object is provided, contains named snapshot operation attributes.
* @param startStageEnded Flag indicating that the {@link DistributedProcessType#START_SNAPSHOT} phase has completed.
*/
public Object extraParameter();
protected void startStageEnded(boolean startStageEnded) {
this.startStageEnded = startStageEnded;
}

/** {@inheritDoc} */
@Override public String toString() {
return S.toString(SnapshotOperation.class, this, super.toString());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* 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.cache.persistence.snapshot;

import java.io.Serializable;
import java.util.List;
import java.util.UUID;
import org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.jetbrains.annotations.Nullable;

/**
* Snapshot operation end request for {@link DistributedProcessType#END_SNAPSHOT} initiate message.
*/
public class SnapshotOperationEndRequest implements Serializable {
/** Serial version uid. */
private static final long serialVersionUID = 0L;

/** Request ID. */
@GridToStringInclude
private final UUID reqId;

/** Exception occurred during snapshot operation processing. */
@Nullable private final Throwable err;

/**
* Snapshot operation warnings. Warnings do not interrupt snapshot process but raise exception at the end to make
* the operation status 'not OK' if no other error occurred.
*/
@Nullable private final List<String> warnings;

/**
* @param id Request ID.
* @param err Exception occurred during snapshot operation processing.
* @param warnings Warnings of snapshot operation.
*/
public SnapshotOperationEndRequest(UUID id, @Nullable Throwable err, @Nullable List<String> warnings) {
reqId = id;
this.err = err;
this.warnings = warnings;
}

/** @return Request ID. */
public UUID requestId() {
return reqId;
}

/** @return Exception occurred during snapshot operation processing. */
@Nullable public Throwable error() {
return err;
}

/** @return Warnings of snapshot operation. */
@Nullable public List<String> warnings() {
return warnings;
}

/** {@inheritDoc} */
@Override public String toString() {
return S.toString(SnapshotOperationEndRequest.class, this, super.toString());
}
}
Loading
Loading