public void Publish_Shards_Asycn() { var currentConfig = ShardSetConfig.LoadCurrent(TestShardSetName); currentConfig.Servers.Clear(); var serverLocation = ConfigurationManager.AppSettings["TestSQLServer"] ?? "(localdb)\v11.0"; var server = Server.Load(serverLocation) ?? new Server { ServerInstanceName = serverLocation, Location = "Test Server Location", MaxShardsAllowed = -1, }; server.MaxShardsAllowed = -1; server = server.Save(); currentConfig.Servers.Add(server); currentConfig.Save(); currentConfig.UpdateShardMap(); currentConfig.Save(); currentConfig.DeployShardMap(true); currentConfig.PublishShardMap(true); var queue = ShardSetActionQueue.GetQueue(); queue.QueueProcessingEvent += Queue_QueueProcessingEvent; queue.CheckAndProcessQueue(Guid.NewGuid()); }
public void Elastic_Scale_Up_Test() { SaveTestSettings(); SaveTestShardSetConfig(); DeployCurrentShardSetConfigAsync(); // process the queues var queue = ShardSetActionQueue.GetQueue(); queue.QueueProcessingEvent += Queue_QueueProcessingEvent; queue.CheckAndProcessQueue(Guid.NewGuid()); // create some test data across the shards //CreateTestData(); // Reread the test shard set configuration to get the Current Shard Map Id value // of prior deployment var shardSetConfig = ShardSetConfig.LoadCurrent(TestShardSetName); // create a new configuration with more shards shardSetConfig.TargetShardCount = 8; shardSetConfig.MaxShardCount = 8; shardSetConfig.UpdateShardMap(); shardSetConfig.Save(); // redeploy and publish async shardSetConfig.DeployShardMap(true); shardSetConfig.PublishShardMap(true); // execute from queues until clear queue.CheckAndProcessQueue(Guid.NewGuid()); }
public void Sync_Shards_Async() { var shardSetConfig = SetupTestShardSetConfig(); shardSetConfig.SyncShards(true); var queue = ShardSetActionQueue.GetQueue(); queue.QueueProcessingEvent += Queue_QueueProcessingEvent; queue.CheckAndProcessQueue(Guid.NewGuid()); }
private void CheckQueues() { // check the queues every so often for a task try { Thread.Sleep(_workerRoleSleepTimeInMilliseconds); Log.Info("Checking worker role queue"); ShardSetActionQueue.GetQueue().CheckAndProcessQueue(_uniqueProcessID); } catch (Exception ex) { Log.Error("Exception processing the work role queue", ex); } }