Skip to content
Snippets Groups Projects
Commit f747db34 authored by Dan Notestein's avatar Dan Notestein
Browse files

Switch ZFS datasets for postgres to the default 128k record size,

create a separate dataset for the WAL
parent 99a3daf0
No related branches found
No related tags found
No related merge requests found
......@@ -61,7 +61,9 @@ echo " mounted on: $TOP_LEVEL_DATASET_MOUNTPOINT"
zfs_common_options="-o atime=off"
zfs_compressed_options="-o compression=lz4"
zfs_uncompressed_options="-o compression=off"
zfs_postgres_options="-o recordsize=8k" # or "-o recordsize=16k", consider also "-o logbias=throughput"
# several sites recommend 8k blocks for optimizing postgres on zfs, but we have found that it
# kills compression ratios for haf_block_log, so we've decided to leave it at the default 128k
zfs_postgres_options="" # or "-o recordsize=8k -o recordsize=16k", consider also "-o logbias=throughput"
zfs create $zfs_common_options $zfs_compressed_options "${ZPOOL}/${TOP_LEVEL_DATASET}"
# create an uncompressed dataset for the blockchain. Blocks in it are already compressed, so won't compress further.
......@@ -79,7 +81,7 @@ zfs create $zfs_common_options $zfs_uncompressed_options $zfs_postgres_options -
# create a dataset for the write-ahead logs, simply to reduce the size of snapshots of other datasets
# note: this is disabled, I'm not sure we really care about the size of the snapshots of other datasets, we
# only care about the total size, and I'm not sure this gives us any benefit
# zfs create $zfs_common_options $zfs_uncompressed_options $zfs_postgres_options -o canmount=on "${ZPOOL}/${TOP_LEVEL_DATASET}/haf_db_store/pgdata/pg_wal"
zfs create $zfs_common_options $zfs_uncompressed_options $zfs_postgres_options -o canmount=on "${ZPOOL}/${TOP_LEVEL_DATASET}/haf_db_store/pgdata/pg_wal"
# create a dataset for the main HAF database itself
zfs create $zfs_common_options $zfs_compressed_options $zfs_postgres_options -o canmount=on "${ZPOOL}/${TOP_LEVEL_DATASET}/haf_db_store/tablespace"
......
......@@ -68,6 +68,7 @@ echo " mounted on: $TOP_LEVEL_DATASET_MOUNTPOINT"
sync; sync; sync
echo 3 > /proc/sys/vm/drop_caches
zfs umount "${ZPOOL}/${TOP_LEVEL_DATASET}/haf_db_store/pgdata/pg_wal"
zfs umount "${ZPOOL}/${TOP_LEVEL_DATASET}/haf_db_store/pgdata"
zfs umount "${ZPOOL}/${TOP_LEVEL_DATASET}/haf_db_store/tablespace"
zfs umount "${ZPOOL}/${TOP_LEVEL_DATASET}/blockchain"
......@@ -77,8 +78,10 @@ zfs rollback "${ZPOOL}/${TOP_LEVEL_DATASET}@${SNAPSHOT_NAME}"
zfs rollback "${ZPOOL}/${TOP_LEVEL_DATASET}/blockchain@${SNAPSHOT_NAME}"
zfs rollback "${ZPOOL}/${TOP_LEVEL_DATASET}/haf_db_store/tablespace@${SNAPSHOT_NAME}"
zfs rollback "${ZPOOL}/${TOP_LEVEL_DATASET}/haf_db_store/pgdata@${SNAPSHOT_NAME}"
zfs rollback "${ZPOOL}/${TOP_LEVEL_DATASET}/haf_db_store/pgdata/pg_wal@${SNAPSHOT_NAME}"
zfs mount "${ZPOOL}/${TOP_LEVEL_DATASET}"
zfs mount "${ZPOOL}/${TOP_LEVEL_DATASET}/blockchain"
zfs mount "${ZPOOL}/${TOP_LEVEL_DATASET}/haf_db_store/tablespace"
zfs mount "${ZPOOL}/${TOP_LEVEL_DATASET}/haf_db_store/pgdata"
zfs mount "${ZPOOL}/${TOP_LEVEL_DATASET}/haf_db_store/pgdata/pg_wal"
......@@ -68,6 +68,7 @@ echo " mounted on: $TOP_LEVEL_DATASET_MOUNTPOINT"
sync; sync; sync
echo 3 > /proc/sys/vm/drop_caches
zfs umount "${ZPOOL}/${TOP_LEVEL_DATASET}/haf_db_store/pgdata/pg_wal"
zfs umount "${ZPOOL}/${TOP_LEVEL_DATASET}/haf_db_store/pgdata"
zfs umount "${ZPOOL}/${TOP_LEVEL_DATASET}/haf_db_store/tablespace"
zfs umount "${ZPOOL}/${TOP_LEVEL_DATASET}/blockchain"
......@@ -79,3 +80,4 @@ zfs mount "${ZPOOL}/${TOP_LEVEL_DATASET}"
zfs mount "${ZPOOL}/${TOP_LEVEL_DATASET}/blockchain"
zfs mount "${ZPOOL}/${TOP_LEVEL_DATASET}/haf_db_store/tablespace"
zfs mount "${ZPOOL}/${TOP_LEVEL_DATASET}/haf_db_store/pgdata"
zfs mount "${ZPOOL}/${TOP_LEVEL_DATASET}/haf_db_store/pgdata/pg_wal"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment