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
2 changes: 1 addition & 1 deletion properties/service_fabric_common.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<!-- Version for binaries, nuget packages generated from this repo. -->
<!-- TODO: Versions numbers are changed here manually for now, Integrate this with GitVersion. -->
<MajorVersion>5</MajorVersion>
<MinorVersion>2</MinorVersion>
<MinorVersion>3</MinorVersion>
<BuildVersion>0</BuildVersion>
<Revision>0</Revision>
</PropertyGroup>
Expand Down
36 changes: 36 additions & 0 deletions src/Microsoft.ServiceFabric.Client.Http/Generated/ReplicaClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -410,5 +410,41 @@ HttpRequestMessage RequestFunc()

return this.httpClient.SendAsync(RequestFunc, url, requestId, cancellationToken);
}

/// <inheritdoc />
public Task RestoreReplicaAsync(
NodeName nodeName,
PartitionId partitionId,
ReplicaId replicaId,
long? serverTimeout = 60,
CancellationToken cancellationToken = default(CancellationToken))
{
nodeName.ThrowIfNull(nameof(nodeName));
partitionId.ThrowIfNull(nameof(partitionId));
replicaId.ThrowIfNull(nameof(replicaId));
serverTimeout?.ThrowIfOutOfInclusiveRange("serverTimeout", 1, 4294967295);
var requestId = Guid.NewGuid().ToString();
var url = "Nodes/{nodeName}/$/GetPartitions/{partitionId}/$/GetReplicas/{replicaId}/$/Restore";
url = url.Replace("{nodeName}", Uri.EscapeDataString(nodeName.ToString()));
url = url.Replace("{partitionId}", partitionId.ToString());
url = url.Replace("{replicaId}", replicaId.ToString());
var queryParams = new List<string>();

// Append to queryParams if not null.
serverTimeout?.AddToQueryParameters(queryParams, $"timeout={serverTimeout}");
queryParams.Add("api-version=11.3");
url += "?" + string.Join("&", queryParams);

HttpRequestMessage RequestFunc()
{
var request = new HttpRequestMessage()
{
Method = HttpMethod.Post,
};
return request;
}

return this.httpClient.SendAsync(RequestFunc, url, requestId, cancellationToken);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ internal class ReplicaStatusConverter
{
obj = ReplicaStatus.Dropped;
}
else if (string.Compare(value, "Completed", StringComparison.OrdinalIgnoreCase) == 0)
{
obj = ReplicaStatus.Completed;
}
else if (string.Compare(value, "ToBeRemoved", StringComparison.OrdinalIgnoreCase) == 0)
{
obj = ReplicaStatus.ToBeRemoved;
}

return obj;
}
Expand Down Expand Up @@ -81,6 +89,12 @@ public static void Serialize(JsonWriter writer, ReplicaStatus? value)
case ReplicaStatus.Dropped:
writer.WriteStringValue("Dropped");
break;
case ReplicaStatus.Completed:
writer.WriteStringValue("Completed");
break;
case ReplicaStatus.ToBeRemoved:
writer.WriteStringValue("ToBeRemoved");
break;
default:
throw new ArgumentException($"Invalid value {value.ToString()} for enum type ReplicaStatus");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ internal static StatefulServiceReplicaInfo GetFromJsonProperties(JsonReader read
var replicaRole = default(ReplicaRole?);
var replicaId = default(ReplicaId);
var previousReplicaRole = default(ReplicaRole?);
var toBeRemovedExpirationTimeUtc = default(DateTime?);

do
{
Expand Down Expand Up @@ -77,6 +78,10 @@ internal static StatefulServiceReplicaInfo GetFromJsonProperties(JsonReader read
{
previousReplicaRole = ReplicaRoleConverter.Deserialize(reader);
}
else if (string.Compare("ToBeRemovedExpirationTimeUtc", propName, StringComparison.OrdinalIgnoreCase) == 0)
{
toBeRemovedExpirationTimeUtc = reader.ReadValueAsDateTime();
}
else
{
reader.SkipPropertyValue();
Expand All @@ -92,7 +97,8 @@ internal static StatefulServiceReplicaInfo GetFromJsonProperties(JsonReader read
lastInBuildDurationInSeconds: lastInBuildDurationInSeconds,
replicaRole: replicaRole,
replicaId: replicaId,
previousReplicaRole: previousReplicaRole);
previousReplicaRole: previousReplicaRole,
toBeRemovedExpirationTimeUtc: toBeRemovedExpirationTimeUtc);
}

/// <summary>
Expand Down Expand Up @@ -129,6 +135,11 @@ internal static void Serialize(JsonWriter writer, StatefulServiceReplicaInfo obj
writer.WriteProperty(obj.ReplicaId, "ReplicaId", ReplicaIdConverter.Serialize);
}

if (obj.ToBeRemovedExpirationTimeUtc != null)
{
writer.WriteProperty(obj.ToBeRemovedExpirationTimeUtc, "ToBeRemovedExpirationTimeUtc", JsonWriterExtensions.WriteDateTimeValue);
}

writer.WriteEndObject();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ Task ReportDeployedApplicationHealthAsync(
/// For example, if the application name is "fabric:/myapp/app1", the application identity would be "myapp~app1" in
/// 6.0+ and "myapp/app1" in previous versions.
/// </param>
/// <param name ="applicationArmMetadataUpdateDescription">The Arm metadata to be assocated with a specific
/// <param name ="applicationArmMetadataUpdateDescription">The Arm metadata to be associated with a specific
/// application</param>
/// <param name ="serverTimeout">The server timeout for performing the operation in seconds. This timeout specifies the
/// time duration that the client is willing to wait for the requested operation to complete. The default value for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ Task<BackupProgressInfo> GetPartitionBackupProgressAsync(
/// </remarks>
/// <param name ="partitionId">The identity of the partition.</param>
/// <param name ="restorePartitionDescription">Describes the parameters to restore the partition.</param>
/// <param name ="latest">Specifies whether BackupRestore Service whould automatically determine the latest backup
/// <param name ="latest">Specifies whether BackupRestore Service would automatically determine the latest backup
/// available and Restore using that. Set to false by default, but user can pass True and BackupRestore service will
/// automatically fetch the latest backup and Restore the partition using that.</param>
/// <param name ="restoreTimeout">Specifies the maximum amount of time to wait, in minutes, for the restore operation
Expand Down
35 changes: 34 additions & 1 deletion src/Microsoft.ServiceFabric.Client/Generated/IReplicaClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,10 @@ Task RestartReplicaAsync(
/// of the replica from the cluster. This API tests the replica state removal path, and simulates the report fault
/// permanent path through client APIs. Warning - There are no safety checks performed when this API is used. Incorrect
/// use of this API can lead to data loss for stateful services. In addition, the forceRemove flag impacts all other
/// replicas hosted in the same process.
/// replicas hosted in the same process. If the cluster has the replica soft delete feature enabled, the flow is
/// updated to no longer remove all of the state information of the replica from the cluster. This state is instead
/// persisted on the disk to be restorable from in the case of unexpected quorum loss. If the partition is otherwise
/// healthy, Service Fabric will permanently delete the replica state periodically.
/// </remarks>
/// <param name ="nodeName">The name of the node.</param>
/// <param name ="partitionId">The identity of the partition.</param>
Expand All @@ -375,5 +378,35 @@ Task RemoveReplicaAsync(
bool? forceRemove = default(bool?),
long? serverTimeout = 60,
CancellationToken cancellationToken = default(CancellationToken));

/// <summary>
/// Recovers a ToBeRemoved replica by reopening the stateful service replica.
/// </summary>
/// <remarks>
/// Recovers a ToBeRemoved replica by reopening the stateful service replica. Use this if the partition is stuck in
/// quorum loss in order to prevent data loss. In the event of Quorum Loss, customers should restore all soft deleted
/// (ToBeRemoved) replicas using this API. Service Fabric automatically determines which replicas to retain to restore
/// quorum. This command has no effect on replicas which are not in the ToBeRemoved state.
/// </remarks>
/// <param name ="nodeName">The name of the node.</param>
/// <param name ="partitionId">The identity of the partition.</param>
/// <param name ="replicaId">The identifier of the replica.</param>
/// <param name ="serverTimeout">The server timeout for performing the operation in seconds. This timeout specifies the
/// time duration that the client is willing to wait for the requested operation to complete. The default value for
/// this parameter is 60 seconds.</param>
/// <param name ="cancellationToken">Cancels the client-side operation.</param>
/// <returns>
/// A task that represents the asynchronous operation.
/// </returns>
/// <exception cref="InvalidCredentialsException">Thrown when invalid credentials are used while making request to cluster.</exception>
/// <exception cref="ServiceFabricRequestException">Thrown when request to Service Fabric cluster failed due to an underlying issue such as network connectivity, DNS failure or timeout.</exception>
/// <exception cref="ServiceFabricException">Thrown when the requested operation failed at server. Exception contains Error code <see cref="FabricError.ErrorCode"/>, message indicating the failure. It also contains a flag wether the exception is transient or not, client operations can be retried if its transient.</exception>
/// <exception cref="OperationCanceledException">Thrown when cancellation is requested for the cancellation token.</exception>
Task RestoreReplicaAsync(
NodeName nodeName,
PartitionId partitionId,
ReplicaId replicaId,
long? serverTimeout = 60,
CancellationToken cancellationToken = default(CancellationToken));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,8 @@ Task<UnplacedReplicaInformation> GetUnplacedReplicaInformationAsync(
/// For example, if the service name is "fabric:/myapp/app1/svc1", the service identity would be "myapp~app1~svc1" in
/// 6.0+ and "myapp/app1/svc1" in previous versions.
/// </param>
/// <param name ="serviceArmMetadataUpdateDescription">The Arm metadata to be assocated with a specific service</param>
/// <param name ="serviceArmMetadataUpdateDescription">The Arm metadata to be associated with a specific
/// service</param>
/// <param name ="serverTimeout">The server timeout for performing the operation in seconds. This timeout specifies the
/// time duration that the client is willing to wait for the requested operation to complete. The default value for
/// this parameter is 60 seconds.</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public enum DeactivationIntent

/// <summary>
/// Indicates the intent is for the node to remove data. You might specify this setting when the hard disk is being
/// reimaged. The value is 3.
/// re-imaged. The value is 3.
/// </summary>
RemoveData,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public abstract partial class DeployedServiceReplicaInfo
/// lifetime of the service. If the same service was deleted and recreated the IDs of its partitions would be
/// different.</param>
/// <param name="replicaStatus">The status of a replica of a service. Possible values include: 'Invalid', 'InBuild',
/// 'Standby', 'Ready', 'Down', 'Dropped'</param>
/// 'Standby', 'Ready', 'Down', 'Dropped', 'Completed', 'ToBeRemoved'</param>
/// <param name="address">The last address returned by the replica in Open or ChangeRole.</param>
/// <param name="servicePackageActivationId">The ActivationId of a deployed service package. If
/// ServicePackageActivationMode specified at the time of creating the service
Expand Down Expand Up @@ -90,7 +90,7 @@ protected DeployedServiceReplicaInfo(

/// <summary>
/// Gets the status of a replica of a service. Possible values include: 'Invalid', 'InBuild', 'Standby', 'Ready',
/// 'Down', 'Dropped'
/// 'Down', 'Dropped', 'Completed', 'ToBeRemoved'
/// </summary>
public ReplicaStatus? ReplicaStatus { get; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public partial class DeployedStatefulServiceReplicaInfo : DeployedServiceReplica
/// lifetime of the service. If the same service was deleted and recreated the IDs of its partitions would be
/// different.</param>
/// <param name="replicaStatus">The status of a replica of a service. Possible values include: 'Invalid', 'InBuild',
/// 'Standby', 'Ready', 'Down', 'Dropped'</param>
/// 'Standby', 'Ready', 'Down', 'Dropped', 'Completed', 'ToBeRemoved'</param>
/// <param name="address">The last address returned by the replica in Open or ChangeRole.</param>
/// <param name="servicePackageActivationId">The ActivationId of a deployed service package. If
/// ServicePackageActivationMode specified at the time of creating the service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public partial class DeployedStatelessServiceInstanceInfo : DeployedServiceRepli
/// lifetime of the service. If the same service was deleted and recreated the IDs of its partitions would be
/// different.</param>
/// <param name="replicaStatus">The status of a replica of a service. Possible values include: 'Invalid', 'InBuild',
/// 'Standby', 'Ready', 'Down', 'Dropped'</param>
/// 'Standby', 'Ready', 'Down', 'Dropped', 'Completed', 'ToBeRemoved'</param>
/// <param name="address">The last address returned by the replica in Open or ChangeRole.</param>
/// <param name="servicePackageActivationId">The ActivationId of a deployed service package. If
/// ServicePackageActivationMode specified at the time of creating the service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public partial class LivenessProbeFailedEvent : ApplicationEvent
/// <param name="stdOut">the standard output stream</param>
/// <param name="stdErr">the standard error stream</param>
/// <param name="errorCode">the error code for the process</param>
/// <param name="message">message emited from the failed event</param>
/// <param name="message">message emitted from the failed event</param>
/// <param name="category">The category of event.</param>
/// <param name="hasCorrelatedEvents">Shows there is existing related events available.</param>
/// <param name="codePackageName">Name of Code package.</param>
Expand Down Expand Up @@ -171,7 +171,7 @@ public LivenessProbeFailedEvent(
public string ErrorCode { get; }

/// <summary>
/// Gets message emited from the failed event
/// Gets message emitted from the failed event
/// </summary>
public string Message { get; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public partial class ReadinessProbeFailedEvent : ApplicationEvent
/// <param name="stdOut">the standard output stream</param>
/// <param name="stdErr">the standard error stream</param>
/// <param name="errorCode">the error code for the process</param>
/// <param name="message">message emited from the failed event</param>
/// <param name="message">message emitted from the failed event</param>
/// <param name="category">The category of event.</param>
/// <param name="hasCorrelatedEvents">Shows there is existing related events available.</param>
/// <param name="codePackageName">Name of Code package.</param>
Expand Down Expand Up @@ -171,7 +171,7 @@ public ReadinessProbeFailedEvent(
public string ErrorCode { get; }

/// <summary>
/// Gets message emited from the failed event
/// Gets message emitted from the failed event
/// </summary>
public string Message { get; }
}
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.ServiceFabric.Common/Generated/ReplicaInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public abstract partial class ReplicaInfo
/// </summary>
/// <param name="serviceKind">The kind of service (Stateless or Stateful).</param>
/// <param name="replicaStatus">The status of a replica of a service. Possible values include: 'Invalid', 'InBuild',
/// 'Standby', 'Ready', 'Down', 'Dropped'</param>
/// 'Standby', 'Ready', 'Down', 'Dropped', 'Completed', 'ToBeRemoved'</param>
/// <param name="healthState">The health state of a Service Fabric entity such as Cluster, Node, Application, Service,
/// Partition, Replica etc. Possible values include: 'Invalid', 'Ok', 'Warning', 'Error', 'Unknown'</param>
/// <param name="nodeName">The name of a Service Fabric node.</param>
Expand All @@ -43,7 +43,7 @@ protected ReplicaInfo(

/// <summary>
/// Gets the status of a replica of a service. Possible values include: 'Invalid', 'InBuild', 'Standby', 'Ready',
/// 'Down', 'Dropped'
/// 'Down', 'Dropped', 'Completed', 'ToBeRemoved'
/// </summary>
public ReplicaStatus? ReplicaStatus { get; }

Expand Down
11 changes: 11 additions & 0 deletions src/Microsoft.ServiceFabric.Common/Generated/ReplicaStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,16 @@ public enum ReplicaStatus
/// state has been deleted. The value is 5.
/// </summary>
Dropped,

/// <summary>
/// The replica is completed. This means that the replica has been removed from the replica set. The value is 6.
/// </summary>
Completed,

/// <summary>
/// The replica is to be removed. This means that the replica has been removed from the replica set; however its data
/// is still preserved on disk temporarily and can be restored if manual actions are taken. The value is 7.
/// </summary>
ToBeRemoved,
}
}
Loading