Esempio n. 1
0
 public CountsComputer(long lastCommittedTransactionId, NodeStore nodes, RelationshipStore relationships, int highLabelId, int highRelationshipTypeId, NumberArrayFactory numberArrayFactory, ProgressReporter progressMonitor)
 {
     this._lastCommittedTransactionId = lastCommittedTransactionId;
     this._nodes                  = nodes;
     this._relationships          = relationships;
     this._highLabelId            = highLabelId;
     this._highRelationshipTypeId = highRelationshipTypeId;
     this._numberArrayFactory     = numberArrayFactory;
     this._progressMonitor        = progressMonitor;
 }
Esempio n. 2
0
 internal NodeCountsProcessor(NodeStore nodeStore, NodeLabelsCache cache, int highLabelId, Org.Neo4j.Kernel.Impl.Api.CountsAccessor_Updater counts, ProgressReporter progressReporter)
 {
     this._nodeStore = nodeStore;
     this._cache     = cache;
     this._anyLabel  = highLabelId;
     this._counts    = counts;
     // Instantiate with high id + 1 since we need that extra slot for the ANY count
     this._labelCounts      = new long[highLabelId + 1];
     this._progressReporter = progressReporter;
 }
        private void MonitorSection(VisibleMigrationProgressMonitor monitor, string name, int max, params int[] steps)
        {
            ProgressReporter progressReporter = monitor.StartSection(name);

            progressReporter.Start(max);
            foreach (int step in steps)
            {
                progressReporter.Progress(step);
            }
            progressReporter.Completed();
        }
Esempio n. 4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void migrateExplicitIndexes(org.neo4j.kernel.impl.util.monitoring.ProgressReporter progressMonitor) throws java.io.IOException
        private void MigrateExplicitIndexes(ProgressReporter progressMonitor)
        {
            try
            {
                _fileSystem.copyRecursively(_originalExplicitIndexesRoot, _migrationExplicitIndexesRoot);
                Path indexRootPath = _migrationExplicitIndexesRoot.toPath();
                LuceneExplicitIndexUpgrader indexUpgrader = CreateLuceneExplicitIndexUpgrader(indexRootPath, progressMonitor);
                indexUpgrader.UpgradeIndexes();
            }
            catch (ExplicitIndexMigrationException lime)
            {
                _log.error("Migration of explicit indexes failed. Index: " + lime.FailedIndexName + " can't be " + "migrated.", lime);
                throw new IOException("Explicit index migration failed.", lime);
            }
        }
Esempio n. 5
0
        private void RebuildCounts(long lastCommittedTransactionId, ProgressReporter progressReporter)
        {
            CleanupCountsForRebuilding();

            IdGeneratorFactory idGenFactory = new DefaultIdGeneratorFactory(_fs);
            StoreFactory       storeFactory = new StoreFactory(_testDir.databaseLayout(), _config, idGenFactory, _pageCache, _fs, _logProvider, EmptyVersionContextSupplier.EMPTY);

            using (Lifespan life = new Lifespan(), NeoStores neoStores = storeFactory.OpenAllNeoStores())
            {
                NodeStore         nodeStore           = neoStores.NodeStore;
                RelationshipStore relationshipStore   = neoStores.RelationshipStore;
                int            highLabelId            = ( int )neoStores.LabelTokenStore.HighId;
                int            highRelationshipTypeId = ( int )neoStores.RelationshipTypeTokenStore.HighId;
                CountsComputer countsComputer         = new CountsComputer(lastCommittedTransactionId, nodeStore, relationshipStore, highLabelId, highRelationshipTypeId, [email protected]_Fields.AutoWithoutPagecache, progressReporter);
                CountsTracker  countsTracker          = CreateCountsTracker();
                life.Add(countsTracker.setInitializer(countsComputer));
            }
        }
