Jeffrey Cohen
and 1 contributors

NAME - Extent Space Management



This module contains the space management hooks for Genezzo::Block::RDBlock basic block operations. Any insert/update/delete operation which modifies a block might change the space usage. All minor changes are reflected in the local block XHP (eXtent Header Position) record. Any changes greater than ~30% are reflected in the extent header XHA (eXtent Header _A_), which has a bitvec to track every block in the extent. Larger changes must propagate to the segment header (or subheader) X1A (eXtent FIRST _A_), which tracks space usage for every extent in the segment.

Space management must balance efficient space usage against update costs/concurrency issues. Frequently updating the extent headers and segment headers provides more accurate information on actual block usage, but these blocks become a point of contention when multiple updates are running simultaneously. If the extent and segment headers are updated infrequently, space managment might allocate new extents unnecessarily because it doesn't know that free space is still available, or worst-case, it may attempt to re-use blocks which are already full. The basic pushhash (see Genezzo::PushHash::hph routines are designed to be robust if an operation runs out of space, so this situation is not insurmountable.

Need hooks to update segment header. Allocating space without updating the segment header is fine, since the operation to obtain new free blocks can view the list of extents with free blocks in the segment header, and then it can probe the extent headers to check if space is still available. The converse problem is that deletes may free up blocks or even entire extents, and this information must get back to the segment header so it knows that space is available. At minimum, an operation which causes an extent to transition from full to at least one block free should update the segment header.



update local block XHP (eXtent Header Position) with new percent used


call track_usage to update after new row pushed in block


call track_usage to update after new row stored in block


call track_usage to update after row deleted from block


if current block is the extent header, update now, else setup Contrib data structs to pass usage info to post_untie


use the usage info from pre_untie to update the extent header


store the initial usage info for the block. block_pre_untie_hook will compare the current usage with the previous in order to determine whether the extent header update is necessary.



better error handling
better error handling


Jeffrey I. Cohen,


Genezzo::Block::RDBlock, perl(1).

Copyright (c) 2006, 2007 Jeffrey I Cohen. All rights reserved.

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

Address bug reports and comments to:

For more information, please visit the Genezzo homepage at