On Thu, May 22, 2008 at 07:56:37PM +0200, Marc Haber wrote:
> Upstream has rejected the patch since it will run recovery every time
> a new process is started, breaking already running processes.
> 
> They instead suggest running db_recover unconditionally in the
> postinst, which poses some challenge since one would have to find out
> whether to recover and which db_recover to use.

I wrote a mini-version of db_recover in perl. Find it as an attachment.

Some notes on it:
No other application should have the torrus db open when it is
recovered. Potential candidates are torrus itself, but also any apache
(or other webserver) process that is doing visualisation. The Berkeley
DB Docu implies undefined results in this case, although my own
experiments show friendly behaviour ATM.

Unfortunatly the BerkeleyDB::env_remove function is not implemented in
the perl packages yet. When it is in, this would mimic the db_recover
program completely.

Apart from that, I propose the script to be included in the postinstall
process of the torrus package. In the normal case it suns quickly and
does nothing.

Bye,

Joerg

#!/usr/bin/perl -w
#
# Copyright (C) 2008 Joerg Dorchain <[EMAIL PROTECTED]>
#
# recover a torrus-db in case of BerkeleyDB upgrades
#
#  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
#  (at your option) 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

require '/usr/share/torrus/conf_defaults/torrus-config.pl';

use strict;
use BerkeleyDB;

if ( not -d $Torrus::Global::dbHome ) { die "No such directory: 
$Torrus::Global::dbHome"; }

my $env = new BerkeleyDB::Env( -Home  => $Torrus::Global::dbHome,
                -Flags => (DB_CREATE | DB_RECOVER | DB_INIT_TXN | DB_INIT_LOCK),
                -Mode  => 0664, -ErrFile => *STDERR, -Verbose => 1 );
if( not defined($env) ) { die "Cannot create BerkeleyDB Environment: 
".$BerkeleyDB::Error; }

# Use it only when it is implemented - checked with BerkeleyDB 0.34
# BerkeleyDB::env_remove (-Home  => $Torrus::Global::dbHome);
print "Recovery of $Torrus::Global::dbHome sucessful\n";

Attachment: signature.asc
Description: Digital signature

Reply via email to