Reason
Zone updates (including incomming IXFR, ...) are slow. Tiny updates to gigantic zones are hell slow. The reason that Copy-On-Write trie doesn't fix it is that there are pointers between nodes in tree (pointer to previous node, pointer to additionals, pointer to nsec3 node and wildcard-proving nsec3 ....), which need to be refreshed when a node is replaced (thus need to replace further nodes...).
New structure for zone node
zone_binode_t will consist of two node_t instances, as one allocated piece in memory. The flag of which one of them shall be used for responding DNS queries will be in zone_contents_t. Any pointer to zone_binode_t will be used like a pointer to zone_node_t using the central flag. Consequence: by atomically exchanging zone_contents_t, all pointers will immediately point to updated nodes.
Another consequence: from the view of COW, there will only be nodes added or removed during txn, no just modified ones.
New requirements for Trie
- Node lookup will return not only found node and its predeccesor, but also its successor and its parent.
- The same will return when inserting new node.
- Ability to iterate through sub-tree.
TODO continue...