PowerDNS / pdns

PowerDNS Authoritative, PowerDNS Recursor, dnsdist
https://www.powerdns.com/
GNU General Public License v2.0
3.67k stars 907 forks source link

auth-lmdb-ls: flush caches on sync #12832

Open Habbie opened 1 year ago

Habbie commented 1 year ago

Short description

When users change things via the API, the auth knows this, and can flush caches. When changes come in via some other path, such as Lightning Stream, the auth does not know. However, every update to an LMDB updates the txnid, which is cheap to read.

Usecase

Reducing the appearance of replication lag (which can, with default cache settings, look like a full minute).

Description

When lmdb-lightningstream is set, auth should periodically (say, every second) check txnid on all open databases, and if it changes, flush the caches.

Habbie commented 1 year ago

For bonus points, update our cache of the txnid when -we- do a write, (and the txnid we opened is the one currently cached), so we don't flush when we know exactly what we did.

klaus-nicat commented 1 year ago

Is the "flush" global or per zone? Is this about packet-cache, query-cache or both?

Habbie commented 1 year ago

This would be about a global flush for all caches (packet, query, negquery, zone metadata perhaps).

klaus-nicat commented 1 year ago

So what if lmdb-lightningstream updates come every second? Flushing cache every second can have negative impact. There should be some "flush-only-after-seconds: X" config