protected internal abstract LabelScanStore CreateLabelScanStore(FileSystemAbstraction fileSystemAbstraction, DatabaseLayout databaseLayout, FullStoreChangeStream fullStoreChangeStream, bool usePersistentStore, bool readOnly, Org.Neo4j.Kernel.api.labelscan.LabelScanStore_Monitor monitor);
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public Result runFullConsistencyCheck(org.neo4j.io.layout.DatabaseLayout databaseLayout, org.neo4j.kernel.configuration.Config config, org.neo4j.helpers.progress.ProgressMonitorFactory progressFactory, final org.neo4j.logging.LogProvider logProvider, final org.neo4j.io.fs.FileSystemAbstraction fileSystem, final org.neo4j.io.pagecache.PageCache pageCache, final boolean verbose, java.io.File reportDir, org.neo4j.consistency.checking.full.ConsistencyFlags consistencyFlags) throws org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException //JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: public virtual Result RunFullConsistencyCheck(DatabaseLayout databaseLayout, Config config, ProgressMonitorFactory progressFactory, LogProvider logProvider, FileSystemAbstraction fileSystem, PageCache pageCache, bool verbose, File reportDir, ConsistencyFlags consistencyFlags) { AssertRecovered(databaseLayout, config, fileSystem, pageCache); Log log = logProvider.getLog(this.GetType()); config.augment(GraphDatabaseSettings.read_only, TRUE); config.augment(GraphDatabaseSettings.pagecache_warmup_enabled, FALSE); StoreFactory factory = new StoreFactory(databaseLayout, config, new DefaultIdGeneratorFactory(fileSystem), pageCache, fileSystem, logProvider, EmptyVersionContextSupplier.EMPTY); ConsistencySummaryStatistics summary; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.io.File reportFile = chooseReportPath(reportDir); File reportFile = ChooseReportPath(reportDir); Suppliers.Lazy <PrintWriter> reportWriterSupplier = GetReportWriterSupplier(fileSystem, reportFile); Log reportLog = new ConsistencyReportLog(reportWriterSupplier); // Bootstrap kernel extensions Monitors monitors = new Monitors(); LifeSupport life = new LifeSupport(); JobScheduler jobScheduler = life.Add(JobSchedulerFactory.createInitialisedScheduler()); TokenHolders tokenHolders = new TokenHolders(new DelegatingTokenHolder(new ReadOnlyTokenCreator(), Org.Neo4j.Kernel.impl.core.TokenHolder_Fields.TYPE_PROPERTY_KEY), new DelegatingTokenHolder(new ReadOnlyTokenCreator(), Org.Neo4j.Kernel.impl.core.TokenHolder_Fields.TYPE_LABEL), new DelegatingTokenHolder(new ReadOnlyTokenCreator(), Org.Neo4j.Kernel.impl.core.TokenHolder_Fields.TYPE_RELATIONSHIP_TYPE)); DatabaseKernelExtensions extensions = life.Add(instantiateKernelExtensions(databaseLayout.DatabaseDirectory(), fileSystem, config, new SimpleLogService(logProvider, logProvider), pageCache, jobScheduler, RecoveryCleanupWorkCollector.ignore(), TOOL, monitors, tokenHolders)); DefaultIndexProviderMap indexes = life.Add(new DefaultIndexProviderMap(extensions, config)); try { using (NeoStores neoStores = factory.OpenAllNeoStores()) { // Load tokens before starting extensions, etc. tokenHolders.PropertyKeyTokens().InitialTokens = neoStores.PropertyKeyTokenStore.Tokens; tokenHolders.LabelTokens().InitialTokens = neoStores.LabelTokenStore.Tokens; tokenHolders.RelationshipTypeTokens().InitialTokens = neoStores.RelationshipTypeTokenStore.Tokens; life.Start(); LabelScanStore labelScanStore = new NativeLabelScanStore(pageCache, databaseLayout, fileSystem, Org.Neo4j.Kernel.Impl.Api.scan.FullStoreChangeStream_Fields.Empty, true, monitors, RecoveryCleanupWorkCollector.ignore()); life.Add(labelScanStore); int numberOfThreads = DefaultConsistencyCheckThreadsNumber(); Statistics statistics; StoreAccess storeAccess; AccessStatistics stats = new AccessStatistics(); if (verbose) { statistics = new VerboseStatistics(stats, new DefaultCounts(numberOfThreads), log); storeAccess = new AccessStatsKeepingStoreAccess(neoStores, stats); } else { statistics = Statistics.NONE; storeAccess = new StoreAccess(neoStores); } storeAccess.Initialize(); DirectStoreAccess stores = new DirectStoreAccess(storeAccess, labelScanStore, indexes, tokenHolders); FullCheck check = new FullCheck(progressFactory, statistics, numberOfThreads, consistencyFlags, config, true); summary = check.Execute(stores, new DuplicatingLog(log, reportLog)); } } finally { life.Shutdown(); if (reportWriterSupplier.Initialised) { reportWriterSupplier.get().close(); } } if (!summary.Consistent) { log.Warn("See '%s' for a detailed consistency report.", reportFile.Path); return(Result.failure(reportFile)); } return(Result.success(reportFile)); }
public virtual Result RunFullConsistencyCheck(DatabaseLayout databaseLayout, Config tuningConfiguration, ProgressMonitorFactory progressFactory, LogProvider logProvider, bool verbose) { return(RunFullConsistencyCheck(databaseLayout, tuningConfiguration, progressFactory, logProvider, verbose, new ConsistencyFlags(tuningConfiguration))); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public Result runFullConsistencyCheck(org.neo4j.io.layout.DatabaseLayout databaseLayout, org.neo4j.kernel.configuration.Config config, org.neo4j.helpers.progress.ProgressMonitorFactory progressFactory, final org.neo4j.logging.LogProvider logProvider, final org.neo4j.io.fs.FileSystemAbstraction fileSystem, final org.neo4j.io.pagecache.PageCache pageCache, final boolean verbose, org.neo4j.consistency.checking.full.ConsistencyFlags consistencyFlags) throws org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException //JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: public virtual Result RunFullConsistencyCheck(DatabaseLayout databaseLayout, Config config, ProgressMonitorFactory progressFactory, LogProvider logProvider, FileSystemAbstraction fileSystem, PageCache pageCache, bool verbose, ConsistencyFlags consistencyFlags) { return(RunFullConsistencyCheck(databaseLayout, config, progressFactory, logProvider, fileSystem, pageCache, verbose, DefaultReportDir(config, databaseLayout.DatabaseDirectory()), consistencyFlags)); }
public virtual Result RunFullConsistencyCheck(DatabaseLayout databaseLayout, Config tuningConfiguration, ProgressMonitorFactory progressFactory, LogProvider logProvider, FileSystemAbstraction fileSystem, PageCache pageCache, bool verbose, File reportDir) { return(RunFullConsistencyCheck(databaseLayout, tuningConfiguration, progressFactory, logProvider, fileSystem, pageCache, verbose, reportDir, new ConsistencyFlags(tuningConfiguration))); }
//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) { base.migrate(directoryLayout, migrationLayout, progressReporter, versionToMigrateFrom, versionToMigrateTo); throw new Exception("This upgrade is failing"); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void moveMigratedFiles(org.neo4j.io.layout.DatabaseLayout migrationLayout, org.neo4j.io.layout.DatabaseLayout directoryLayout, String versionToUpgradeFrom, String versionToMigrateTo) throws java.io.IOException public override void moveMigratedFiles(DatabaseLayout migrationLayout, DatabaseLayout directoryLayout, string versionToUpgradeFrom, string versionToMigrateTo) { base.moveMigratedFiles(migrationLayout, directoryLayout, versionToUpgradeFrom, versionToMigrateTo); throw new Exception("This upgrade is failing"); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void shouldStartFromGivenId(int sparsity) throws java.io.IOException private void ShouldStartFromGivenId(int sparsity) { // given NativeLabelScanStore store = Life.add(new NativeLabelScanStore(Storage.pageCache(), DatabaseLayout.of(Storage.directory().directory()), Storage.fileSystem(), EMPTY, false, new Monitors(), immediate())); int labelId = 1; int highNodeId = 100_000; BitArray expected = new BitArray(highNodeId); using (LabelScanWriter writer = store.NewWriter()) { int updates = highNodeId / sparsity; for (int i = 0; i < updates; i++) { int nodeId = Random.Next(highNodeId); writer.Write(labelChanges(nodeId, EMPTY_LONG_ARRAY, new long[] { labelId })); expected.Set(nodeId, true); } } // when long fromId = Random.Next(highNodeId); int nextExpectedId = expected.nextSetBit(toIntExact(fromId + 1)); using (LabelScanReader reader = store.NewReader(), PrimitiveLongResourceIterator ids = reader.NodesWithAnyOfLabels(fromId, new int[] { labelId })) { // then while (nextExpectedId != -1) { assertTrue(ids.hasNext()); long nextId = ids.next(); assertEquals(nextExpectedId, toIntExact(nextId)); nextExpectedId = expected.nextSetBit(nextExpectedId + 1); } assertFalse(ids.hasNext()); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUpLabelScanStore() public virtual void SetUpLabelScanStore() { _jobScheduler = new ThreadPoolJobScheduler(); _workingDatabaseLayout = _directory.databaseLayout(); _prepareDirectory = _directory.directory("prepare"); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static long lastTxChecksumOf(org.neo4j.io.layout.DatabaseLayout databaseLayout, org.neo4j.io.pagecache.PageCache pageCache) throws java.io.IOException private static long LastTxChecksumOf(DatabaseLayout databaseLayout, PageCache pageCache) { File neoStore = databaseLayout.MetadataStore(); return(MetaDataStore.getRecord(pageCache, neoStore, MetaDataStore.Position.LAST_TRANSACTION_CHECKSUM)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static long getLastCommittedTx(org.neo4j.io.layout.DatabaseLayout databaseLayout, org.neo4j.io.pagecache.PageCache pageCache) throws java.io.IOException private static long GetLastCommittedTx(DatabaseLayout databaseLayout, PageCache pageCache) { File neoStore = databaseLayout.MetadataStore(); return(MetaDataStore.getRecord(pageCache, neoStore, MetaDataStore.Position.LAST_TRANSACTION_ID)); }
internal Incrementing(FileSystemAbstraction fs, PageCache pages, ProgressiveFormat format, RotationMonitor monitor, DatabaseLayout databaseLayout) : base(fs, pages, format, monitor) { this.DatabaseLayout = databaseLayout; BaseName = databaseLayout.CountStoreA().Name; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void whenHAModeSwitcherSwitchesToSlaveTheOtherModeSwitcherDoNotGetTheOldMasterClient() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void WhenHAModeSwitcherSwitchesToSlaveTheOtherModeSwitcherDoNotGetTheOldMasterClient() { InstanceId me = new InstanceId(1); StoreId storeId = newStoreIdForCurrentVersion(); HighAvailabilityMemberContext context = mock(typeof(HighAvailabilityMemberContext)); when(context.MyId).thenReturn(me); AvailabilityGuard guard = mock(typeof(DatabaseAvailabilityGuard)); ObservedClusterMembers members = mock(typeof(ObservedClusterMembers)); ClusterMember masterMember = mock(typeof(ClusterMember)); when(masterMember.HARole).thenReturn("master"); when(masterMember.HasRole("master")).thenReturn(true); when(masterMember.InstanceId).thenReturn(new InstanceId(2)); when(masterMember.StoreId).thenReturn(storeId); ClusterMember self = new ClusterMember(me); when(members.Members).thenReturn(Arrays.asList(self, masterMember)); when(members.CurrentMember).thenReturn(self); DependencyResolver dependencyResolver = mock(typeof(DependencyResolver)); FileSystemAbstraction fs = mock(typeof(FileSystemAbstraction)); when(fs.FileExists(any(typeof(File)))).thenReturn(true); when(dependencyResolver.ResolveDependency(typeof(FileSystemAbstraction))).thenReturn(fs); when(dependencyResolver.ResolveDependency(typeof(Monitors))).thenReturn(new Monitors()); NeoStoreDataSource dataSource = mock(typeof(NeoStoreDataSource)); when(dataSource.DependencyResolver).thenReturn(dependencyResolver); when(dataSource.StoreId).thenReturn(storeId); when(dependencyResolver.ResolveDependency(typeof(NeoStoreDataSource))).thenReturn(dataSource); when(dependencyResolver.ResolveDependency(typeof(TransactionIdStore))).thenReturn(new SimpleTransactionIdStore()); when(dependencyResolver.ResolveDependency(typeof(ObservedClusterMembers))).thenReturn(members); UpdatePuller updatePuller = mock(typeof(UpdatePuller)); when(updatePuller.TryPullUpdates()).thenReturn(true); when(dependencyResolver.ResolveDependency(typeof(UpdatePuller))).thenReturn(updatePuller); ClusterMemberAvailability clusterMemberAvailability = mock(typeof(ClusterMemberAvailability)); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final TriggerableClusterMemberEvents events = new TriggerableClusterMemberEvents(); TriggerableClusterMemberEvents events = new TriggerableClusterMemberEvents(); Election election = mock(typeof(Election)); HighAvailabilityMemberStateMachine stateMachine = new HighAvailabilityMemberStateMachine(context, guard, members, events, election, NullLogProvider.Instance); ClusterMembers clusterMembers = new ClusterMembers(members, stateMachine); when(dependencyResolver.ResolveDependency(typeof(ClusterMembers))).thenReturn(clusterMembers); stateMachine.Init(); stateMachine.Start(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.ha.DelegateInvocationHandler<org.neo4j.kernel.ha.com.master.Master> handler = new org.neo4j.kernel.ha.DelegateInvocationHandler<>(org.neo4j.kernel.ha.com.master.Master.class); DelegateInvocationHandler <Master> handler = new DelegateInvocationHandler <Master>(typeof(Master)); MasterClientResolver masterClientResolver = mock(typeof(MasterClientResolver)); MasterClient masterClient = mock(typeof(MasterClient)); when(masterClient.ProtocolVersion).thenReturn(MasterClient214.PROTOCOL_VERSION); when(masterClient.Handshake(anyLong(), any(typeof(StoreId)))).thenReturn(new ResponseAnonymousInnerClass(this, storeId, mock(typeof(ResourceReleaser)), handler)); when(masterClient.ToString()).thenReturn("TheExpectedMasterClient!"); when(masterClientResolver.Instantiate(anyString(), anyInt(), anyString(), any(typeof(Monitors)), any(typeof(StoreId)), any(typeof(LifeSupport)))).thenReturn(masterClient); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.concurrent.CountDownLatch latch = new java.util.concurrent.CountDownLatch(2); System.Threading.CountdownEvent latch = new System.Threading.CountdownEvent(2); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.concurrent.atomic.AtomicBoolean switchedSuccessfully = new java.util.concurrent.atomic.AtomicBoolean(); AtomicBoolean switchedSuccessfully = new AtomicBoolean(); SwitchToSlave.Monitor monitor = new MonitorAnonymousInnerClass(this, latch, switchedSuccessfully); Config config = Config.defaults(ClusterSettings.server_id, me.ToString()); DatabaseTransactionStats transactionCounters = mock(typeof(DatabaseTransactionStats)); when(transactionCounters.NumberOfActiveTransactions).thenReturn(0L); PageCache pageCacheMock = mock(typeof(PageCache)); PagedFile pagedFileMock = mock(typeof(PagedFile)); when(pagedFileMock.LastPageId).thenReturn(1L); when(pageCacheMock.Map(any(typeof(File)), anyInt())).thenReturn(pagedFileMock); TransactionIdStore transactionIdStoreMock = mock(typeof(TransactionIdStore)); when(transactionIdStoreMock.LastCommittedTransaction).thenReturn(new TransactionId(0, 0, 0)); SwitchToSlaveCopyThenBranch switchToSlave = new SwitchToSlaveCopyThenBranch(DatabaseLayout.of(new File("")), NullLogService.Instance, mock(typeof(FileSystemAbstraction)), config, mock(typeof(HaIdGeneratorFactory)), handler, mock(typeof(ClusterMemberAvailability)), mock(typeof(RequestContextFactory)), mock(typeof(PullerFactory), RETURNS_MOCKS), Iterables.empty(), masterClientResolver, monitor, new Org.Neo4j.com.storecopy.StoreCopyClientMonitor_Adapter(), Suppliers.singleton(dataSource), Suppliers.singleton(transactionIdStoreMock), slave => { SlaveServer mock = mock(typeof(SlaveServer)); when(mock.SocketAddress).thenReturn(new InetSocketAddress("localhost", 123)); return(mock); }, updatePuller, pageCacheMock, mock(typeof(Monitors)), () => transactionCounters); ComponentSwitcherContainer switcherContainer = new ComponentSwitcherContainer(); HighAvailabilityModeSwitcher haModeSwitcher = new HighAvailabilityModeSwitcher(switchToSlave, mock(typeof(SwitchToMaster)), election, clusterMemberAvailability, mock(typeof(ClusterClient)), storeSupplierMock(), me, switcherContainer, NeoStoreDataSourceSupplierMock(), NullLogService.Instance); haModeSwitcher.Init(); haModeSwitcher.Start(); haModeSwitcher.ListeningAt(URI.create("http://localhost:12345")); stateMachine.AddHighAvailabilityMemberListener(haModeSwitcher); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.concurrent.atomic.AtomicReference<org.neo4j.kernel.ha.com.master.Master> ref = new java.util.concurrent.atomic.AtomicReference<>(null); AtomicReference <Master> @ref = new AtomicReference <Master>(null); //noinspection unchecked AbstractComponentSwitcher <object> otherModeSwitcher = new AbstractComponentSwitcherAnonymousInnerClass(this, mock(typeof(DelegateInvocationHandler)), handler, latch, @ref); switcherContainer.Add(otherModeSwitcher); // When events.SwitchToSlave(me); // Then latch.await(); assertTrue("mode switch failed", switchedSuccessfully.get()); Master actual = @ref.get(); // let's test the toString()s since there are too many wrappers of proxies assertEquals(masterClient.ToString(), actual.ToString()); stateMachine.Stop(); stateMachine.Shutdown(); haModeSwitcher.Stop(); haModeSwitcher.Shutdown(); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: protected void prepareSampleDatabase(String version, org.neo4j.io.fs.FileSystemAbstraction fileSystem, org.neo4j.io.layout.DatabaseLayout databaseLayout, java.io.File databaseDirectory) throws java.io.IOException protected internal override void PrepareSampleDatabase(string version, FileSystemAbstraction fileSystem, DatabaseLayout databaseLayout, File databaseDirectory) { File resourceDirectory = FindFormatStoreDirectoryForVersion(version, databaseDirectory); File directory = databaseLayout.DatabaseDirectory(); fileSystem.DeleteRecursively(directory); fileSystem.Mkdirs(directory); fileSystem.CopyRecursively(resourceDirectory, directory); }