Esempio n. 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void migrateHighLimit3_0StoreFiles() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MigrateHighLimit3_0StoreFiles()
        {
            FileSystemAbstraction fileSystem = _fileSystemRule.get();
            PageCache             pageCache  = _pageCacheRule.getPageCache(fileSystem);

            using (JobScheduler jobScheduler = new ThreadPoolJobScheduler())
            {
                StoreMigrator migrator = new StoreMigrator(fileSystem, pageCache, Config.defaults(), NullLogService.Instance, jobScheduler);

                DatabaseLayout databaseLayout  = _testDirectory.databaseLayout();
                DatabaseLayout migrationLayout = _testDirectory.databaseLayout("migration");

                PrepareNeoStoreFile(fileSystem, databaseLayout, HighLimitV3_0_0.STORE_VERSION, pageCache);

                ProgressReporter progressMonitor = mock(typeof(ProgressReporter));

                migrator.Migrate(databaseLayout, migrationLayout, progressMonitor, HighLimitV3_0_0.STORE_VERSION, HighLimit.StoreVersion);

                int newStoreFilesCount = fileSystem.ListFiles(migrationLayout.DatabaseDirectory()).Length;
                assertThat("Store should be migrated and new store files should be created.", newStoreFilesCount, Matchers.greaterThanOrEqualTo(StoreType.values().length));
            }
        }
Esempio n. 7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void migrate(org.neo4j.io.layout.DatabaseLayout directoryLayout, org.neo4j.io.layout.DatabaseLayout migrationLayout, org.neo4j.kernel.impl.util.monitoring.ProgressReporter progressMonitor, String versionToMigrateFrom, String versionToMigrateTo) throws java.io.IOException
        public override void Migrate(DatabaseLayout directoryLayout, DatabaseLayout migrationLayout, ProgressReporter progressMonitor, string versionToMigrateFrom, string versionToMigrateTo)
        {
        }
Esempio n. 8
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void migrate(org.neo4j.io.layout.DatabaseLayout directoryLayout, org.neo4j.io.layout.DatabaseLayout migrationLayout, org.neo4j.kernel.impl.util.monitoring.ProgressReporter progressMonitor, String versionToMigrateFrom, String versionToMigrateTo) throws java.io.IOException
        public override void Migrate(DatabaseLayout directoryLayout, DatabaseLayout migrationLayout, ProgressReporter progressMonitor, string versionToMigrateFrom, string versionToMigrateTo)
        {
            IndexImplementation indexImplementation = _explicitIndexProvider.getProviderByName(LUCENE_EXPLICIT_INDEX_PROVIDER_NAME);

            if (indexImplementation != null)
            {
                RecordFormats from = RecordFormatSelector.selectForVersion(versionToMigrateFrom);
                RecordFormats to   = RecordFormatSelector.selectForVersion(versionToMigrateTo);
                if (!from.HasCompatibleCapabilities(to, CapabilityType.INDEX))
                {
                    _originalExplicitIndexesRoot  = indexImplementation.GetIndexImplementationDirectory(directoryLayout);
                    _migrationExplicitIndexesRoot = indexImplementation.GetIndexImplementationDirectory(migrationLayout);
                    if (IsNotEmptyDirectory(_originalExplicitIndexesRoot))
                    {
                        MigrateExplicitIndexes(progressMonitor);
                        _explicitIndexMigrated = true;
                    }
                }
            }
            else
            {
                _log.debug("Lucene index provider not found, nothing to migrate.");
            }
        }
Esempio n. 9
0
 public MonitorAnonymousInnerClass(ProgressReporter progressMonitor)
 {
     this._progressMonitor = progressMonitor;
 }
Esempio n. 10
0
 private static LuceneExplicitIndexUpgrader.Monitor ProgressMonitor(ProgressReporter progressMonitor)
 {
     return(new MonitorAnonymousInnerClass(progressMonitor));
 }
        private NativeLabelScanStore GetNativeLabelScanStore(DatabaseLayout migrationDirectoryStructure, ProgressReporter progressReporter, NeoStores neoStores)
        {
            NeoStoreIndexStoreView neoStoreIndexStoreView = new NeoStoreIndexStoreView(NO_LOCK_SERVICE, neoStores);

            return(new NativeLabelScanStore(_pageCache, migrationDirectoryStructure, _fileSystem, new MonitoredFullLabelStream(neoStoreIndexStoreView, progressReporter), false, new Monitors(), RecoveryCleanupWorkCollector.immediate()));
        }
