From: rkinyon@cpan.org Date: Thu, 26 Jun 2008 03:23:56 +0000 (+0000) Subject: read_txn_slots has been moved into the FileHeader sector. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=40963fbade74c603c30cd7317c52f2cbfc8afab4;p=dbsrgits%2FDBM-Deep.git read_txn_slots has been moved into the FileHeader sector. git-svn-id: http://svn.ali.as/cpan/trunk/DBM-Deep@3640 88f4d9cd-8a04-0410-9d60-8f63309c3137 --- diff --git a/lib/DBM/Deep/Engine.pm b/lib/DBM/Deep/Engine.pm index 2c369a9..7edcd05 100644 --- a/lib/DBM/Deep/Engine.pm +++ b/lib/DBM/Deep/Engine.pm @@ -567,13 +567,7 @@ sub commit { sub read_txn_slots { my $self = shift; - my $bl = $self->txn_bitfield_len; - my $num_bits = $bl * 8; - return split '', unpack( 'b'.$num_bits, - $self->storage->read_at( - $self->trans_loc, $bl, - ) - ); + return $self->_load_header->read_txn_slots; } sub write_txn_slots { diff --git a/lib/DBM/Deep/Engine/Sector/FileHeader.pm b/lib/DBM/Deep/Engine/Sector/FileHeader.pm index 4a0870d..2cc2c65 100644 --- a/lib/DBM/Deep/Engine/Sector/FileHeader.pm +++ b/lib/DBM/Deep/Engine/Sector/FileHeader.pm @@ -193,5 +193,13 @@ sub request_sector { return $loc; } +sub read_txn_slots { + my $self = shift; + my $e = $self->engine; + my $bl = $e->txn_bitfield_len; + my $num_bits = $bl * 8; + return split '', unpack( 'b'.$num_bits, $self->read( $e->trans_loc, $bl ) ); +} + 1; __END__ diff --git a/lib/DBM/Deep/File.pm b/lib/DBM/Deep/File.pm index f75689a..aa1ea32 100644 --- a/lib/DBM/Deep/File.pm +++ b/lib/DBM/Deep/File.pm @@ -7,7 +7,7 @@ use warnings FATAL => 'all'; use Fcntl qw( :DEFAULT :flock :seek ); -use constant DEBUG => 1; +use constant DEBUG => 0; sub new { my $class = shift; @@ -110,7 +110,6 @@ sub print_at { my $self = shift; my $loc = shift; - warn "print_at called\n"; local ($/,$\); my $fh = $self->{fh}; diff --git a/t/03_bighash.t b/t/03_bighash.t index 6dff322..6e6ccee 100644 --- a/t/03_bighash.t +++ b/t/03_bighash.t @@ -12,6 +12,8 @@ use t::common qw( new_fh ); plan tests => 9; +my $locked = 0; + use_ok( 'DBM::Deep' ); diag "This test can take up to a minute to run. Please be patient."; @@ -22,7 +24,7 @@ my $db = DBM::Deep->new( type => DBM::Deep->TYPE_HASH, ); -#$db->lock_exclusive; +$db->lock_exclusive if $locked; $db->{foo} = {}; my $foo = $db->{foo}; @@ -54,6 +56,7 @@ cmp_ok( scalar(@keys), '==', $max_keys + 1, "Number of keys is correct" ); my @control = sort map { "hello $_" } 0 .. $max_keys; cmp_deeply( \@keys, \@control, "Correct keys are there" ); +warn localtime(time) . ": before exists\n"; ok( !exists $foo->{does_not_exist}, "EXISTS works on large hashes for non-existent keys" ); is( $foo->{does_not_exist}, undef, "autovivification works on large hashes" ); ok( exists $foo->{does_not_exist}, "EXISTS works on large hashes for newly-existent keys" ); @@ -64,4 +67,4 @@ $db->clear; warn localtime(time) . ": after clear\n"; cmp_ok( scalar(keys %$db), '==', 0, "Number of keys after clear() is correct" ); -#$db->unlock; +$db->unlock if $locked;