diff --git a/doc/man/knot.conf.5in b/doc/man/knot.conf.5in index 9efc6b5ce140aebf5fe90df9d04bd2f0f8ab8697..09eee095001f1c2dd5bb1e7be274767fecda8fba 100644 --- a/doc/man/knot.conf.5in +++ b/doc/man/knot.conf.5in @@ -694,8 +694,9 @@ Definition of zones served by the server. zone: \- domain: DNAME template: template_id - file: STR storage: STR + file: STR + journal: STR master: remote_id ... ddns\-master: remote_id notify: remote_id ... @@ -724,6 +725,11 @@ A zone name identifier. A \fI\%reference\fP to a configuration template. .sp \fIDefault:\fP not set or \fIdefault\fP (if the template exists) +.SS storage +.sp +A data directory for storing zone files, journal files and timers database. +.sp +\fIDefault:\fP \fB${localstatedir}/lib/knot\fP (configured with \fB\-\-with\-storage=path\fP) .SS file .sp A path to the zone file. Non absolute path is relative to @@ -749,11 +755,13 @@ terminating dot (the result for the root zone is the empty string!). .UNINDENT .sp \fIDefault:\fP \fI\%storage\fP/\fB%s\fP\&.zone -.SS storage +.SS journal .sp -A data directory for storing zone files, journal files and timers database. +A path to the zone journal. Non absolute path is relative to +\fI\%storage\fP\&. The same set of formatters as for +\fI\%file\fP is supported. .sp -\fIDefault:\fP \fB${localstatedir}/lib/knot\fP (configured with \fB\-\-with\-storage=path\fP) +\fIDefault:\fP \fI\%storage\fP/\fB%s\fP\&.db .SS master .sp An ordered list of \fI\%references\fP to zone master servers. diff --git a/doc/reference.rst b/doc/reference.rst index 8307a955fe26c6c5b845fc0aa88865cc73b3151b..20c0eeb1e93b4d12ec3c3776ea3b34a6b55404c5 100644 --- a/doc/reference.rst +++ b/doc/reference.rst @@ -834,8 +834,9 @@ Definition of zones served by the server. zone: - domain: DNAME template: template_id - file: STR storage: STR + file: STR + journal: STR master: remote_id ... ddns-master: remote_id notify: remote_id ... @@ -869,6 +870,15 @@ A :ref:`reference<template_id>` to a configuration template. *Default:* not set or *default* (if the template exists) +.. _zone_storage: + +storage +------- + +A data directory for storing zone files, journal files and timers database. + +*Default:* ``${localstatedir}/lib/knot`` (configured with ``--with-storage=path``) + .. _zone_file: file @@ -893,14 +903,16 @@ A path to the zone file. Non absolute path is relative to *Default:* :ref:`storage<zone_storage>`/``%s``\ .zone -.. _zone_storage: +.. _zone_journal: -storage +journal ------- -A data directory for storing zone files, journal files and timers database. +A path to the zone journal. Non absolute path is relative to +:ref:`storage<zone_storage>`. The same set of formatters as for +:ref:`file<zone_file>` is supported. -*Default:* ``${localstatedir}/lib/knot`` (configured with ``--with-storage=path``) +*Default:* :ref:`storage<zone_storage>`/``%s``\ .db .. _zone_master: diff --git a/src/knot/conf/conf.c b/src/knot/conf/conf.c index 5a1de91678ab964b9d21729d5e6d2ff0c1e62cfb..8d3c27ba0839ae375474592bcd23adc8b406eced 100644 --- a/src/knot/conf/conf.c +++ b/src/knot/conf/conf.c @@ -1062,7 +1062,15 @@ char* conf_journalfile_txn( return NULL; } - return get_filename(conf, txn, zone, "%s.db"); + conf_val_t val = conf_zone_get_txn(conf, txn, C_JOURNAL, zone); + const char *journal = conf_str(&val); + + // Use default journalfile name pattern if not specified. + if (journal == NULL) { + journal = "%s.db"; + } + + return get_filename(conf, txn, zone, journal); } size_t conf_udp_threads_txn( diff --git a/src/knot/conf/scheme.c b/src/knot/conf/scheme.c index 27f75aca4681b2ef81354ef8c33d3202dd3ca3b6..a7ccaa8dc9b781ae02e09bf2001c08479e2cb93c 100644 --- a/src/knot/conf/scheme.c +++ b/src/knot/conf/scheme.c @@ -216,8 +216,9 @@ static const yp_item_t desc_remote[] = { }; #define ZONE_ITEMS(FLAGS) \ - { C_FILE, YP_TSTR, YP_VNONE, FLAGS }, \ { C_STORAGE, YP_TSTR, YP_VSTR = { STORAGE_DIR }, FLAGS }, \ + { C_FILE, YP_TSTR, YP_VNONE, FLAGS }, \ + { C_JOURNAL, YP_TSTR, YP_VNONE, FLAGS }, \ { C_MASTER, YP_TREF, YP_VREF = { C_RMT }, YP_FMULTI, { check_ref } }, \ { C_DDNS_MASTER, YP_TREF, YP_VREF = { C_RMT }, YP_FNONE, { check_ref } }, \ { C_NOTIFY, YP_TREF, YP_VREF = { C_RMT }, YP_FMULTI, { check_ref } }, \ diff --git a/src/knot/conf/scheme.h b/src/knot/conf/scheme.h index 963763a90558bf64ef5e6995ef73629f493ec9d3..87546961cb865c8909e8b227b374f2c5cf301360 100644 --- a/src/knot/conf/scheme.h +++ b/src/knot/conf/scheme.h @@ -52,6 +52,7 @@ #define C_IDENT "\x08""identity" #define C_INCL "\x07""include" #define C_IXFR_DIFF "\x15""ixfr-from-differences" +#define C_JOURNAL "\x07""journal" #define C_KASP_DB "\x07""kasp-db" #define C_KEY "\x03""key" #define C_KEYSTORE "\x08""keystore"