Ejemplo n.º 1
0
        /// <summary>
        /// Allows silo config to be programmatically set.
        /// </summary>
        /// <param name="config">Configuration data for this silo & cluster.</param>
        private void SetSiloConfig(ClusterConfiguration config)
        {
            Config = config;

            if (Verbose > 0)
            {
                Config.Defaults.DefaultTraceLevel = (Severity.Verbose - 1 + Verbose);
            }


            if (!String.IsNullOrEmpty(DeploymentId))
            {
                Config.Globals.DeploymentId = DeploymentId;
            }

            if (string.IsNullOrWhiteSpace(Name))
            {
                throw new ArgumentException("SiloName not defined - cannot initialize config");
            }

            NodeConfig = Config.GetOrAddConfigurationForNode(Name);
            Type       = NodeConfig.IsPrimaryNode ? Silo.SiloType.Primary : Silo.SiloType.Secondary;

            if (TraceFilePath != null)
            {
                var traceFileName = Config.GetOrAddConfigurationForNode(Name).TraceFileName;
                if (traceFileName != null && !Path.IsPathRooted(traceFileName))
                {
                    Config.GetOrAddConfigurationForNode(Name).TraceFileName = TraceFilePath + "\\" + traceFileName;
                }
            }

            ConfigLoaded = true;
            InitializeLogger(config.GetOrAddConfigurationForNode(Name));
        }
Ejemplo n.º 2
0
        internal static void InitSchedulerLogging()
        {
            TraceLogger.UnInitialize();
            //TraceLogger.LogConsumers.Add(new LogWriterToConsole());
            if (!Logger.TelemetryConsumers.OfType <ConsoleTelemetryConsumer>().Any())
            {
                Logger.TelemetryConsumers.Add(new ConsoleTelemetryConsumer());
            }

            var traceLevels = new[]
            {
                Tuple.Create("Scheduler", Severity.Verbose3),
                Tuple.Create("Scheduler.WorkerPoolThread", Severity.Verbose2),
            };

            TraceLogger.SetTraceLevelOverrides(new List <Tuple <string, Severity> >(traceLevels));

            var orleansConfig = new ClusterConfiguration();

            orleansConfig.StandardLoad();
            NodeConfiguration config = orleansConfig.GetOrAddConfigurationForNode("Primary");

            StatisticsCollector.Initialize(config);
            SchedulerStatisticsGroup.Init();
        }
        public static void AdjustClusterConfiguration(ClusterConfiguration config)
        {
            var settings = new Dictionary <string, string>();

            // get initial settings from configs
            ProviderConfig.WriteProperties(settings);
            EventHubConfig.WriteProperties(settings);

            // add queue balancer setting
            settings.Add(PersistentStreamProviderConfig.QUEUE_BALANCER_TYPE, StreamQueueBalancerType.DynamicClusterConfigDeploymentBalancer.ToString());

            // register stream provider
            config.Globals.RegisterStreamProvider <EventHubStreamProvider>(StreamProviderName, settings);
            config.Globals.RegisterStorageProvider <MemoryStorage>("PubSubStore");

            // make sure all node configs exist, for dynamic cluster queue balancer
            config.GetOrAddConfigurationForNode("Primary");
            config.GetOrAddConfigurationForNode("Secondary_1");
        }
Ejemplo n.º 4
0
        public static void ClassInitialize(TestContext testContext)
        {
            hostName = Dns.GetHostName();
            logger   = TraceLogger.GetLogger("MembershipTablePluginTests", TraceLogger.LoggerType.Application);

            ClusterConfiguration cfg = new ClusterConfiguration();

            cfg.LoadFromFile("OrleansConfigurationForTesting.xml");
            TraceLogger.Initialize(cfg.GetOrAddConfigurationForNode("Primary"));

            TraceLogger.AddTraceLevelOverride("AzureTableDataManager", Severity.Verbose3);
            TraceLogger.AddTraceLevelOverride("OrleansSiloInstanceManager", Severity.Verbose3);
            TraceLogger.AddTraceLevelOverride("Storage", Severity.Verbose3);
        }
