Eric Rollins

NAME

Genezzo::Contrib::Clustered::Clustered - Shared data cluster support for Genezzo

SYNOPSIS

  genprepundo.pl

  gendba.pl
  >@havok.sql
  >@syshook.sql
  >@clustered.sql

DESCRIPTION

Genezzo is an extensible database with SQL and DBI. It is written in Perl. Basic routines inside Genezzo are overridden via Havok SysHooks. Override routines will (eventually) provide support for shared data clusters. Routines will provide transactions, distributed locking, undo, and recovery. Today these routines support a single-user single-threaded database, and provide basic transactional commit and rollback via undo. Locking routines are currently stubs.

Undo File Format

All blocks are $Genezzo::Block::Std::DEFBLOCKSIZE

  (block 0)

Frozen data structure stored via Genezzo::Block::RDBlock->HPush()

  {
     "procs" => $processes,
     "blocks_per_proc" => $blocks_per_process,
     "files" => {
         per fileidx =>
         { fileidx, filename, blocksize, numblocks, hdrsize }
     }
  };

Process Status Block

  (block 1 to $processes+1)

 ----------processid(10)---------------- to end of block

 1st character is status:

    - = clear
    C = committed
    R = rolledback
    P = pending

Undo Blocks

  (array of $blocks_per_process * $processes)

These are written paired (for recoverability), so only half number is actually available.

Undo blocks contain multiple rows. 1st row is {"tx"}, a transaction id. following rows are {"f" = $fileno, "b" = $blockno}. All are Frozen data structures stored via Genezzo::Block::RDBlock->HPush().

The list of fileno/blockno indicate which blocks should be replaced if the transaction rolls back, or which blocks should have the process id cleared (not yet implemented) if the transaction commits.

At process startup undo blocks for the process are initially all written with tx 0, so we can distinguish when we move to a block left over from a previous transaction.

Before-Image Block Storage

The before image of each block is written at the tail of the file where it originates, at position $declared_file_length + $blocknum. So when this module is enabled data files actually grow to twice their declared size. Note dynamic data file growth (increase_by) is not supported with this module.

FUNCTIONS

ReadBlock
 Wraps Genezzo::BufCa::BCFile::ReadBlock
DirtyBlock
 Wraps Genezzo::BufCa::DirtyScalar::STORE
Commit
 Wraps Genezzo::GenDBI::Kgnz_Commit
Rollback
 Wraps Genezzo::GenDBI::Kgnz_Rollback

EXPORT

  none

LIMITATIONS

  No Distributed/clustered functionality today.  Still single machine, 
  single process, single user, single threaded.

  This is pre-alpha software; don't use it to store any data you hope
  to see again!

AUTHOR

Eric Rollins, rollins@acm.org

COPYRIGHT AND LICENSE

    Copyright (C) 2005 by Eric Rollins.  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
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    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 rollins@acm.org