Example #1
0
        /// <summary>
        ///     Restart after some administrative tasks that do not need data to be loaded from persistent storage
        /// </summary>
        public void LightStart()
        {
            _storage       = new ReliableStorage(new NullObjectProcessor(), WorkingDirectory);
            TransactionLog = new TransactionLog(WorkingDirectory);

            StartProcessingTransactions();
        }
Example #2
0
        /// <summary>
        ///     Restart after some administrative tasks that do not need data to be loaded from persistent storage
        /// </summary>
        public void LightStart(bool resetStorage = false)
        {
            if (resetStorage)
            {
                _storage = new ReliableStorage(new NullObjectProcessor(), WorkingDirectory);
            }
            else
            {
                _storage.LightRestart();
            }


            TransactionLog = new TransactionLog(WorkingDirectory);

            StartProcessingTransactions();
        }
Example #3
0
        public void Start()
        {
            _storage = Container != null
                ? new ReliableStorage(new ObjectProcessor(Container), WorkingDirectory)
                : new ReliableStorage(new NullObjectProcessor(), WorkingDirectory);


            ServerLog.LogInfo("start processing schema");

            // Stage 1  load the schema and
            // register types (this will create an in-memory data store for each type)

            lock (_schemaSync)
            {
                Container?.LoadSchema(SchemaFilePath);
                Container?.LoadSequence(SequenceFilePath);
            }

            ServerLog.LogInfo("end processing schema");

            ServerLog.LogInfo("start loading transaction log");
            TransactionLog = new TransactionLog(WorkingDirectory);
            ServerLog.LogInfo("end loading transaction log");

            // if there are pending transactions data needs to be loaded twice
            // first without processing the persistent objects; simply initializing offset tables
            // second after processing pending transactions reload and store objects in memory
            if (TransactionLog.PendingTransactionsCount > 0)
            {
                ServerLog.LogInfo("start loading data before transaction processing");
                // load once without processing the objects
                _storage.LoadPersistentData(false);
                ServerLog.LogInfo("end loading data before transaction processing");
            }

            // start the thread that will process pending transactions
            StartProcessingTransactions();

            ServerLog.LogInfo("start waiting for pending transactions to be processed");
            // Stage 2 wait for the persistence engine to commit all the pending transactions in the log
            // in the storage


            WaitForPendingTransactions();

            ServerLog.LogInfo("end waiting for pending transactions");

            // Stage 3 house keeping

            ServerLog.LogInfo("start compacting the transaction log");
            TransactionLog.ClearLog();
            ServerLog.LogInfo("end compacting the transaction log");

            ServerLog.LogInfo("start compacting the persistence storage");
            _storage.CleanStorage();
            ServerLog.LogInfo("end compacting the persistence storage");

            ServerLog.LogInfo("begin load data");
            // Stage 4 load data from persisent storage to memory
            _storage.LoadPersistentData();
            ServerLog.LogInfo("end load data");
        }