Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Knot DNS
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
22
Issues
22
List
Boards
Labels
Service Desk
Milestones
Merge Requests
16
Merge Requests
16
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Knot projects
Knot DNS
Commits
9e99c527
Commit
9e99c527
authored
Feb 13, 2019
by
Libor Peltan
Committed by
Daniel Salzman
Apr 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zone-in-journal: load journal directly into zone contents
parent
072e09f8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
37 deletions
+21
-37
src/knot/updates/changesets.c
src/knot/updates/changesets.c
+0
-17
src/knot/updates/changesets.h
src/knot/updates/changesets.h
+0
-10
src/knot/zone/zone-load.c
src/knot/zone/zone-load.c
+21
-10
No files found.
src/knot/updates/changesets.c
View file @
9e99c527
...
...
@@ -503,23 +503,6 @@ bool changeset_differs_just_serial(const changeset_t *ch)
return
ret
;
}
int
changeset_to_contents
(
changeset_t
*
ch
,
zone_contents_t
**
out
)
{
assert
(
ch
->
soa_from
==
NULL
);
assert
(
zone_contents_is_empty
(
ch
->
remove
));
assert
(
out
!=
NULL
);
*
out
=
ch
->
add
;
int
ret
=
add_rr_to_contents
(
*
out
,
ch
->
soa_to
);
knot_rrset_free
(
ch
->
soa_to
,
NULL
);
if
(
ret
!=
KNOT_EOK
)
{
zone_contents_deep_free
(
*
out
);
}
zone_contents_deep_free
(
ch
->
remove
);
return
ret
;
}
changeset_t
*
changeset_from_contents
(
const
zone_contents_t
*
contents
)
{
zone_contents_t
*
copy
=
NULL
;
...
...
src/knot/updates/changesets.h
View file @
9e99c527
...
...
@@ -192,16 +192,6 @@ int changeset_cancelout(changeset_t *ch);
*/
bool
changeset_differs_just_serial
(
const
changeset_t
*
ch
);
/*!
* \brief Loads zone contents from botstrap changeset.
*
* \param ch Changeset to load from, will be freed!
* \param out Zone contents.
*
* \return KNOT_E*
*/
int
changeset_to_contents
(
changeset_t
*
ch
,
zone_contents_t
**
out
);
/*!
* \brief Creates a bootstrap changeset from zone.
*
...
...
src/knot/zone/zone-load.c
View file @
9e99c527
...
...
@@ -114,35 +114,46 @@ int zone_load_from_journal(conf_t *conf, zone_t *zone, zone_contents_t **content
return
KNOT_EINVAL
;
}
*
contents
=
zone_contents_new
(
zone
->
name
);
if
(
*
contents
==
NULL
)
{
return
KNOT_ENOMEM
;
}
journal_read_t
*
read
=
NULL
;
int
ret
=
journal_read_begin
(
zone_journal
(
zone
),
true
,
0
,
&
read
);
if
(
ret
!=
KNOT_EOK
)
{
if
(
ret
==
KNOT_ENOENT
)
{
zone_contents_free
(
*
contents
);
return
ret
;
}
changeset_t
zone_in_j
;
apply_ctx_t
a_ctx
=
{
0
};
ret
=
journal_read_changeset
(
read
,
&
zone_in_j
)
?
KNOT_EOK
:
KNOT_ENOENT
;
if
(
ret
==
KNOT_EOK
)
{
ret
=
changeset_to_contents
(
&
zone_in_j
,
contents
);
knot_rrset_t
rr
=
{
0
}
;
while
(
ret
==
KNOT_EOK
&&
journal_read_rrset
(
read
,
&
rr
,
false
))
{
zone_node_t
*
unused
=
NULL
;
ret
=
zone_contents_add_rr
(
*
contents
,
&
rr
,
&
unused
);
journal_read_clear_rrset
(
&
rr
);
}
apply_ctx_t
a_ctx
=
{
0
};
if
(
ret
==
KNOT_EOK
)
{
ret
=
apply_init_ctx
(
&
a_ctx
,
*
contents
,
0
);
}
if
(
ret
!=
KNOT_EOK
)
{
if
(
ret
==
KNOT_EOK
)
{
ret
=
journal_read_rrsets
(
read
,
apply_one_cb
,
&
a_ctx
);
}
else
{
journal_read_end
(
read
);
return
ret
;
}
if
(
a_ctx
.
contents
!=
NULL
)
{
update_cleanup
(
&
a_ctx
);
}
ret
=
journal_read_rrsets
(
read
,
apply_one_cb
,
&
a_ctx
);
if
(
ret
==
KNOT_EOK
)
{
log_zone_info
(
zone
->
name
,
"zone loaded from journal, serial %u"
,
zone_contents_serial
(
*
contents
));
}
else
{
log_zone_error
(
zone
->
name
,
"failed to load zone from journal (%s)"
,
knot_strerror
(
ret
));
zone_contents_deep_free
(
*
contents
);
}
update_cleanup
(
&
a_ctx
);
return
ret
;
}
...
...
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