//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCloseIndexAndLabelScanSnapshots() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCloseIndexAndLabelScanSnapshots()
        {
            // Given
            LabelScanStore        labelScanStore  = mock(typeof(LabelScanStore));
            IndexingService       indexingService = mock(typeof(IndexingService));
            ExplicitIndexProvider explicitIndexes = mock(typeof(ExplicitIndexProvider));

            when(explicitIndexes.AllIndexProviders()).thenReturn(Collections.emptyList());
            DatabaseLayout databaseLayout = mock(typeof(DatabaseLayout));

            when(databaseLayout.MetadataStore()).thenReturn(mock(typeof(File)));
            LogFiles logFiles = mock(typeof(LogFiles));

            FilesInStoreDirAre(databaseLayout, _standardStoreDirFiles, _standardStoreDirDirectories);
            StorageEngine       storageEngine = mock(typeof(StorageEngine));
            NeoStoreFileListing fileListing   = new NeoStoreFileListing(databaseLayout, logFiles, labelScanStore, indexingService, explicitIndexes, storageEngine);

            ResourceIterator <File> scanSnapshot  = ScanStoreFilesAre(labelScanStore, new string[] { "blah/scan.store", "scan.more" });
            ResourceIterator <File> indexSnapshot = IndexFilesAre(indexingService, new string[] { "schema/index/my.index" });

            ResourceIterator <StoreFileMetadata> result = fileListing.Builder().excludeLogFiles().build();

            // When
            result.Close();

            // Then
            verify(scanSnapshot).close();
            verify(indexSnapshot).close();
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: public ExplicitIndexStore(@Nonnull Config config, IndexConfigStore indexStore, java.util.function.Supplier<org.neo4j.internal.kernel.api.Kernel> kernel, org.neo4j.kernel.impl.api.ExplicitIndexProvider defaultExplicitIndexProvider)
        public ExplicitIndexStore(Config config, IndexConfigStore indexStore, System.Func <Kernel> kernel, ExplicitIndexProvider defaultExplicitIndexProvider)
        {
            this._config                = config;
            this._indexStore            = indexStore;
            this._kernel                = kernel;
            this._explicitIndexProvider = defaultExplicitIndexProvider;
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void transferOriginalDataToMigrationDirectory() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TransferOriginalDataToMigrationDirectory()
        {
            ExplicitIndexProvider indexProviders = ExplicitIndexProvider;
            ExplicitIndexMigrator indexMigrator  = new TestExplicitIndexMigrator(this, _fs, indexProviders, _logProvider, true);

            indexMigrator.Migrate(_storeLayout, _migrationLayout, _progressMonitor, StandardV2_3.STORE_VERSION, StandardV3_0.STORE_VERSION);

            verify(_fs).copyRecursively(_originalIndexStore, _migratedIndexStore);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void skipEmptyIndexStorageMigration() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void SkipEmptyIndexStorageMigration()
        {
            when(_fs.listFiles(_originalIndexStore)).thenReturn(null);

            ExplicitIndexProvider indexProviders = ExplicitIndexProvider;
            ExplicitIndexMigrator indexMigrator  = new TestExplicitIndexMigrator(this, _fs, indexProviders, _logProvider, true);

            indexMigrator.Migrate(_storeLayout, _migrationLayout, _progressMonitor, StandardV2_3.STORE_VERSION, StandardV3_0.STORE_VERSION);

            verify(_fs, never()).deleteRecursively(_originalIndexStore);
            verify(_fs, never()).moveToDirectory(_migratedIndexStore, _storeLayout.databaseDirectory());
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void cleanupMigrationDirectory() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CleanupMigrationDirectory()
        {
            when(_fs.fileExists(_migratedIndexStore)).thenReturn(true);

            ExplicitIndexProvider indexProviders = ExplicitIndexProvider;
            ExplicitIndexMigrator indexMigrator  = new TestExplicitIndexMigrator(this, _fs, indexProviders, _logProvider, true);

            indexMigrator.Migrate(_storeLayout, _migrationLayout, _progressMonitor, StandardV2_3.STORE_VERSION, StandardV3_0.STORE_VERSION);
            indexMigrator.Cleanup(_migrationLayout);

            verify(_fs).deleteRecursively(_migratedIndexStore);
        }
        private ExplicitIndexTransactionStateImpl NewExplicitIndexTxState()
        {
            _indexConfigStore = mock(typeof(IndexConfigStore));
            when(_indexConfigStore.get(eq(typeof(Node)), anyString())).thenReturn(_config);
            when(_indexConfigStore.get(eq(typeof(Relationship)), anyString())).thenReturn(_config);

            ExplicitIndexProvider explicitIndexProvider = mock(typeof(ExplicitIndexProvider));

            when(explicitIndexProvider.GetProviderByName(anyString())).thenReturn(_provider);

            return(new ExplicitIndexTransactionStateImpl(_indexConfigStore, explicitIndexProvider));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void transferMigratedIndexesToStoreDirectory() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TransferMigratedIndexesToStoreDirectory()
        {
            ExplicitIndexProvider indexProviders = ExplicitIndexProvider;
            ExplicitIndexMigrator indexMigrator  = new TestExplicitIndexMigrator(this, _fs, indexProviders, _logProvider, true);

            indexMigrator.Migrate(_storeLayout, _migrationLayout, _progressMonitor, StandardV2_3.STORE_VERSION, StandardV3_0.STORE_VERSION);
            reset(_fs);

            indexMigrator.MoveMigratedFiles(_migrationLayout, _storeLayout, "any", "any");

            verify(_fs).deleteRecursively(_originalIndexStore);
            verify(_fs).moveToDirectory(_migratedIndexStore, _storeLayout.databaseDirectory());
        }
示例#8
0
            internal StoreSizeProvider(FileSystemAbstraction fs, NeoStoreDataSource ds)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.graphdb.DependencyResolver deps = ds.getDependencyResolver();
                DependencyResolver deps = ds.DependencyResolver;

                this.Fs       = requireNonNull(fs);
                this.LogFiles = deps.ResolveDependency(typeof(LogFiles));
                this.ExplicitIndexProviderLookup = deps.ResolveDependency(typeof(ExplicitIndexProvider));
                this.IndexProviderMap            = deps.ResolveDependency(typeof(IndexProviderMap));
                this.LabelScanStore = deps.ResolveDependency(typeof(LabelScanStore));
                this.DatabaseLayout = ds.DatabaseLayout;
            }
示例#9
0
        public RecordStorageEngine(DatabaseLayout databaseLayout, Config config, PageCache pageCache, FileSystemAbstraction fs, LogProvider logProvider, LogProvider userLogProvider, TokenHolders tokenHolders, SchemaState schemaState, ConstraintSemantics constraintSemantics, JobScheduler scheduler, TokenNameLookup tokenNameLookup, LockService lockService, IndexProviderMap indexProviderMap, IndexingService.Monitor indexingServiceMonitor, DatabaseHealth databaseHealth, ExplicitIndexProvider explicitIndexProvider, IndexConfigStore indexConfigStore, IdOrderingQueue explicitIndexTransactionOrdering, IdGeneratorFactory idGeneratorFactory, IdController idController, Monitors monitors, RecoveryCleanupWorkCollector recoveryCleanupWorkCollector, OperationalMode operationalMode, VersionContextSupplier versionContextSupplier)
        {
            this._tokenHolders   = tokenHolders;
            this._schemaState    = schemaState;
            this._lockService    = lockService;
            this._databaseHealth = databaseHealth;
            this._explicitIndexProviderLookup      = explicitIndexProvider;
            this._indexConfigStore                 = indexConfigStore;
            this._constraintSemantics              = constraintSemantics;
            this._explicitIndexTransactionOrdering = explicitIndexTransactionOrdering;

            this._idController = idController;
            StoreFactory factory = new StoreFactory(databaseLayout, config, idGeneratorFactory, pageCache, fs, logProvider, versionContextSupplier);

            _neoStores = factory.OpenAllNeoStores(true);

            try
            {
                _schemaCache   = new SchemaCache(constraintSemantics, Collections.emptyList(), indexProviderMap);
                _schemaStorage = new SchemaStorage(_neoStores.SchemaStore);

                NeoStoreIndexStoreView neoStoreIndexStoreView = new NeoStoreIndexStoreView(lockService, _neoStores);
                bool readOnly = config.Get(GraphDatabaseSettings.read_only) && operationalMode == OperationalMode.single;
                monitors.AddMonitorListener(new LoggingMonitor(logProvider.GetLog(typeof(NativeLabelScanStore))));
                _labelScanStore = new NativeLabelScanStore(pageCache, databaseLayout, fs, new FullLabelStream(neoStoreIndexStoreView), readOnly, monitors, recoveryCleanupWorkCollector);

                _indexStoreView        = new DynamicIndexStoreView(neoStoreIndexStoreView, _labelScanStore, lockService, _neoStores, logProvider);
                this._indexProviderMap = indexProviderMap;
                _indexingService       = IndexingServiceFactory.createIndexingService(config, scheduler, indexProviderMap, _indexStoreView, tokenNameLookup, Iterators.asList(_schemaStorage.loadAllSchemaRules()), logProvider, userLogProvider, indexingServiceMonitor, schemaState, readOnly);

                _integrityValidator = new IntegrityValidator(_neoStores, _indexingService);
                _cacheAccess        = new BridgingCacheAccess(_schemaCache, schemaState, tokenHolders);

                _explicitIndexApplierLookup = new Org.Neo4j.Kernel.Impl.Api.ExplicitIndexApplierLookup_Direct(explicitIndexProvider);

                _labelScanStoreSync = new WorkSync <Supplier <LabelScanWriter>, LabelUpdateWork>(_labelScanStore.newWriter);

                _commandReaderFactory = new RecordStorageCommandReaderFactory();
                _indexUpdatesSync     = new WorkSync <IndexingUpdateService, IndexUpdatesWork>(_indexingService);

                _denseNodeThreshold = config.Get(GraphDatabaseSettings.dense_node_threshold);
                _recordIdBatchSize  = config.Get(GraphDatabaseSettings.record_id_batch_size);
            }
            catch (Exception failure)
            {
                _neoStores.close();
                throw failure;
            }
        }
示例#10
0
        internal ModularDatabaseCreationContext(string databaseName, PlatformModule platformModule, DatabaseEditionContext editionContext, Procedures procedures, GraphDatabaseFacade facade)
        {
            this._databaseName = databaseName;
            this._config       = platformModule.Config;
            DatabaseIdContext idContext = editionContext.IdContext;

            this._idGeneratorFactory = idContext.IdGeneratorFactory;
            this._idController       = idContext.IdController;
            this._databaseLayout     = platformModule.StoreLayout.databaseLayout(databaseName);
            this._logService         = platformModule.Logging;
            this._scheduler          = platformModule.JobScheduler;
            this._globalDependencies = platformModule.Dependencies;
            this._tokenHolders       = editionContext.CreateTokenHolders();
            this._tokenNameLookup    = new NonTransactionalTokenNameLookup(_tokenHolders);
            this._locks = editionContext.CreateLocks();
            this._statementLocksFactory    = editionContext.CreateStatementLocksFactory();
            this._schemaWriteGuard         = editionContext.SchemaWriteGuard;
            this._transactionEventHandlers = new TransactionEventHandlers(facade);
            this._monitors = new Monitors(platformModule.Monitors);
            this._indexingServiceMonitor = _monitors.newMonitor(typeof(IndexingService.Monitor));
            this._physicalLogMonitor     = _monitors.newMonitor(typeof(LogFileCreationMonitor));
            this._fs = platformModule.FileSystem;
            this._transactionStats = editionContext.CreateTransactionMonitor();
            this._databaseHealth   = new DatabaseHealth(platformModule.PanicEventGenerator, _logService.getInternalLog(typeof(DatabaseHealth)));
            this._transactionHeaderInformationFactory = editionContext.HeaderInformationFactory;
            this._commitProcessFactory  = editionContext.CommitProcessFactory;
            this._autoIndexing          = new InternalAutoIndexing(platformModule.Config, _tokenHolders.propertyKeyTokens());
            this._indexConfigStore      = new IndexConfigStore(_databaseLayout, _fs);
            this._explicitIndexProvider = new DefaultExplicitIndexProvider();
            this._pageCache             = platformModule.PageCache;
            this._constraintSemantics   = editionContext.ConstraintSemantics;
            this._tracers    = platformModule.Tracers;
            this._procedures = procedures;
            this._ioLimiter  = editionContext.IoLimiter;
            this._clock      = platformModule.Clock;
            this._databaseAvailabilityGuard    = editionContext.CreateDatabaseAvailabilityGuard(_clock, _logService, _config);
            this._databaseAvailability         = new DatabaseAvailability(_databaseAvailabilityGuard, _transactionStats, platformModule.Clock, AwaitActiveTransactionDeadlineMillis);
            this._coreAPIAvailabilityGuard     = new CoreAPIAvailabilityGuard(_databaseAvailabilityGuard, editionContext.TransactionStartTimeout);
            this._accessCapability             = editionContext.AccessCapability;
            this._storeCopyCheckPointMutex     = new StoreCopyCheckPointMutex();
            this._recoveryCleanupWorkCollector = platformModule.RecoveryCleanupWorkCollector;
            this._databaseInfo               = platformModule.DatabaseInfo;
            this._versionContextSupplier     = platformModule.VersionContextSupplier;
            this._collectionsFactorySupplier = platformModule.CollectionsFactorySupplier;
            this._kernelExtensionFactories   = platformModule.KernelExtensionFactories;
            this._watcherServiceFactory      = editionContext.WatcherServiceFactory;
            this._facade          = facade;
            this._engineProviders = platformModule.EngineProviders;
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void logErrorWithIndexNameOnIndexMigrationException()
        public virtual void LogErrorWithIndexNameOnIndexMigrationException()
        {
            Log log = mock(typeof(Log));

            when(_logProvider.getLog(typeof(TestExplicitIndexMigrator))).thenReturn(log);

            ExplicitIndexProvider indexProviders = ExplicitIndexProvider;

            try
            {
                ExplicitIndexMigrator indexMigrator = new TestExplicitIndexMigrator(this, _fs, indexProviders, _logProvider, false);
                indexMigrator.Migrate(_storeLayout, _migrationLayout, _progressMonitor, StandardV2_3.STORE_VERSION, StandardV3_0.STORE_VERSION);

                fail("Index migration should fail");
            }
            catch (IOException)
            {
                // ignored
            }

            verify(log).error(eq("Migration of explicit indexes failed. Index: testIndex can't be migrated."), any(typeof(Exception)));
        }
 internal TestExplicitIndexMigrator(ExplicitIndexMigratorTest outerInstance, FileSystemAbstraction fileSystem, ExplicitIndexProvider explicitIndexProvider, LogProvider logProvider, bool successfulMigration) : base(fileSystem, explicitIndexProvider, logProvider)
 {
     this._outerInstance      = outerInstance;
     this.SuccessfulMigration = successfulMigration;
 }
示例#13
0
 public NeoStoreFileListing(DatabaseLayout databaseLayout, LogFiles logFiles, LabelScanStore labelScanStore, IndexingService indexingService, ExplicitIndexProvider explicitIndexProviders, StorageEngine storageEngine)
 {
     this._databaseLayout           = databaseLayout;
     this._logFiles                 = logFiles;
     this._storageEngine            = storageEngine;
     this._neoStoreFileIndexListing = new NeoStoreFileIndexListing(labelScanStore, indexingService, explicitIndexProviders);
     this._additionalProviders      = new CopyOnWriteArraySet <StoreFileProvider>();
 }
 public ExplicitIndexTransactionStateProvider(IndexConfigStore indexConfigStore, ExplicitIndexProvider explicitIndexProviderLookup)
 {
     this._indexConfigStore            = indexConfigStore;
     this._explicitIndexProviderLookup = explicitIndexProviderLookup;
 }
 public ExplicitIndexTransactionStateImpl(IndexConfigStore indexConfigStore, ExplicitIndexProvider explicitIndexProvider)
 {
     this._indexConfigStore = indexConfigStore;
     this._providerLookup   = explicitIndexProvider;
 }
 public ExplicitIndexApplierLookup_Direct(ExplicitIndexProvider provider)
 {
     this.Provider = provider;
 }
示例#17
0
 internal NeoStoreFileIndexListing(LabelScanStore labelScanStore, IndexingService indexingService, ExplicitIndexProvider explicitIndexProviders)
 {
     this._labelScanStore         = labelScanStore;
     this._indexingService        = indexingService;
     this._explicitIndexProviders = explicitIndexProviders;
 }