r62348 - in /branches/upstream/libdbm-deep-perl/current: Changes META.yml README 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 02:17:54 UTC 2010


Author: ansgar-guest
Date: Mon Sep  6 02:14:35 2010
New Revision: 62348

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=62348
Log:
[svn-upgrade] new version libdbm-deep-perl (2.0002)

Modified:
    branches/upstream/libdbm-deep-perl/current/Changes
    branches/upstream/libdbm-deep-perl/current/META.yml
    branches/upstream/libdbm-deep-perl/current/README
    branches/upstream/libdbm-deep-perl/current/lib/DBM/Deep.pm
    branches/upstream/libdbm-deep-perl/current/lib/DBM/Deep.pod
    branches/upstream/libdbm-deep-perl/current/lib/DBM/Deep/Engine/File.pm
    branches/upstream/libdbm-deep-perl/current/lib/DBM/Deep/Internals.pod
    branches/upstream/libdbm-deep-perl/current/t/06_error.t
    branches/upstream/libdbm-deep-perl/current/t/43_transaction_maximum.t

Modified: branches/upstream/libdbm-deep-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbm-deep-perl/current/Changes?rev=62348&op=diff
==============================================================================
--- branches/upstream/libdbm-deep-perl/current/Changes (original)
+++ branches/upstream/libdbm-deep-perl/current/Changes Mon Sep  6 02:14:35 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: branches/upstream/libdbm-deep-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbm-deep-perl/current/META.yml?rev=62348&op=diff
==============================================================================
--- branches/upstream/libdbm-deep-perl/current/META.yml (original)
+++ branches/upstream/libdbm-deep-perl/current/META.yml Mon Sep  6 02:14:35 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: branches/upstream/libdbm-deep-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbm-deep-perl/current/README?rev=62348&op=diff
==============================================================================
--- branches/upstream/libdbm-deep-perl/current/README (original)
+++ branches/upstream/libdbm-deep-perl/current/README Mon Sep  6 02:14:35 2010
@@ -3,7 +3,7 @@
     transactions
 
 VERSION
-    2.0001
+    2.0002
 
 SYNOPSIS
       use DBM::Deep;

Modified: branches/upstream/libdbm-deep-perl/current/lib/DBM/Deep.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbm-deep-perl/current/lib/DBM/Deep.pm?rev=62348&op=diff
==============================================================================
--- branches/upstream/libdbm-deep-perl/current/lib/DBM/Deep.pm (original)
+++ branches/upstream/libdbm-deep-perl/current/lib/DBM/Deep.pm Mon Sep  6 02:14:35 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: branches/upstream/libdbm-deep-perl/current/lib/DBM/Deep.pod
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbm-deep-perl/current/lib/DBM/Deep.pod?rev=62348&op=diff
==============================================================================
--- branches/upstream/libdbm-deep-perl/current/lib/DBM/Deep.pod (original)
+++ branches/upstream/libdbm-deep-perl/current/lib/DBM/Deep.pod Mon Sep  6 02:14:35 2010
@@ -4,7 +4,7 @@
 
 =head1 VERSION
 
-2.0001
+2.0002
 
 =head1 SYNOPSIS
 

Modified: branches/upstream/libdbm-deep-perl/current/lib/DBM/Deep/Engine/File.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbm-deep-perl/current/lib/DBM/Deep/Engine/File.pm?rev=62348&op=diff
==============================================================================
--- branches/upstream/libdbm-deep-perl/current/lib/DBM/Deep/Engine/File.pm (original)
+++ branches/upstream/libdbm-deep-perl/current/lib/DBM/Deep/Engine/File.pm Mon Sep  6 02:14:35 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: branches/upstream/libdbm-deep-perl/current/lib/DBM/Deep/Internals.pod
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbm-deep-perl/current/lib/DBM/Deep/Internals.pod?rev=62348&op=diff
==============================================================================
--- branches/upstream/libdbm-deep-perl/current/lib/DBM/Deep/Internals.pod (original)
+++ branches/upstream/libdbm-deep-perl/current/lib/DBM/Deep/Internals.pod Mon Sep  6 02:14:35 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: branches/upstream/libdbm-deep-perl/current/t/06_error.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbm-deep-perl/current/t/06_error.t?rev=62348&op=diff
==============================================================================
--- branches/upstream/libdbm-deep-perl/current/t/06_error.t (original)
+++ branches/upstream/libdbm-deep-perl/current/t/06_error.t Mon Sep  6 02:14:35 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: branches/upstream/libdbm-deep-perl/current/t/43_transaction_maximum.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbm-deep-perl/current/t/43_transaction_maximum.t?rev=62348&op=diff
==============================================================================
--- branches/upstream/libdbm-deep-perl/current/t/43_transaction_maximum.t (original)
+++ branches/upstream/libdbm-deep-perl/current/t/43_transaction_maximum.t Mon Sep  6 02:14:35 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