• Julien Muchembled's avatar
    mariadb: build RocksDB without fallocate · dc16dc04
    Julien Muchembled authored
    https://github.com/facebook/rocksdb/commit/7291a3f813e563efbd6870465b1063a115480373
    is not enough.
    
    Anway, given how SST files are written, fallocate
    is unlikely to be useful, even less on SSD.
    
    RocksDB seems to have options to disable at runtime (see env/io_posix.cc)
    but I see nothing for that in MariaDB configuration.
    
    Steps to reproduce:
    
    With a Btrfs partition (no specific mkfs option and for example 2GB size)
    and following MariaDB configuration:
    
      [mysqld]
      datadir = /tmp/datadir
      disable-log-bin
      plugin-load = ha_rocksdb
      rocksdb_default_cf_options = compression=kNoCompression;bottommost_compression=kZSTD
    
    execute the following queries with `mysql -uroot`:
    
    > USE test;
    > CREATE TABLE t(x MEDIUMBLOB) ENGINE=RocksDB;
    > INSERT INTO t VALUES(repeat('.',16777215));
    > INSERT INTO t SELECT x FROM t UNION ALL SELECT x FROM t;
    > INSERT INTO t SELECT x FROM t UNION ALL SELECT x FROM t;
    > INSERT INTO t SELECT x FROM t UNION ALL SELECT x FROM t;
    
    Disk usage can be checked with:
    
    > SHOW ENGINE RocksDB STATUS \G
    
    Level    Files   Size     ...
    ------------------------- ...
      L0      1/0   144.00 MB ...
      L2      1/0   288.00 MB ...
     Sum      2/0   432.00 MB ...
    
    and this can be compacted as follows:
    
    > SET GLOBAL rocksdb_compact_cf='default';
    
    > SHOW ENGINE RocksDB STATUS \G
    
    Level    Files   Size     ...
    ------------------------- ...
      L0      0/0    0.00 KB  ...
      L1      0/0    0.00 KB  ...
      L2      1/0   16.28 KB  ...
     Sum      1/0   16.28 KB  ...
    
    Now using `compsize` (on Debian, it's provided by btrfs-compsize package):
    
    # with -DWITH_FALLOCATE=NO
    
    $ compsize /tmp/datadir/#rocksdb/000029.sst
    Type       Perc     Disk Usage   Uncompressed Referenced
    TOTAL      100%       20K          20K          20K
    none       100%       20K          20K          20K
    
    # without -DWITH_FALLOCATE=NO
    
    $ compsize /tmp/datadir/#rocksdb/000029.sst
    Type       Perc     Disk Usage   Uncompressed Referenced
    TOTAL      100%       35M          35M          20K
    none       100%       35M          35M          20K
    dc16dc04
buildout.cfg 6.12 KB