code: private PageLeafImpl compact(TableKelp table)
    {
      long now = CurrentTime.currentTime() / 1000;
      
      Set<PageLeafEntry> entries = fillEntries(table);
      
      ArrayList<BlockLeaf> blocks = new ArrayList<>();
      BlockLeaf block = new BlockLeaf(getId());
      
      blocks.add(block);
      
      Row row = table.row();
      
      for (PageLeafEntry entry : entries) {
        if (entry.getCode() != INSERT && entry.getExpires() <= now) {
          continue;
        }
  
        while (! block.addEntry(row, entry)) {
          block = new BlockLeaf(getId());
          blocks.add(block);
        }
      }
      
      PageLeafImpl newPage = new PageLeafImpl(getId(), 
                                              getNextId(), 
                                              getSequence(),
                                              _table,
                                              getMinKey(), 
                                              getMaxKey(),
                                              blocks);
      
      newPage.validate(table);
      newPage.toSorted(table);
      
      if (isDirty()) {
        newPage.setDirty();
      }
      
      if (_stub != null) {
        _stub.copyToCompact(newPage);
      }
  
      return newPage;
    }
docs: Compacts the leaf by rebuilding the delta entries and discarding obsolete
  removed entries.