Remove setting rdataset->ttl to 0. When it is set to 0, stale records

in "rndc dumpdb" output show 0 TTLs.

Add rbtdb->serve_stale_ttl to various checks so that stale records are
not purged from the cache when they've been stale for RBTDB_VIRTUAL
(300) seconds.

Increment ns_statscounter_usedstale when a stale answer is used.

There's a question of whether overmem_purge should be purging ancient
records, instead of stale ones.  I've left it as purging stale
records, since stale records could take up the majority of the cache.
44 jobs for !199 with kchen-servestale-fix in 17 minutes and 24 seconds (queued for 4 seconds)
latest detached
Status Job ID Name Coverage
  Precheck
passed #163574
amd64 linux
🐞:sid:amd64

00:00:37

passed #163573
amd64 linux
misc:sid:amd64

00:00:15

 
  Build
passed #163585
amd64 linux
asan:sid:amd64

00:03:33

passed #163586
amd64 linux
clang:stretch:amd64

00:01:47

passed #163587
i386 linux
clang:stretch:i386

00:01:56

passed #163575
amd64 linux
docs:sid:amd64

00:00:46

passed #163584
amd64 linux
gcc:bionic:amd64

00:01:59

passed #163576
amd64 linux
gcc:centos6:amd64

00:01:52

passed #163577
amd64 linux
gcc:centos7:amd64

00:02:01

passed #163582
amd64 linux
gcc:fedora29:amd64

00:02:54

passed #163578
amd64 linux
gcc:jessie:amd64

00:01:15

passed #163580
amd64 linux
gcc:sid:amd64

00:01:12

passed #163581
i386 linux
gcc:sid:i386

00:01:50

passed #163579
amd64 linux
gcc:stretch:amd64

00:01:12

passed #163583
amd64 linux
gcc:xenial:amd64

00:02:26

passed #163589
amd64 linux
noassert:sid:amd64

00:01:45

passed #163588
amd64 linux
pkcs11:sid:amd64

00:01:43

 
  Test
passed #163598
amd64 linux
install:gcc:sid:amd64

00:01:36

passed #163609
amd64 linux
system:asan:sid:amd64

00:07:50

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

00:06:56

passed #163590
amd64 linux
system:gcc:centos6:amd64

00:06:10

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

00:06:35

passed #163603
amd64 linux
system:gcc:fedora29:amd64

00:06:29

passed #163594
amd64 linux
system:gcc:jessie:amd64

00:06:59

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

00:06:30

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

00:06:28

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

00:06:12

passed #163605
amd64 linux
system:gcc:xenial:amd64

00:06:47

passed #163614
amd64 linux
system:noassert:sid:amd64

00:06:50

passed #163612
amd64 linux
system:pkcs11:sid:amd64

00:06:52

passed #163610
amd64 linux
unit:asan:sid:amd64

00:00:55

passed #163611
amd64 linux
unit:clang:stretch:amd64

00:00:42

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

00:00:43

passed #163591
amd64 linux
unit:gcc:centos6:amd64

00:00:47

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

00:00:45

passed #163604
amd64 linux
unit:gcc:fedora29:amd64

00:00:50

passed #163595
amd64 linux
unit:gcc:jessie:amd64

00:00:29

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

00:00:45

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

00:00:49

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

00:00:45

passed #163606
amd64 linux
unit:gcc:xenial:amd64

00:00:51

passed #163615
amd64 linux
unit:noassert:sid:amd64

00:00:48

passed #163613
amd64 linux
unit:pkcs11:sid:amd64

00:00:45

failed #163596
amd64 linux
system:gcc:stretch:amd64

00:06:55