4362. [func] Changed rndc reconfig behaviour so that newly added

zones are loaded asynchronously and the loading does
			not block the server. [RT #41934]
This commit is contained in:
Witold Krecicki
2016-05-05 21:41:12 +02:00
parent 28053af04c
commit e846f127d6
8 changed files with 126 additions and 40 deletions

View File

@@ -23,5 +23,8 @@ rm -f ns*/named.run
rm -f ns4/*.conf
rm -f rndc.status
rm -f rndc.output
rm -f dig.out
rm -f ns*/named.lock
rm -f ns4/*.nta
rm -f ns6/named.conf
rm -f ns6/huge.zone.db

View File

@@ -0,0 +1,3 @@
# teardown of a huge zone with tracing enabled takes way too long
# -m none is set so that stop.pl does not timeout
-X named.lock -m none -T clienttest -c named.conf -d 99 -g -U 4

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
controls { /* empty */ };
options {
port 5300;
pid-file "named.pid";
listen-on { 10.53.0.6; };
listen-on-v6 { none; };
recursion no;
};
key rndc_key {
secret "1234abcd8765";
algorithm hmac-sha256;
};
controls {
inet 10.53.0.6 port 9953 allow { any; } keys { rndc_key; };
};

View File

@@ -25,7 +25,12 @@ $SHELL ../genzone.sh 2 >ns2/nil.db
$SHELL ../genzone.sh 2 >ns2/other.db
$SHELL ../genzone.sh 2 >ns2/static.db
$SHELL ../genzone.sh 2 >ns6/huge.zone.db
awk 'END { for (i = 1; i <= 1000000; i++)
printf "host%u IN A 10.53.0.6\n", i; }' < /dev/null >> ns6/huge.zone.db
cat ns4/named.conf.in > ns4/named.conf
cat ns6/named.conf.in > ns6/named.conf
make_key () {
$RNDCCONFGEN -r $RANDFILE -k key$1 -A $2 -s 10.53.0.4 -p 995${1} \

View File

@@ -448,6 +448,55 @@ grep "^running on " rndc.output > /dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:test 'rndc reconfig' with loading of a large zone"
ret=0
cur=`awk 'BEGIN {l=0} /^/ {l++} END { print l }' ns6/named.run`
cp ns6/named.conf ns6/named.conf.save
echo "zone \"huge.zone\" { type master; file \"huge.zone.db\"; };" >> ns6/named.conf
echo " I:reloading config"
$RNDC -s 10.53.0.6 -p 9953 -c ../common/rndc.conf reconfig > rndc.output 2>&1 || ret=1
if [ $ret != 0 ]; then echo " I:failed"; fi
status=`expr $status + $ret`
sleep 1
echo " I:check if zone load was scheduled"
grep "scheduled loading new zones" ns6/named.run > /dev/null || ret=1
if [ $ret != 0 ]; then echo " I:failed"; fi
status=`expr $status + $ret`
echo " I:check if query for the zone returns SERVFAIL"
$DIG @10.53.0.6 -p 5300 -t soa huge.zone > dig.out
grep "SERVFAIL" dig.out > /dev/null || ret=1
if [ $ret != 0 ]; then echo " I:failed"; fi
status=`expr $status + $ret`
echo " I:wait for the zones to be loaded"
ret=1
try=0
while test $try -lt 45
do
sleep 1
sed -n "$cur,"'$p' < ns6/named.run | grep "any newly configured zones are now loaded" > /dev/null && {
ret=0
break
}
try=`expr $try + 1`
done
if [ $ret != 0 ]; then echo " I:failed"; fi
status=`expr $status + $ret`
echo " I:check if query for the zone returns NOERROR"
$DIG @10.53.0.6 -p 5300 -t soa huge.zone > dig.out
grep "NOERROR" dig.out > /dev/null || ret=1
if [ $ret != 0 ]; then echo " I:failed"; fi
status=`expr $status + $ret`
mv ns6/named.conf.save ns6/named.conf
sleep 1
$RNDC -s 10.53.0.6 -p 9953 -c ../common/rndc.conf reconfig > /dev/null || ret=1
sleep 1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
if [ -x "$PYTHON" ]; then
echo "I:test rndc python bindings"
ret=0