Example #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 update the shard.
     return(ts.ExecuteOperation(
                StoreOperationRequestBuilder.SpUpdateShardLocal,
                StoreOperationRequestBuilder.UpdateShardLocal(this.Id, _shardMap, _shardNew)));
 }
Example #2
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.SpUpdateShardLocal,
                StoreOperationRequestBuilder.UpdateShardLocal(this.Id, _shardMap, _shardOld)));
 }
        /// <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)
        {
            // There should already be some version of LSM at this location as RecoveryMAnager.AttachShard() first reads existing shard maps from this location.

            IStoreResults checkResult = ts.ExecuteCommandSingle(SqlUtils.CheckIfExistsLocalScript.Single());

            Debug.Assert(checkResult.StoreVersion != null);

            // Upgrade local shard map to latest version before attaching.
            ts.ExecuteCommandBatch(SqlUtils.FilterUpgradeCommands(SqlUtils.UpgradeLocalScript, GlobalConstants.LsmVersionClient, checkResult.StoreVersion.Version));

            // Now update the shards table in LSM.
            return(ts.ExecuteOperation(
                       StoreOperationRequestBuilder.SpUpdateShardLocal,
                       StoreOperationRequestBuilder.UpdateShardLocal(this.Id, _shardMap, _shard)));
        }