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
24
Issues
24
List
Boards
Labels
Milestones
Merge Requests
6
Merge Requests
6
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
21fa0abd
Commit
21fa0abd
authored
Oct 25, 2016
by
Daniel Salzman
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ctl: purge also zone timers with zone-purge
parent
428a030f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
4 deletions
+53
-4
doc/man/knotc.8in
doc/man/knotc.8in
+1
-1
doc/man_knotc.rst
doc/man_knotc.rst
+1
-1
src/knot/ctl/commands.c
src/knot/ctl/commands.c
+4
-1
src/knot/zone/timers.c
src/knot/zone/timers.c
+34
-0
src/knot/zone/timers.h
src/knot/zone/timers.h
+12
-0
src/utils/knotc/commands.c
src/utils/knotc/commands.c
+1
-1
No files found.
doc/man/knotc.8in
View file @
21fa0abd
...
...
@@ -135,7 +135,7 @@ requires a ttl value specified.
Remove zone data within the transaction.
.TP
\fBzone\-purge\fP \fIzone\fP\&...
Purge zone data,
zone file, and zone journal
.
Purge zone data,
file, journal, and timers
.
.TP
\fBconf\-init\fP
Initialize the configuration database. (*)
...
...
doc/man_knotc.rst
View file @
21fa0abd
...
...
@@ -112,7 +112,7 @@ Actions
Remove zone data within the transaction.
**zone-purge** *zone*...
Purge zone data,
zone file, and zone journal
.
Purge zone data,
file, journal, and timers
.
**conf-init**
Initialize the configuration database. (*)
...
...
src/knot/ctl/commands.c
View file @
21fa0abd
...
...
@@ -22,6 +22,7 @@
#include "knot/ctl/commands.h"
#include "knot/events/handlers.h"
#include "knot/updates/zone-update.h"
#include "knot/zone/timers.h"
#include "libknot/libknot.h"
#include "libknot/yparser/yptrafo.h"
#include "contrib/macros.h"
...
...
@@ -915,7 +916,9 @@ static int zone_purge(zone_t *zone, ctl_args_t *args)
(
void
)
unlink
(
journalfile
);
free
(
journalfile
);
// TODO: Purge the zone timers (after zone events refactoring).
// Purge the zone timers.
(
void
)
remove_timer_db
(
args
->
server
->
timers_db
,
args
->
server
->
zone_db
,
zone
->
name
);
return
KNOT_EOK
;
}
...
...
src/knot/zone/timers.c
View file @
21fa0abd
...
...
@@ -219,6 +219,40 @@ int write_timer_db(knot_db_t *timer_db, knot_zonedb_t *zone_db)
return
db_api
->
txn_commit
(
&
txn
);
}
int
remove_timer_db
(
knot_db_t
*
timer_db
,
knot_zonedb_t
*
zone_db
,
const
knot_dname_t
*
zone_name
)
{
if
(
timer_db
==
NULL
)
{
return
KNOT_EOK
;
}
if
(
zone_db
==
NULL
||
zone_name
==
NULL
)
{
return
KNOT_EINVAL
;
}
const
knot_db_api_t
*
db_api
=
knot_db_lmdb_api
();
assert
(
db_api
);
knot_db_txn_t
txn
;
int
ret
=
db_api
->
txn_begin
(
timer_db
,
&
txn
,
KNOT_DB_SORTED
);
if
(
ret
!=
KNOT_EOK
)
{
return
ret
;
}
knot_db_val_t
key
=
{
.
data
=
(
void
*
)
zone_name
,
.
len
=
knot_dname_size
(
zone_name
)
};
ret
=
db_api
->
del
(
&
txn
,
&
key
);
if
(
ret
!=
KNOT_EOK
)
{
db_api
->
txn_abort
(
&
txn
);
return
ret
;
}
return
db_api
->
txn_commit
(
&
txn
);
}
int
sweep_timer_db
(
knot_db_t
*
timer_db
,
knot_zonedb_t
*
zone_db
)
{
if
(
timer_db
==
NULL
)
{
...
...
src/knot/zone/timers.h
View file @
21fa0abd
...
...
@@ -62,6 +62,18 @@ int read_zone_timers(knot_db_t *timer_db, const zone_t *zone, time_t *timers);
*/
int
write_timer_db
(
knot_db_t
*
timer_db
,
knot_zonedb_t
*
zone_db
);
/*!
* \brief Removes specific zone timers from timers db.
*
* \param timer_db Timer database.
* \param zone_db Zone database.
* \param zone_name Zone name.
*
* \return KNOT_E*
*/
int
remove_timer_db
(
knot_db_t
*
timer_db
,
knot_zonedb_t
*
zone_db
,
const
knot_dname_t
*
zone_name
);
/*!
* \brief Removes stale zones info from timers db.
*
...
...
src/utils/knotc/commands.c
View file @
21fa0abd
...
...
@@ -930,7 +930,7 @@ static const cmd_help_t cmd_help_table[] = {
{
CMD_ZONE_GET
,
"<zone> [<owner> [<type>]]"
,
"Get zone data within the transaction."
},
{
CMD_ZONE_SET
,
"<zone> <owner> [<ttl>] <type> <rdata>"
,
"Add zone record within the transaction."
},
{
CMD_ZONE_UNSET
,
"<zone> <owner> [<type> [<rdata>]]"
,
"Remove zone data within the transaction."
},
{
CMD_ZONE_PURGE
,
"<zone>..."
,
"Purge zone data,
zone file, and zone journal
."
},
{
CMD_ZONE_PURGE
,
"<zone>..."
,
"Purge zone data,
file, journal, and timers
."
},
{
""
,
""
,
""
},
{
CMD_CONF_INIT
,
""
,
"Initialize the confdb. (*)"
},
{
CMD_CONF_CHECK
,
""
,
"Check the server configuration. (*)"
},
...
...
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