Next: , Previous: , Up: Buffer, I/O, and Free-List Management   [Contents][Index]


2.3.3 Deferred writes of data blocks

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.

Description and purpose

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.

Implementation

The handle field ‘wcb’ has the following boolean values:

  1. SAP: save block after PUTs
  2. SAR: save block after REMOVEs
  3. SAC: force block save after cached block changes (not currently implemented)
  4. FAC: flush buffer entirely after cached block changes (not currently implemented – future functionality)

These bits are set as follows:

DIRECTORY

SAP=SAR=1;

FREE LIST

SAR=1; SAP=SAC=0;

USER DATA

SAP=SAR=SAC=0;

The state of these bits can be changed at any time using (han:set-wcb! han new-bits). Directory trees force wcb-sap and 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.

Calling flush-ents flushes some modified blocks. It is thread safe and can be called by a timer interrupt.


Next: Caching of last (leaf) block used, Previous: update-access, Up: Buffer, I/O, and Free-List Management   [Contents][Index]