예제 #1
0
 private int getFileSizeMb(String file) {
   long length = fs.getFileSize(new File(dbPath, "neostore." + file));
   int mb = (int) (length / 1024 / 1024);
   if (mb > 0) {
     return mb;
   }
   // default return 1MB if small or empty file
   return 1;
 }
예제 #2
0
  @Test
  public void pruneByFileSize() throws Exception {
    // Given
    int size = 1050;
    newDb(size + " size");

    doTransaction();
    rotate();
    long sizeOfOneLog =
        fs.getFileSize(neoDataSource().getXaContainer().getLogicalLog().getFileName(0));
    int filesNeededToExceedPruneLimit = (int) Math.ceil((double) size / (double) sizeOfOneLog);

    // When
    for (int i = 1; i < filesNeededToExceedPruneLimit * 2; i++) {
      doTransaction();
      rotate();

      // Then
      assertEquals(Math.min(i + 1, filesNeededToExceedPruneLimit), logCount());
    }
  }