Ejemplo n.º 1
0
        public TransactionManager(TransactionLog transactionLog, IOptions <TransactionsConfiguration> configOption, ILoggerFactory loggerFactory, ITelemetryProducer telemetryProducer,
                                  Factory <NodeConfiguration> getNodeConfig, TimeSpan?logMaintenanceInterval = null)
        {
            this.transactionLog         = transactionLog;
            this.config                 = configOption.Value;
            this.logger                 = loggerFactory.CreateLogger <TransactionManager>();
            this.logMaintenanceInterval = logMaintenanceInterval ?? DefaultLogMaintenanceInterval;

            activeTransactionsTracker = new ActiveTransactionsTracker(configOption, this.transactionLog, loggerFactory);

            transactionsTable = new ConcurrentDictionary <long, Transaction>(2, 1000000);

            dependencyQueue  = new ConcurrentQueue <Transaction>();
            groupCommitQueue = new ConcurrentQueue <Tuple <CommitRecord, Transaction> >();
            checkpointQueue  = new ConcurrentQueue <Transaction>();

            this.dependencyLock = new InterlockedExchangeLock();
            this.commitLock     = new InterlockedExchangeLock();
            this.checkpointLock = new InterlockedExchangeLock();
            this.resources      = new Dictionary <ITransactionalResource, long>();
            this.transactions   = new List <Transaction>();
            this.metrics        =
                new TransactionManagerMetrics(telemetryProducer, getNodeConfig().StatisticsMetricsTableWriteInterval);
            this.checkpointedLSN = 0;
            this.IsRunning       = false;
        }
Ejemplo n.º 2
0
        public TransactionManager(TransactionLog transactionLog, IOptions <TransactionsConfiguration> configOption, Factory <string, Logger> logFactory)
        {
            this.transactionLog = transactionLog;
            this.config         = configOption.Value;
            this.Logger         = logFactory(nameof(TransactionManager));

            activeTransactionsTracker = new ActiveTransactionsTracker(configOption, this.transactionLog, logFactory);

            transactionsTable = new ConcurrentDictionary <long, Transaction>(2, 1000000);

            dependencyQueue  = new ConcurrentQueue <Transaction>();
            groupCommitQueue = new ConcurrentQueue <Tuple <CommitRecord, Transaction> >();
            checkpointQueue  = new ConcurrentQueue <Transaction>();

            this.dependencyLock = new InterlockedExchangeLock();
            this.commitLock     = new InterlockedExchangeLock();
            this.checkpointLock = new InterlockedExchangeLock();
            this.resources      = new Dictionary <ITransactionalResource, long>();
            this.transactions   = new List <Transaction>();

            this.checkpointedLSN = 0;
            this.IsRunning       = false;
        }