예제 #1
0
 public override void Close()
 {
     foreach (StoreType type in StoreType.values())
     {
         IdSequence generator = IdGenerator(type);
         if (generator is RenewableBatchIdSequence)
         {
             (( RenewableBatchIdSequence )generator).Close();
         }
     }
 }
예제 #2
0
        private long SumStoreFiles(DatabaseLayout databaseLayout)
        {
            long total = 0;

            // Include store files
            foreach (StoreType type in StoreType.values())
            {
                if (type.RecordStore)
                {
                    FileSystemAbstraction fileSystem = _outsideWorld.fileSystem();
                    total += databaseLayout.file(type.DatabaseFile).filter(fileSystem.fileExists).mapToLong(fileSystem.getFileSize).sum();
                }
            }
            // Include label index
            total += SizeOfFileIfExists(databaseLayout.LabelScanStore());
            return(total);
        }
예제 #3
0
        private void ManuallyCountTotalMappedFileSize(File dir, MutableLong result, NativeIndexFileFilter nativeIndexFilter)
        {
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            ISet <string> storeFiles = Stream.of(StoreType.values()).filter(StoreType::isRecordStore).map(type => type.DatabaseFile.Name).collect(Collectors.toSet());

            foreach (File file in dir.listFiles())
            {
                if (file.Directory)
                {
                    ManuallyCountTotalMappedFileSize(file, result, nativeIndexFilter);
                }
                else if (storeFiles.Contains(file.Name) || file.Name.Equals(DatabaseFile.LABEL_SCAN_STORE.Name) || nativeIndexFilter.Accept(file))
                {
                    result.add(file.length());
                }
            }
        }
예제 #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static long[] calculatePageCacheFileSize(org.neo4j.io.layout.DatabaseLayout databaseLayout) throws java.io.IOException
        private static long[] CalculatePageCacheFileSize(DatabaseLayout databaseLayout)
        {
            MutableLong pageCacheTotal = new MutableLong();
            MutableLong luceneTotal    = new MutableLong();

            foreach (StoreType storeType in StoreType.values())
            {
                if (storeType.RecordStore)
                {
                    long length = databaseLayout.file(storeType.DatabaseFile).mapToLong(File.length).sum();
                    pageCacheTotal.add(length);
                }
            }

            Files.walkFileTree(IndexDirectoryStructure.baseSchemaIndexFolder(databaseLayout.DatabaseDirectory()).toPath(), new SimpleFileVisitorAnonymousInnerClass(pageCacheTotal, luceneTotal));
            pageCacheTotal.add(databaseLayout.LabelScanStore().length());
            return(new long[] { pageCacheTotal.longValue(), luceneTotal.longValue() });
        }
예제 #5
0
 public RenewableBatchIdSequences(NeoStores stores, int batchSize)
 {
     foreach (StoreType type in StoreType.values())
     {
         if (type.RecordStore)
         {
             RecordStore <AbstractBaseRecord> store = stores.GetRecordStore(type);
             if (type.LimitedIdStore || batchSize == 1)
             {
                 // This is a token store or otherwise meta-data store, so let's not add batching for it
                 _types[type.ordinal()] = store;
             }
             else
             {
                 // This is a normal record store where id batching is beneficial
                 _types[type.ordinal()] = new RenewableBatchIdSequence(store, batchSize, store.freeId);
             }
         }
     }
 }
예제 #6
0
        public override ICollection <StoreFileMetadata> ListStorageFiles()
        {
            IList <StoreFileMetadata> files = new List <StoreFileMetadata>();

            foreach (StoreType type in StoreType.values())
            {
                if (type.Equals(StoreType.COUNTS))
                {
                    AddCountStoreFiles(files);
                }
                else
                {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.impl.store.RecordStore<org.neo4j.kernel.impl.store.record.AbstractBaseRecord> recordStore = neoStores.getRecordStore(type);
                    RecordStore <AbstractBaseRecord> recordStore = _neoStores.getRecordStore(type);
                    StoreFileMetadata metadata = new StoreFileMetadata(recordStore.StorageFile, recordStore.RecordSize);
                    Files.Add(metadata);
                }
            }
            return(files);
        }
예제 #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void migrateHighLimit3_0StoreFiles() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MigrateHighLimit3_0StoreFiles()
        {
            FileSystemAbstraction fileSystem = _fileSystemRule.get();
            PageCache             pageCache  = _pageCacheRule.getPageCache(fileSystem);

            using (JobScheduler jobScheduler = new ThreadPoolJobScheduler())
            {
                StoreMigrator migrator = new StoreMigrator(fileSystem, pageCache, Config.defaults(), NullLogService.Instance, jobScheduler);

                DatabaseLayout databaseLayout  = _testDirectory.databaseLayout();
                DatabaseLayout migrationLayout = _testDirectory.databaseLayout("migration");

                PrepareNeoStoreFile(fileSystem, databaseLayout, HighLimitV3_0_0.STORE_VERSION, pageCache);

                ProgressReporter progressMonitor = mock(typeof(ProgressReporter));

                migrator.Migrate(databaseLayout, migrationLayout, progressMonitor, HighLimitV3_0_0.STORE_VERSION, HighLimit.StoreVersion);

                int newStoreFilesCount = fileSystem.ListFiles(migrationLayout.DatabaseDirectory()).Length;
                assertThat("Store should be migrated and new store files should be created.", newStoreFilesCount, Matchers.greaterThanOrEqualTo(StoreType.values().length));
            }
        }