public RpcDatabaseCopyStatus2[] GetCopyStatus(string serverName, RpcGetDatabaseCopyStatusFlags2 collectionFlags2, Guid[] dbGuids, int timeoutMs) { if (dbGuids == null || dbGuids.Length == 0) { dbGuids = new Guid[] { Guid.Empty }; } RpcDatabaseCopyStatus2[] statusResults = null; ReplayRpcClientWrapper.RunRpcOperation(serverName, null, timeoutMs, TasksRpcExceptionWrapper.Instance, delegate(ReplayRpcClient rpcClient) { RpcErrorExceptionInfo result; try { if (ReplayRpcVersionControl.IsGetCopyStatusEx4RpcSupported(ReplayRpcClientWrapper.GetServerVersion(serverName))) { ExTraceGlobals.ReplayServiceRpcTracer.TraceDebug <string>(0L, "GetCopyStatus(): Now making RpccGetCopyStatusEx4() RPC to server {0}.", serverName); RpcErrorExceptionInfo rpcErrorExceptionInfo = rpcClient.RpccGetCopyStatusEx4(collectionFlags2, dbGuids, ref statusResults); if (!rpcErrorExceptionInfo.IsFailed()) { ReplayRpcClientWrapper.DeserializeExtendedErrorInfo(statusResults); } result = rpcErrorExceptionInfo; } else { RpcDatabaseCopyStatus[] array = null; ExTraceGlobals.ReplayServiceRpcTracer.TraceDebug <string>(0L, "GetCopyStatus(): Now making GetCopyStatusEx2() RPC to server {0}.", serverName); RpcErrorExceptionInfo copyStatusEx = rpcClient.GetCopyStatusEx2(ReplayRpcClientWrapper.ConvertToLegacyCopyStatusFlags(collectionFlags2), dbGuids, ref array); if (!copyStatusEx.IsFailed() && array != null) { statusResults = ReplayRpcClientWrapper.ConvertLegacyCopyStatusArray(array); } result = copyStatusEx; } } catch (RpcException ex) { if (ReplayRpcErrorCode.IsRpcTimeoutError(ex.ErrorCode)) { throw new ReplayServiceDownException(serverName, ex.Message, ex); } throw; } return(result); }); return(statusResults); }
public RpcCopyStatusContainer GetCopyStatusWithHealthState(string serverName, RpcGetDatabaseCopyStatusFlags2 collectionFlags2, Guid[] dbGuids, int timeoutMs) { if (dbGuids == null || dbGuids.Length == 0) { dbGuids = new Guid[] { Guid.Empty }; } RpcCopyStatusContainer container = null; if (ReplayRpcVersionControl.IsGetCopyStatusWithHealthStateRpcSupported(ReplayRpcClientWrapper.GetServerVersion(serverName))) { ReplayRpcClientWrapper.RunRpcOperation(serverName, null, timeoutMs, TasksRpcExceptionWrapper.Instance, delegate(ReplayRpcClient rpcClient) { RpcErrorExceptionInfo result; try { ExTraceGlobals.ReplayServiceRpcTracer.TraceDebug <string>(0L, "GetCopyStatusWithHealthState(): Now making RpccGetCopyStatusWithHealthState() RPC to server {0}.", serverName); RpcErrorExceptionInfo rpcErrorExceptionInfo = rpcClient.RpccGetCopyStatusWithHealthState(collectionFlags2, dbGuids, ref container); if (!rpcErrorExceptionInfo.IsFailed()) { ReplayRpcClientWrapper.DeserializeExtendedErrorInfo(container.CopyStatuses); } result = rpcErrorExceptionInfo; } catch (RpcException ex) { if (ReplayRpcErrorCode.IsRpcTimeoutError(ex.ErrorCode)) { throw new ReplayServiceDownException(serverName, ex.Message, ex); } throw; } return(result); }); } else { container = new RpcCopyStatusContainer(); container.HealthStates = null; container.CopyStatuses = this.GetCopyStatus(serverName, collectionFlags2, dbGuids, timeoutMs); } return(container); }