mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-08 18:52:07 -04:00
get foundname from the node
when calling dns_qp_lookup() from qpcache, instead of passing 'foundname' so that a name would be constructed from the QP key, we now just use the name field in the node data. this makes dns_qp_lookup() run faster. the same optimization has also been added to qpzone. the documentation for dns_qp_lookup() has been updated to discuss this performance consideration.
This commit is contained in:
parent
04d319afe4
commit
2789e58473
4 changed files with 36 additions and 20 deletions
|
|
@ -536,9 +536,12 @@ dns_qp_lookup(dns_qpreadable_t qpr, const dns_name_t *name,
|
|||
*
|
||||
* If 'foundname' is not NULL, it will be updated to contain the name
|
||||
* that was found (if any). The return code, ISC_R_SUCCESS or
|
||||
* DNS_R_PARTIALMATCH, indicates whether the name found is name that
|
||||
* was requested, or an ancestor. If the result is ISC_R_NOTFOUND,
|
||||
* 'foundname' will not be updated.
|
||||
* DNS_R_PARTIALMATCH, indicates whether the name found is the name
|
||||
* that was requested, or an ancestor. If the result is ISC_R_NOTFOUND,
|
||||
* 'foundname' will not be updated. (NOTE: the name will be constructed
|
||||
* from the QP key of the found node, and this can be time-consuming.
|
||||
* In performance-critical code, it is faster to store a copy of the
|
||||
* name in the node data and use that instead of passing 'foundname'.)
|
||||
*
|
||||
* If 'chain' is not NULL, it is updated to contain a QP chain with
|
||||
* references to the populated nodes in the tree between the root and
|
||||
|
|
|
|||
|
|
@ -278,9 +278,12 @@ dns_nametree_covered(dns_nametree_t *nametree, const dns_name_t *name,
|
|||
REQUIRE(VALID_NAMETREE(nametree));
|
||||
|
||||
dns_qpmulti_query(nametree->table, &qpr);
|
||||
result = dns_qp_lookup(&qpr, name, found, NULL, NULL, (void **)&node,
|
||||
result = dns_qp_lookup(&qpr, name, NULL, NULL, NULL, (void **)&node,
|
||||
NULL);
|
||||
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
|
||||
if (found != NULL) {
|
||||
dns_name_copy(&node->name, found);
|
||||
}
|
||||
switch (nametree->type) {
|
||||
case DNS_NAMETREE_BOOL:
|
||||
ret = node->set;
|
||||
|
|
|
|||
|
|
@ -1499,11 +1499,12 @@ find_coveringnsec(search_t *search, const dns_name_t *name,
|
|||
* Lookup the predecessor in the main tree.
|
||||
*/
|
||||
node = NULL;
|
||||
result = dns_qp_lookup(search->qpdb->tree, predecessor, fname, NULL,
|
||||
result = dns_qp_lookup(search->qpdb->tree, predecessor, NULL, NULL,
|
||||
NULL, (void **)&node, NULL);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
dns_name_copy(&node->name, fname);
|
||||
|
||||
lock = &(search->qpdb->node_locks[node->locknum].lock);
|
||||
NODE_RDLOCK(lock, &nlocktype);
|
||||
|
|
@ -1597,8 +1598,11 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
|
|||
/*
|
||||
* Search down from the root of the tree.
|
||||
*/
|
||||
result = dns_qp_lookup(search.qpdb->tree, name, foundname, NULL,
|
||||
result = dns_qp_lookup(search.qpdb->tree, name, NULL, NULL,
|
||||
&search.chain, (void **)&node, NULL);
|
||||
if (result != ISC_R_NOTFOUND && foundname != NULL) {
|
||||
dns_name_copy(&node->name, foundname);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the QP chain to see if there's a node above us with a
|
||||
|
|
@ -1619,17 +1623,16 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
|
|||
dns_qpchain_node(&search.chain, i, NULL, (void **)&encloser,
|
||||
NULL);
|
||||
|
||||
if (encloser->delegating) {
|
||||
zcresult = check_zonecut(
|
||||
encloser, (void *)&search DNS__DB_FLARG_PASS);
|
||||
if (zcresult != DNS_R_CONTINUE) {
|
||||
result = DNS_R_PARTIALMATCH;
|
||||
dns_qpchain_node(&search.chain, i, foundname,
|
||||
NULL, NULL);
|
||||
search.chain.len = i - 1;
|
||||
node = encloser;
|
||||
break;
|
||||
zcresult = check_zonecut(encloser,
|
||||
(void *)&search DNS__DB_FLARG_PASS);
|
||||
if (zcresult != DNS_R_CONTINUE) {
|
||||
result = DNS_R_PARTIALMATCH;
|
||||
search.chain.len = i - 1;
|
||||
node = encloser;
|
||||
if (foundname != NULL) {
|
||||
dns_name_copy(&node->name, foundname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2034,8 +2037,11 @@ findzonecut(dns_db_t *db, const dns_name_t *name, unsigned int options,
|
|||
/*
|
||||
* Search down from the root of the tree.
|
||||
*/
|
||||
result = dns_qp_lookup(search.qpdb->tree, name, dcname, NULL,
|
||||
result = dns_qp_lookup(search.qpdb->tree, name, NULL, NULL,
|
||||
&search.chain, (void **)&node, NULL);
|
||||
if (result != ISC_R_NOTFOUND) {
|
||||
dns_name_copy(&node->name, dcname);
|
||||
}
|
||||
if ((options & DNS_DBFIND_NOEXACT) != 0 && result == ISC_R_SUCCESS) {
|
||||
int len = dns_qpchain_length(&search.chain);
|
||||
if (len >= 2) {
|
||||
|
|
|
|||
|
|
@ -3382,8 +3382,11 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
|
|||
/*
|
||||
* Search down from the root of the tree.
|
||||
*/
|
||||
result = dns_qp_lookup(&search.qpr, name, foundname, &search.iter,
|
||||
result = dns_qp_lookup(&search.qpr, name, NULL, &search.iter,
|
||||
&search.chain, (void **)&node, NULL);
|
||||
if (result != ISC_R_NOTFOUND) {
|
||||
dns_name_copy(&node->name, foundname);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the QP chain to see if there's a node above us with a
|
||||
|
|
@ -3404,10 +3407,11 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
|
|||
tresult = check_zonecut(n, &search DNS__DB_FLARG_PASS);
|
||||
if (tresult != DNS_R_CONTINUE) {
|
||||
result = tresult;
|
||||
dns_qpchain_node(&search.chain, i, foundname, NULL,
|
||||
NULL);
|
||||
search.chain.len = i - 1;
|
||||
node = n;
|
||||
if (foundname != NULL) {
|
||||
dns_name_copy(&node->name, foundname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue