Ejemplo n.º 1
0
        private static KernelTransactions NewKernelTransactions(Locks locks, StorageEngine storageEngine, TransactionCommitProcess commitProcess, bool testKernelTransactions)
        {
            LifeSupport life = new LifeSupport();

            life.Start();

            TransactionIdStore transactionIdStore = mock(typeof(TransactionIdStore));

            when(transactionIdStore.LastCommittedTransaction).thenReturn(new TransactionId(0, 0, 0));

            Tracers tracers = new Tracers("null", NullLog.Instance, new Monitors(), mock(typeof(JobScheduler)), _clock);
            StatementLocksFactory statementLocksFactory = new SimpleStatementLocksFactory(locks);

            StatementOperationParts statementOperations = mock(typeof(StatementOperationParts));
            KernelTransactions      transactions;

            if (testKernelTransactions)
            {
                transactions = CreateTestTransactions(storageEngine, commitProcess, transactionIdStore, tracers, statementLocksFactory, statementOperations, _clock, _databaseAvailabilityGuard);
            }
            else
            {
                transactions = CreateTransactions(storageEngine, commitProcess, transactionIdStore, tracers, statementLocksFactory, statementOperations, _clock, _databaseAvailabilityGuard);
            }
            transactions.Start();
            return(transactions);
        }
Ejemplo n.º 2
0
 public KernelTransactions(Config config, StatementLocksFactory statementLocksFactory, ConstraintIndexCreator constraintIndexCreator, StatementOperationParts statementOperations, SchemaWriteGuard schemaWriteGuard, TransactionHeaderInformationFactory txHeaderFactory, TransactionCommitProcess transactionCommitProcess, AuxiliaryTransactionStateManager auxTxStateManager, TransactionHooks hooks, TransactionMonitor transactionMonitor, AvailabilityGuard databaseAvailabilityGuard, Tracers tracers, StorageEngine storageEngine, Procedures procedures, TransactionIdStore transactionIdStore, SystemNanoClock clock, AtomicReference <CpuClock> cpuClockRef, AtomicReference <HeapAllocation> heapAllocationRef, AccessCapability accessCapability, AutoIndexing autoIndexing, ExplicitIndexStore explicitIndexStore, VersionContextSupplier versionContextSupplier, CollectionsFactorySupplier collectionsFactorySupplier, ConstraintSemantics constraintSemantics, SchemaState schemaState, IndexingService indexingService, TokenHolders tokenHolders, string currentDatabaseName, Dependencies dataSourceDependencies)
 {
     if (!InstanceFieldsInitialized)
     {
         InitializeInstanceFields();
         InstanceFieldsInitialized = true;
     }
     this._config = config;
     this._statementLocksFactory  = statementLocksFactory;
     this._constraintIndexCreator = constraintIndexCreator;
     this._statementOperations    = statementOperations;
     this._schemaWriteGuard       = schemaWriteGuard;
     this._transactionHeaderInformationFactory = txHeaderFactory;
     this._transactionCommitProcess            = transactionCommitProcess;
     this._auxTxStateManager         = auxTxStateManager;
     this._hooks                     = hooks;
     this._transactionMonitor        = transactionMonitor;
     this._databaseAvailabilityGuard = databaseAvailabilityGuard;
     this._tracers                   = tracers;
     this._storageEngine             = storageEngine;
     this._procedures                = procedures;
     this._transactionIdStore        = transactionIdStore;
     this._cpuClockRef               = cpuClockRef;
     this._heapAllocationRef         = heapAllocationRef;
     this._accessCapability          = accessCapability;
     this._autoIndexing              = autoIndexing;
     this._explicitIndexStore        = explicitIndexStore;
     this._indexingService           = indexingService;
     this._tokenHolders              = tokenHolders;
     this._currentDatabaseName       = currentDatabaseName;
     this._dataSourceDependencies    = dataSourceDependencies;
     this._versionContextSupplier    = versionContextSupplier;
     this._clock                     = clock;
     DoBlockNewTransactions();
     this._collectionsFactorySupplier = collectionsFactorySupplier;
     this._constraintSemantics        = constraintSemantics;
     this._schemaState = schemaState;
 }
