Converted to using only 2 transactions by default and added the num_txns to the header
[dbsrgits/DBM-Deep.git] / lib / DBM / Deep.pm
index 4031271..a203c6e 100644 (file)
@@ -274,7 +274,12 @@ sub optimize {
 
     my $db_temp = DBM::Deep->new(
         file => $self->_storage->{file} . '.tmp',
-        type => $self->_type
+        type => $self->_type,
+
+        # Bring over all the parameters that we need to bring over
+        num_txns => $self->_engine->num_txns,
+        byte_size => $self->_engine->byte_size,
+        max_buckets => $self->_engine->max_buckets,
     );
 
     $self->lock();
@@ -311,8 +316,11 @@ sub optimize {
 
     $self->unlock();
     $self->_storage->close;
+
     $self->_storage->open;
+    $self->lock();
     $self->_engine->setup_fh( $self );
+    $self->unlock();
 
     return 1;
 }