Fixed hardcoded 0 staleness for HEAD in inc_txn_staleness_counter
rkinyon [Thu, 27 Sep 2007 19:19:45 +0000 (19:19 +0000)]
Changes
lib/DBM/Deep/Engine.pm

diff --git a/Changes b/Changes
index 4e03a9c..88d6092 100644 (file)
--- a/Changes
+++ b/Changes
@@ -5,6 +5,8 @@ Revision history for DBM::Deep.
     - Added filter sugar methods to be more API-compatible with other DBMs
     - Implemented _dump_file in order to display the file structure.
       - Arrays now clean up after themselves better.
+      - Bucketlists now clean up after themselves better.
+      - Reindexing properly clears the old bucketlist before freeing it.
 
 1.0003 Sep 24 14:00:00 2007 EDT
     - THIS VERSION IS INCOMPATIBLE WITH FILES FROM ALL OTHER PRIOR VERSIONS.
index c5b3363..bc63b76 100644 (file)
@@ -575,7 +575,7 @@ sub inc_txn_staleness_counter {
     my ($trans_id) = @_;
 
     # Hardcode staleness of 0 for the HEAD
-    return unless $trans_id;
+    return 0 unless $trans_id;
 
     $self->storage->print_at(
         $self->trans_loc + $self->txn_bitfield_len + $STALE_SIZE * ($trans_id - 1),
@@ -945,7 +945,7 @@ sub _dump_file {
             elsif ( $sector->type eq 'B' ) {
                 foreach my $bucket ( $sector->chopped_up ) {
                     $return .= "\n    ";
-                    $return .= sprintf "%04d", unpack($StP{$self->byte_size},
+                    $return .= sprintf "%08d", unpack($StP{$self->byte_size},
                         substr( $bucket->[-1], $self->hash_size, $self->byte_size),
                     );
                     foreach my $txn ( 0 .. $self->num_txns - 1 ) {
@@ -955,7 +955,7 @@ sub _dump_file {
                                 $self->byte_size,
                             ),
                         );
-                        $return .= sprintf " %04d", $l;
+                        $return .= sprintf " %08d", $l;
                     }
                 }
             }