Ejemplo n.º 5
0
        public static SiloHandle StartOrleansSilo(TestingSiloHost host, Silo.SiloType type, TestingSiloOptions options, int instanceCount, AppDomain shared = null)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }

            // Load initial config settings, then apply some overrides below.
            ClusterConfiguration config = new ClusterConfiguration();

            if (options.SiloConfigFile == null)
            {
                config.StandardLoad();
            }
            else
            {
                config.LoadFromFile(options.SiloConfigFile.FullName);
            }

            int basePort = options.BasePort < 0 ? BasePort : options.BasePort;


            if (config.Globals.SeedNodes.Count > 0 && options.BasePort < 0)
            {
                config.PrimaryNode = config.Globals.SeedNodes[0];
            }
            else
            {
                config.PrimaryNode = new IPEndPoint(IPAddress.Loopback, basePort);
            }
            config.Globals.SeedNodes.Clear();
            config.Globals.SeedNodes.Add(config.PrimaryNode);

            if (!String.IsNullOrEmpty(host.DeploymentId))
            {
                config.Globals.DeploymentId = host.DeploymentId;
            }

            config.Defaults.PropagateActivityId = options.PropagateActivityId;
            if (options.LargeMessageWarningThreshold > 0)
            {
                config.Defaults.LargeMessageWarningThreshold = options.LargeMessageWarningThreshold;
            }

            config.Globals.LivenessType        = options.LivenessType;
            config.Globals.ReminderServiceType = options.ReminderServiceType;
            if (!String.IsNullOrEmpty(options.DataConnectionString))
            {
                config.Globals.DataConnectionString = options.DataConnectionString;
            }

            host.livenessStabilizationTime = GetLivenessStabilizationTime(config.Globals);

            host.Globals = config.Globals;

            string siloName;

            switch (type)
            {
            case Silo.SiloType.Primary:
                siloName = "Primary";
                break;

            default:
                siloName = "Secondary_" + instanceCount.ToString(CultureInfo.InvariantCulture);
                break;
            }

            NodeConfiguration nodeConfig = config.GetOrAddConfigurationForNode(siloName);

            nodeConfig.HostNameOrIPAddress = "loopback";
            nodeConfig.Port = basePort + instanceCount;
            nodeConfig.DefaultTraceLevel   = config.Defaults.DefaultTraceLevel;
            nodeConfig.PropagateActivityId = config.Defaults.PropagateActivityId;
            nodeConfig.BulkMessageLimit    = config.Defaults.BulkMessageLimit;

            if (nodeConfig.ProxyGatewayEndpoint != null && nodeConfig.ProxyGatewayEndpoint.Address != null)
            {
                int proxyBasePort = options.ProxyBasePort < 0 ? ProxyBasePort : options.ProxyBasePort;
                nodeConfig.ProxyGatewayEndpoint = new IPEndPoint(nodeConfig.ProxyGatewayEndpoint.Address, proxyBasePort + instanceCount);
            }

            config.Globals.ExpectedClusterSize = 2;

            config.Overrides[siloName] = nodeConfig;

            AdjustForTest(config, options);

            WriteLog("Starting a new silo in app domain {0} with config {1}", siloName, config.ToString(siloName));
            AppDomain appDomain;
            Silo      silo = host.LoadSiloInNewAppDomain(siloName, type, config, out appDomain);

            silo.Start();

            SiloHandle retValue = new SiloHandle
            {
                Name      = siloName,
                Silo      = silo,
                Options   = options,
                Endpoint  = silo.SiloAddress.Endpoint,
                AppDomain = appDomain,
            };

            host.ImportGeneratedAssemblies(retValue);
            return(retValue);
        }