Ejemplo n.º 3
0
 public KernelStatement(KernelTransactionImplementation transaction, TxStateHolder txStateHolder, StorageReader storageReader, LockTracer systemLockTracer, StatementOperationParts statementOperations, ClockContext clockContext, VersionContextSupplier versionContextSupplier)
 {
     this._transaction             = transaction;
     this._txStateHolder           = txStateHolder;
     this._storageReader           = storageReader;
     this._facade                  = new OperationsFacade(this, statementOperations);
     this._executingQueryList      = ExecutingQueryList.EMPTY;
     this._systemLockTracer        = systemLockTracer;
     this._statementOpenCloseCalls = _recordStatementsTraces ? new LinkedList <StackTraceElement[]>() : _emptyStatementHistory;
     this._clockContext            = clockContext;
     this._versionContextSupplier  = versionContextSupplier;
 }
Ejemplo n.º 4
0
 internal TestKernelTransactions(StatementLocksFactory statementLocksFactory, ConstraintIndexCreator constraintIndexCreator, StatementOperationParts statementOperations, SchemaWriteGuard schemaWriteGuard, TransactionHeaderInformationFactory txHeaderFactory, TransactionCommitProcess transactionCommitProcess, AuxiliaryTransactionStateManager auxTxStateManager, TransactionHooks hooks, TransactionMonitor transactionMonitor, AvailabilityGuard databaseAvailabilityGuard, Tracers tracers, StorageEngine storageEngine, Procedures procedures, TransactionIdStore transactionIdStore, SystemNanoClock clock, AccessCapability accessCapability, AutoIndexing autoIndexing, VersionContextSupplier versionContextSupplier, TokenHolders tokenHolders, Dependencies dataSourceDependencies) : base(Config.defaults(), statementLocksFactory, constraintIndexCreator, statementOperations, schemaWriteGuard, txHeaderFactory, transactionCommitProcess, auxTxStateManager, hooks, transactionMonitor, databaseAvailabilityGuard, tracers, storageEngine, procedures, transactionIdStore, clock, new AtomicReference <CpuClock>(CpuClock.NOT_AVAILABLE), new AtomicReference <HeapAllocation>(HeapAllocation.NOT_AVAILABLE), accessCapability, autoIndexing, mock(typeof(ExplicitIndexStore)), versionContextSupplier, ON_HEAP, new StandardConstraintSemantics(), mock(typeof(SchemaState)), mock(typeof(IndexingService)), tokenHolders, DEFAULT_DATABASE_NAME, dataSourceDependencies)
 {
 }
Ejemplo n.º 5
0
 private static TestKernelTransactions CreateTestTransactions(StorageEngine storageEngine, TransactionCommitProcess commitProcess, TransactionIdStore transactionIdStore, Tracers tracers, StatementLocksFactory statementLocksFactory, StatementOperationParts statementOperations, SystemNanoClock clock, AvailabilityGuard databaseAvailabilityGuard)
 {
     return(new TestKernelTransactions(statementLocksFactory, null, statementOperations, null, DEFAULT, commitProcess, mock(typeof(AuxiliaryTransactionStateManager)), new TransactionHooks(), mock(typeof(TransactionMonitor)), databaseAvailabilityGuard, tracers, storageEngine, new Procedures(), transactionIdStore, clock, new CanWrite(), AutoIndexing.UNSUPPORTED, EmptyVersionContextSupplier.EMPTY, mockedTokenHolders(), new Dependencies()));
 }
Ejemplo n.º 6
0
 private static KernelTransactions CreateTransactions(StorageEngine storageEngine, TransactionCommitProcess commitProcess, TransactionIdStore transactionIdStore, Tracers tracers, StatementLocksFactory statementLocksFactory, StatementOperationParts statementOperations, SystemNanoClock clock, AvailabilityGuard databaseAvailabilityGuard)
 {
     return(new KernelTransactions(Config.defaults(), statementLocksFactory, null, statementOperations, null, DEFAULT, commitProcess, mock(typeof(AuxiliaryTransactionStateManager)), new TransactionHooks(), mock(typeof(TransactionMonitor)), databaseAvailabilityGuard, tracers, storageEngine, new Procedures(), transactionIdStore, clock, new AtomicReference <CpuClock>(CpuClock.NOT_AVAILABLE), new AtomicReference <HeapAllocation>(HeapAllocation.NOT_AVAILABLE), new CanWrite(), AutoIndexing.UNSUPPORTED, mock(typeof(ExplicitIndexStore)), EmptyVersionContextSupplier.EMPTY, ON_HEAP, mock(typeof(ConstraintSemantics)), mock(typeof(SchemaState)), mock(typeof(IndexingService)), mockedTokenHolders(), DEFAULT_DATABASE_NAME, new Dependencies()));
 }
Ejemplo n.º 7
0
 internal OperationsFacade(KernelStatement statement, StatementOperationParts operationParts)
 {
     this._statement  = statement;
     this._operations = operationParts;
 }