private void rehashToSize(final int newPagesSize) throws NoFreeSpaceException {
    assert pagesLock.isHeldByCurrentThread() : "Must hold pagesLock while rehashing";

    final AtomicReferenceArray<PageImpl> newPages = new AtomicReferenceArray<>(newPagesSize);
    final int pagesCopied = rehashWithoutTombstones(pages, newPages);

    this.pagesCount = pagesCopied;//tombstones were removed during rehash
    this.pages = newPages;
  }
private void rehashToSize(final int newPagesSize)