FileStoreStats implements FileStoreStatsMBean, FileStoreMonitor, SegmentNotFoundExceptionListener { @Override public long getJournalWriteStatsAsCount() { return journalWriteStats.getCount(); } FileStoreStats(StatisticsProvider statisticsProvider, FileStore store, long initialSize); void init(long initialSize); @Override void notify(@NotNull SegmentId id, @NotNull SegmentNotFoundException snfe); @Override void written(long delta); @Override void reclaimed(long size); @Override void flushed(); @Override long getApproximateSize(); @Override int getTarFileCount(); @Override int getSegmentCount(); @NotNull @Override CompositeData getWriteStats(); @NotNull @Override CompositeData getRepositorySize(); @Override String fileStoreInfoAsString(); @Override long getJournalWriteStatsAsCount(); @Override CompositeData getJournalWriteStatsAsCompositeData(); static final String SEGMENT_REPO_SIZE; static final String SEGMENT_WRITES; static final String JOURNAL_WRITES; }
@Test public void testJournalWriteStats() throws Exception { StatisticsProvider statsProvider = new DefaultStatisticsProvider(executor); FileStore fileStore = fileStoreBuilder(segmentFolder.newFolder()).withStatisticsProvider(statsProvider).build(); FileStoreStats stats = new FileStoreStats(statsProvider, fileStore, 0); SegmentNodeStore nodeStore = SegmentNodeStoreBuilders.builder(fileStore).build(); for (int i = 0; i < 10; i++) { NodeBuilder root = nodeStore.getRoot().builder(); root.setProperty("count", i); nodeStore.merge(root, EmptyHook.INSTANCE, CommitInfo.EMPTY); fileStore.flush(); } assertEquals(10, stats.getJournalWriteStatsAsCount()); }