protected internal virtual void Create(System.Action <PageCursor> headerWriter) { lock (this) { AssertNotDropped(); AssertNotClosed(); DeleteFileIfPresent(fileSystem, storeFile); instantiateTree(RecoveryCleanupWorkCollector.immediate(), headerWriter); // true: tree uniqueness is (value,entityId) // false: tree uniqueness is (value) <-- i.e. more strict _mainConflictDetector = MainConflictDetector; // for updates we have to have uniqueness on (value,entityId) to allow for intermediary violating updates. // there are added conflict checks after updates have been applied. _updatesConflictDetector = new ThrowingConflictDetector <KEY, VALUE, Value[]>(true); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void before() public virtual void Before() { PageCache pageCache = _pageCacheRule.getPageCache(_fileSystem); _store = _life.add(new NativeLabelScanStore(pageCache, _directory.databaseLayout(), _fileSystem, Org.Neo4j.Kernel.Impl.Api.scan.FullStoreChangeStream_Fields.Empty, false, new Monitors(), RecoveryCleanupWorkCollector.immediate(), Math.Min(pageCache.PageSize(), 256 << _random.Next(5)))); }
private LabelScanStore GetLabelScanStore(FileSystemAbstraction fileSystemAbstraction, DatabaseLayout databaseLayout, FullStoreChangeStream fullStoreChangeStream, bool readOnly, Monitors monitors) { PageCache pageCache = PageCacheRule.getPageCache(fileSystemAbstraction); return(new NativeLabelScanStore(pageCache, databaseLayout, fileSystemAbstraction, fullStoreChangeStream, readOnly, monitors, RecoveryCleanupWorkCollector.immediate())); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public static void run(final org.neo4j.io.fs.FileSystemAbstraction fs, final java.io.File storeDirectory, org.neo4j.kernel.configuration.Config config, org.neo4j.logging.LogProvider userLogProvider) throws Exception //JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: public static void Run(FileSystemAbstraction fs, File storeDirectory, Config config, LogProvider userLogProvider) { StoreLogService logService = StoreLogService.withUserLogProvider(userLogProvider).withInternalLog(config.Get(store_internal_log_path)).build(fs); VisibleMigrationProgressMonitor progressMonitor = new VisibleMigrationProgressMonitor(logService.GetUserLog(typeof(StoreMigration))); LifeSupport life = new LifeSupport(); life.Add(logService); // Add participants from kernel extensions... DefaultExplicitIndexProvider migrationIndexProvider = new DefaultExplicitIndexProvider(); Log log = userLogProvider.GetLog(typeof(StoreMigration)); JobScheduler jobScheduler = JobSchedulerFactory.createInitialisedScheduler(); try { using (PageCache pageCache = createPageCache(fs, config, jobScheduler)) { Dependencies deps = new Dependencies(); Monitors monitors = new Monitors(); deps.SatisfyDependencies(fs, config, migrationIndexProvider, pageCache, logService, monitors, RecoveryCleanupWorkCollector.immediate()); KernelContext kernelContext = new SimpleKernelContext(storeDirectory, DatabaseInfo.UNKNOWN, deps); DatabaseKernelExtensions kernelExtensions = life.Add(new DatabaseKernelExtensions(kernelContext, GraphDatabaseDependencies.newDependencies().kernelExtensions(), deps, ignore())); DatabaseLayout databaseLayout = DatabaseLayout.of(storeDirectory); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.impl.transaction.log.files.LogFiles logFiles = org.neo4j.kernel.impl.transaction.log.files.LogFilesBuilder.activeFilesBuilder(databaseLayout, fs, pageCache).withConfig(config).build(); LogFiles logFiles = LogFilesBuilder.activeFilesBuilder(databaseLayout, fs, pageCache).withConfig(config).build(); LogTailScanner tailScanner = new LogTailScanner(logFiles, new VersionAwareLogEntryReader <Org.Neo4j.Kernel.impl.transaction.log.ReadableClosablePositionAwareChannel>(), monitors); DefaultIndexProviderMap indexProviderMap = life.Add(new DefaultIndexProviderMap(kernelExtensions, config)); // Add the kernel store migrator life.Start(); long startTime = DateTimeHelper.CurrentUnixTimeMillis(); DatabaseMigrator migrator = new DatabaseMigrator(progressMonitor, fs, config, logService, indexProviderMap, migrationIndexProvider, pageCache, RecordFormatSelector.selectForConfig(config, userLogProvider), tailScanner, jobScheduler); migrator.Migrate(databaseLayout); // Append checkpoint so the last log entry will have the latest version AppendCheckpoint(logFiles, tailScanner); long duration = DateTimeHelper.CurrentUnixTimeMillis() - startTime; log.Info(format("Migration completed in %d s%n", duration / 1000)); } } catch (Exception e) { throw new StoreUpgrader.UnableToUpgradeException("Failure during upgrade", e); } finally { life.Shutdown(); jobScheduler.close(); } }
public virtual NeoStoreDataSource GetDataSource(DatabaseLayout databaseLayout, FileSystemAbstraction fs, PageCache pageCache, DependencyResolver otherCustomOverriddenDependencies) { ShutdownAnyRunning(); StatementLocksFactory locksFactory = mock(typeof(StatementLocksFactory)); StatementLocks statementLocks = mock(typeof(StatementLocks)); Org.Neo4j.Kernel.impl.locking.Locks_Client locks = mock(typeof(Org.Neo4j.Kernel.impl.locking.Locks_Client)); when(statementLocks.Optimistic()).thenReturn(locks); when(statementLocks.Pessimistic()).thenReturn(locks); when(locksFactory.NewInstance()).thenReturn(statementLocks); JobScheduler jobScheduler = mock(typeof(JobScheduler), RETURNS_MOCKS); Monitors monitors = new Monitors(); Dependencies mutableDependencies = new Dependencies(otherCustomOverriddenDependencies); // Satisfy non-satisfied dependencies Config config = Dependency(mutableDependencies, typeof(Config), deps => Config.defaults()); config.augment(default_schema_provider, EMPTY.ProviderDescriptor.name()); LogService logService = Dependency(mutableDependencies, typeof(LogService), deps => new SimpleLogService(NullLogProvider.Instance)); IdGeneratorFactory idGeneratorFactory = Dependency(mutableDependencies, typeof(IdGeneratorFactory), deps => new DefaultIdGeneratorFactory(fs)); IdTypeConfigurationProvider idConfigurationProvider = Dependency(mutableDependencies, typeof(IdTypeConfigurationProvider), deps => new CommunityIdTypeConfigurationProvider()); DatabaseHealth databaseHealth = Dependency(mutableDependencies, typeof(DatabaseHealth), deps => new DatabaseHealth(mock(typeof(DatabasePanicEventGenerator)), NullLog.Instance)); SystemNanoClock clock = Dependency(mutableDependencies, typeof(SystemNanoClock), deps => Clocks.nanoClock()); TransactionMonitor transactionMonitor = Dependency(mutableDependencies, typeof(TransactionMonitor), deps => new DatabaseTransactionStats()); DatabaseAvailabilityGuard databaseAvailabilityGuard = Dependency(mutableDependencies, typeof(DatabaseAvailabilityGuard), deps => new DatabaseAvailabilityGuard(DEFAULT_DATABASE_NAME, deps.resolveDependency(typeof(SystemNanoClock)), NullLog.Instance)); Dependency(mutableDependencies, typeof(DiagnosticsManager), deps => new DiagnosticsManager(NullLog.Instance)); Dependency(mutableDependencies, typeof(IndexProvider), deps => EMPTY); _dataSource = new NeoStoreDataSource(new TestDatabaseCreationContext(DEFAULT_DATABASE_NAME, databaseLayout, config, idGeneratorFactory, logService, mock(typeof(JobScheduler), RETURNS_MOCKS), mock(typeof(TokenNameLookup)), mutableDependencies, mockedTokenHolders(), locksFactory, mock(typeof(SchemaWriteGuard)), mock(typeof(TransactionEventHandlers)), IndexingService.NO_MONITOR, fs, transactionMonitor, databaseHealth, mock(typeof(LogFileCreationMonitor)), TransactionHeaderInformationFactory.DEFAULT, new CommunityCommitProcessFactory(), mock(typeof(InternalAutoIndexing)), mock(typeof(IndexConfigStore)), mock(typeof(ExplicitIndexProvider)), pageCache, new StandardConstraintSemantics(), monitors, new Tracers("null", NullLog.Instance, monitors, jobScheduler, clock), mock(typeof(Procedures)), Org.Neo4j.Io.pagecache.IOLimiter_Fields.Unlimited, databaseAvailabilityGuard, clock, new CanWrite(), new StoreCopyCheckPointMutex(), RecoveryCleanupWorkCollector.immediate(), new BufferedIdController(new BufferingIdGeneratorFactory(idGeneratorFactory, Org.Neo4j.Kernel.impl.store.id.IdReuseEligibility_Fields.Always, idConfigurationProvider), jobScheduler), DatabaseInfo.COMMUNITY, new TransactionVersionContextSupplier(), ON_HEAP, Collections.emptyList(), file => EMPTY_WATCHER, new GraphDatabaseFacade(), Iterables.empty())); return(_dataSource); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldApplyIndexUpdatesInWorkSyncedBatches() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldApplyIndexUpdatesInWorkSyncedBatches() { // GIVEN //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: long duration = parseTimeMillis.apply(System.getProperty(this.GetType().FullName + ".duration", "2s")); //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: int numThreads = Integer.getInteger(this.GetType().FullName + ".numThreads", Runtime.Runtime.availableProcessors()); DefaultFileSystemAbstraction fs = _fileSystemRule.get(); PageCache pageCache = _pageCacheRule.getPageCache(fs); FusionIndexProvider indexProvider = NativeLuceneFusionIndexProviderFactory20.create(pageCache, _directory.databaseDir(), fs, IndexProvider.Monitor_Fields.EMPTY, Config.defaults(), OperationalMode.single, RecoveryCleanupWorkCollector.immediate()); RecordStorageEngine storageEngine = _storageEngineRule.getWith(fs, pageCache, _directory.databaseLayout()).indexProvider(indexProvider).build(); storageEngine.Apply(Tx(singletonList(createIndexRule(DESCRIPTOR, 1, _descriptor))), TransactionApplicationMode.EXTERNAL); Dependencies dependencies = new Dependencies(); storageEngine.SatisfyDependencies(dependencies); IndexProxy index = dependencies.ResolveDependency(typeof(IndexingService)).getIndexProxy(_descriptor); AwaitOnline(index); // WHEN Workers <Worker> workers = new Workers <Worker>(this.GetType().Name); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.concurrent.atomic.AtomicBoolean end = new java.util.concurrent.atomic.AtomicBoolean(); AtomicBoolean end = new AtomicBoolean(); for (int i = 0; i < numThreads; i++) { workers.Start(new Worker(this, i, end, storageEngine, 10, index)); } // let the threads hammer the storage engine for some time Thread.Sleep(duration); end.set(true); // THEN (assertions as part of the workers applying transactions) workers.AwaitAndThrowOnError(); }
private LabelScanStore StartLabelScanStore(PageCache pageCache, IndexStoreView indexStoreView, Monitors monitors, bool readOnly) { NativeLabelScanStore labelScanStore = new NativeLabelScanStore(pageCache, _directory.databaseLayout(), _fileSystem, new FullLabelStream(indexStoreView), readOnly, monitors, RecoveryCleanupWorkCollector.immediate()); try { labelScanStore.Init(); labelScanStore.Start(); } catch (IOException e) { throw new UncheckedIOException(e); } return(labelScanStore); }