* if some of the views share a single cache. But since the
* operation is lightweight we prefer simplicity here.
*/
- result = dns_view_flushnode(view, name, tree);
+ if (dns_name_equal(name, dns_rootname)) {
+ result = dns_view_flushcache(view, false);
+ } else {
+ result = dns_view_flushnode(view, name, tree);
+ }
if (result != ISC_R_SUCCESS) {
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
ISC_LOG_ERROR,
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
+n=$((n + 1))
+echo_i "check 'flushtree .' is equivalent to 'flush' ($n)"
+ret=0
+clear_cache
+dump_cache
+grep -v DATE ns2/named_dump.db.test$n >ns2/named_dump.db.test$n.a
+load_cache
+dump_cache
+grep -v DATE ns2/named_dump.db.test$n >ns2/named_dump.db.test$n.b
+$RNDC $RNDCOPTS flushtree . || ret=1
+dump_cache
+grep -v DATE ns2/named_dump.db.test$n >ns2/named_dump.db.test$n.c
+cmp -s ns2/named_dump.db.test$n.a ns2/named_dump.db.test$n.b && ret=1
+cmp -s ns2/named_dump.db.test$n.a ns2/named_dump.db.test$n.c || ret=1
+status=$((status + ret))
+
echo_i "exit status: $status"
[ $status -eq 0 ] || exit 1
dns_dbnode_t *node = NULL;
dns_db_t *db = NULL;
- if (tree && dns_name_equal(name, dns_rootname)) {
- return dns_cache_flush(cache);
- }
+ REQUIRE(!(tree && dns_name_equal(name, dns_rootname)));
LOCK(&cache->lock);
if (cache->db != NULL) {
isc_result_t
dns_cache_flushnode(dns_cache_t *cache, const dns_name_t *name, bool tree);
/*
- * Flush a given name from the cache. If 'tree' is true, then
- * also flush all names under 'name'.
+ * Flush the data for node 'name' from the cache.
+ *
+ * If 'tree' is true, then also flush all nodes under 'name'. (Note that
+ * flushing of a tree only works for names below the root. To flush the
+ * entire tree, use dns_cache_flush().)
*
* Requires:
*\li 'cache' to be valid.
*\li 'name' to be valid.
+ *\li if 'tree' is true, then 'name' is not root.
*
* Returns:
*\li #ISC_R_SUCCESS
dns_view_flushcache(dns_view_t *view, bool fixuponly);
/*%<
* Flush the view's cache (and ADB). If 'fixuponly' is true, it only updates
- * the internal reference to the cache DB with omitting actual flush operation.
+ * the internal reference to the cache DB, omitting actual flush operation.
* 'fixuponly' is intended to be used for a view that shares a cache with
- * a different view. dns_view_flushcache() is a backward compatible version
- * that always sets fixuponly to false.
+ * a different view.
*
* Requires:
* 'view' is valid.