Re: org.ozoneDB.ObjectNotFoundException: No such object ID:

Jimmy Stiefel <[email protected]> Tue, 22 Nov 2005 11:14:38 -0800
Newsgroups gmane.comp.java.ozone.user
Message-ID <1132686878.14010.27.camel@crystal>
I've experienced similar problems on multiple occasions with 1.2.  One
numerous occasions,  the server has lost objects from its index.

First thing I'd recommend is to try rebuilding your object index.  
This is generally a safe operation,  but backup first to be safe!  This
has fixed the situation most of the time.

Stop Ozone.
Delete the file "nameTable.wizard" in your database data directory.
Start ozone.

On start, Ozone will automatically rebuild your object index by walking
through each cluster.  When it is done,  hopefully your objects will be
findable again.

If that doesn't work,  you are dealing with corruption of one or more
cluster files.  During the index rebuild,  you will see messages in your
log about a corrupt cluster (and which one it is) if that is the case.
I had that problem yesterday and was able to repair it by restoring the
bad cluster from a backup.  That worked in my case,  but it may
introduce inconsistencies, so beware - YMMV.

As a last resort, I'd write a utility to traverse your data looking for
the bad objects by calling an impl method on each suspect ozone object
and catching the ozone exception.  When you find a bad one, you don't
want to delete it from ozone (it's already gone from there - that's the
problem) - you just want to remove the reference.   In my case I had a
collection that contained some "lost" objects.  I tested & found the bad
ones like so (below),  then removed those elements from my collection.
You will lose data this way,  but at least you'll get your system back.

   try {
       member.getUserName();
   } catch(org.ozoneDB.UnexpectedException ex) {
       logger.warn("Ozone failure: bad proxy? Scheduling errant member
for removal.", e);
        corrupt.add(userName);
    }

I'd strongly advise testing out any repair attempt on a copy of your
data to validate the effectiveness of your repair before alterring your
production data.

~Jimmy


On Thu, 2005-11-17 at 17:12 +0100, Rikard Andersson wrote:
> Hi.
>  
> Somehow I seem to have gotten a corrupt ozone database, how I am not
> sure. But I am looking for a way to fix it without having to delete
> the entire db. Leads on how the db may have been corrupt is
> appreciated as well.
>  
> Scenario:
> I am able to get the name of the object from:
> String[] vNames = vLocalDatabase.objectNames(); // vLocalDatabase is
> org.ozoneDB.LocalDatabase
>  
> But when I try to access the object with:
> vLocalDatabase.objectForName(vNames[CORRUPT_NBR]);
> I get the exception below, obviously same problem when I try to delete
> it, because I need access the object in order to delete it...
>  
> And since I am not able to delete it, I cannot (or can I?) rewrite
> just the corrupt object.
>  
> Any help, solving the issue is much appreciated.
>  
> Br
> Rikard Andersson
>  
> Exception:
> org.ozoneDB.ObjectNotFoundException: No such object ID: 119
>  at org.ozoneDB.core.Transaction.acquireObject(Unknown Source)
>  at org.ozoneDB.Database.fetch(Unknown Source)
>  at
> org.ozoneDB.blob.BLOBPageImpl_Proxy.size(BLOBPageImpl_Proxy.java:69)
>  at
> org.ozoneDB.blob.BLOBContainerImpl.available(BLOBContainerImpl.java:80)
>  at
> org.ozoneDB.blob.BLOBContainerImpl.read(BLOBContainerImpl.java:174)
>  at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
>  at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>  at java.lang.reflect.Method.invoke(Method.java:324)
>  at org.ozoneDB.core.AbstractObjectContainer.invokeTarget(Unknown
> Source)
>  at org.ozoneDB.core.Transaction.invokeObject(Unknown Source)
>  at org.ozoneDB.core.DbRemote.DbInvoke.perform(Unknown Source)
>  at org.ozoneDB.core.Transaction.performCommand(Unknown Source)
>  at org.ozoneDB.core.TransactionManager.performCommand(Unknown Source)
>  at org.ozoneDB.core.TransactionManager.completeTransaction(Unknown
> Source)
>  at org.ozoneDB.core.TransactionManager.handleCommand(Unknown Source)
>  at org.ozoneDB.core.DbRemote.DbLocalClient.send(Unknown Source)
>  at org.ozoneDB.ExternalDatabase.sendCommand(Unknown Source)
>  at org.ozoneDB.ExternalDatabase.sendCommand(Unknown Source)
>  at org.ozoneDB.ExternalDatabase.invoke(Unknown Source)
>  at
> org.ozoneDB.blob.BLOBContainerImpl_Proxy.read(BLOBContainerImpl_Proxy.java:220)
>  at org.ozoneDB.blob.BLOBInputStream.read(BLOBInputStream.java:62)
>  at java.util.zip.CheckedInputStream.read(CheckedInputStream.java:60)
> .... 
>  



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click