Ejemplo n.º 1
0
 /// <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)
 {
     // Adds back the removed shard entries.
     return(ts.ExecuteOperation(
                StoreOperationRequestBuilder.SpAddShardLocal,
                StoreOperationRequestBuilder.AddShardLocal(this.Id, true, _shardMap, _shard)));
 }
        /// <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)
        {
            IStoreResults checkResult = ts.ExecuteCommandSingle(SqlUtils.CheckIfExistsLocalScript.Single());

            // Shard not already deployed, just need to add the proper entries.
            if (checkResult.StoreVersion == null)
            {
                // create initial version of LSM
                ts.ExecuteCommandBatch(SqlUtils.CreateLocalScript);

                // now upgrade LSM to latest version
                ts.ExecuteCommandBatch(SqlUtils.FilterUpgradeCommands(SqlUtils.UpgradeLocalScript, GlobalConstants.LsmVersionClient));
            }

            // Now actually add the shard entries.
            return(ts.ExecuteOperation(
                       StoreOperationRequestBuilder.SpAddShardLocal,
                       StoreOperationRequestBuilder.AddShardLocal(this.Id, false, _shardMap, _shard)));
        }