예제 #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static void dumpCountsStore(org.neo4j.io.fs.FileSystemAbstraction fs, java.io.File path, java.io.PrintStream out) throws Exception
//JAVA TO C# CONVERTER NOTE: Members cannot have the same name as their enclosing type:
        public static void DumpCountsStoreConflict(FileSystemAbstraction fs, File path, PrintStream @out)
        {
            using (JobScheduler jobScheduler = createInitialisedScheduler(), PageCache pages = createPageCache(fs, jobScheduler), Lifespan life = new Lifespan())
            {
                NullLogProvider logProvider = NullLogProvider.Instance;
                Config          config      = Config.defaults();
                if (fs.IsDirectory(path))
                {
                    DatabaseLayout databaseLayout = DatabaseLayout.of(path);
                    StoreFactory   factory        = new StoreFactory(databaseLayout, Config.defaults(), new DefaultIdGeneratorFactory(fs), pages, fs, logProvider, EmptyVersionContextSupplier.EMPTY);

                    NeoStores     neoStores     = factory.OpenAllNeoStores();
                    SchemaStorage schemaStorage = new SchemaStorage(neoStores.SchemaStore);
                    neoStores.Counts.accept(new DumpCountsStore(@out, neoStores, schemaStorage));
                }
                else
                {
                    VisitableCountsTracker tracker = new VisitableCountsTracker(logProvider, fs, pages, config, DatabaseLayout.of(path.ParentFile));
                    if (fs.FileExists(path))
                    {
                        tracker.VisitFile(path, new DumpCountsStore(@out));
                    }
                    else
                    {
                        life.Add(tracker).accept(new DumpCountsStore(@out));
                    }
                }
            }
        }
예제 #2
0
        private static StoreFactory OpenStore(FileSystemAbstraction fileSystem, File storeDir, Config config, PageCache pageCache)
        {
            IdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory(fileSystem);
            NullLogProvider    logProvider        = NullLogProvider.Instance;

            return(new StoreFactory(DatabaseLayout.of(storeDir), config, idGeneratorFactory, pageCache, fileSystem, logProvider, EmptyVersionContextSupplier.EMPTY));
        }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void SetUp()
        {
            _life = new LifeSupport();
            PageCache       pageCache       = Storage.pageCache();
            DatabaseLayout  databaseLayout  = Storage.directory().databaseLayout();
            Config          config          = Config.defaults(GraphDatabaseSettings.default_schema_provider, EMPTY.ProviderDescriptor.name());
            NullLogProvider nullLogProvider = NullLogProvider.Instance;
            StoreFactory    storeFactory    = new StoreFactory(databaseLayout, config, new DefaultIdGeneratorFactory(Storage.fileSystem()), pageCache, Storage.fileSystem(), nullLogProvider, EmptyVersionContextSupplier.EMPTY);

            _neoStores = storeFactory.OpenAllNeoStores(true);
            _neoStores.Counts.start();
            CountsComputer.recomputeCounts(_neoStores, pageCache, databaseLayout);
            _nodeStore         = _neoStores.NodeStore;
            _relationshipStore = _neoStores.RelationshipStore;
            PropertyStore propertyStore = _neoStores.PropertyStore;
            JobScheduler  scheduler     = JobSchedulerFactory.createScheduler();
            Dependencies  dependencies  = new Dependencies();

            dependencies.SatisfyDependency(EMPTY);
            DefaultIndexProviderMap providerMap = new DefaultIndexProviderMap(dependencies, config);

            _life.add(providerMap);
            _indexingService = IndexingServiceFactory.createIndexingService(config, scheduler, providerMap, new NeoStoreIndexStoreView(LockService.NO_LOCK_SERVICE, _neoStores), SchemaUtil.idTokenNameLookup, empty(), nullLogProvider, nullLogProvider, IndexingService.NO_MONITOR, new DatabaseSchemaState(nullLogProvider), false);
            _propertyPhysicalToLogicalConverter = new PropertyPhysicalToLogicalConverter(_neoStores.PropertyStore);
            _life.add(_indexingService);
            _life.add(scheduler);
            _life.init();
            _life.start();
            _propertyCreator = new PropertyCreator(_neoStores.PropertyStore, new PropertyTraverser());
            _recordAccess    = new DirectRecordAccess <PropertyRecord, PrimitiveRecord>(_neoStores.PropertyStore, Loaders.propertyLoader(propertyStore));
        }
