Merge cd5303b: RT# 50541: Fix for clear bug. Introduces a speed regression
[dbsrgits/DBM-Deep.git] / lib / DBM / Deep / Engine / Sector / Reference.pm
index 94dfaee..c681cda 100644 (file)
@@ -163,10 +163,13 @@ sub delete_key {
     my $self = shift;
     my ($args) = @_;
 
-    # XXX What should happen if this fails?
+    # This can return nothing if we are deleting an entry in a hashref that was
+    # auto-vivified as part of the delete process. For example:
+    #     my $x = {};
+    #     delete $x->{foo}{bar};
     my $blist = $self->get_bucket_list({
         key_md5 => $args->{key_md5},
-    }) or DBM::Deep->_throw_error( "How did delete_key fail (no blist)?!" );
+    }) or return;
 
     # Save the location so that we can free the data
     my $location = $blist->get_data_location_for({
@@ -280,9 +283,10 @@ sub get_bucket_list {
     $sector->find_md5( $args->{key_md5} );
 
     # See whether or not we need to reindex the bucketlist
-    # Yes, the double-braces are there for a reason. if() doesn't create a redo-able block,
-    # so we have to create a bare block within the if() for redo-purposes. Patch and idea
-    # submitted by sprout@cpan.org. -RobK, 2008-01-09
+    # Yes, the double-braces are there for a reason. if() doesn't create a
+    # redo-able block, so we have to create a bare block within the if() for
+    # redo-purposes.
+    # Patch and idea submitted by sprout@cpan.org. -RobK, 2008-01-09
     if ( !$sector->has_md5 && $args->{create} && $sector->{idx} == -1 ) {{
         my $redo;