uint32_t middle_serial = zone_contents_serial(up.new_cont);
- if (do_diff && old_contents_exist && journal_conts == NULL && dnssec_enable) {
+ if (do_diff && old_contents_exist && dnssec_enable && !zone_journal_has_zij(zone)) {
ret = zone_update_start_extra(&up);
if (ret != KNOT_EOK) {
goto cleanup;
return txn.ret;
}
-int journal_info(zone_journal_t j, bool *exists, uint32_t *first_serial,
+int journal_info(zone_journal_t j, bool *exists, uint32_t *first_serial, bool *has_zij,
uint32_t *serial_to, bool *has_merged, uint32_t *merged_serial,
uint64_t *occupied, uint64_t *occupied_total)
{
if (first_serial != NULL) {
*first_serial = md.first_serial;
}
+ if (has_zij != NULL) {
+ *has_zij = journal_contains(&txn, true, 0, j.zone);
+ }
if (serial_to != NULL) {
*serial_to = md.serial_to;
}
* \param j Zone journal.
* \param exists Output: bool if the zone exists in the journal.
* \param first_serial Optional output: serial-from of the first changeset in journal.
+ * \param has_zij Optional output: bool if there is zone-in-journal.
* \param serial_to Optional output: serial.to of the last changeset in journal.
* \param has_merged Optional output: bool if there is a special (non zone-in-journal) merged changeset.
* \param merged_serial Optional output: serial-from of the merged changeset.
*
* \return KNOT_E*
*/
-int journal_info(zone_journal_t j, bool *exists, uint32_t *first_serial,
+int journal_info(zone_journal_t j, bool *exists, uint32_t *first_serial, bool *has_zij,
uint32_t *serial_to, bool *has_merged, uint32_t *merged_serial,
uint64_t *occupied, uint64_t *occupied_total);
/*! \brief Return true if this zone exists in journal DB. */
inline static bool journal_is_existing(zone_journal_t j) {
bool ex = false;
- (void)journal_info(j, &ex, NULL, NULL, NULL, NULL, NULL, NULL);
+ (void)journal_info(j, &ex, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
return ex;
}
zone_journal_t j = zone_journal(zone);
bool j_exists = false;
- int ret = journal_info(j, &j_exists, NULL, &j_serial_to, NULL, NULL, NULL, NULL);
+ int ret = journal_info(j, &j_exists, NULL, NULL, &j_serial_to, NULL, NULL, NULL, NULL);
if (ret != KNOT_EOK) {
return ret;
} else if (!j_exists) {
return flush_journal(conf, zone, false, verbose);
}
+bool zone_journal_has_zij(zone_t *zone)
+{
+ bool exists = false, zij = false;
+ journal_info(zone_journal(zone), &exists, NULL, &zij, NULL, NULL, NULL, NULL, NULL);
+ return exists && zij;
+}
+
zone_contents_t *zone_switch_contents(zone_t *zone, zone_contents_t *new_contents)
{
if (zone == NULL) {
/*! \brief Synchronize zone file with journal. */
int zone_flush_journal(conf_t *conf, zone_t *zone, bool verbose);
+bool zone_journal_has_zij(zone_t *zone);
+
/*!
* \brief Atomically switch the content of the zone.
*/
// Flush if bootstrapped or if the journal doesn't exist.
if (!zone->zonefile.exists || journal_info(
- zone_journal(zone), &exists, NULL, &journal_serial, NULL, NULL, NULL, NULL
+ zone_journal(zone), &exists, NULL, NULL, &journal_serial, NULL, NULL, NULL, NULL
) != KNOT_EOK || !exists || journal_serial != zone_serial) {
zone_flush_journal(conf(), zone, false);
}
return ret;
}
- ret = journal_info(j, &exists, NULL, NULL, NULL, NULL, &occupied, &occupied_all);
+ ret = journal_info(j, &exists, NULL, NULL, NULL, NULL, NULL, &occupied, &occupied_all);
if (ret != KNOT_EOK || !exists) {
fprintf(stderr, "This zone does not exist in DB %s\n", path);
knot_lmdb_deinit(&jdb);
static int merged_present(void)
{
bool exists, has_merged;
- return journal_info(jj, &exists, NULL, NULL, &has_merged, NULL, NULL, NULL) == KNOT_EOK && exists && has_merged;
+ return journal_info(jj, &exists, NULL, NULL, NULL, &has_merged, NULL, NULL, NULL) == KNOT_EOK && exists && has_merged;
}
static void test_merge(const knot_dname_t *apex)