diff options
Diffstat (limited to 'modules/apps/mariadb')
-rw-r--r-- | modules/apps/mariadb/default.nix | 15 | ||||
-rw-r--r-- | modules/apps/mariadb/mysqld.nix | 61 |
2 files changed, 73 insertions, 3 deletions
diff --git a/modules/apps/mariadb/default.nix b/modules/apps/mariadb/default.nix index 1c366ae..13b9626 100644 --- a/modules/apps/mariadb/default.nix +++ b/modules/apps/mariadb/default.nix @@ -14,8 +14,19 @@ let cfg = config.nixsap.apps.mariadb; - getDirs = l: map dirOf (filter (p: p != null && hasPrefix "/" p) l); - mydirs = [ cfg.mysqld.datadir ] ++ getDirs [ cfg.mysqld.log_bin cfg.mysqld.relay_log ]; + getDirs = l: filter (p: p != null) l; + dirsOf = l: map dirOf (getDirs l); + mydirs = with cfg.mysqld; unique ([ + datadir + ] ++ dirsOf [ + log_bin + relay_log + ] ++ getDirs [ + tokudb_data_dir + tokudb_log_dir + tokudb_tmp_dir + ]); + explicit = filterAttrs (n: v: n != "_module" && v != null); hasMasters = (explicit cfg.replicate) != {}; concatNonEmpty = sep: list: concatStringsSep sep (filter (s: s != "") list); diff --git a/modules/apps/mariadb/mysqld.nix b/modules/apps/mariadb/mysqld.nix index f8753a8..b2ed7d8 100644 --- a/modules/apps/mariadb/mysqld.nix +++ b/modules/apps/mariadb/mysqld.nix @@ -116,6 +116,16 @@ let check = isFloat; }; + pint = mkOptionType { + name = "positive integer"; + check = x: builtins.isInt x && x >= 0; + }; + + percent = mkOptionType { + name = "percent"; + check = x: builtins.isInt x && x >= 0 x <= 100; + }; + # https://mariadb.com/kb/en/mariadb/optimizer-switch/ optimizer = { options = { @@ -179,7 +189,7 @@ in { innodb_buffer_pool_load_at_startup = optional bool; innodb_buffer_pool_size = optional int; innodb_compression_algorithm = optional (enum ["none" "zlib" "lz4" "lzo" "lzma" "bzip2" "snappy"]); - innodb_compression_failure_threshold_pct = optional (addCheck int (i: 0 <= i && i <= 100)); + innodb_compression_failure_threshold_pct = optional percent; innodb_compression_level = optional (enum' [0 1 2 3 4 5 6 7 8 9]); innodb_compression_pad_pct_max = optional (addCheck int (i: 0 <= i && i <= 75)); innodb_doublewrite = optional bool; @@ -281,7 +291,56 @@ in { thread_cache_size = optional int; tmp_table_size = optional int; tmpdir = optional path; + tokudb_alter_print_error = optional bool; + tokudb_analyze_time = optional pint; + tokudb_block_size = optional pint; + tokudb_bulk_fetch = optional bool; + tokudb_cache_size = optional pint; + tokudb_check_jemalloc = optional bool; + tokudb_checkpoint_lock = optional bool; + tokudb_checkpoint_on_flush_logs = optional bool; + tokudb_checkpointing_period = optional pint; + tokudb_cleaner_iterations = optional pint; + tokudb_cleaner_period = optional pint; + tokudb_commit_sync = optional bool; + tokudb_create_index_online = optional bool; + tokudb_data_dir = optional path; + tokudb_debug = optional pint; + tokudb_directio = optional bool; + tokudb_disable_hot_alter = optional bool; + tokudb_disable_prefetching = optional bool; + tokudb_disable_slow_alter = optional bool; + tokudb_empty_scan = optional (enum ["lr" "rl" "disabled"]); + tokudb_fs_reserve_percent = optional percent; + tokudb_fsync_log_period = optional pint; + tokudb_hide_default_row_format = optional bool; + tokudb_killed_time = optional pint; + tokudb_last_lock_timeout = optional str; + tokudb_load_save_space = optional bool; + tokudb_loader_memory_size = optional pint; + tokudb_lock_timeout = optional pint; + tokudb_lock_timeout_debug = optional pint; + tokudb_log_dir = optional path; + tokudb_max_lock_memory = optional pint; + tokudb_optimize_index_fraction = optional float; + tokudb_optimize_index_name = optional str; + tokudb_optimize_throttle = optional pint; + tokudb_pk_insert_mode = optional (enum' [0 1 2]); + tokudb_prelock_empty = optional bool; + tokudb_read_block_size = optional (addCheck pint (p: p >= 4096)); + tokudb_read_buf_size = optional pint; + tokudb_read_status_frequency = optional pint; + tokudb_row_format = optional (enum ["tokudb_default" "tokudb_fast" "tokudb_small" "tokudb_zlib" "tokudb_quicklz" "tokudb_lzma" "tokudb_uncompressed"]); + tokudb_rpl_check_readonly = optional bool; + tokudb_rpl_lookup_rows = optional bool; + tokudb_rpl_lookup_rows_delay = optional pint; + tokudb_rpl_unique_checks = optional bool; + tokudb_rpl_unique_checks_delay = optional pint; + tokudb_support_xa = optional bool; + tokudb_tmp_dir = optional path; + tokudb_write_status_frequency = optional pint; wait_timeout = optional int; + }; config = { ignore_db_dirs = [ "lost+found" ]; |