Genezzo-Contrib-Clustered
view release on metacpan or search on metacpan
lib/Genezzo/Contrib/Clustered.pm view on Meta::CPAN
if($affected > 0) {
print STDERR "rollback at startup necessary!\n";
print STDERR "PLEASE TYPE ROLLBACK COMMAND\n";
# note here no rollback work will occur, but system will restart
# from disk (verify)
}
}elsif($tx_state eq $COMMITTED_CODE){
# need to clear PID in blocks
$self->ApplyFuncToUndo(\&CommitFunc);
}
$self->WriteTransactionState($CLEAR_BUFF);
# Rollback_Internal and Commit accumulate locks.
# Keep them.
# $gtxLock->unlockAll();
$gtxLock->demoteAll();
$cl_ctx->{tx_id} = 0;
whisper "G:C:C:_init begin init undo\n";
# Init all undo blocks.
$self->CreateUndoBlock();
my $tmp_undo_blockid;
for($tmp_undo_blockid = 0;
$tmp_undo_blockid < ($cl_ctx->{undoHeader}->{blocks_per_proc}/2);
$tmp_undo_blockid++)
{
$cl_ctx->{current_undo_blockid} = $tmp_undo_blockid;
$self->WriteUndoBlock();
}
whisper "G:C:C:_init end init undo\n";
$cl_ctx->{tx_id} = 1;
$cl_ctx->{have_begin_trans} = 0;
whisper "Genezzo::Contrib::Clustered::_init finished\n";
$self->{init_done} = 1;
}
####################################################################
sub new
{
whoami;
my $invocant = shift;
my $class = ref($invocant) || $invocant ;
my $self = {};
$self->{MARK} = 1;
# Clustered context.
$self->{cl_ctx} = {};
# Flag to avoid processing write to buffer during read.
$self->{inReadBlock} = 0;
$self->{init_done} = 0;
$self->{dict} = shift @_;
# greet $self->{dict}->{prefs};
return bless $self, $class;
}
####################################################################
sub SysHookInit
{
goto &new
}
####################################################################
BEGIN
{
# Rollback at start will obtain shared locks for all blocks in buffer
# cache.
print STDERR "Genezzo::Contrib::Clustered will be installed (please type rollback)\n";
$COMMITTED_BUFF = "";
$ROLLEDBACK_BUFF = "";
$PENDING_BUFF = "";
$CLEAR_BUFF = "";
$COMMITTED_CODE = "C";
$ROLLEDBACK_CODE = "R";
$PENDING_CODE = "P";
$CLEAR_CODE = "-";
$UNDO_BLOCKSIZE = $Genezzo::Block::Std::DEFBLOCKSIZE;
$starting_pid = 1;
$pad_undo = 0;
}
1;
__END__
=head1 NAME
Genezzo::Contrib::Clustered - Shared data cluster support for Genezzo
=head1 SYNOPSIS
genprepundo.pl
gendba.pl
>@havok.sql
>@syshook.sql
>@clustered.sql
=head1 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.
=head2 Undo File Format
( run in 1.242 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )