/// <summary> /// Handles errors from the the LSM operation on the source shard. /// </summary> /// <param name="result">Operation result.</param> public override void HandleDoLocalSourceExecuteError(IStoreResults result) { // Possible errors from spUpdateShardLocal: // StoreResult.StoreVersionMismatch // StoreResult.MissingParametersForStoredProcedure // StoreResult.ShardDoesNotExist switch (result.Result) { case StoreResult.StoreVersionMismatch: case StoreResult.MissingParametersForStoredProcedure: case StoreResult.ShardDoesNotExist: throw StoreOperationErrorHandler.OnShardMapErrorLocal( result, _shardMap, _shard.Location, ShardManagementErrorCategory.ShardMap, StoreOperationErrorHandler.OperationNameFromStoreOperationCode(this.OperationCode), StoreOperationRequestBuilder.SpUpdateShardLocal); default: throw new ShardManagementException( ShardManagementErrorCategory.ShardMapManager, ShardManagementErrorCode.StorageOperationFailure, Errors._Store_SqlExceptionLocal, OperationName ); } }
/// <summary> /// Handles errors from the undo of LSM operation on the source shard. /// </summary> /// <param name="result">Operation result.</param> public override void HandleUndoLocalSourceExecuteError(IStoreResults result) { // Possible errors are: // StoreResult.StoreVersionMismatch // StoreResult.MissingParametersForStoredProcedure throw StoreOperationErrorHandler.OnShardMapErrorLocal( result, _shardMap, _shard.Location, ShardManagementErrorCategory.ShardMap, StoreOperationErrorHandler.OperationNameFromStoreOperationCode(this.OperationCode), StoreOperationRequestBuilder.SpAddShardLocal); }
/// <summary> /// Handles errors from the undo of LSM operation on the source shard. /// </summary> /// <param name="result">Operation result.</param> public override void HandleUndoLocalSourceExecuteError(IStoreResults result) { // Possible errors are: // StoreResult.StoreVersionMismatch // StoreResult.MissingParametersForStoredProcedure // Stored procedure can also return StoreResult.ShardDoesNotExist, but only for AttachShard operations throw StoreOperationErrorHandler.OnShardMapErrorLocal( result, _shardMap, _shardNew.Location, ShardManagementErrorCategory.ShardMap, StoreOperationErrorHandler.OperationNameFromStoreOperationCode(this.OperationCode), StoreOperationRequestBuilder.SpUpdateShardLocal); }
/// <summary> /// Terminates connection on the source shard object. /// </summary> private void KillConnectionsOnSourceShard() { SqlUtils.WithSqlExceptionHandling(() => { string sourceShardConnectionString = this.GetConnectionStringForShardLocation(_mappingSource.StoreShard.Location); IStoreResults result; using (IStoreConnection connectionForKill = this.Manager.StoreConnectionFactory.GetConnection(StoreConnectionKind.LocalSource, sourceShardConnectionString)) { connectionForKill.Open(); using (IStoreTransactionScope ts = connectionForKill.GetTransactionScope(StoreTransactionScopeKind.NonTransactional)) { result = ts.ExecuteOperation( StoreOperationRequestBuilder.SpKillSessionsForShardMappingLocal, StoreOperationRequestBuilder.KillSessionsForShardMappingLocal(_patternForKill)); } } if (result.Result != StoreResult.Success) { // Possible errors are: // StoreResult.UnableToKillSessions // StoreResult.StoreVersionMismatch // StoreResult.MissingParametersForStoredProcedure throw StoreOperationErrorHandler.OnShardMapErrorLocal( result, _shardMap, _mappingSource.StoreShard.Location, _errorCategory, StoreOperationErrorHandler.OperationNameFromStoreOperationCode(this.OperationCode), StoreOperationRequestBuilder.SpKillSessionsForShardMappingLocal); } }); }