The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Genezzo::Contrib::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 provide support for shared data clusters. Routines provide transactions, distributed locking, undo, and recovery.

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, full_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 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.

While a transaction is in progress blocks in the main portion of the file will contain the process id (PID) of the active process. Before-image blocks at the tail of the file should always have PIDs of 0 (or unset).

FUNCTIONS

ReadBlock

Replaces Genezzo::BufCa::BCFile::_filereadblock

DirtyBlock

Wraps Genezzo::BufCa::DirtyScalar::STORE

_init_filewriteblock

Called by Genezzo::BufCa::BCFile::_filewriteblock

Commit

Wraps Genezzo::GenDBI::Kgnz_Commit

Rollback

Wraps Genezzo::GenDBI::Kgnz_Rollback

Execute

Wraps Genezzo::GenDBI::Kgnz_Execute (experimental!)

EXPORT

none

LIMITATIONS

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

See README for current TODO list.

SEE ALSO

http://www.genezzo.com

http://eric_rollins.home.mindspring.com/genezzo/ClusteredGenezzoDesign.html

http://eric_rollins.home.mindspring.com/genezzo/cluster.html

http://opendlm.sourceforge.net/

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