Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Knot DNS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
23
Issues
23
List
Boards
Labels
Milestones
Merge Requests
5
Merge Requests
5
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Knot projects
Knot DNS
Commits
0e8b3c40
Commit
0e8b3c40
authored
Dec 04, 2018
by
Libor Peltan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
journal: drop when any axfr-like change to zone
parent
be10afd0
Changes
6
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
11 deletions
+43
-11
src/knot/journal/journal.c
src/knot/journal/journal.c
+5
-0
src/knot/journal/journal.h
src/knot/journal/journal.h
+9
-0
src/knot/updates/zone-update.c
src/knot/updates/zone-update.c
+3
-4
src/knot/zone/zone.c
src/knot/zone/zone.c
+18
-0
src/knot/zone/zone.h
src/knot/zone/zone.h
+1
-0
tests/knot/test_journal.c
tests/knot/test_journal.c
+7
-7
No files found.
src/knot/journal/journal.c
View file @
0e8b3c40
...
@@ -1940,6 +1940,11 @@ void journal_metadata_info(journal_t *j, bool *has_bootstrap, kserial_t *merged_
...
@@ -1940,6 +1940,11 @@ void journal_metadata_info(journal_t *j, bool *has_bootstrap, kserial_t *merged_
txn_abort
(
txn
);
txn_abort
(
txn
);
}
}
int
journal_drop_changesets
(
journal_t
*
journal
)
{
return
drop_journal
(
journal
,
NULL
);
}
int
journal_db_list_zones
(
journal_db_t
**
db
,
list_t
*
zones
)
int
journal_db_list_zones
(
journal_db_t
**
db
,
list_t
*
zones
)
{
{
uint64_t
expected_count
;
uint64_t
expected_count
;
...
...
src/knot/journal/journal.h
View file @
0e8b3c40
...
@@ -221,6 +221,15 @@ void journal_metadata_info(journal_t *journal, bool *is_empty, kserial_t *merged
...
@@ -221,6 +221,15 @@ void journal_metadata_info(journal_t *journal, bool *is_empty, kserial_t *merged
kserial_t
*
first_serial
,
kserial_t
*
last_flushed
,
kserial_t
*
first_serial
,
kserial_t
*
last_flushed
,
kserial_t
*
serial_to
,
uint64_t
*
occupied
,
uint64_t
*
occupied_all_zones
);
kserial_t
*
serial_to
,
uint64_t
*
occupied
,
uint64_t
*
occupied_all_zones
);
/*!
* \brief Delete all changesets in zone's journal, keeping metadata.
*
* \param journal Journal to clear.
*
* \return KNOT_E*
*/
int
journal_drop_changesets
(
journal_t
*
journal
);
/*! \brief Check the journal consistency, errors to stderr.
/*! \brief Check the journal consistency, errors to stderr.
*
*
* \param journal Journal to check.
* \param journal Journal to check.
...
...
src/knot/updates/zone-update.c
View file @
0e8b3c40
...
@@ -651,14 +651,13 @@ static int commit_full(conf_t *conf, zone_update_t *update, zone_contents_t **co
...
@@ -651,14 +651,13 @@ static int commit_full(conf_t *conf, zone_update_t *update, zone_contents_t **co
conf_val_t
val
=
conf_zone_get
(
conf
,
C_JOURNAL_CONTENT
,
update
->
zone
->
name
);
conf_val_t
val
=
conf_zone_get
(
conf
,
C_JOURNAL_CONTENT
,
update
->
zone
->
name
);
if
(
conf_opt
(
&
val
)
==
JOURNAL_CONTENT_ALL
)
{
if
(
conf_opt
(
&
val
)
==
JOURNAL_CONTENT_ALL
)
{
ret
=
zone_in_journal_store
(
conf
,
update
->
zone
,
update
->
new_cont
);
ret
=
zone_in_journal_store
(
conf
,
update
->
zone
,
update
->
new_cont
);
if
(
ret
!=
KNOT_EOK
)
{
}
else
{
// zone_in_journal_store does this automatically
return
ret
;
ret
=
zone_changes_clear
(
conf
,
update
->
zone
);
}
}
}
*
contents_out
=
update
->
new_cont
;
*
contents_out
=
update
->
new_cont
;
return
KNOT_EOK
;
return
ret
;
}
}
/*! \brief Routine for calling call_rcu() easier way.
/*! \brief Routine for calling call_rcu() easier way.
...
...
src/knot/zone/zone.c
View file @
0e8b3c40
...
@@ -295,6 +295,24 @@ int zone_change_store(conf_t *conf, zone_t *zone, changeset_t *change)
...
@@ -295,6 +295,24 @@ int zone_change_store(conf_t *conf, zone_t *zone, changeset_t *change)
return
ret
;
return
ret
;
}
}
int
zone_changes_clear
(
conf_t
*
conf
,
zone_t
*
zone
)
{
if
(
conf
==
NULL
||
zone
==
NULL
)
{
return
KNOT_EINVAL
;
}
JOURNAL_LOCK_RW
int
ret
=
open_journal
(
zone
);
if
(
ret
==
KNOT_EOK
)
{
ret
=
journal_drop_changesets
(
zone
->
journal
);
}
JOURNAL_UNLOCK_RW
return
ret
;
}
int
zone_changes_load
(
conf_t
*
conf
,
zone_t
*
zone
,
list_t
*
dst
,
uint32_t
from
)
int
zone_changes_load
(
conf_t
*
conf
,
zone_t
*
zone
,
list_t
*
dst
,
uint32_t
from
)
{
{
if
(
conf
==
NULL
||
zone
==
NULL
||
dst
==
NULL
)
{
if
(
conf
==
NULL
||
zone
==
NULL
||
dst
==
NULL
)
{
...
...
src/knot/zone/zone.h
View file @
0e8b3c40
...
@@ -115,6 +115,7 @@ void zone_free(zone_t **zone_ptr);
...
@@ -115,6 +115,7 @@ void zone_free(zone_t **zone_ptr);
void
zone_control_clear
(
zone_t
*
zone
);
void
zone_control_clear
(
zone_t
*
zone
);
int
zone_change_store
(
conf_t
*
conf
,
zone_t
*
zone
,
changeset_t
*
change
);
int
zone_change_store
(
conf_t
*
conf
,
zone_t
*
zone
,
changeset_t
*
change
);
int
zone_changes_clear
(
conf_t
*
conf
,
zone_t
*
zone
);
int
zone_changes_load
(
conf_t
*
conf
,
zone_t
*
zone
,
list_t
*
dst
,
uint32_t
from
);
int
zone_changes_load
(
conf_t
*
conf
,
zone_t
*
zone
,
list_t
*
dst
,
uint32_t
from
);
int
zone_chgset_ctx_load
(
conf_t
*
conf
,
zone_t
*
zone
,
chgset_ctx_list_t
*
dst
,
uint32_t
from
);
int
zone_chgset_ctx_load
(
conf_t
*
conf
,
zone_t
*
zone
,
chgset_ctx_list_t
*
dst
,
uint32_t
from
);
int
zone_in_journal_load
(
conf_t
*
conf
,
zone_t
*
zone
,
list_t
*
dst
);
int
zone_in_journal_load
(
conf_t
*
conf
,
zone_t
*
zone
,
list_t
*
dst
);
...
...
tests/knot/test_journal.c
View file @
0e8b3c40
...
@@ -415,8 +415,8 @@ static void test_store_load(void)
...
@@ -415,8 +415,8 @@ static void test_store_load(void)
init_list
(
&
l
);
init_list
(
&
l
);
ret
=
journal_flush
(
j
);
ret
=
journal_flush
(
j
);
is_int
(
KNOT_EOK
,
ret
,
"journal: allways ok journal_flush 0"
);
is_int
(
KNOT_EOK
,
ret
,
"journal: allways ok journal_flush 0"
);
ret
=
drop_journal
(
j
,
NULL
);
/* Clear the journal for the collision test */
ret
=
journal_drop_changesets
(
j
);
/* Clear the journal for the collision test */
is_int
(
KNOT_EOK
,
ret
,
"journal: allways ok
drop_journal
"
);
is_int
(
KNOT_EOK
,
ret
,
"journal: allways ok
journal_drop_changesets
"
);
/* Test for serial number collision handling. We insert changesets
/* Test for serial number collision handling. We insert changesets
* with valid serial sequence that overflows and then collides with itself.
* with valid serial sequence that overflows and then collides with itself.
...
@@ -468,8 +468,8 @@ static void test_store_load(void)
...
@@ -468,8 +468,8 @@ static void test_store_load(void)
init_list
(
&
k
);
init_list
(
&
k
);
/* Check bootstrap changeset */
/* Check bootstrap changeset */
ret
=
drop_journal
(
j
,
NULL
);
ret
=
journal_drop_changesets
(
j
);
ok
(
ret
==
KNOT_EOK
,
"journal:
drop_journal
must be ok"
);
ok
(
ret
==
KNOT_EOK
,
"journal:
journal_drop_changesets
must be ok"
);
changeset_t
*
m_ch6
=
changeset_new
(
apex
);
changeset_t
*
m_ch6
=
changeset_new
(
apex
);
init_random_changeset
(
m_ch6
,
0
,
1
,
128
,
apex
,
true
);
init_random_changeset
(
m_ch6
,
0
,
1
,
128
,
apex
,
true
);
...
@@ -622,8 +622,8 @@ static void test_merge(void)
...
@@ -622,8 +622,8 @@ static void test_merge(void)
set_conf
(
-
1
,
512
*
1024
);
set_conf
(
-
1
,
512
*
1024
);
ok
(
journal_merge_allowed
(
j
),
"journal: merge allowed"
);
ok
(
journal_merge_allowed
(
j
),
"journal: merge allowed"
);
ret
=
drop_journal
(
j
,
NULL
);
ret
=
journal_drop_changesets
(
j
);
is_int
(
KNOT_EOK
,
ret
,
"journal:
drop_journal
must be ok"
);
is_int
(
KNOT_EOK
,
ret
,
"journal:
journal_drop_changesets
must be ok"
);
// insert stuff and check the merge
// insert stuff and check the merge
for
(
i
=
0
;
!
merged_present
()
&&
i
<
40000
;
i
++
)
{
for
(
i
=
0
;
!
merged_present
()
&&
i
<
40000
;
i
++
)
{
...
@@ -652,7 +652,7 @@ static void test_merge(void)
...
@@ -652,7 +652,7 @@ static void test_merge(void)
ok
(
list_size
(
&
l
)
==
4
,
"journal: read short history of merged/unmerged changesets"
);
ok
(
list_size
(
&
l
)
==
4
,
"journal: read short history of merged/unmerged changesets"
);
changesets_free
(
&
l
);
changesets_free
(
&
l
);
ret
=
drop_journal
(
j
,
NULL
);
ret
=
journal_drop_changesets
(
j
);
assert
(
ret
==
KNOT_EOK
);
assert
(
ret
==
KNOT_EOK
);
// disallow merge
// disallow merge
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment