Note: this is a different sort of referral from the "deferred index updates" discussed earlier. Those deferred operations were correctness- preserving; these are not. The idea here is that we can reduce i/o traffic if we can safely lose a "small" number of updates.
The general idea here is that we can reduce I/O traffic by deferring writes of leaf blocks, in the sense that the updates can be lost without compromising the structure of the database. This only works where the data updates in question are not critical to database or application. Currently, we always defer leaf updates – both PUTs and REMoves – to data trees, where a data tree is any tree not of type DIRECTORY. (DIRECTORY leaf blocks are written to disk after every update.) The idea is that the user application should have control over how often the data blocks are written.
Also, referral of PUTs and DELETES should be separately controllable. This feature is needed for example by the database itself in maintaining the free list: we can afford to defer INSERTS of deleted block, because the worst that could happen is that a free block gets lost. But DELETES from the free list must update immediately, else a block could be doubly-allocated.
The handle field ‘wcb’ has the following boolean values:
These bits are set as follows:
The state of these bits can be changed at any time using
(han:set-wcb! han new-bits). Directory trees force
wcb-sar when opened or created. Also,
open_seg forces the free list write control bits to be as shown
above, regardless of the block type of the free-list.
flush-ents flushes some modified blocks. It is thread
safe and can be called by a timer interrupt.