Pause the dbiterator when dumping the zone to the disk

When we rewrote the zone dumping to use the separate threadpool, the
dumping would acquire the read lock for the whole time the zone dumping
process is dumping the zone.

When combined with incoming IXFR that tries to acquire the write lock on
the same rwlock, we would end up blocking all the other readers.

In this commit, we pause the dbiterator every time we get next record
and before start dumping it to the disk.

(cherry picked from commit 7e59b8a4)
81 jobs for !5151 with 2732-pause-the-dbiterator-in-dumptostream-v9_16 in 30 minutes and 44 seconds (queued for 10 seconds)
latest detached
Status Job ID Name Coverage
  Precheck
passed #1775641
amd64 linux
autoreconf

00:00:18

passed #1775643
amd64 linux
clang-format

00:00:19

passed #1775644
amd64 linux
coccinelle

00:03:41

passed #1775720
amd64 linux
danger

00:00:15

passed #1775642
amd64 linux
misc

00:00:15

passed #1775646
amd64 linux
tarball-create

00:00:19

failed #1775645
amd64 linux
danger

00:00:17

 
  Build
passed #1775660
amd64 linux
clang:asan

00:03:49

passed #1775664
amd64 linux
clang:buster:amd64

00:01:46

passed #1775667
amd64 libvirt
clang:freebsd12:amd64

00:01:55

passed #1775668
amd64 libvirt
clang:freebsd13:amd64

00:03:37

passed #1775669
amd64 libvirt
clang:openbsd:amd64

00:03:24

passed #1775662
amd64 linux
clang:tsan

00:02:21

passed #1775647
amd64 linux
gcc:alpine3.13:amd64

00:01:51

passed #1775659
amd64 linux
gcc:asan

00:03:06

passed #1775657
amd64 linux
gcc:bionic:amd64

00:01:48

passed #1775651
amd64 linux
gcc:buster:amd64

00:01:29

passed #1775648
amd64 linux
gcc:centos7:amd64

00:01:37

passed #1775649
amd64 linux
gcc:centos8:amd64

00:01:39

passed #1775658
amd64 linux
gcc:focal:amd64

00:01:45

passed #1775663
amd64 linux
gcc:mutexatomics

00:01:43

passed #1775653
amd64 linux
gcc:out-of-tree

00:01:34

passed #1775652
amd64 linux
gcc:sid:amd64

00:02:14

passed #1775655
i386 linux
gcc:sid:i386

00:01:37

passed #1775665
amd64 linux
gcc:softhsm2.4

00:01:41

passed #1775666
amd64 linux
gcc:softhsm2.6

00:01:31

passed #1775650
amd64 linux
gcc:stretch:amd64

00:01:59

passed #1775654
amd64 linux
gcc:tarball

00:02:03

passed #1775661
amd64 linux
gcc:tsan

00:02:02

passed #1775656
amd64 linux
gcc:tumbleweed:amd64

00:01:33

passed #1775671
amd64 windows
msvc:windows:amd64

00:01:19

passed #1775670
amd64 linux
nolibtool:sid:amd64

00:02:13

 
  Unit
passed #1775683
amd64 linux
unit:clang:asan

00:01:15

passed #1775687
amd64 linux
unit:clang:buster:amd64

00:00:42

passed #1775690
amd64 libvirt
unit:clang:freebsd12:amd64

00:01:03

passed #1775691
amd64 libvirt
unit:clang:freebsd13:amd64

00:02:53

passed #1775685
amd64 linux
unit:clang:tsan

00:01:31

passed #1775672
amd64 linux
unit:gcc:alpine3.13:amd64

00:01:07

passed #1775682
amd64 linux
unit:gcc:asan

00:01:08

passed #1775680
amd64 linux
unit:gcc:bionic:amd64

00:00:43

passed #1775676
amd64 linux
unit:gcc:buster:amd64

00:00:56

passed #1775673
amd64 linux
unit:gcc:centos7:amd64

00:00:38

passed #1775674
amd64 linux
unit:gcc:centos8:amd64

00:00:38

passed #1775681
amd64 linux
unit:gcc:focal:amd64

00:00:42

passed #1775686
amd64 linux
unit:gcc:mutexatomics

00:00:45

passed #1775677
amd64 linux
unit:gcc:sid:amd64

00:00:35

passed #1775678
i386 linux
unit:gcc:sid:i386

00:00:58

passed #1775688
amd64 linux
unit:gcc:softhsm2.4

00:00:42

passed #1775689
amd64 linux
unit:gcc:softhsm2.6

00:00:41

passed #1775675
amd64 linux
unit:gcc:stretch:amd64

00:00:42

passed #1775684
amd64 linux
unit:gcc:tsan

00:01:47

passed #1775679
amd64 linux
unit:gcc:tumbleweed:amd64

00:00:38

passed #1775692
amd64 linux
unit:nolibtool:sid:amd64

00:00:52

 
  System
passed #1775704
amd64 linux
system:clang:asan

00:13:18

passed #1775708
amd64 linux
system:clang:buster:amd64

00:11:50

passed #1775711
amd64 libvirt
system:clang:freebsd12:amd64

00:10:55

passed #1775722
libvirt amd64
system:clang:freebsd13:amd64

00:12:38

passed #1775706
amd64 linux
system:clang:tsan

00:15:18

passed #1775693
amd64 linux
system:gcc:alpine3.13:amd64

00:12:03

passed #1775703
amd64 linux
system:gcc:asan

00:14:02

passed #1775701
amd64 linux
system:gcc:bionic:amd64

00:11:03

passed #1775697
amd64 linux
system:gcc:buster:amd64

00:13:03

passed #1775694
amd64 linux
system:gcc:centos7:amd64

00:11:22

passed #1775695
amd64 linux
system:gcc:centos8:amd64

00:11:26

passed #1775702
amd64 linux
system:gcc:focal:amd64

00:11:32

passed #1775707
amd64 linux
system:gcc:mutexatomics

00:12:33

passed #1775698
amd64 linux
system:gcc:sid:amd64

00:10:59

passed #1775699
i386 linux
system:gcc:sid:i386

00:09:50

passed #1775709
amd64 linux
system:gcc:softhsm2.4

00:12:01

passed #1775710
amd64 linux
system:gcc:softhsm2.6

00:11:46

passed #1775696
amd64 linux
system:gcc:stretch:amd64

00:11:16

passed #1775705
amd64 linux
system:gcc:tsan

00:15:19

passed #1775700
amd64 linux
system:gcc:tumbleweed:amd64

00:12:10

passed #1775713
amd64 linux
system:nolibtool:sid:amd64

00:11:27

failed #1775712
amd64 libvirt
system:clang:freebsd13:amd64

00:12:36

 
  Docs
passed #1775714
amd64 linux
docs

00:02:21

 
  Postcheck
passed #1775718
amd64 linux
cppcheck

00:00:31

passed #1775715
amd64 linux
flake8

00:00:27

passed #1775719
amd64 linux
gcov

00:00:33

76.0%
passed #1775716
amd64 linux
pylint

00:00:29

passed #1775717
amd64 linux
scan-build

00:09:03