[LON-CAPA-cvs] cvs: loncom /debugging_tools seed_accesscount.pl

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 04 Dec 2003 13:40:29 -0000


matthew		Thu Dec  4 08:40:29 2003 EDT

  Modified files:              
    /loncom/debugging_tools	seed_accesscount.pl 
  Log:
  Added call to reduce size of the resevaldata.db file once keys are removed.
  
  
Index: loncom/debugging_tools/seed_accesscount.pl
diff -u loncom/debugging_tools/seed_accesscount.pl:1.2 loncom/debugging_tools/seed_accesscount.pl:1.3
--- loncom/debugging_tools/seed_accesscount.pl:1.2	Fri Nov 14 15:41:48 2003
+++ loncom/debugging_tools/seed_accesscount.pl	Thu Dec  4 08:40:29 2003
@@ -2,7 +2,7 @@
 #
 # The LearningOnline Network
 #
-# $Id: seed_accesscount.pl,v 1.2 2003/11/14 20:41:48 matthew Exp $
+# $Id: seed_accesscount.pl,v 1.3 2003/12/04 13:40:29 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -91,13 +91,17 @@
     untie %resevalDB;
     # remove the keys we saved.
     next if (! scalar(@Keys)); # skip it if we did not get anything...
-    if (! tie(%resevalDB,'GDBM_File',$resDBname,&GDBM_WRITER,0640)) {
+    my $dbptr;
+    if (! ($dbptr = tie(%resevalDB,'GDBM_File',$resDBname,&GDBM_WRITER,0640))){
         die "Unable to re-tie to $resDBname.  No deletes occured.";
     }
     foreach my $basekey (@Keys) {
         delete($resevalDB{$basekey});
     }
-    untie %resevalDB;
+    # Squish the file down
+    $dbptr->reorganize();
+    $dbptr = undef;
+    untie(%resevalDB);
 }
 exit;