Esempio n. 1
0
 /// <summary>
 /// Performs the LSM operation on the source shard.
 /// </summary>
 /// <param name="ts">Transaction scope.</param>
 /// <returns>Result of the operation.</returns>
 public override IStoreResults DoLocalSourceExecute(IStoreTransactionScope ts)
 {
     // Now actually add the shard entries.
     return(ts.ExecuteOperation(
                StoreOperationRequestBuilder.SpRemoveShardLocal,
                StoreOperationRequestBuilder.RemoveShardLocal(this.Id, _shardMap, _shard)));
 }
        /// <summary>
        /// Performs the undo of LSM operation on the source shard.
        /// </summary>
        /// <param name="ts">Transaction scope.</param>
        /// <returns>Result of the operation.</returns>
        public override IStoreResults UndoLocalSourceExecute(IStoreTransactionScope ts)
        {
            IStoreResults checkResult = ts.ExecuteCommandSingle(SqlUtils.CheckIfExistsLocalScript.Single());

            if (checkResult.StoreVersion != null)
            {
                // Remove the added shard entries.
                return(ts.ExecuteOperation(
                           StoreOperationRequestBuilder.SpRemoveShardLocal,
                           StoreOperationRequestBuilder.RemoveShardLocal(this.Id, _shardMap, _shard)));
            }
            else
            {
                // If version is < 0, then shard never got deployed, consider it a success.
                return(new SqlResults());
            }
        }