From bda028e0eed5979845c2d4e42c11544e5359bbd2 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Mon, 22 Feb 2021 15:17:54 -0800 Subject: [PATCH] create 'journal' system test tests that version 1 journal files containing version 1 transaction headers are rolled forward correctly on server startup, then updated into version 2 journals. also checks journal file consistency and 'max-journal-size' behavior. (cherry picked from commit a0aefa1de6459000ddfd1876be886e3b12cf7692) --- bin/tests/system/conf.sh.common | 1 + bin/tests/system/journal/clean.sh | 14 ++ .../system/journal/ns1/changed.ver1.jnl.saved | Bin 0 -> 707 bytes .../system/journal/ns1/changed.ver2.jnl.saved | Bin 0 -> 718 bytes bin/tests/system/journal/ns1/d1212.jnl.saved | Bin 0 -> 1478 bytes bin/tests/system/journal/ns1/d2121.jnl.saved | Bin 0 -> 1478 bytes bin/tests/system/journal/ns1/generic.db.in | 16 ++ bin/tests/system/journal/ns1/ixfr.db.in | 17 ++ .../system/journal/ns1/ixfr.ver1.jnl.saved | Bin 0 -> 686 bytes .../system/journal/ns1/maxjournal.jnl.saved | Bin 0 -> 13660 bytes .../system/journal/ns1/maxjournal2.jnl.saved | Bin 0 -> 14259 bytes bin/tests/system/journal/ns1/named.conf.in | 90 ++++++++ .../journal/ns1/unchanged.ver1.jnl.saved | Bin 0 -> 512 bytes .../journal/ns1/unchanged.ver2.jnl.saved | Bin 0 -> 512 bytes bin/tests/system/journal/setup.sh | 42 ++++ bin/tests/system/journal/tests.sh | 201 ++++++++++++++++++ util/copyrights | 12 ++ 17 files changed, 393 insertions(+) create mode 100644 bin/tests/system/journal/clean.sh create mode 100644 bin/tests/system/journal/ns1/changed.ver1.jnl.saved create mode 100644 bin/tests/system/journal/ns1/changed.ver2.jnl.saved create mode 100644 bin/tests/system/journal/ns1/d1212.jnl.saved create mode 100644 bin/tests/system/journal/ns1/d2121.jnl.saved create mode 100644 bin/tests/system/journal/ns1/generic.db.in create mode 100644 bin/tests/system/journal/ns1/ixfr.db.in create mode 100644 bin/tests/system/journal/ns1/ixfr.ver1.jnl.saved create mode 100644 bin/tests/system/journal/ns1/maxjournal.jnl.saved create mode 100644 bin/tests/system/journal/ns1/maxjournal2.jnl.saved create mode 100644 bin/tests/system/journal/ns1/named.conf.in create mode 100644 bin/tests/system/journal/ns1/unchanged.ver1.jnl.saved create mode 100644 bin/tests/system/journal/ns1/unchanged.ver2.jnl.saved create mode 100644 bin/tests/system/journal/setup.sh create mode 100644 bin/tests/system/journal/tests.sh diff --git a/bin/tests/system/conf.sh.common b/bin/tests/system/conf.sh.common index 65fce6267e..405f88bb9f 100644 --- a/bin/tests/system/conf.sh.common +++ b/bin/tests/system/conf.sh.common @@ -88,6 +88,7 @@ idna \ inline \ integrity \ ixfr \ +journal \ kasp \ keepalive \ legacy \ diff --git a/bin/tests/system/journal/clean.sh b/bin/tests/system/journal/clean.sh new file mode 100644 index 0000000000..1b8649595a --- /dev/null +++ b/bin/tests/system/journal/clean.sh @@ -0,0 +1,14 @@ +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at https://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +rm -f */named.memstats +rm -f */named.run +rm -f */named.conf +rm -f */*.db */*.jnl +rm -f dig.out* diff --git a/bin/tests/system/journal/ns1/changed.ver1.jnl.saved b/bin/tests/system/journal/ns1/changed.ver1.jnl.saved new file mode 100644 index 0000000000000000000000000000000000000000..b449a7dbccfae7280bd90bdcd0813866c46f1fae GIT binary patch literal 707 zcmcC^^7M02@bPz72(#p3U|=YJb8{*K0~3gz2BZ%Ig)D#=CxEHPsbExMu!q2QP#i+y zo57tuIU_MIJvD`afsKI?m;fReOqlYD;i6m_`Nbu@#9$ABeLx2? zgW?eq=L}vP$r*`x>8UA33=C`xjKEY7!C=OeSBwzm%E&J+$xSRSNi9MMLQ(>s00RTd m1_n;61~AP)foZ_>hhdr=Yhp@DkrBdHp!*;$WZ^PpU;+TC+d*mo literal 0 HcmV?d00001 diff --git a/bin/tests/system/journal/ns1/d1212.jnl.saved b/bin/tests/system/journal/ns1/d1212.jnl.saved new file mode 100644 index 0000000000000000000000000000000000000000..57c149722ebad409a260ccd53d8abd0319461e85 GIT binary patch literal 1478 zcmcC^^7M02@bPz72(#p3U|=YJb8{*K0~3gz$-uyR3@Bs)#5e(x`e{IY?}7a33=GVV zfbN=ojw!DgRf;Pk zzqlkfvA86)2vq`P8Uq8L05JA9FmPHmfN5%(40I!g$=ay)GYEj(3Q^44|KZr5Kg`jLl`#@iWkk6#3Z*0K()DN&o-= literal 0 HcmV?d00001 diff --git a/bin/tests/system/journal/ns1/d2121.jnl.saved b/bin/tests/system/journal/ns1/d2121.jnl.saved new file mode 100644 index 0000000000000000000000000000000000000000..ec21372f445e86cbf37dac465ca5c5464cae1099 GIT binary patch literal 1478 zcmcC^^7M02@bPz72(#p3U|=YJb8{*K0~3gz$-uyR3@Bs)#5e(x`e{IYpMm`83=GVV zfb6tIDT)2abXQ_Eza8!=4QMzxC(NtH_8#pWpL1SHUnlz7(==*1^M42t3DKn%>4RPr)5 whf&ANKsRD|SqDc9i?9W!CgSIQUCw| literal 0 HcmV?d00001 diff --git a/bin/tests/system/journal/ns1/generic.db.in b/bin/tests/system/journal/ns1/generic.db.in new file mode 100644 index 0000000000..bb75d3ce82 --- /dev/null +++ b/bin/tests/system/journal/ns1/generic.db.in @@ -0,0 +1,16 @@ +; Copyright (C) Internet Systems Consortium, Inc. ("ISC") +; +; This Source Code Form is subject to the terms of the Mozilla Public +; License, v. 2.0. If a copy of the MPL was not distributed with this +; file, You can obtain one at http://mozilla.org/MPL/2.0/. +; +; See the COPYRIGHT file distributed with this work for additional +; information regarding copyright ownership. + + +$TTL 600 +@ SOA ns hostmaster 2012010901 3600 1200 604800 1200 + NS ns +ns A 192.0.2.1 + +addr1 A 10.53.0.1 diff --git a/bin/tests/system/journal/ns1/ixfr.db.in b/bin/tests/system/journal/ns1/ixfr.db.in new file mode 100644 index 0000000000..cee52ca6c5 --- /dev/null +++ b/bin/tests/system/journal/ns1/ixfr.db.in @@ -0,0 +1,17 @@ +; Copyright (C) Internet Systems Consortium, Inc. ("ISC") +; +; This Source Code Form is subject to the terms of the Mozilla Public +; License, v. 2.0. If a copy of the MPL was not distributed with this +; file, You can obtain one at http://mozilla.org/MPL/2.0/. +; +; See the COPYRIGHT file distributed with this work for additional +; information regarding copyright ownership. + + +$TTL 600 +@ SOA ns hostmaster 2012010902 3600 1200 604800 1200 + NS ns +ns A 192.0.2.1 + +addr1 A 10.53.0.1 +addr2 A 10.53.0.2 diff --git a/bin/tests/system/journal/ns1/ixfr.ver1.jnl.saved b/bin/tests/system/journal/ns1/ixfr.ver1.jnl.saved new file mode 100644 index 0000000000000000000000000000000000000000..10b5116ef2bfcdc182ce801d144738e6dd157f9d GIT binary patch literal 686 zcmcC^^7M02@bPz72(#p3U|=YJb8{*K0~3gz2Bg;kg)D#=CxEHPsbExMu!q1RP#i+y zo57AHvm&jCfq{*I5g7Xs40=p?#SkH`jQrw~+{EIN)FOxgBU`sUfD2m=+>UkO&qc7B)2`BBp4Ch=qlPg>BWWC~dW< zd8SK$fCY(#g@r{I7XARg`>yIyES|pc=52Cw()+dNo^zhl-h03AxvSQ0*i>J;ar3&` zZ7YhBj`e+NmdZ-lD=pi>UCX)s@vGm@pX2vF@O_I^J_0;14P6ahkcJ%wFG|DPz)RAI zkKkpgSOH#M8J^H0?2XU#k5E_DIufzz5Qd zE#O0G=4tSeH0wF|Seo4jK9TBb!Kc!kt>80h?iuj8H19R|LYn^_d?_uM3BHmRZU|{8)r@7ME^%dCrS(RRbH%`N_K_1 zk{@n#(d}uV$M@!ht^qtX4D6{;Hl!RMHHDr3IKJy2$9Mnjc*v}U%=o)?XO^Hpw1vJ-b9^ zyw1qcpW73;*qMc%T_!VLlf~e7bE3;?PNHX5$c)#oIr?*ZA{RTe(6g&##%ui;{BBNk zS>8Q14nk%L`g6~WT|+bu#1qc8>nsp2)?{EcEOK znQ?9+2EUsVT~>1vJ-bO}oX5%0pW73;*qMc%wUHU;ykhXXIniY`C(*N8WXAcy9R0aH zk&B&K=-F*D<6LSCem5t&tmY(o)=p-ech1qD+Y`CinT4KpkQwLbWAM8<(PcF!(X&o6 z<9bGp{@k9(#m+4B><*c6?I#Amn-g7Da}qu4A~UX&<>=4tiCpZ=LeEOqB)O&-gWt`G zE~`0-p4}xguD|B!&+Um^?94*X?vWYSs$=lGIniY`C(*O}WX5&<9R0aHk&B&K=virZ zf*pt${BBNkS;ajvFOs7_w@LUPcXOi4 zYEGhOugHu&?;QQPJ&}u@S?F15XP%w-82oNdbXm fvlcP<-JIyMnv>|+J2LAXgv=83=bjn4{5rFr`Xv;4 literal 0 HcmV?d00001 diff --git a/bin/tests/system/journal/ns1/maxjournal2.jnl.saved b/bin/tests/system/journal/ns1/maxjournal2.jnl.saved new file mode 100644 index 0000000000000000000000000000000000000000..e200905955a533116a92cdafedbb607b61945b3f GIT binary patch literal 14259 zcmds;No3_lrBPytS=1aQYO0uRh(shpL?SG&l9+`O!bW0gDdwRy&(u7$hK;3I zSy+gb*bqxgp5Nj`Kdo-QlboC;H*eef_xs-W{odaHzvn-9!Qy2rmW*D$a_Q(b^QP8U zYu~qz$E1n^-$-*FN}9`~)33jdKhEEM=I0YqbCH1%ho|dY(a2p;0?*KD8g~@DFOB~I zK9D910r8}E9r#F^cm{kdP5J~rktUAB_68K!2`UQL;O|J!8r5T&SHmUv= z_)?nr9egFtng+g>X7B3MaQ`RXQ?eUwi^Dlyo#T3E58 zvE4J(n|3zt*|Aa6Ay zwecuhyb-cj(J7san{cq%$H7FUdQ1_A>=Z)=n{kl0w~^X-l!cvTpVaH%1sr5yAY-W> z(s0O5F=X%}4zi>Ysf|Zj*je^TWw2P}VKFLWsUFgB$WAe2@G=gvj2EemM_Jfe_DN;1 zSYTxVG-IhA(s0O5F=X&64zhF{sf|Zj*je^TW$+pfvgn?%R1ax5WTzN1cpV41T@k5` zM_Jfe_DN;%1`cwgCu6A|(s0O5F=X&24sweuQX7x5u(Rxw%3yI*kDH4bOZAY3Lw1TG zgST;z+p>|`c$9^mWuH_AiyP|P(9T$@hcq0rQw$lri-T+hh}6cTEbJ`%q%wF92iZiC zu~ZLfIAo_7GT4HHY(I(A#-l9kEc>J~cpnGZxRbF|4{11Lrx-H$00)b0U=ABxI%wlj z7Iv0>QW<=RgKQSdSgMCK9I{gk8GM9;Y_p5h#-l9kEc>J~SZttVgJQ-~J*44~onpw~ z6C7k~XQVbBWnpL8CzZjcILM~hjHP-=!y!Axkilm-$admLZ9K}t&azJ`gU@l0jo2AW z^^k@`c8Vc`FL018?2+1dl!cvTpHv20agfdb8B6t$hC_CWA%kr=$j2rkwectmJIg+) z3>F`l;R7cbOZAY3Lw1TGgRgLqkLpBf<53oNmVHtge2s%|d>l+vs>c*@sQnaw1D`8! ASpWb4 literal 0 HcmV?d00001 diff --git a/bin/tests/system/journal/ns1/named.conf.in b/bin/tests/system/journal/ns1/named.conf.in new file mode 100644 index 0000000000..3fdd96b0ed --- /dev/null +++ b/bin/tests/system/journal/ns1/named.conf.in @@ -0,0 +1,90 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +options { + query-source address 10.53.0.1; + notify-source 10.53.0.1; + transfer-source 10.53.0.1; + port @PORT@; + session-keyfile "session.key"; + pid-file "named.pid"; + listen-on { 10.53.0.1; }; + listen-on-v6 { none; }; + dnssec-validation yes; + minimal-responses no; + recursion no; + notify yes; +}; + +key rndc_key { + secret "1234abcd8765"; + algorithm hmac-sha256; +}; + +controls { + inet 10.53.0.1 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; +}; + +zone changed { + type primary; + update-policy local; + file "changed.db"; +}; + +zone unchanged { + type primary; + update-policy local; + file "unchanged.db"; +}; + +zone changed2 { + type primary; + update-policy local; + file "changed2.db"; +}; + +zone unchanged2 { + type primary; + update-policy local; + file "unchanged2.db"; +}; + +zone hdr1d1d2d1d2 { + type primary; + update-policy local; + file "d1212.db"; +}; + +zone hdr1d2d1d2d1 { + type primary; + update-policy local; + file "d2121.db"; +}; + +zone ixfr { + type primary; + ixfr-from-differences yes; + file "ixfr.db"; +}; + +zone maxjournal { + type primary; + max-journal-size 1k; + update-policy local; + file "maxjournal.db"; +}; + +zone maxjournal2 { + type primary; + max-journal-size 1k; + update-policy local; + file "maxjournal2.db"; +}; diff --git a/bin/tests/system/journal/ns1/unchanged.ver1.jnl.saved b/bin/tests/system/journal/ns1/unchanged.ver1.jnl.saved new file mode 100644 index 0000000000000000000000000000000000000000..f7885d93dd7abfd1b09078e3cba0d724c1472acd GIT binary patch literal 512 fcmcC^^7M02@bPz72(#p3zzQs|ijE2nix2<+f3yQk literal 0 HcmV?d00001 diff --git a/bin/tests/system/journal/ns1/unchanged.ver2.jnl.saved b/bin/tests/system/journal/ns1/unchanged.ver2.jnl.saved new file mode 100644 index 0000000000000000000000000000000000000000..d974be4df70fdbea4ba8ed85ced6fb814b1dbc80 GIT binary patch literal 512 hcmcC^^7M02@bPz72(#2P;$px8EU<`;3JsGG0027u1FQf5 literal 0 HcmV?d00001 diff --git a/bin/tests/system/journal/setup.sh b/bin/tests/system/journal/setup.sh new file mode 100644 index 0000000000..23c963920f --- /dev/null +++ b/bin/tests/system/journal/setup.sh @@ -0,0 +1,42 @@ +#!/bin/sh +# +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at https://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +. ../conf.sh + +$SHELL clean.sh + +copy_setports ns1/named.conf.in ns1/named.conf +cp ns1/generic.db.in ns1/changed.db +cp ns1/changed.ver1.jnl.saved ns1/changed.db.jnl + +cp ns1/generic.db.in ns1/unchanged.db +cp ns1/unchanged.ver1.jnl.saved ns1/unchanged.db.jnl + +cp ns1/generic.db.in ns1/changed2.db +cp ns1/changed.ver2.jnl.saved ns1/changed2.db.jnl + +cp ns1/generic.db.in ns1/unchanged2.db +cp ns1/unchanged.ver2.jnl.saved ns1/unchanged2.db.jnl + +cp ns1/ixfr.db.in ns1/ixfr.db +cp ns1/ixfr.ver1.jnl.saved ns1/ixfr.db.jnl + +cp ns1/generic.db.in ns1/d1212.db +cp ns1/d1212.jnl.saved ns1/d1212.db.jnl + +cp ns1/generic.db.in ns1/d2121.db +cp ns1/d2121.jnl.saved ns1/d2121.db.jnl + +cp ns1/generic.db.in ns1/maxjournal.db +cp ns1/maxjournal.jnl.saved ns1/maxjournal.db.jnl + +cp ns1/generic.db.in ns1/maxjournal2.db +cp ns1/maxjournal2.jnl.saved ns1/maxjournal2.db.jnl diff --git a/bin/tests/system/journal/tests.sh b/bin/tests/system/journal/tests.sh new file mode 100644 index 0000000000..7fd12dc14c --- /dev/null +++ b/bin/tests/system/journal/tests.sh @@ -0,0 +1,201 @@ +#!/bin/sh +# +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at https://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +. ../conf.sh + +dig_with_opts() { + "$DIG" @10.53.0.1 -p "$PORT" +tcp "$@" +} + +rndc_with_opts() { + "$RNDC" -c ../common/rndc.conf -p "$CONTROLPORT" -s "$@" +} + +status=0 +n=0 + +n=`expr $n + 1` +echo_i "check outdated journal rolled forward (dynamic) ($n)" +ret=0 +dig_with_opts changed soa > dig.out.test$n +grep 'status: NOERROR' dig.out.test$n > /dev/null || ret=1 +grep '2012010902' dig.out.test$n > /dev/null || ret=1 +grep 'zone changed/IN: retried using old journal format' ns1/named.run > /dev/null || ret=1 +[ $ret -eq 0 ] || echo_i "failed" +status=`expr $status + $ret` + +n=`expr $n + 1` +echo_i "check outdated empty journal did not cause an error (dynamic) ($n)" +ret=0 +dig_with_opts unchanged soa > dig.out.test$n +grep 'status: NOERROR' dig.out.test$n > /dev/null || ret=1 +grep '2012010901' dig.out.test$n > /dev/null || ret=1 +[ $ret -eq 0 ] || echo_i "failed" +status=`expr $status + $ret` + +n=`expr $n + 1` +echo_i "check outdated journals were updated or removed (dynamic) ($n)" +ret=0 +cat -v ns1/changed.db.jnl | grep "BIND LOG V9.2" > /dev/null || ret=1 +[ -f ns1/unchanged.db.jnl ] && ret=1 +[ $ret -eq 0 ] || echo_i "failed" +status=`expr $status + $ret` + +n=`expr $n + 1` +echo_i "check updated journal has correct RR count (dynamic) ($n)" +ret=0 +$JOURNALPRINT -x ns1/changed.db.jnl | grep "rrcount 3 " > /dev/null || ret=1 +[ $ret -eq 0 ] || echo_i "failed" +status=`expr $status + $ret` + +n=`expr $n + 1` +echo_i "check new-format journal rolled forward (dynamic) ($n)" +ret=0 +dig_with_opts changed2 soa > dig.out.test$n +grep 'status: NOERROR' dig.out.test$n > /dev/null || ret=1 +grep '2012010902' dig.out.test$n > /dev/null || ret=1 +grep 'zone changed2/IN: retried using old journal format' ns1/named.run > /dev/null && ret=1 +[ $ret -eq 0 ] || echo_i "failed" +status=`expr $status + $ret` + +n=`expr $n + 1` +echo_i "check new-format empty journal did not cause error (dynamic) ($n)" +ret=0 +dig_with_opts unchanged2 soa > dig.out.test$n +grep 'status: NOERROR' dig.out.test$n > /dev/null || ret=1 +grep '2012010901' dig.out.test$n > /dev/null || ret=1 +grep 'zone unchanged2/IN: retried using old journal format' ns1/named.run > /dev/null && ret=1 +[ $ret -eq 0 ] || echo_i "failed" +status=`expr $status + $ret` + +n=`expr $n + 1` +echo_i "check new-format journals were updated or removed (dynamic) ($n)" +ret=0 +cat -v ns1/changed2.db.jnl | grep "BIND LOG V9.2" > /dev/null || ret=1 +[ -f ns1/unchanged2.db.jnl ] && ret=1 +[ $ret -eq 0 ] || echo_i "failed" +status=`expr $status + $ret` + +n=`expr $n + 1` +echo_i "check outdated up-to-date journal succeeded (ixfr-from-differences) ($n)" +ret=0 +dig_with_opts -t soa ixfr > dig.out.test$n +grep 'status: NOERROR' dig.out.test$n > /dev/null || ret=1 +grep '2012010902' dig.out.test$n > /dev/null || ret=1 +grep 'zone ixfr/IN: journal rollforward completed successfully: recoverable' ns1/named.run > /dev/null || ret=1 +[ $ret -eq 0 ] || echo_i "failed" +status=`expr $status + $ret` + +n=`expr $n + 1` +echo_i "check outdated journal was updated (ixfr-from-differences) ($n)" +ret=0 +cat -v ns1/ixfr.db.jnl | grep "BIND LOG V9.2" > /dev/null || ret=1 +[ $ret -eq 0 ] || echo_i "failed" +status=`expr $status + $ret` + +n=`expr $n + 1` +echo_i "check journal with mixed headers succeeded (version 1,2,1,2) ($n)" +ret=0 +dig_with_opts -t soa hdr1d1d2d1d2 > dig.out.test$n +grep 'status: NOERROR' dig.out.test$n > /dev/null || ret=1 +grep '2012010905' dig.out.test$n > /dev/null || ret=1 +grep 'zone hdr1d1d2d1d2/IN: journal rollforward completed successfully: recoverable' ns1/named.run > /dev/null || ret=1 +[ $ret -eq 0 ] || echo_i "failed" +status=`expr $status + $ret` + +n=`expr $n + 1` +echo_i "check journal with mixed headers was updated (version 1,2,1,2) ($n)" +ret=0 +[ $($JOURNALPRINT -x ns1/d1212.jnl.saved | grep -c "version 1") -eq 2 ] || ret=1 +[ $($JOURNALPRINT -x ns1/d1212.jnl.saved | grep -c "version 2") -eq 2 ] || ret=1 +[ $($JOURNALPRINT -x ns1/d1212.db.jnl | grep -c "version 1") -eq 0 ] || ret=1 +[ $($JOURNALPRINT -x ns1/d1212.db.jnl | grep -c "version 2") -eq 4 ] || ret=1 +[ $ret -eq 0 ] || echo_i "failed" +status=`expr $status + $ret` + +n=`expr $n + 1` +echo_i "check journal with mixed headers succeeded (version 2,1,2,1) ($n)" +ret=0 +dig_with_opts -t soa hdr1d2d1d2d1 > dig.out.test$n +grep 'status: NOERROR' dig.out.test$n > /dev/null || ret=1 +grep '2012010905' dig.out.test$n > /dev/null || ret=1 +grep 'zone hdr1d2d1d2d1/IN: journal rollforward completed successfully: recoverable' ns1/named.run > /dev/null || ret=1 +[ $ret -eq 0 ] || echo_i "failed" +status=`expr $status + $ret` + +n=`expr $n + 1` +echo_i "check journal with mixed headers was updated (version 2,1,2,1) ($n)" +ret=0 +[ $($JOURNALPRINT -x ns1/d2121.jnl.saved | grep -c "version 1") -eq 2 ] || ret=1 +[ $($JOURNALPRINT -x ns1/d2121.jnl.saved | grep -c "version 2") -eq 2 ] || ret=1 +[ $($JOURNALPRINT -x ns1/d2121.db.jnl | grep -c "version 1") -eq 0 ] || ret=1 +[ $($JOURNALPRINT -x ns1/d2121.db.jnl | grep -c "version 2") -eq 4 ] || ret=1 +[ $ret -eq 0 ] || echo_i "failed" +status=`expr $status + $ret` + +n=`expr $n + 1` +echo_i "check there are no journals left un-updated ($n)" +ret=0 +c1=$(cat -v ns1/*.jnl | grep -c "BIND LOG V9") +c2=$(cat -v ns1/*.jnl | grep -c "BIND LOG V9.2") +[ ${c1} -eq ${c2} ] || ret=1 +[ $ret -eq 0 ] || echo_i "failed" +status=`expr $status + $ret` + +n=`expr $n + 1` +echo_i "check journal downgrade/upgrade ($n)" +ret=0 +cp ns1/changed.db.jnl ns1/temp.jnl +$JOURNALPRINT -d ns1/temp.jnl +[ $($JOURNALPRINT -x ns1/temp.jnl | grep -c "version 1") -eq 1 ] || ret=1 +$JOURNALPRINT -x ns1/temp.jnl | grep -q "Header version = 1" || ret=1 +$JOURNALPRINT -u ns1/temp.jnl +$JOURNALPRINT -x ns1/temp.jnl | grep -q "Header version = 2" || ret=1 +[ $($JOURNALPRINT -x ns1/temp.jnl | grep -c "version 2") -eq 1 ] || ret=1 +[ $ret -eq 0 ] || echo_i "failed" +status=`expr $status + $ret` + +n=`expr $n + 1` +echo_i "check max-journal-size works after journal update ($n)" +ret=0 +# a dump should have been triggered by repairing the journal, +# which would have resulted in the journal already being +# compacted. +[ $(wc -c < ns1/maxjournal.db.jnl) -lt 4000 ] || ret=1 +[ $ret -eq 0 ] || echo_i "failed" +status=`expr $status + $ret` + +n=`expr $n + 1` +echo_i "check max-journal-size works with non-updated journals ($n)" +ret=0 +# journal was not repaired, so it should still be big +[ $(wc -c < ns1/maxjournal2.db.jnl) -gt 12000 ] || ret=1 +# the zone hasn't been dumped yet, so 'rndc sync' should work without +# needing a zone update first. +rndc_with_opts 10.53.0.1 sync maxjournal2 +check_size() ( + [ $(wc -c < ns1/maxjournal2.db.jnl) -lt 4000 ] +) +retry_quiet 10 check_size || ret=1 +[ $ret -eq 0 ] || echo_i "failed" +status=`expr $status + $ret` + +n=`expr $n + 1` +echo_i "check journal index consistency ($n)" +ret=0 +for jnl in ns1/*.jnl; do + $JOURNALPRINT -x $jnl 2>&1 | grep -q "Offset mismatch" && ret=1 +done +[ $ret -eq 0 ] || echo_i "failed" +status=`expr $status + $ret` + +echo_i "exit status: $status" +[ $status -eq 0 ] || exit 1 diff --git a/util/copyrights b/util/copyrights index 9a9d53e44c..1e4b6c779c 100644 --- a/util/copyrights +++ b/util/copyrights @@ -638,6 +638,18 @@ ./bin/tests/system/ixfr/prereq.sh SH 2001,2004,2007,2012,2014,2016,2018,2019,2020,2021 ./bin/tests/system/ixfr/setup.sh SH 2001,2004,2007,2011,2012,2013,2014,2016,2018,2019,2020,2021 ./bin/tests/system/ixfr/tests.sh SH 2001,2004,2007,2011,2012,2014,2016,2018,2019,2020,2021 +./bin/tests/system/journal/clean.sh SH 2021 +./bin/tests/system/journal/ns1/changed.ver1.jnl.saved X 2021 +./bin/tests/system/journal/ns1/changed.ver2.jnl.saved X 2021 +./bin/tests/system/journal/ns1/d1212.jnl.saved X 2021 +./bin/tests/system/journal/ns1/d2121.jnl.saved X 2021 +./bin/tests/system/journal/ns1/ixfr.ver1.jnl.saved X 2021 +./bin/tests/system/journal/ns1/maxjournal.jnl.saved X 2021 +./bin/tests/system/journal/ns1/maxjournal2.jnl.saved X 2021 +./bin/tests/system/journal/ns1/unchanged.ver1.jnl.saved X 2021 +./bin/tests/system/journal/ns1/unchanged.ver2.jnl.saved X 2021 +./bin/tests/system/journal/setup.sh SH 2021 +./bin/tests/system/journal/tests.sh SH 2021 ./bin/tests/system/kasp/README TXT.BRIEF 2019,2020,2021 ./bin/tests/system/kasp/clean.sh SH 2019,2020,2021 ./bin/tests/system/kasp/ns2/setup.sh SH 2019,2020,2021