Esempio n. 12
0
        public NodeCountsAndLabelIndexBuildStage(Configuration config, NodeLabelsCache cache, NodeStore nodeStore, int highLabelId, Org.Neo4j.Kernel.Impl.Api.CountsAccessor_Updater countsUpdater, ProgressReporter progressReporter, LabelScanStore labelIndex, params StatsProvider[] additionalStatsProviders) : base(NAME, null, config, ORDER_SEND_DOWNSTREAM | RECYCLE_BATCHES)
        {
            Add(new BatchFeedStep(Control(), config, allIn(nodeStore, config), nodeStore.RecordSize));
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: add(new org.neo4j.unsafe.impl.batchimport.staging.ReadRecordsStep<>(control(), config, false, nodeStore));
            Add(new ReadRecordsStep <object>(Control(), config, false, nodeStore));
            Add(new LabelIndexWriterStep(Control(), config, labelIndex, nodeStore));
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: add(new RecordProcessorStep<>(control(), "COUNT", config, new NodeCountsProcessor(nodeStore, cache, highLabelId, countsUpdater, progressReporter), true, additionalStatsProviders));
            Add(new RecordProcessorStep <object>(Control(), "COUNT", config, new NodeCountsProcessor(nodeStore, cache, highLabelId, countsUpdater, progressReporter), true, additionalStatsProviders));
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void migrate(org.neo4j.io.layout.DatabaseLayout directoryLayout, org.neo4j.io.layout.DatabaseLayout migrationLayout, org.neo4j.kernel.impl.util.monitoring.ProgressReporter progressReporter, String versionToMigrateFrom, String versionToMigrateTo) throws java.io.IOException
        public override void Migrate(DatabaseLayout directoryLayout, DatabaseLayout migrationLayout, ProgressReporter progressReporter, string versionToMigrateFrom, string versionToMigrateTo)
        {
            if (IsNativeLabelScanStoreMigrationRequired(directoryLayout))
            {
                StoreFactory storeFactory = GetStoreFactory(directoryLayout, versionToMigrateFrom);
                using (NeoStores neoStores = storeFactory.OpenAllNeoStores(), Lifespan lifespan = new Lifespan())
                {
                    neoStores.VerifyStoreOk();
                    // Remove any existing file to ensure we always do migration
                    DeleteNativeIndexFile(migrationLayout);

                    progressReporter.Start(neoStores.NodeStore.NumberOfIdsInUse);
                    NativeLabelScanStore nativeLabelScanStore = GetNativeLabelScanStore(migrationLayout, progressReporter, neoStores);
                    lifespan.Add(nativeLabelScanStore);
                }
                _nativeLabelScanStoreMigrated = true;
            }
        }
 internal MonitoredFullLabelStream(IndexStoreView indexStoreView, ProgressReporter progressReporter) : base(indexStoreView)
 {
     this.ProgressReporter = progressReporter;
 }
Esempio n. 15
0
 internal virtual LuceneExplicitIndexUpgrader CreateLuceneExplicitIndexUpgrader(Path indexRootPath, ProgressReporter progressMonitor)
 {
     return(new LuceneExplicitIndexUpgrader(indexRootPath, progressMonitor(progressMonitor)));
 }
Esempio n. 16
0
        public RelationshipCountsStage(Configuration config, NodeLabelsCache cache, RelationshipStore relationshipStore, int highLabelId, int highRelationshipTypeId, Org.Neo4j.Kernel.Impl.Api.CountsAccessor_Updater countsUpdater, NumberArrayFactory cacheFactory, ProgressReporter progressReporter) : base(NAME, null, config, RECYCLE_BATCHES)
        {
            Add(new BatchFeedStep(Control(), config, allIn(relationshipStore, config), relationshipStore.RecordSize));
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: add(new org.neo4j.unsafe.impl.batchimport.staging.ReadRecordsStep<>(control(), config, false, relationshipStore));
            Add(new ReadRecordsStep <object>(Control(), config, false, relationshipStore));
            Add(new ProcessRelationshipCountsDataStep(Control(), cache, config, highLabelId, highRelationshipTypeId, countsUpdater, cacheFactory, progressReporter));
        }
Esempio n. 17
0
        public override void Migrate(DatabaseLayout directoryLayout, DatabaseLayout migrationLayout, ProgressReporter progressReporter, string versionToMigrateFrom, string versionToMigrateTo)
        {
            RecordFormats from = RecordFormatSelector.selectForVersion(versionToMigrateFrom);
            RecordFormats to   = RecordFormatSelector.selectForVersion(versionToMigrateTo);

            if (!from.HasCompatibleCapabilities(to, CapabilityType.INDEX))
            {
                _schemaIndexDirectory = _indexProvider.directoryStructure().rootDirectory();
                if (_schemaIndexDirectory != null)
                {
                    _deleteObsoleteIndexes = true;
                }
                // else this schema index provider doesn't have any persistent storage to delete.
            }
        }