Exemple #1
0
 public virtual void Update(CountsTracker target, long txId)
 {
     using (Org.Neo4j.Kernel.Impl.Api.CountsAccessor_Updater updater = target.Apply(txId).get(), Org.Neo4j.Kernel.Impl.Api.CountsAccessor_IndexStatsUpdater stats = target.UpdateIndexCounts())
     {
         _state.accept(new Org.Neo4j.Kernel.Impl.Api.CountsAccessor_Initializer(updater, stats));
     }
 }
 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(timeout = 30_000) public void obtainCountsStoreResetterAfterFailedTransaction() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ObtainCountsStoreResetterAfterFailedTransaction()
        {
            RecordStorageEngine engine           = BuildRecordStorageEngine();
            Exception           applicationError = ExecuteFailingTransaction(engine);

            assertNotNull(applicationError);

            CountsTracker countsStore = engine.TestAccessNeoStores().Counts;

            // possible to obtain a resetting updater that internally has a write lock on the counts store
            using (Org.Neo4j.Kernel.Impl.Api.CountsAccessor_Updater updater = countsStore.Reset(0))
            {
                assertNotNull(updater);
            }
        }
Exemple #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: org.neo4j.consistency.report.ConsistencySummaryStatistics execute(org.neo4j.kernel.api.direct.DirectStoreAccess stores, org.neo4j.logging.Log log, org.neo4j.consistency.report.ConsistencyReporter.Monitor reportMonitor) throws ConsistencyCheckIncompleteException
        internal virtual ConsistencySummaryStatistics Execute(DirectStoreAccess stores, Log log, ConsistencyReporter.Monitor reportMonitor)
        {
            ConsistencySummaryStatistics summary = new ConsistencySummaryStatistics();
            InconsistencyReport          report  = new InconsistencyReport(new InconsistencyMessageLogger(log), summary);

            OwnerCheck             ownerCheck    = new OwnerCheck(_checkPropertyOwners);
            CountsBuilderDecorator countsBuilder = new CountsBuilderDecorator(stores.NativeStores());
            CheckDecorator         decorator     = new Org.Neo4j.Consistency.checking.CheckDecorator_ChainCheckDecorator(ownerCheck, countsBuilder);
            CacheAccess            cacheAccess   = new DefaultCacheAccess(AUTO_WITHOUT_PAGECACHE.newByteArray(stores.NativeStores().NodeStore.HighId, new sbyte[ByteArrayBitsManipulator.MAX_BYTES]), _statistics.Counts, _threads);
            RecordAccess           records       = RecordAccess(stores.NativeStores(), cacheAccess);

            Execute(stores, decorator, records, report, cacheAccess, reportMonitor);
            ownerCheck.ScanForOrphanChains(_progressFactory);

            if (_checkGraph)
            {
                CountsAccessor countsAccessor = stores.NativeStores().Counts;
                bool           checkCounts    = true;
                if (_startCountsStore && countsAccessor is CountsTracker)
                {
                    CountsTracker tracker = ( CountsTracker )countsAccessor;
                    // Perhaps other read-only use cases thinks it's fine to just rebuild an in-memory counts store,
                    // but the consistency checker should instead prevent rebuild and report that the counts store is broken or missing
                    tracker.Initializer = new RebuildPreventingCountsInitializer(this);
                    try
                    {
                        tracker.Start();
                    }
                    catch (Exception e)
                    {
                        log.Error("Counts store is missing, broken or of an older format and will not be consistency checked", e);
                        summary.Update(RecordType.COUNTS, 1, 0);
                        checkCounts = false;
                    }
                }

                if (checkCounts)
                {
                    countsBuilder.CheckCounts(countsAccessor, new ConsistencyReporter(records, report), _progressFactory);
                }
            }

            if (!summary.Consistent)
            {
                log.Warn("Inconsistencies found: " + summary);
            }
            return(summary);
        }
Exemple #5
0
 public virtual void Flush(IOLimiter limiter)
 {
     try
     {
         CountsTracker counts = ( CountsTracker )_stores[StoreType.Counts.ordinal()];
         if (counts != null)
         {
             Counts.rotate(MetaDataStore.LastCommittedTransactionId);
         }
         _pageCache.flushAndForce(limiter);
     }
     catch (IOException e)
     {
         throw new UnderlyingStorageException("Failed to flush", e);
     }
 }
Exemple #6
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;
 }
Exemple #7
0
        internal virtual CountsTracker CreateCountStore()
        {
            bool          readOnly  = _config.get(GraphDatabaseSettings.read_only);
            CountsTracker counts    = readOnly ? CreateReadOnlyCountsTracker(_layout) : CreateWritableCountsTracker(_layout);
            NeoStores     neoStores = this;

            Counts.Initializer = new DataInitializerAnonymousInnerClass(this, neoStores);

            try
            {
                Counts.init();                         // TODO: move this to LifeCycle
            }
            catch (IOException e)
            {
                throw new UnderlyingStorageException("Failed to initialize counts store", e);
            }
            return(counts);
        }
 public CountsStoreBatchTransactionApplier(CountsTracker countsTracker, TransactionApplicationMode mode)
 {
     this._countsTracker = countsTracker;
     this._mode          = mode;
 }
 private void MockLabelNodeCount(CountsTracker countStore, int labelId)
 {
     Org.Neo4j.Register.Register_DoubleLongRegister register = Registers.newDoubleLongRegister(labelId, labelId);
     when(countStore.NodeCount(eq(labelId), any(typeof(Org.Neo4j.Register.Register_DoubleLongRegister)))).thenReturn(register);
 }