//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public static void main(String[] args) throws java.io.IOException public static void Main(string[] args) { using (FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction()) { _console.printf("Neo4j Raw Store Diagnostics Reader%n"); if (args.Length != 1 || !fileSystem.IsDirectory(new File(args[0]))) { _console.printf("Usage: rsdr <store directory>%n"); return; } File databaseDirectory = new File(args[0]); DatabaseLayout databaseLayout = DatabaseLayout.of(databaseDirectory); Config config = BuildConfig(); JobScheduler jobScheduler = createInitialisedScheduler(); using (PageCache pageCache = createPageCache(fileSystem, config, jobScheduler)) { File neoStore = databaseLayout.MetadataStore(); StoreFactory factory = OpenStore(fileSystem, neoStore, config, pageCache); NeoStores neoStores = factory.OpenAllNeoStores(); Interact(fileSystem, neoStores, databaseLayout); } } }
//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() { StoreFactory storeFactory = new StoreFactory(_testDirectory.databaseLayout(), Config.defaults(), new DefaultIdGeneratorFactory(_fs.get()), PageCacheRule.getPageCache(_fs.get()), _fs.get(), NullLogProvider.Instance, EmptyVersionContextSupplier.EMPTY); _neoStores = storeFactory.OpenAllNeoStores(true); _nodeStore = _neoStores.NodeStore; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldPackTheHighestTxCommittedAsObligation() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldPackTheHighestTxCommittedAsObligation() { // GIVEN LogicalTransactionStore transactionStore = mock(typeof(LogicalTransactionStore)); FileSystemAbstraction fs = _fsRule.get(); PageCache pageCache = _pageCacheRule.getPageCache(fs); using (NeoStores neoStore = CreateNeoStore(fs, pageCache)) { MetaDataStore store = neoStore.MetaDataStore; store.TransactionCommitted(2, 111, BASE_TX_COMMIT_TIMESTAMP); store.TransactionCommitted(3, 222, BASE_TX_COMMIT_TIMESTAMP); store.TransactionCommitted(4, 333, BASE_TX_COMMIT_TIMESTAMP); store.TransactionCommitted(5, 444, BASE_TX_COMMIT_TIMESTAMP); store.TransactionCommitted(6, 555, BASE_TX_COMMIT_TIMESTAMP); // skip 7 to emulate the fact we have an hole in the committed tx ids list const long expectedTxId = 8L; store.TransactionCommitted(expectedTxId, 777, BASE_TX_COMMIT_TIMESTAMP); ResponsePacker packer = new ResponsePacker(transactionStore, store, Suppliers.singleton(newStoreIdForCurrentVersion())); // WHEN Response <object> response = packer.PackTransactionObligationResponse(new RequestContext(0, 0, 0, 0, 0), new object()); // THEN assertTrue(response is TransactionObligationResponse); (( TransactionObligationResponse )response).accept(new HandlerAnonymousInnerClass(this, expectedTxId)); } }
public NeoStoreBatchTransactionApplier(CommandVersion version, NeoStores store, CacheAccessBackDoor cacheAccess, LockService lockService) { this._version = version; this._neoStores = store; this._cacheAccess = cacheAccess; this._lockService = lockService; }
//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)); }
private void PrepareDbWithDeletedRelationshipPartOfTheChain() { GraphDatabaseAPI db = ( GraphDatabaseAPI )(new TestGraphDatabaseFactory()).newEmbeddedDatabaseBuilder(_testDirectory.databaseDir()).setConfig(GraphDatabaseSettings.record_format, RecordFormatName).setConfig("dbms.backup.enabled", "false").newGraphDatabase(); try { RelationshipType relationshipType = RelationshipType.withName("testRelationshipType"); using (Transaction tx = Db.beginTx()) { Node node1 = set(Db.createNode()); Node node2 = set(Db.createNode(), property("key", "value")); node1.CreateRelationshipTo(node2, relationshipType); node1.CreateRelationshipTo(node2, relationshipType); node1.CreateRelationshipTo(node2, relationshipType); node1.CreateRelationshipTo(node2, relationshipType); node1.CreateRelationshipTo(node2, relationshipType); node1.CreateRelationshipTo(node2, relationshipType); tx.Success(); } RecordStorageEngine recordStorageEngine = Db.DependencyResolver.resolveDependency(typeof(RecordStorageEngine)); NeoStores neoStores = recordStorageEngine.TestAccessNeoStores(); RelationshipStore relationshipStore = neoStores.RelationshipStore; RelationshipRecord relationshipRecord = new RelationshipRecord(-1); RelationshipRecord record = relationshipStore.GetRecord(4, relationshipRecord, RecordLoad.FORCE); record.InUse = false; relationshipStore.UpdateRecord(relationshipRecord); } finally { Db.shutdown(); } }
//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)); } } } }
private static RecordStore GetStore(string fname, NeoStores neoStores) { switch (fname) { case "neostore.nodestore.db": return(neoStores.NodeStore); case "neostore.labeltokenstore.db": return(neoStores.LabelTokenStore); case "neostore.propertystore.db.index": return(neoStores.PropertyKeyTokenStore); case "neostore.propertystore.db": return(neoStores.PropertyStore); case "neostore.relationshipgroupstore.db": return(neoStores.RelationshipGroupStore); case "neostore.relationshipstore.db": return(neoStores.RelationshipStore); case "neostore.relationshiptypestore.db": return(neoStores.RelationshipTypeTokenStore); case "neostore.schemastore.db": return(neoStores.SchemaStore); default: return(null); } }
internal override RelationshipStore store(NeoStores neoStores) { NodeRecord nodeRecord = nodeRecord(neoStores, _node); outerInstance.firstRecord = nodeRecord.Dense ? -1 : nodeRecord.NextRel; return(base.store(neoStores)); }
public DynamicIndexStoreView(NeoStoreIndexStoreView neoStoreIndexStoreView, LabelScanStore labelScanStore, LockService locks, NeoStores neoStores, LogProvider logProvider) { this._neoStores = neoStores; this._neoStoreIndexStoreView = neoStoreIndexStoreView; this.Locks = locks; this._labelScanStore = labelScanStore; this._log = logProvider.getLog(this.GetType()); }
private static long HighestNodeId(GraphDatabaseService db) { DependencyResolver resolver = DependencyResolver(db); NeoStores neoStores = resolver.ResolveDependency(typeof(RecordStorageEngine)).testAccessNeoStores(); NodeStore nodeStore = neoStores.NodeStore; return(nodeStore.HighestPossibleIdInUse); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void startUp() public virtual void StartUp() { Config config = Config.defaults(GraphDatabaseSettings.label_block_size, "60"); StoreFactory storeFactory = new StoreFactory(TestDirectory.databaseLayout(), config, new DefaultIdGeneratorFactory(Fs.get()), PageCacheRule.getPageCache(Fs.get()), Fs.get(), NullLogProvider.Instance, EmptyVersionContextSupplier.EMPTY); _neoStores = storeFactory.OpenAllNeoStores(true); _nodeStore = _neoStores.NodeStore; }
public NeoStoreIndexStoreView(LockService locks, NeoStores neoStores) { this.Locks = locks; this._neoStores = neoStores; this.PropertyStore = neoStores.PropertyStore; this.NodeStore = neoStores.NodeStore; this.RelationshipStore = neoStores.RelationshipStore; this._counts = neoStores.Counts; }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: protected void after(boolean successful) throws Throwable protected internal override void After(bool successful) { IOUtils.closeAll(_neoStores, _rulePageCache, _jobScheduler); _neoStores = null; if (_ruleFs != null) { _ruleFs.Dispose(); } }
internal Applier(GraphStoreFixture outerInstance) { this._outerInstance = outerInstance; Database = ( GraphDatabaseAPI )(new TestGraphDatabaseFactory()).newEmbeddedDatabaseBuilder(outerInstance.directory.DatabaseDir()).setConfig("dbms.backup.enabled", "false").newGraphDatabase(); DependencyResolver dependencyResolver = Database.DependencyResolver; CommitProcess = new TransactionRepresentationCommitProcess(dependencyResolver.ResolveDependency(typeof(TransactionAppender)), dependencyResolver.ResolveDependency(typeof(StorageEngine))); TransactionIdStore = Database.DependencyResolver.resolveDependency(typeof(TransactionIdStore)); NeoStores = Database.DependencyResolver.resolveDependency(typeof(RecordStorageEngine)).testAccessNeoStores(); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private org.neo4j.kernel.impl.store.NeoStores open(org.neo4j.io.fs.FileSystemAbstraction fs, org.neo4j.io.pagecache.PageCache pageCache, org.neo4j.kernel.impl.store.format.RecordFormats format, System.Func<org.neo4j.io.fs.FileSystemAbstraction,org.neo4j.kernel.impl.store.id.IdGeneratorFactory> idGeneratorFactory, String... config) throws java.io.IOException private NeoStores Open(FileSystemAbstraction fs, PageCache pageCache, RecordFormats format, System.Func <FileSystemAbstraction, IdGeneratorFactory> idGeneratorFactory, params string[] config) { Debug.Assert(_neoStores == null, "Already opened"); TestDirectory testDirectory = TestDirectory.TestDirectoryConflict(fs); testDirectory.PrepareDirectory(_testClass, null); Config configuration = ConfigOf(config); StoreFactory storeFactory = new StoreFactory(testDirectory.DatabaseLayout(), configuration, idGeneratorFactory(fs), pageCache, fs, format, NullLogProvider.Instance, EmptyVersionContextSupplier.EMPTY); return(_neoStores = _stores.Length == 0 ? storeFactory.OpenAllNeoStores(true) : storeFactory.OpenNeoStores(true, _stores)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static void interact(org.neo4j.io.fs.FileSystemAbstraction fileSystem, org.neo4j.kernel.impl.store.NeoStores neoStores, org.neo4j.io.layout.DatabaseLayout databaseLayout) throws java.io.IOException private static void Interact(FileSystemAbstraction fileSystem, NeoStores neoStores, DatabaseLayout databaseLayout) { PrintHelp(); string cmd; do { cmd = _console.readLine("neo? "); } while (Execute(fileSystem, cmd, neoStores, databaseLayout)); Environment.Exit(0); }
//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); }
internal Worker(IndexWorkSyncTransactionApplicationStressIT outerInstance, int id, AtomicBoolean end, RecordStorageEngine storageEngine, int batchSize, IndexProxy index) { this._outerInstance = outerInstance; this.Id = id; this.End = end; this.StorageEngine = storageEngine; this.BatchSize = batchSize; this.Index = index; NeoStores neoStores = this.StorageEngine.testAccessNeoStores(); this.NodeIds = neoStores.NodeStore; this.CommandCreationContext = storageEngine.AllocateCommandCreationContext(); }
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; } }
private static IDictionary <IdType, long> GetHighIds(GraphDatabaseAPI db) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.Map<org.neo4j.kernel.impl.store.id.IdType,long> highIds = new java.util.HashMap<>(); IDictionary <IdType, long> highIds = new Dictionary <IdType, long>(); NeoStores neoStores = Db.DependencyResolver.resolveDependency(typeof(RecordStorageEngine)).testAccessNeoStores(); Visitor <CommonAbstractStore, Exception> visitor = store => { highIds[store.IdType] = store.HighId; return(true); }; neoStores.VisitStore(visitor); return(highIds); }
internal RecordStorageReader(TokenHolders tokenHolders, SchemaStorage schemaStorage, NeoStores neoStores, IndexingService indexService, SchemaCache schemaCache, System.Func <IndexReaderFactory> indexReaderFactory, System.Func <LabelScanReader> labelScanReaderSupplier, RecordStorageCommandCreationContext commandCreationContext) { this._tokenHolders = tokenHolders; this._neoStores = neoStores; this._schemaStorage = schemaStorage; this._indexService = indexService; this._nodeStore = neoStores.NodeStore; this._relationshipStore = neoStores.RelationshipStore; this._relationshipGroupStore = neoStores.RelationshipGroupStore; this._propertyStore = neoStores.PropertyStore; this._counts = neoStores.Counts; this._schemaCache = schemaCache; this._indexReaderFactorySupplier = indexReaderFactory; this._labelScanReaderSupplier = labelScanReaderSupplier; this._commandCreationContext = commandCreationContext; }
private NeoStores CreateNeoStores() { NeoStores neoStores = mock(typeof(NeoStores)); LabelTokenStore labelTokenStore = mock(typeof(LabelTokenStore)); RelationshipTypeTokenStore typeTokenStore = mock(typeof(RelationshipTypeTokenStore)); PropertyKeyTokenStore propertyKeyTokenStore = mock(typeof(PropertyKeyTokenStore)); when(labelTokenStore.Tokens).thenReturn(LabelTokens); when(typeTokenStore.Tokens).thenReturn(TypeTokes); when(propertyKeyTokenStore.Tokens).thenReturn(PropertyTokens); when(neoStores.LabelTokenStore).thenReturn(labelTokenStore); when(neoStores.RelationshipTypeTokenStore).thenReturn(typeTokenStore); when(neoStores.PropertyKeyTokenStore).thenReturn(propertyKeyTokenStore); return(neoStores); }
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; } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldOnlyChangeLockedRecordsWhenUpgradingToDenseNode() public virtual void ShouldOnlyChangeLockedRecordsWhenUpgradingToDenseNode() { // GIVEN long nodeId = CreateNodeWithRelationships(DENSE_NODE_THRESHOLD); NeoStores neoStores = FlipToNeoStores(); Tracker tracker = new Tracker(neoStores); RelationshipGroupGetter groupGetter = new RelationshipGroupGetter(neoStores.RelationshipGroupStore); RelationshipCreator relationshipCreator = new RelationshipCreator(groupGetter, 5); // WHEN relationshipCreator.RelationshipCreate(_idGeneratorFactory.get(IdType.RELATIONSHIP).nextId(), 0, nodeId, nodeId, tracker, tracker); // THEN assertEquals(tracker.RelationshipLocksAcquired.Count, tracker.ChangedRelationships.Count); assertFalse(tracker.RelationshipLocksAcquired.Count == 0); }
internal TransactionRecordState(NeoStores neoStores, IntegrityValidator integrityValidator, RecordChangeSet recordChangeSet, long lastCommittedTxWhenTransactionStarted, ResourceLocker locks, RelationshipCreator relationshipCreator, RelationshipDeleter relationshipDeleter, PropertyCreator propertyCreator, PropertyDeleter propertyDeleter) { this._neoStores = neoStores; this._nodeStore = neoStores.NodeStore; this._relationshipStore = neoStores.RelationshipStore; this._propertyStore = neoStores.PropertyStore; this._relationshipGroupStore = neoStores.RelationshipGroupStore; this._metaDataStore = neoStores.MetaDataStore; this._schemaStore = neoStores.SchemaStore; this._integrityValidator = integrityValidator; this._recordChangeSet = recordChangeSet; this._lastCommittedTxWhenTransactionStarted = lastCommittedTxWhenTransactionStarted; this._locks = locks; this._relationshipCreator = relationshipCreator; this._relationshipDeleter = relationshipDeleter; this._propertyCreator = propertyCreator; this._propertyDeleter = propertyDeleter; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void populateFromQueuePopulatesWhenThresholdReached() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void PopulateFromQueuePopulatesWhenThresholdReached() { SetProperty(QUEUE_THRESHOLD_NAME, 2); NeoStores neoStores = mock(typeof(NeoStores)); NodeStore nodeStore = mock(typeof(NodeStore)); when(neoStores.NodeStore).thenReturn(nodeStore); NeoStoreIndexStoreView storeView = new NeoStoreIndexStoreView(LockService.NO_LOCK_SERVICE, neoStores); BatchingMultipleIndexPopulator batchingPopulator = new BatchingMultipleIndexPopulator(storeView, ImmediateExecutor(), NullLogProvider.Instance, mock(typeof(SchemaState))); IndexPopulator populator1 = AddPopulator(batchingPopulator, _index1); IndexUpdater updater1 = mock(typeof(IndexUpdater)); when(populator1.NewPopulatingUpdater(any())).thenReturn(updater1); IndexPopulator populator2 = AddPopulator(batchingPopulator, _index42); IndexUpdater updater2 = mock(typeof(IndexUpdater)); when(populator2.NewPopulatingUpdater(any())).thenReturn(updater2); batchingPopulator.IndexAllEntities(); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.neo4j.kernel.api.index.IndexEntryUpdate<?> update1 = add(1, index1.schema(), "foo"); IndexEntryUpdate <object> update1 = add(1, _index1.schema(), "foo"); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.neo4j.kernel.api.index.IndexEntryUpdate<?> update2 = add(2, index42.schema(), "bar"); IndexEntryUpdate <object> update2 = add(2, _index42.schema(), "bar"); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.neo4j.kernel.api.index.IndexEntryUpdate<?> update3 = add(3, index1.schema(), "baz"); IndexEntryUpdate <object> update3 = add(3, _index1.schema(), "baz"); batchingPopulator.QueueUpdate(update1); batchingPopulator.QueueUpdate(update2); batchingPopulator.QueueUpdate(update3); batchingPopulator.PopulateFromQueueBatched(42); verify(updater1).process(update1); verify(updater1).process(update3); verify(updater2).process(update2); }
private void RebuildCountsFromScratch( DatabaseLayout sourceStructure, DatabaseLayout migrationStructure, long lastTxId, ProgressReporter progressMonitor, string expectedStoreVersion, PageCache pageCache, LogProvider logProvider ) { RecordFormats recordFormats = selectForVersion( expectedStoreVersion ); IdGeneratorFactory idGeneratorFactory = new ReadOnlyIdGeneratorFactory( _fileSystem ); StoreFactory storeFactory = new StoreFactory( sourceStructure, _config, idGeneratorFactory, pageCache, _fileSystem, recordFormats, logProvider, EmptyVersionContextSupplier.EMPTY ); using ( NeoStores neoStores = storeFactory.OpenNeoStores( StoreType.NODE, StoreType.RELATIONSHIP, StoreType.LABEL_TOKEN, StoreType.RELATIONSHIP_TYPE_TOKEN ) ) { neoStores.VerifyStoreOk(); NodeStore nodeStore = neoStores.NodeStore; RelationshipStore relationshipStore = neoStores.RelationshipStore; using ( Lifespan life = new Lifespan() ) { int highLabelId = ( int ) neoStores.LabelTokenStore.HighId; int highRelationshipTypeId = ( int ) neoStores.RelationshipTypeTokenStore.HighId; CountsComputer initializer = new CountsComputer( lastTxId, nodeStore, relationshipStore, highLabelId, highRelationshipTypeId, NumberArrayFactory.auto( pageCache, migrationStructure.DatabaseDirectory(), true, [email protected]_Fields.NoMonitor ), progressMonitor ); life.Add( ( new CountsTracker( logProvider, _fileSystem, pageCache, _config, migrationStructure, EmptyVersionContextSupplier.EMPTY ) ).setInitializer( initializer ) ); } } }
private static long CalculateNumberOfProperties(NeoStores stores) { long count = 0; PropertyRecord record = stores.PropertyStore.newRecord(); using (PageCursor cursor = stores.PropertyStore.openPageCursorForReading(0)) { long highId = stores.PropertyStore.HighId; for (long id = 0; id < highId; id++) { stores.PropertyStore.getRecordByCursor(id, record, CHECK, cursor); if (record.InUse()) { count += count(record); } } } return(count); }
private GraphDatabaseAPI DatabaseWithManyPropertyKeys(int propertyKeyCount) { PageCache pageCache = _pageCacheRule.getPageCache(_fileSystemRule.get()); StoreFactory storeFactory = new StoreFactory(_testDirectory.databaseLayout(), Config.defaults(), new DefaultIdGeneratorFactory(_fileSystemRule.get()), pageCache, _fileSystemRule.get(), NullLogProvider.Instance, EmptyVersionContextSupplier.EMPTY); NeoStores neoStores = storeFactory.OpenAllNeoStores(true); PropertyKeyTokenStore store = neoStores.PropertyKeyTokenStore; for (int i = 0; i < propertyKeyCount; i++) { PropertyKeyTokenRecord record = new PropertyKeyTokenRecord(( int )store.nextId()); record.InUse = true; ICollection <DynamicRecord> nameRecords = store.AllocateNameRecords(PropertyStore.encodeString(Key(i))); record.AddNameRecords(nameRecords); record.NameId = ( int )Iterables.first(nameRecords).Id; store.UpdateRecord(record); } neoStores.Close(); return(Database()); }