mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 06:55:30 +00:00
Merge branch '2732-pause-the-dbiterator-in-dumptostream' into 'main'
Pause the dbiterator when dumping the zone to the disk Closes #2732 See merge request isc-projects/bind9!5150
This commit is contained in:
@@ -254,7 +254,6 @@ struct dns_dumpctx {
|
|||||||
isc_mutex_t lock;
|
isc_mutex_t lock;
|
||||||
isc_refcount_t references;
|
isc_refcount_t references;
|
||||||
atomic_bool canceled;
|
atomic_bool canceled;
|
||||||
bool first;
|
|
||||||
bool do_date;
|
bool do_date;
|
||||||
isc_stdtime_t now;
|
isc_stdtime_t now;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
@@ -1578,7 +1577,6 @@ dumpctx_create(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
|
|||||||
dctx->done = NULL;
|
dctx->done = NULL;
|
||||||
dctx->done_arg = NULL;
|
dctx->done_arg = NULL;
|
||||||
dctx->task = NULL;
|
dctx->task = NULL;
|
||||||
dctx->first = true;
|
|
||||||
atomic_init(&dctx->canceled, false);
|
atomic_init(&dctx->canceled, false);
|
||||||
dctx->file = NULL;
|
dctx->file = NULL;
|
||||||
dctx->tmpfile = NULL;
|
dctx->tmpfile = NULL;
|
||||||
@@ -1737,7 +1735,6 @@ dumptostream(dns_dumpctx_t *dctx) {
|
|||||||
char *bufmem;
|
char *bufmem;
|
||||||
dns_name_t *name;
|
dns_name_t *name;
|
||||||
dns_fixedname_t fixname;
|
dns_fixedname_t fixname;
|
||||||
isc_time_t start;
|
|
||||||
|
|
||||||
bufmem = isc_mem_get(dctx->mctx, initial_buffer_length);
|
bufmem = isc_mem_get(dctx->mctx, initial_buffer_length);
|
||||||
|
|
||||||
@@ -1745,32 +1742,24 @@ dumptostream(dns_dumpctx_t *dctx) {
|
|||||||
|
|
||||||
name = dns_fixedname_initname(&fixname);
|
name = dns_fixedname_initname(&fixname);
|
||||||
|
|
||||||
if (dctx->first) {
|
CHECK(writeheader(dctx));
|
||||||
CHECK(writeheader(dctx));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fast format is not currently written incrementally,
|
* Fast format is not currently written incrementally,
|
||||||
* so we make the call to dns_db_serialize() here.
|
* so we make the call to dns_db_serialize() here.
|
||||||
* If the database is anything other than an rbtdb,
|
* If the database is anything other than an rbtdb,
|
||||||
* this should result in not implemented
|
* this should result in not implemented
|
||||||
*/
|
*/
|
||||||
if (dctx->format == dns_masterformat_map) {
|
if (dctx->format == dns_masterformat_map) {
|
||||||
result = dns_db_serialize(dctx->db, dctx->version,
|
result = dns_db_serialize(dctx->db, dctx->version, dctx->f);
|
||||||
dctx->f);
|
goto cleanup;
|
||||||
goto cleanup;
|
}
|
||||||
}
|
|
||||||
|
result = dns_dbiterator_first(dctx->dbiter);
|
||||||
result = dns_dbiterator_first(dctx->dbiter);
|
if (result != ISC_R_SUCCESS && result != ISC_R_NOMORE) {
|
||||||
if (result != ISC_R_SUCCESS && result != ISC_R_NOMORE) {
|
goto cleanup;
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
dctx->first = false;
|
|
||||||
} else {
|
|
||||||
result = ISC_R_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isc_time_now(&start);
|
|
||||||
while (result == ISC_R_SUCCESS) {
|
while (result == ISC_R_SUCCESS) {
|
||||||
dns_rdatasetiter_t *rdsiter = NULL;
|
dns_rdatasetiter_t *rdsiter = NULL;
|
||||||
dns_dbnode_t *node = NULL;
|
dns_dbnode_t *node = NULL;
|
||||||
@@ -1790,6 +1779,10 @@ dumptostream(dns_dumpctx_t *dctx) {
|
|||||||
}
|
}
|
||||||
dctx->tctx.neworigin = origin;
|
dctx->tctx.neworigin = origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result = dns_dbiterator_pause(dctx->dbiter);
|
||||||
|
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||||
|
|
||||||
result = dns_db_allrdatasets(dctx->db, node, dctx->version,
|
result = dns_db_allrdatasets(dctx->db, node, dctx->version,
|
||||||
dctx->now, &rdsiter);
|
dctx->now, &rdsiter);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
|
Reference in New Issue
Block a user