[837] in Coldmud discussion meeting

root meeting help first previous next last

db splitter in ColdCore 2.1 release

daemon@ATHENA.MIT.EDU (Sun Oct 22 20:56:31 1995 )

Date: Sun, 22 Oct 1995 18:00:13 -0400 (EDT)
From: James C Deikun <jcdst10+@pitt.edu>
To: coldstuff@pippin.ece.usu.edu

The 'dumpsplit' perl script in ColdCore 2.1 contained two significant 
bugs when it came to splitting a db:

  1) it didn't specify a file mode for mkdir() which caused it not to parse.

  2) there was an off-by-one bug that caused the body of the previous 
object to be placed in the file meant for a given object.

I've fixed both of them (I hope).  Note, though, that I've only tested 
this once (the results were satisfactory) and I haven't tested putting 
the db back together again.

The rest of this message is a patch (context diff) for the changes.


BEGIN -- CUT HERE -- Cut here -- cut here
*** dumpsplit   Wed Oct 11 14:27:17 1995
--- dumpsplit.new       Mon Oct 16 14:00:48 1995
***************
*** 54,61 ****
  sub split {
      while (<DUMP>) {
          if (/^object /) {
!             &saveobj($_);
          } elsif (/^parent /) {
              $parents = "${parents}$_";
          } elsif (/^name /) {
              print NAMES;
--- 54,65 ----
  sub split {
      while (<DUMP>) {
          if (/^object /) {
!             $obj = $_;
          } elsif (/^parent /) {
+             if ($obj) {
+                 &saveobj($obj);
+                 $obj = '';
+             }
              $parents = "${parents}$_";
          } elsif (/^name /) {
              print NAMES;
***************
*** 118,124 ****
  $names = "$srcdir/names";

  if (!(-d $srcdir)) {
!     mkdir($srcdir) || (print "Unable to make directory \"$srcdir\"." && 
exit);  }

  if (/^-s/) {
--- 122,128 ----
  $names = "$srcdir/names";

  if (!(-d $srcdir)) {
!     mkdir($srcdir, 0700) || (print "Unable to make directory 
\"$srcdir\"." &&
exit);
  }

  if (/^-s/) {
END -- CUT HERE -- Cut here -- cut here