Esempio n. 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));
                    }
                }
            }
        }
 internal TransactionToRecordStateVisitor(TransactionRecordState recordState, SchemaState schemaState, SchemaStorage schemaStorage, ConstraintSemantics constraintSemantics)
 {
     this._recordState         = recordState;
     this._schemaState         = schemaState;
     this._schemaStorage       = schemaStorage;
     this._constraintSemantics = constraintSemantics;
 }
Esempio n. 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRemoveIndexStatisticsAfterIndexIsDeleted() throws org.neo4j.internal.kernel.api.exceptions.KernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldRemoveIndexStatisticsAfterIndexIsDeleted()
        {
            // given
            _indexOnlineMonitor.initialize(0);
            CreateSomePersons();
            IndexReference index = CreatePersonNameIndex();

            AwaitIndexesOnline();

            SchemaStorage storage = new SchemaStorage(NeoStores().SchemaStore);
            long          indexId = storage.IndexGetForSchema(( IndexDescriptor )index).Id;

            // when
            DropIndex(index);

            // then
            try
            {
                IndexSelectivity(index);
                fail("Expected IndexNotFoundKernelException to be thrown");
            }
            catch (IndexNotFoundKernelException)
            {
                Register_DoubleLongRegister actual = Tracker.indexSample(indexId, Registers.newDoubleLongRegister());
                AssertDoubleLongEquals(0L, 0L, actual);
            }

            // and then index size and index updates are zero on disk
            Register_DoubleLongRegister actual = Tracker.indexUpdatesAndSize(indexId, Registers.newDoubleLongRegister());

            AssertDoubleLongEquals(0L, 0L, actual);
        }
Esempio n. 4
0
        private SchemaStorage CreateSchemaStorage()
        {
            SchemaStorage               schemaStorage = mock(typeof(SchemaStorage));
            StoreIndexDescriptor        rule          = _descriptor.withId(INDEX_ID);
            List <StoreIndexDescriptor> rules         = new List <StoreIndexDescriptor>();

            rules.Add(rule);

            when(schemaStorage.IndexesGetAll()).thenReturn(rules.GetEnumerator());
            return(schemaStorage);
        }
Esempio n. 5
0
        private static IDictionary <long, IndexDescriptor> GetAllIndexesFrom(SchemaStorage storage)
        {
            Dictionary <long, IndexDescriptor> indexes    = new Dictionary <long, IndexDescriptor>();
            IEnumerator <StoreIndexDescriptor> indexRules = storage.IndexesGetAll();

            while (indexRules.MoveNext())
            {
                StoreIndexDescriptor rule = indexRules.Current;
                indexes[rule.Id] = rule;
            }
            return(indexes);
        }
Esempio n. 6
0
        public MandatoryProperties(StoreAccess storeAccess)
        {
            this._storeAccess = storeAccess;
            SchemaStorage schemaStorage = new SchemaStorage(storeAccess.SchemaStore);

            foreach (ConstraintRule rule in ConstraintsIgnoringMalformed(schemaStorage))
            {
                if (rule.ConstraintDescriptor.enforcesPropertyExistence())
                {
                    rule.Schema().processWith(constraintRecorder);
                }
            }
        }
Esempio n. 7
0
        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;
            }
        }
Esempio n. 8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void committedConstraintRuleShouldCrossReferenceTheCorrespondingIndexRule() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CommittedConstraintRuleShouldCrossReferenceTheCorrespondingIndexRule()
        {
            // when
            SchemaWrite statement = schemaWriteInNewTransaction();

            statement.UniquePropertyConstraintCreate(Descriptor);
            commit();

            // then
            SchemaStorage        schema         = new SchemaStorage(NeoStores().SchemaStore);
            StoreIndexDescriptor indexRule      = Schema.indexGetForSchema(TestIndexDescriptorFactory.uniqueForLabel(TypeId, PropertyKeyId));
            ConstraintRule       constraintRule = Schema.constraintsGetSingle(ConstraintDescriptorFactory.uniqueForLabel(TypeId, PropertyKeyId));

            assertEquals(constraintRule.Id, indexRule.OwningConstraint.Value);
            assertEquals(indexRule.Id, constraintRule.OwnedIndex);
        }
Esempio n. 9
0
 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;
 }
Esempio n. 10
0
 internal DumpCountsStore(PrintStream @out, NeoStores neoStores, SchemaStorage schemaStorage) : this(@out, GetAllIndexesFrom(schemaStorage), AllTokensFrom(neoStores.LabelTokenStore), AllTokensFrom(neoStores.RelationshipTypeTokenStore), AllTokensFrom(neoStores.PropertyKeyTokenStore))
 {
 }
Esempio n. 11
0
 private IEnumerable <ConstraintRule> ConstraintsIgnoringMalformed(SchemaStorage schemaStorage)
 {
     return(schemaStorage.constraintsGetAllIgnoreMalformed);
 }
Esempio n. 12
0
 public DumpStoreAnonymousInnerClass2(SchemaStorage storage) : base(System.out)