예제 #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.kernel.impl.store.NeoStores createNeoStore(org.neo4j.io.fs.FileSystemAbstraction fs, org.neo4j.io.pagecache.PageCache pageCache) throws java.io.IOException
        private NeoStores CreateNeoStore(FileSystemAbstraction fs, PageCache pageCache)
        {
            Config config = Config.defaults();
            DefaultIdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory(fs);
            NullLogProvider           logProvider        = NullLogProvider.Instance;
            StoreFactory storeFactory = new StoreFactory(_testDirectory.databaseLayout(), config, idGeneratorFactory, pageCache, fs, logProvider, EmptyVersionContextSupplier.EMPTY);

            return(storeFactory.OpenAllNeoStores(true));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setupStores()
        public virtual void SetupStores()
        {
            DatabaseLayout            storeLayout        = Storage.directory().databaseLayout();
            Config                    config             = Config.defaults(pagecache_memory, "8m");
            PageCache                 pageCache          = Storage.pageCache();
            FileSystemAbstraction     fs                 = Storage.fileSystem();
            DefaultIdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory(fs);
            NullLogProvider           logProvider        = NullLogProvider.Instance;
            StoreFactory              storeFactory       = new StoreFactory(storeLayout, config, idGeneratorFactory, pageCache, fs, logProvider, EMPTY);

            _neoStores = storeFactory.OpenAllNeoStores(true);
        }
예제 #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCloseMultiPopulatorOnSuccessfulPopulation()
        public virtual void ShouldCloseMultiPopulatorOnSuccessfulPopulation()
        {
            // given
            NullLogProvider logProvider = NullLogProvider.Instance;
            TrackingMultipleIndexPopulator populator     = new TrackingMultipleIndexPopulator(IndexStoreView_Fields.Empty, logProvider, EntityType.NODE, new DatabaseSchemaState(logProvider));
            IndexPopulationJob             populationJob = new IndexPopulationJob(populator, NO_MONITOR, false);

            // when
            populationJob.Run();

            // then
            assertTrue(populator.Closed);
        }
예제 #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCloseMultiPopulatorOnFailedPopulation()
        public virtual void ShouldCloseMultiPopulatorOnFailedPopulation()
        {
            // given
            NullLogProvider logProvider                  = NullLogProvider.Instance;
            IndexStoreView  failingStoreView             = new IndexStoreView_AdaptorAnonymousInnerClass(this);
            TrackingMultipleIndexPopulator populator     = new TrackingMultipleIndexPopulator(failingStoreView, logProvider, EntityType.NODE, new DatabaseSchemaState(logProvider));
            IndexPopulationJob             populationJob = new IndexPopulationJob(populator, NO_MONITOR, false);

            // when
            populationJob.Run();

            // then
            assertTrue(populator.Closed);
        }
예제 #8
0
        private void CreateStore(DatabaseLayout migrationDirectoryStructure, RecordFormats newFormat)
        {
            IdGeneratorFactory idGeneratorFactory = new ReadOnlyIdGeneratorFactory(_fileSystem);
            NullLogProvider    logProvider        = NullLogProvider.Instance;
            StoreFactory       storeFactory       = new StoreFactory(migrationDirectoryStructure, _config, idGeneratorFactory, _pageCache, _fileSystem, newFormat, logProvider, EmptyVersionContextSupplier.EMPTY);

            using (NeoStores neoStores = storeFactory.OpenAllNeoStores(true))
            {
                neoStores.MetaDataStore;
                neoStores.LabelTokenStore;
                neoStores.NodeStore;
                neoStores.PropertyStore;
                neoStores.RelationshipGroupStore;
                neoStores.RelationshipStore;
                neoStores.SchemaStore;
            }
        }
예제 #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustFlipToFailedIfFailureToApplyLastBatchWhileFlipping() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MustFlipToFailedIfFailureToApplyLastBatchWhileFlipping()
        {
            // given
            NullLogProvider logProvider = NullLogProvider.Instance;
            IndexStoreView  storeView   = EmptyIndexStoreViewThatProcessUpdates();

            Org.Neo4j.Kernel.Api.Index.IndexPopulator_Adapter populator = EmptyPopulatorWithThrowingUpdater();
            FailedIndexProxy    failedProxy = FailedIndexProxy(storeView, populator);
            OnlineIndexProxy    onlineProxy = OnlineIndexProxy(storeView);
            FlippableIndexProxy flipper     = new FlippableIndexProxy();

            flipper.FlipTarget = () => onlineProxy;
            MultipleIndexPopulator multipleIndexPopulator = new MultipleIndexPopulator(storeView, logProvider, EntityType.NODE, mock(typeof(SchemaState)));

            MultipleIndexPopulator.IndexPopulation indexPopulation = multipleIndexPopulator.AddPopulator(populator, DummyMeta(), flipper, t => failedProxy, "userDescription");
            multipleIndexPopulator.QueueUpdate(SomeUpdate());
            multipleIndexPopulator.IndexAllEntities().run();

            // when
            indexPopulation.Flip(false);

            // then
            assertSame("flipper should have flipped to failing proxy", flipper.State, InternalIndexState.FAILED);
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void launchCustomIndexPopulation(java.util.Map<String,int> labelNameIdMap, int propertyId, Runnable customAction) throws Exception
        private void LaunchCustomIndexPopulation(IDictionary <string, int> labelNameIdMap, int propertyId, ThreadStart customAction)
        {
            NeoStores      neoStores      = NeoStores;
            LabelScanStore labelScanStore = LabelScanStore;
            ThreadToStatementContextBridge transactionStatementContextBridge = TransactionStatementContextBridge;

            using (Transaction transaction = EmbeddedDatabase.beginTx(), KernelTransaction ktx = transactionStatementContextBridge.GetKernelTransactionBoundToThisThread(true))
            {
                DynamicIndexStoreView storeView = DynamicIndexStoreViewWrapper(customAction, neoStores, labelScanStore);

                IndexProviderMap providerMap     = IndexProviderMap;
                JobScheduler     scheduler       = JobScheduler;
                TokenNameLookup  tokenNameLookup = new SilentTokenNameLookup(ktx.TokenRead());

                NullLogProvider nullLogProvider = NullLogProvider.Instance;
                _indexService = IndexingServiceFactory.createIndexingService(Config.defaults(), scheduler, providerMap, storeView, tokenNameLookup, GetIndexRules(neoStores), nullLogProvider, nullLogProvider, IndexingService.NO_MONITOR, SchemaState, false);
                _indexService.start();

                _rules = CreateIndexRules(labelNameIdMap, propertyId);

                _indexService.createIndexes(_rules);
                transaction.Success();
            }
        }
예제 #11
0
 public PreFlightTasksAnonymousInnerClass(CommunityServerBuilder outerInstance, NullLogProvider getInstance) : base(getInstance)
 {
     this.outerInstance = outerInstance;
 }
예제 #12
0
 public NullProviderShould()
 {
     _provider = new NullLogProvider();
 }
예제 #13
0
 public DelayedDirectExecutorAnonymousInnerClass(HeartbeatContextImplTest outerInstance, NullLogProvider getInstance, IList <ThreadStart> runnables) : base(getInstance)
 {
     this.outerInstance = outerInstance;
     this._runnables    = runnables;
 }
예제 #14
0
 public AbstractDynamicStoreAnonymousInnerClass(AbstractDynamicStoreTest outerInstance, File storeFile, File idFile, Config defaults, DefaultIdGeneratorFactory idGeneratorFactory, PageCache pageCache, NullLogProvider getInstance, Org.Neo4j.Kernel.impl.store.format.RecordFormat <DynamicRecord> dynamic, string storeVersion) : base(storeFile, idFile, defaults, IdType.ARRAY_BLOCK, idGeneratorFactory, pageCache, getInstance, "test", BLOCK_SIZE, dynamic, storeVersion)
 {
     this.outerInstance = outerInstance;
 }