r62350 - in /trunk/libdbm-deep-perl: Changes META.yml README debian/changelog debian/copyright lib/DBM/Deep.pm lib/DBM/Deep.pod lib/DBM/Deep/Engine/File.pm lib/DBM/Deep/Internals.pod t/06_error.t t/43_transaction_maximum.t
ansgar-guest at users.alioth.debian.org
ansgar-guest at users.alioth.debian.org
Mon Sep 6 03:09:57 UTC 2010
Author: ansgar-guest
Date: Mon Sep 6 03:09:09 2010
New Revision: 62350
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=62350
Log:
* New upstream release.
+ Errors out instead of corrupting the database when starting too many
transactions.
* debian/copyright: Refer to "Debian systems" instead of "Debian GNU/Linux
systems".
Modified:
trunk/libdbm-deep-perl/Changes
trunk/libdbm-deep-perl/META.yml
trunk/libdbm-deep-perl/README
trunk/libdbm-deep-perl/debian/changelog
trunk/libdbm-deep-perl/debian/copyright
trunk/libdbm-deep-perl/lib/DBM/Deep.pm
trunk/libdbm-deep-perl/lib/DBM/Deep.pod
trunk/libdbm-deep-perl/lib/DBM/Deep/Engine/File.pm
trunk/libdbm-deep-perl/lib/DBM/Deep/Internals.pod
trunk/libdbm-deep-perl/t/06_error.t
trunk/libdbm-deep-perl/t/43_transaction_maximum.t
Modified: trunk/libdbm-deep-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbm-deep-perl/Changes?rev=62350&op=diff
==============================================================================
--- trunk/libdbm-deep-perl/Changes (original)
+++ trunk/libdbm-deep-perl/Changes Mon Sep 6 03:09:09 2010
@@ -1,4 +1,14 @@
Revision history for DBM::Deep (ordered by revision number).
+
+2.0002 Sep 5 12:35:00 2010 PDT
+ - Error messages from DBM::Deep now use the callerâs file name.
+ They used incorrectly to use the name of the program ($0).
+ - begin_work now checks correctly to see whether the new transac-
+ tion exceeds the number the file was created to support. Some-
+ times it would allow a few more transactions, and then proceed
+ to corrupt the database (RT#60903).
+ - The description of the file header in DBM::Deep::Internals has
+ been brought up to date.
2.0001 Aug 22 12:03:00 2010 PDT
- Simply reading a hash or array element no longer causes autoviv-
Modified: trunk/libdbm-deep-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbm-deep-perl/META.yml?rev=62350&op=diff
==============================================================================
--- trunk/libdbm-deep-perl/META.yml (original)
+++ trunk/libdbm-deep-perl/META.yml Mon Sep 6 03:09:09 2010
@@ -23,7 +23,7 @@
provides:
DBM::Deep:
file: lib/DBM/Deep.pm
- version: 2.0001
+ version: 2.0002
DBM::Deep::Array:
file: lib/DBM/Deep/Array.pm
DBM::Deep::Engine:
@@ -81,4 +81,4 @@
perl: 5.008_004
resources:
license: http://dev.perl.org/licenses/
-version: 2.0001
+version: 2.0002
Modified: trunk/libdbm-deep-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbm-deep-perl/README?rev=62350&op=diff
==============================================================================
--- trunk/libdbm-deep-perl/README (original)
+++ trunk/libdbm-deep-perl/README Mon Sep 6 03:09:09 2010
@@ -3,7 +3,7 @@
transactions
VERSION
- 2.0001
+ 2.0002
SYNOPSIS
use DBM::Deep;
Modified: trunk/libdbm-deep-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbm-deep-perl/debian/changelog?rev=62350&op=diff
==============================================================================
--- trunk/libdbm-deep-perl/debian/changelog (original)
+++ trunk/libdbm-deep-perl/debian/changelog Mon Sep 6 03:09:09 2010
@@ -1,3 +1,13 @@
+libdbm-deep-perl (2.0002-1) unstable; urgency=medium
+
+ * New upstream release.
+ + Errors out instead of corrupting the database when starting too many
+ transactions.
+ * debian/copyright: Refer to "Debian systems" instead of "Debian GNU/Linux
+ systems".
+
+ -- Ansgar Burchardt <ansgar at 43-1.org> Mon, 06 Sep 2010 12:05:09 +0900
+
libdbm-deep-perl (2.0001-1) unstable; urgency=low
* New upstream release.
Modified: trunk/libdbm-deep-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbm-deep-perl/debian/copyright?rev=62350&op=diff
==============================================================================
--- trunk/libdbm-deep-perl/debian/copyright (original)
+++ trunk/libdbm-deep-perl/debian/copyright Mon Sep 6 03:09:09 2010
@@ -18,8 +18,8 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the Artistic License, which comes with Perl.
.
- On Debian GNU/Linux systems, the complete text of the Artistic License
- can be found in `/usr/share/common-licenses/Artistic'.
+ On Debian systems, the complete text of the Artistic License can be
+ found in `/usr/share/common-licenses/Artistic'.
License: GPL-1+
This program is free software; you can redistribute it and/or modify
@@ -27,5 +27,5 @@
the Free Software Foundation; either version 1, or (at your option)
any later version.
.
- On Debian GNU/Linux systems, the complete text of version 1 of the GNU
- General Public License can be found in `/usr/share/common-licenses/GPL-1'.
+ On Debian systems, the complete text of version 1 of the GNU General
+ Public License can be found in `/usr/share/common-licenses/GPL-1'.
Modified: trunk/libdbm-deep-perl/lib/DBM/Deep.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbm-deep-perl/lib/DBM/Deep.pm?rev=62350&op=diff
==============================================================================
--- trunk/libdbm-deep-perl/lib/DBM/Deep.pm (original)
+++ trunk/libdbm-deep-perl/lib/DBM/Deep.pm Mon Sep 6 03:09:09 2010
@@ -6,7 +6,7 @@
use warnings FATAL => 'all';
no warnings 'recursion';
-our $VERSION = q(2.0001);
+our $VERSION = q(2.0002);
use Scalar::Util ();
@@ -504,7 +504,7 @@
my @caller = caller( ++$n );
next if $caller[0] =~ m/^DBM::Deep/;
- die "DBM::Deep: $_[1] at $0 line $caller[2]\n";
+ die "DBM::Deep: $_[1] at $caller[1] line $caller[2]\n";
}
}
Modified: trunk/libdbm-deep-perl/lib/DBM/Deep.pod
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbm-deep-perl/lib/DBM/Deep.pod?rev=62350&op=diff
==============================================================================
--- trunk/libdbm-deep-perl/lib/DBM/Deep.pod (original)
+++ trunk/libdbm-deep-perl/lib/DBM/Deep.pod Mon Sep 6 03:09:09 2010
@@ -4,7 +4,7 @@
=head1 VERSION
-2.0001
+2.0002
=head1 SYNOPSIS
Modified: trunk/libdbm-deep-perl/lib/DBM/Deep/Engine/File.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbm-deep-perl/lib/DBM/Deep/Engine/File.pm?rev=62350&op=diff
==============================================================================
--- trunk/libdbm-deep-perl/lib/DBM/Deep/Engine/File.pm (original)
+++ trunk/libdbm-deep-perl/lib/DBM/Deep/Engine/File.pm Mon Sep 6 03:09:09 2010
@@ -426,7 +426,7 @@
my @slots = $self->read_txn_slots;
my $found;
- for my $i ( 0 .. $#slots ) {
+ for my $i ( 0 .. $self->num_txns-2 ) {
next if $slots[$i];
$slots[$i] = 1;
Modified: trunk/libdbm-deep-perl/lib/DBM/Deep/Internals.pod
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbm-deep-perl/lib/DBM/Deep/Internals.pod?rev=62350&op=diff
==============================================================================
--- trunk/libdbm-deep-perl/lib/DBM/Deep/Internals.pod (original)
+++ trunk/libdbm-deep-perl/lib/DBM/Deep/Internals.pod Mon Sep 6 03:09:09 2010
@@ -6,6 +6,8 @@
This document is out-of-date. It describes an intermediate file format used
during the development from 0.983 to 1.0000. It will be rewritten soon.
+
+So far, the description of the header format has been updated.
=head1 DESCRIPTION
@@ -43,11 +45,24 @@
=head1 FILE LAYOUT
+This describes the 1.0003 and 2.0000 formats, which internally are numbered
+3 and 4, respectively. The internal numbers are used in this section. These
+two formats are almost identical.
+
DBM::Deep uses a tagged file layout. Every section has a tag, a size, and then
the data.
=head2 File header
+The file header consists of two parts. The first part is a fixed length of
+13 bytes:
+
+ DBDP h VVVV SSSS
+ \ / | \ \
+ \/ '---. \ '--- size of the second part of the header
+ file \ '--- version
+ signature tag
+
=over 4
=item * File Signature
@@ -55,29 +70,79 @@
The first four bytes are 'DPDB' in network byte order, signifying that this is
a DBM::Deep file.
-=item * File tag/size
-
-This is the tagging of the file header. The file used by versions prior to
-1.00 had a different fifth byte, allowing the difference to the determined.
+=item * File tag
+
+A literal ASCII 'h', indicating that this is the header. The file used by
+versions prior to 1.00 had a different fifth byte, allowing the difference
+to be determined.
=item * Version
This is four bytes containing the file version. This lets the file format change over time.
+
+It is packed in network order, so version 4 is stored as "\0\0\0\cD".
+
+=item * Header size
+
+The size of the second part of the header, in bytes. This number is also
+packed in network order.
+
+=back
+
+The second part of the header is as follows:
+
+ S B S T T(TTTTTTTTT...) (SS SS SS SS ...) (continued...)
+ | | | | \ |
+ | | | '----------. \ staleness counters
+ | | '--------. \ txn bitfield
+ | '------. \ number of transactions
+ byte size \ data sector size
+ max buckets
+
+ (continuation...)
+ BB(BBBBBB) DD(DDDDDD) II(IIIIII)
+ | | |
+ | free data |
+ free blist free index
+
+=over
=item * Constants
These are the file-wide constants that determine how the file is laid out.
They can only be set upon file creation.
+The byte size is the number of bytes used to point to an offset elsewhere
+in the file. This corresponds to the C<pack_size> option. This and the
+next three values are stored as packed 8-bit integers (chars), so 2 is
+represented by "\cB".
+
+C<max_buckets> and C<data_sector_size> are documented in the main
+L<DBM::Deep> man page. The number stored is actually one less than what is
+passed to the constructor, to allow for a range of 1-256.
+
+The number of transactions corresponds to the C<num_txns> value passed to
+the constructor.
+
=item * Transaction information
-The current running transactions are stored here, as is the next transaction
-ID.
+The transaction bitfield consists of one bit for every available
+transaction ID. It is therefore anywhere from 1 byte to 32 bytes long.
+
+The staleness counters each take two bytes (packed 32-bit integers), one
+for each transaction, not including the so-called HEAD (the main
+transaction that all processes share I<before> calling C<begin_work>). So
+these take up 0 to 508 bytes.
+
+Staleness is explained in L<DBM::Deep::Engine|DBM::Deep::Engine/STALENESS>.
=item * Freespace information
-Pointers into the next free sectors of the various sector sizes (Index,
-Bucketlist, and Data) are stored here.
+Pointers into the first free sectors of the various sector sizes (Index,
+Bucketlist, and Data) are stored here. These are called chains internally,
+as each free sector points to the next one.
+
+The number of bytes is determined by the byte size, ranging from 2 to 8.
=back
Modified: trunk/libdbm-deep-perl/t/06_error.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbm-deep-perl/t/06_error.t?rev=62350&op=diff
==============================================================================
--- trunk/libdbm-deep-perl/t/06_error.t (original)
+++ trunk/libdbm-deep-perl/t/06_error.t Mon Sep 6 03:09:09 2010
@@ -137,4 +137,22 @@
)1\.0003 to \d/, "Fail if opening a file version 1";
}
+{
+ # Make sure we get the right file name in the error message.
+ throws_ok {
+ eval "#line 1 gneen\nDBM::Deep->new( 't/etc/db-0-99_04' )"
+ or die $@
+ } qr/ at gneen line 1\b/, "File name in error message is correct";
+}
+
+{
+ # Too many transactions.
+ my ($fh, $filename) = new_fh();
+
+ throws_ok {
+ new DBM::Deep $filename =>-> begin_work;
+ } qr/^DBM::Deep: Cannot allocate transaction ID at/,
+ "Error when starting transaction in database with only 1 txn";
+}
+
done_testing;
Modified: trunk/libdbm-deep-perl/t/43_transaction_maximum.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdbm-deep-perl/t/43_transaction_maximum.t?rev=62350&op=diff
==============================================================================
--- trunk/libdbm-deep-perl/t/43_transaction_maximum.t (original)
+++ trunk/libdbm-deep-perl/t/43_transaction_maximum.t Mon Sep 6 03:09:09 2010
@@ -30,12 +30,15 @@
),
()
)
- } 2 .. $max_txns;
- if($reached_max) {
+ } 2 .. $max_txns-1; # -1 because the head is included in the number
+ if($reached_max) { # of transactions
diag "This OS apparently can open only $max_txns files.";
}
- cmp_ok( scalar(@dbs), '==', $max_txns, "We could open enough DB handles" );
+ cmp_ok(
+ scalar(@dbs), '==', $max_txns-1,
+ "We could open enough DB handles"
+ );
my %trans_ids;
for my $n (0 .. $#dbs) {
More information about the Pkg-perl-cvs-commits
mailing list