public OnlineIndexUpdates(NodeStore nodeStore, RelationshipStore relationshipStore, IndexingUpdateService updateService, PropertyPhysicalToLogicalConverter converter) { this._nodeStore = nodeStore; this._relationshipStore = relationshipStore; this._updateService = updateService; this._converter = converter; }
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 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 UnUseRecord(long recordId) { RelationshipStore relationshipStore = _neoStores.RelationshipStore; RelationshipRecord relationshipRecord = relationshipStore.GetRecord(recordId, new RelationshipRecord(-1), RecordLoad.FORCE); relationshipRecord.InUse = false; relationshipStore.UpdateRecord(relationshipRecord); }
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 TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void retrieveUnusedRelationship() public virtual void RetrieveUnusedRelationship() { RelationshipStore relationshipStore = _neoStores.RelationshipStore; relationshipStore.HighId = 10; CreateRelationshipRecord(RELATIONSHIP_ID, 1, relationshipStore, false); using (RecordRelationshipScanCursor cursor = CreateRelationshipCursor()) { cursor.Single(RELATIONSHIP_ID); assertFalse(cursor.Next()); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void retrieveUsedRelationship() public virtual void RetrieveUsedRelationship() { RelationshipStore relationshipStore = _neoStores.RelationshipStore; CreateRelationshipRecord(RELATIONSHIP_ID, 1, relationshipStore, true); using (RecordRelationshipScanCursor cursor = CreateRelationshipCursor()) { cursor.Single(RELATIONSHIP_ID); assertTrue(cursor.Next()); assertEquals(RELATIONSHIP_ID, cursor.EntityReference()); } }
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 void CreateNodeRelationships() { RelationshipStore relationshipStore = _neoStores.RelationshipStore; if (Dense) { RecordStore <RelationshipGroupRecord> relationshipGroupStore = _neoStores.RelationshipGroupStore; relationshipGroupStore.UpdateRecord(CreateRelationshipGroup(1, 1)); relationshipGroupStore.UpdateRecord(CreateRelationshipGroup(2, 2)); relationshipGroupStore.UpdateRecord(CreateRelationshipGroup(3, 3)); } relationshipStore.UpdateRecord(CreateRelationship(1, NO_NEXT_RELATIONSHIP.intValue())); relationshipStore.UpdateRecord(CreateRelationship(2, NO_NEXT_RELATIONSHIP.intValue())); relationshipStore.UpdateRecord(CreateRelationship(3, NO_NEXT_RELATIONSHIP.intValue())); }
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)); } }
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; }
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 void CreateRelationshipChain(int recordsInChain) { RelationshipStore relationshipStore = _neoStores.RelationshipStore; for (int i = 1; i < recordsInChain; i++) { relationshipStore.UpdateRecord(CreateRelationship(i, i + 1)); } relationshipStore.UpdateRecord(CreateRelationship(recordsInChain, NO_NEXT_RELATIONSHIP.intValue())); if (Dense) { RecordStore <RelationshipGroupRecord> relationshipGroupStore = _neoStores.RelationshipGroupStore; for (int i = 1; i < recordsInChain; i++) { relationshipGroupStore.UpdateRecord(CreateRelationshipGroup(i, i)); } relationshipGroupStore.UpdateRecord(CreateRelationshipGroup(recordsInChain, NO_NEXT_RELATIONSHIP.intValue())); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldScanAllInUseRelationships() public virtual void ShouldScanAllInUseRelationships() { // given RelationshipStore relationshipStore = _neoStores.RelationshipStore; int count = 100; relationshipStore.HighId = count; ISet <long> expected = new HashSet <long>(); for (long id = 0; id < count; id++) { bool inUse = Random.nextBoolean(); CreateRelationshipRecord(id, 1, relationshipStore, inUse); if (inUse) { expected.Add(id); } } // when AssertSeesRelationships(expected, ANY_RELATIONSHIP_TYPE); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldScanAllInUseRelationshipsOfCertainType() public virtual void ShouldScanAllInUseRelationshipsOfCertainType() { // given RelationshipStore relationshipStore = _neoStores.RelationshipStore; int count = 100; relationshipStore.HighId = count; ISet <long> expected = new HashSet <long>(); int theType = 1; for (long id = 0; id < count; id++) { bool inUse = Random.nextBoolean(); int type = Random.Next(3); CreateRelationshipRecord(id, type, relationshipStore, inUse); if (inUse && type == theType) { expected.Add(id); } } // when AssertSeesRelationships(expected, theType); }
private TransactionRecordState InjectAllPossibleCommands() { RecordChangeSet recordChangeSet = mock(typeof(RecordChangeSet)); RecordChanges <LabelTokenRecord, Void> labelTokenChanges = mock(typeof(RecordChanges)); RecordChanges <RelationshipTypeTokenRecord, Void> relationshipTypeTokenChanges = mock(typeof(RecordChanges)); RecordChanges <PropertyKeyTokenRecord, Void> propertyKeyTokenChanges = mock(typeof(RecordChanges)); RecordChanges <NodeRecord, Void> nodeRecordChanges = mock(typeof(RecordChanges)); RecordChanges <RelationshipRecord, Void> relationshipRecordChanges = mock(typeof(RecordChanges)); RecordChanges <PropertyRecord, PrimitiveRecord> propertyRecordChanges = mock(typeof(RecordChanges)); RecordChanges <RelationshipGroupRecord, int> relationshipGroupChanges = mock(typeof(RecordChanges)); RecordChanges <SchemaRecord, SchemaRule> schemaRuleChanges = mock(typeof(RecordChanges)); when(recordChangeSet.LabelTokenChanges).thenReturn(labelTokenChanges); when(recordChangeSet.RelationshipTypeTokenChanges).thenReturn(relationshipTypeTokenChanges); when(recordChangeSet.PropertyKeyTokenChanges).thenReturn(propertyKeyTokenChanges); when(recordChangeSet.NodeRecords).thenReturn(nodeRecordChanges); when(recordChangeSet.RelRecords).thenReturn(relationshipRecordChanges); when(recordChangeSet.PropertyRecords).thenReturn(propertyRecordChanges); when(recordChangeSet.RelGroupRecords).thenReturn(relationshipGroupChanges); when(recordChangeSet.SchemaRuleChanges).thenReturn(schemaRuleChanges); IList <RecordAccess_RecordProxy <NodeRecord, Void> > nodeChanges = new LinkedList <RecordAccess_RecordProxy <NodeRecord, Void> >(); RecordChanges.RecordChange <NodeRecord, Void> deletedNode = mock(typeof(RecordChanges.RecordChange)); when(deletedNode.Before).thenReturn(InUseNode()); when(deletedNode.ForReadingLinkage()).thenReturn(MissingNode()); nodeChanges.Add(deletedNode); RecordChanges.RecordChange <NodeRecord, Void> createdNode = mock(typeof(RecordChanges.RecordChange)); when(createdNode.Before).thenReturn(MissingNode()); when(createdNode.ForReadingLinkage()).thenReturn(createdNode()); nodeChanges.Add(createdNode); RecordChanges.RecordChange <NodeRecord, Void> updatedNode = mock(typeof(RecordChanges.RecordChange)); when(updatedNode.Before).thenReturn(InUseNode()); when(updatedNode.ForReadingLinkage()).thenReturn(InUseNode()); nodeChanges.Add(updatedNode); when(nodeRecordChanges.Changes()).thenReturn(nodeChanges); when(nodeRecordChanges.ChangeSize()).thenReturn(3); when(recordChangeSet.ChangeSize()).thenReturn(3); when(labelTokenChanges.Changes()).thenReturn(Collections.emptyList()); when(relationshipTypeTokenChanges.Changes()).thenReturn(Collections.emptyList()); when(propertyKeyTokenChanges.Changes()).thenReturn(Collections.emptyList()); when(relationshipRecordChanges.Changes()).thenReturn(Collections.emptyList()); when(propertyRecordChanges.Changes()).thenReturn(Collections.emptyList()); when(relationshipGroupChanges.Changes()).thenReturn(Collections.emptyList()); when(schemaRuleChanges.Changes()).thenReturn(Collections.emptyList()); NeoStores neoStores = mock(typeof(NeoStores)); NodeStore store = mock(typeof(NodeStore)); when(neoStores.NodeStore).thenReturn(store); RelationshipGroupStore relationshipGroupStore = mock(typeof(RelationshipGroupStore)); when(neoStores.RelationshipGroupStore).thenReturn(relationshipGroupStore); RelationshipStore relationshipStore = mock(typeof(RelationshipStore)); when(neoStores.RelationshipStore).thenReturn(relationshipStore); return(new TransactionRecordState(neoStores, mock(typeof(IntegrityValidator)), recordChangeSet, 0, null, null, null, null, null)); }
public IndexBatchTransactionApplier(IndexingService indexingService, WorkSync <System.Func <LabelScanWriter>, LabelUpdateWork> labelScanStoreSync, WorkSync <IndexingUpdateService, IndexUpdatesWork> indexUpdatesSync, NodeStore nodeStore, RelationshipStore relationshipStore, PropertyStore propertyStore, IndexActivator indexActivator) { this._indexingService = indexingService; this._labelScanStoreSync = labelScanStoreSync; this._indexUpdatesSync = indexUpdatesSync; this._propertyStore = propertyStore; this._transactionApplier = new SingleTransactionApplier(this, nodeStore, relationshipStore); this._indexActivator = indexActivator; }
internal RecordRelationshipCursor(RelationshipStore relationshipStore) : base(NO_ID) { this.RelationshipStore = relationshipStore; }
internal RecordRelationshipTraversalCursor(RelationshipStore relationshipStore, RelationshipGroupStore groupStore) : base(relationshipStore) { this._group = new RecordRelationshipGroupCursor(relationshipStore, groupStore); }
internal SingleTransactionApplier(IndexBatchTransactionApplier outerInstance, NodeStore nodeStore, RelationshipStore relationshipStore) { this._outerInstance = outerInstance; this.NodeStore = nodeStore; this.RelationshipStore = relationshipStore; }
private void CreateRelationshipRecord(long id, int type, RelationshipStore relationshipStore, bool used) { relationshipStore.UpdateRecord((new RelationshipRecord(id)).initialize(used, -1, 1, 2, type, -1, -1, -1, -1, true, true)); }