core/src/main/java/com/orientechnologies/orient/core/storage/cache/local/OWOWCache.java
private void freeSpaceCheckAfterNewPageAdd() throws IOException {
    final long newPagesAdded = amountOfNewPagesAdded.addAndGet(1);
    final long lastSpaceCheck = lastDiskSpaceCheck.get();

    if (newPagesAdded - lastSpaceCheck > diskSizeCheckInterval || lastSpaceCheck == 0) {
      //usable space may be less than free space
      final long freeSpace = Files.getFileStore(storagePath).getUsableSpace();

      if (freeSpace < freeSpaceLimit) {
        callLowSpaceListeners(new OLowDiskSpaceInformation(freeSpace, freeSpaceLimit));
      }

      lastDiskSpaceCheck.lazySet(newPagesAdded);
    }
  }
private void freeSpaceCheckAfterNewPageAdd() throws IOException {
    final long newPagesAdded = amountOfNewPagesAdded.addAndGet(1);
    final long lastSpaceCheck = lastDiskSpaceCheck.get();

    if (newPagesAdded - lastSpaceCheck > diskSizeCheckInterval || lastSpaceCheck == 0) {
      //usable space may be less than free space
      final long freeSpace = Files.getFileStore(storagePath).getUsableSpace();

      if (freeSpace < freeSpaceLimit) {
        callLowSpaceListeners(new OLowDiskSpaceInformation(freeSpace, freeSpaceLimit));
      }

      lastDiskSpaceCheck.lazySet(newPagesAdded);
    }
  }
private void freeSpaceCheckAfterNewPageAdd ( ) throws IOException { final long newPagesAdded = amountOfNewPagesAdded . addAndGet ( 1 ) ; final long lastSpaceCheck = lastDiskSpaceCheck . get ( ) ; if ( newPagesAdded - lastSpaceCheck > diskSizeCheckInterval || lastSpaceCheck == 0 ) { //usable space may be less than free space final long freeSpace = Files . getFileStore ( storagePath ) . getUsableSpace ( ) ; if ( freeSpace < freeSpaceLimit ) { callLowSpaceListeners ( new OLowDiskSpaceInformation ( freeSpace , freeSpaceLimit ) ) ; } lastDiskSpaceCheck . lazySet ( newPagesAdded ) ; } }
This method is called once new pages are added to the disk inside of
{@link OWriteCache#load(long, long, int, OModifiableBoolean, boolean)}  method.
If total amount of added pages minus amount of added pages at the time of last disk space check bigger than threshold value
{@link #diskSizeCheckInterval} new disk space check is performed and if amount of space left on disk less than threshold
{@link
#freeSpaceLimit} then database is switched in "read only" mode
This method is called once new pages are added to the disk inside of {