db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Matrigali <mikem_...@sbcglobal.net>
Subject Re: Derby architecture/design documents
Date Mon, 07 Feb 2005 22:24:27 GMT
Yes, the log record is serialized out, but it does not use generic
java serialization.  Derby implements it's own serialization scheme
for objects that it owns.  The reason for this is to avoid the overhead
of serialization.  Derby basically uses a single number to identify
the object and knows how to create that object when it is read back
in.  The number is known in derby as a format id.

For log records the work is done by using a FormatIdOutputStream.

So the type is actually something like an InsertOperation (Undoable is
an interface implemented by most if not all of the log records).  Search
for LOGOP in
opensource/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java
 to see list of log operations.  The mapping of number to class is
supported through RegisteredFormatIds.java in same directory.

Dibyendu Majumdar wrote:

>> RPost wrote:
>>
>>> 1. Where in the format does a log record indicate the type of record
>>> (redo,
>>> undo, etc)?
>>
>>
> Mike Matrigali wrote:
> 
>> log records are not of type redo, undo, ...   Redo is the recovery phase
>> and during redo you ask every log record to perform redo.  And during
>> undo you ask it to do undo.
> 
> 
> Mike,
> 
> Is my understanding correct that the type (Undoable, for example) of the
> log record is part of the Loggable hierarchy, and that Loggable objects
> are serialized as user data in the LogRecord, and de-serialized back as
> objects when they are being read? Therefore, the correct type of
> Loggable object is automatically created? Relevant code from LogRecord
> given below:
> 
>         Object obj = input.readObject();
> 
>         if (SanityManager.DEBUG) {
>             if ( ! (obj instanceof Loggable))
>                 SanityManager.THROWASSERT(
>                     "log record not getting expected Loggable: got : " +
>                     obj.getClass().getName());
>         }
>         op = (Loggable)obj;
> 
> 
> Regards
> 
> Dibyendu
> 
> 

Mime
View raw message