[Zope] Corrupt Data.fs

Chris McDonough chrism@zope.com
Wed, 27 Mar 2002 10:27:46 -0500


Well.. hmm.  Since you packed, you don't really have any "history" in the
Data.fs that would make a solution like
http://www.zope.org/Members/itamar/CorruptedZODB workable.

Your database really isn't "corrupt" but it sounds like there is either a
bug in BTrees or in the BTreeFolder code that is causing you this problem.
A workaround may be to create a new BTreeFolder, and use the Zope
ObjectManager API to copy the contents of the "old" BTreeFolder to the new
one, then make sure the new one works and delete the old one, moving the new
one in to its place.

Some pseudocode that might get you in the right direction:

app = Zope.app()
for id in app.badfolder.objectIds():
   try:
      ob = getattr(app.badfolder, id)
   except:
      print "couldn't get %s" % id
      continue
   < might need to change ob.id here >
   app.goodfolder._setObject(id, ob)

----- Original Message -----
From: "Sven Rudolph" <rudolph@medical-tribune.de>
To: <zope@zope.org>
Sent: Wednesday, March 27, 2002 5:39 AM
Subject: [Zope] Corrupt Data.fs


> Hello!
>
> I have a problem with a (probably) corrupt Data.fs. on our production
> system. This is what happend:
> Yesterday we accidently deleted a file called "Kopfschmerz1" (this means
> headache1, how fitting). We undeleted it with undo, and everything was OK.
> This night Data.fs was packed (0 Days) by a cron job.
> Now some strange things happen.
> If I use <dtml-in> on the (BTree-)Folder that contains "Kopfschmerz1" it
> breaks with an "Attribute Error" at "Kopfschmerz1".("Kopfschmerz1" is an
> instance of one of our products and should definitly have this attribute).
> If I try to open "Kopfschmerz1" Zope tells me that it doesn't exist, but
> it is shown in the list of the folder. If I try to delete "Kopfschmerz1"
> Zope tells me that it doesn't exist. If I try to create a new object with
> the name "Kopfschmerz1", Zope tells me that an object with this name
> allready exists.
>
> This is what I did wrong:
> I used Zope-2.5.0 with Python-2.1.1
> Ironically I started to set up a new server with Zope-2.5.1b1 and
> Python-2.1.2 yesterday and was planning to switch to it today.
>
> What can I do now?
> Is there a way to get rid of the broken object? (I don't care if I lose
> "Kopfschmerz1", as long as I can keep the other >10000 objects in the
> database).
> What are the possibilitys to repair a damaged Data.fs?
> How can I find out if Data.fs is already damaged, even if no obvious
errors occur?
>
> Thanks in advance!
>
> Sven Rudolph
>
> --
> Sven Rudolph, Programmierer
> GermanMedicalServices.de GmbH
> Unter den Eichen 5, 65195 Wiesbaden
> Tel.: 06 11 / 97 46 25 2
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>