/// <summary>
        /// Starts the MS SQL Node using the specified arguments.
        /// </summary>
        internal void Start()
        {
            ServiceElement serviceConfig = UhuruSection.GetSection().Service;

            Options options = new Options();
            options.AvailableStorage = serviceConfig.AvailableStorage;
            options.Capacity = serviceConfig.Capacity;
            options.BaseDir = serviceConfig.BaseDir;
            options.Index = serviceConfig.Index;
            options.LocalDB = serviceConfig.LocalDB;
            options.MaxDBSize = serviceConfig.MaxDBSize;
            options.MaxLengthyQuery = serviceConfig.MaxLengthyQuery;
            options.MaxLengthTX = serviceConfig.MaxLengthTX;
            options.MigrationNFS = serviceConfig.MigrationNFS;
            options.NodeId = serviceConfig.NodeId;
            options.Plan = serviceConfig.Plan;
            options.Uri = new System.Uri(serviceConfig.MBus);
            options.ZInterval = serviceConfig.ZInterval;
            options.LocalRoute = serviceConfig.LocalRoute;
            options.StatusPort = serviceConfig.StatusPort;

            MSSqlOptions sqlServerOptions = new MSSqlOptions();
            sqlServerOptions.Host = serviceConfig.MSSql.Host;
            sqlServerOptions.User = serviceConfig.MSSql.User;
            sqlServerOptions.Port = serviceConfig.MSSql.Port;
            sqlServerOptions.Password = serviceConfig.MSSql.Password;
            sqlServerOptions.LogicalStorageUnits = serviceConfig.MSSql.LogicalStorageUnits;

            sqlServerOptions.InitialDataSize = serviceConfig.MSSql.InitialDataSize;
            sqlServerOptions.InitialLogSize = serviceConfig.MSSql.InitialLogSize;

            sqlServerOptions.MaxDataSize = serviceConfig.MSSql.MaxDataSize;
            sqlServerOptions.MaxLogSize = serviceConfig.MSSql.MaxLogSize;

            sqlServerOptions.DataFileGrowth = serviceConfig.MSSql.DataFileGrowth;
            sqlServerOptions.LogFileGrowth = serviceConfig.MSSql.LogFileGrowth;

            this.node = new Node();
            this.node.Start(options, sqlServerOptions);
        }
Exemple #2
0
        /// <summary>
        /// Starts the node.
        /// </summary>
        /// <param name="options">The configuration options for the node.</param>
        /// <param name="sqlOptions">The MS SQL Server options.</param>
        public void Start(Options options, MSSqlOptions sqlOptions)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            if (sqlOptions == null)
            {
                throw new ArgumentNullException("sqlOptions");
            }

            this.mssqlConfig = sqlOptions;
            this.maxDbSize = options.MaxDBSize * 1024 * 1024;
            this.maxLongQuery = options.MaxLengthyQuery;
            this.maxLongTx = options.MaxLengthTX;
            this.localIp = NetworkInterface.GetLocalIPAddress(options.LocalRoute);

            this.connection = this.ConnectMSSql();

            TimerHelper.RecurringCall(
                KeepAliveInterval,
                delegate
                {
                    this.KeepAliveMSSql();
                });

            if (this.maxLongQuery > 0)
            {
                TimerHelper.RecurringCall(
                    this.maxLongQuery / 2,
                    delegate
                    {
                        this.KillLongTransactions();
                    });
            }

            if (this.maxLongTx > 0)
            {
                TimerHelper.RecurringCall(
                    this.maxLongTx / 2,
                    delegate
                    {
                        this.KillLongQueries();
                    });
            }
            else
            {
                Logger.Info(Strings.LongTXKillerDisabledInfoMessage);
            }

            TimerHelper.RecurringCall(
                StorageQuotaInterval,
                delegate
                {
                    this.EnforceStorageQuota();
                });

            this.baseDir = options.BaseDir;
            if (!string.IsNullOrEmpty(this.baseDir))
            {
                Directory.CreateDirectory(this.baseDir);
            }

            ProvisionedService.Initialize(options.LocalDB);

            this.CheckDBConsistency();

            this.availableStorageBytes = options.AvailableStorage * 1024 * 1024;
            this.availableCapacity = options.Capacity;

            foreach (ProvisionedService provisioned_service in ProvisionedService.GetInstances())
            {
                this.availableStorageBytes -= this.StorageForService(provisioned_service);
                this.availableCapacity -= this.CapacityUnit();
            }

            this.queriesServed = 0;
            this.qpsLastUpdated = DateTime.Now;

            // initialize qps counter
            this.GetQPS();
            this.longQueriesKilled = 0;
            this.longTxKilled = 0;
            this.provisionServed = 0;
            this.bindingServed = 0;
            this.Start(options);
        }
Exemple #3
0
        /// <summary>
        /// Starts the node.
        /// </summary>
        /// <param name="options">The configuration options for the node.</param>
        /// <param name="sqlOptions">The MS SQL Server options.</param>
        public void Start(Options options, MSSqlOptions sqlOptions)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            if (sqlOptions == null)
            {
                throw new ArgumentNullException("sqlOptions");
            }

            this.mssqlConfig  = sqlOptions;
            this.maxDbSize    = options.MaxDBSize * 1024 * 1024;
            this.maxLongQuery = options.MaxLengthyQuery;
            this.maxLongTx    = options.MaxLengthTX;
            this.localIp      = NetworkInterface.GetLocalIPAddress(options.LocalRoute);

            this.connection = this.ConnectMSSql();

            TimerHelper.RecurringCall(
                KeepAliveInterval,
                delegate
            {
                this.KeepAliveMSSql();
            });

            if (this.maxLongQuery > 0)
            {
                TimerHelper.RecurringCall(
                    this.maxLongQuery / 2,
                    delegate
                {
                    this.KillLongTransactions();
                });
            }

            if (this.maxLongTx > 0)
            {
                TimerHelper.RecurringCall(
                    this.maxLongTx / 2,
                    delegate
                {
                    this.KillLongQueries();
                });
            }
            else
            {
                Logger.Info(Strings.LongTXKillerDisabledInfoMessage);
            }

            TimerHelper.RecurringCall(
                StorageQuotaInterval,
                delegate
            {
                this.EnforceStorageQuota();
            });

            this.baseDir = options.BaseDir;
            if (!string.IsNullOrEmpty(this.baseDir))
            {
                Directory.CreateDirectory(this.baseDir);
            }

            ProvisionedService.Initialize(options.LocalDB);

            this.CheckDBConsistency();

            this.availableStorageBytes = options.AvailableStorage * 1024 * 1024;
            this.availableCapacity     = options.Capacity;

            foreach (ProvisionedService provisioned_service in ProvisionedService.GetInstances())
            {
                this.availableStorageBytes -= this.StorageForService(provisioned_service);
                this.availableCapacity     -= this.CapacityUnit();
            }

            this.queriesServed  = 0;
            this.qpsLastUpdated = DateTime.Now;

            // initialize qps counter
            this.GetQPS();
            this.longQueriesKilled = 0;
            this.longTxKilled      = 0;
            this.provisionServed   = 0;
            this.bindingServed     = 0;
            this.Start(options);
        }