You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Raymond Raymond <ra...@hotmail.com> on 2006/02/28 22:31:11 UTC

Is there any means to get the size of a log record?

I am trying to do some statistics to estimate recovery speed.
I can get how many log records the recovery process scaned
during the recovery and how long the recovery takes.The recovery
speed I got so far is something like

X log records/second

But, to use the recovery speed to schedule the checkpoint,
I need it likes

X KB/second

I looked into the org.apache.derby.impl.store.raw.log.LogToFile.java .
The checkpoint is trigger in the flush(long fileNumber, long wherePosition)
function. The condition to trigger a checkpoint is :

if ((logWrittenFromLastCheckPoint + potentialLastFlush) > checkpointInterval 
&&
?checkpointDaemon != null && !checkpointDaemonCalled && !inLogSwitch)

logWrittenFromLastCheckPoint, potentialLastFlush and?checkpointInterval
are in size (X bytes), so, I need the revovery speed in size (e.g. X 
KB/second).
In another word, I want to know how much (KB) log the recovery process
scaned during recovery. I refered to
http://db.apache.org/derby/papers/logformats.html,
it says the log record wrapper keeps the length of the log record.
I checked the source code and found the length of the log record
is only used in the getNextRecordBackward() and getNextRecordForward()
functions in org.apache.derby.impl.store.raw.log.Scan.java. I can't
get it outside those functions. Anyone can give me some suggestions to
solve the problem?

Thanks.


Raymond

_________________________________________________________________
Powerful Parental Controls Let your child discover the best the Internet has 
to offer.  
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines 
  Start enjoying all the benefits of MSNŽ Premium right now and get the 
first two months FREE*.


Re: Re: Is there any means to get the size of a log record?

Posted by Raymond Raymond <ra...@hotmail.com>.
If I can know the size of log file which is needed to be scaned
during ecovery, I can caculate the speed of recovery in X KB/second.
I got an idea to estimate the size of log which is needed to be
scaned during recovery. But I am not sure whither it is correct
or not.

As far as I know, derby will truncate useless log file after:
-- a intact checkpoint is finished
-- after recovery is finished
Can I say when derby boots, all the log files remained in the log
folder are the log files needed to be scaned by recovery process?
If it is true, I can estimate how much log need to be scaned by

amount of log file * size of log file

(the size of log file is almost the same for each log file, defaultly it
is 1M in derby)

This estimation is not very accurate, but I think the result is good
enough.Any comments?

Thanks.

Raymond


>From: Mike Matrigali <mi...@sbcglobal.net>
>
>I have not had time to look at the specific code.  My guess is that
>you will have to add code to the redo and undo recovery loops to
>track how much they have read.  This may involve changing the internal
>interfaces to get at lengths of each log record - not sure.
>
>you might look at the code that tracks how much log space has been
>using in normal logging currently used for scheduling a checkpoint
>as a pointer to how to track log size.
>
>Raymond Raymond wrote:
>>I am trying to do some statistics to estimate recovery speed.
>>I can get how many log records the recovery process scaned
>>during the recovery and how long the recovery takes.The recovery
>>speed I got so far is something like
>>
>>X log records/second
>>
>>But, to use the recovery speed to schedule the checkpoint,
>>I need it likes
>>
>>X KB/second
>>
>>I looked into the org.apache.derby.impl.store.raw.log.LogToFile.java .
>>The checkpoint is trigger in the flush(long fileNumber, long 
>>wherePosition)
>>function. The condition to trigger a checkpoint is :
>>
>>if ((logWrittenFromLastCheckPoint + potentialLastFlush) > 
>>checkpointInterval &&
>>?checkpointDaemon != null && !checkpointDaemonCalled && !inLogSwitch)
>>
>>logWrittenFromLastCheckPoint, potentialLastFlush and?checkpointInterval
>>are in size (X bytes), so, I need the revovery speed in size (e.g. X 
>>KB/second).
>>In another word, I want to know how much (KB) log the recovery process
>>scaned during recovery. I refered to
>>http://db.apache.org/derby/papers/logformats.html,
>>it says the log record wrapper keeps the length of the log record.
>>I checked the source code and found the length of the log record
>>is only used in the getNextRecordBackward() and getNextRecordForward()
>>functions in org.apache.derby.impl.store.raw.log.Scan.java. I can't
>>get it outside those functions. Anyone can give me some suggestions to
>>solve the problem?
>>
>>Thanks.
>>
>>
>>Raymond
>>
>>_________________________________________________________________
>>Powerful Parental Controls Let your child discover the best the Internet 
>>has to offer.  
>>http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines 
>>  Start enjoying all the benefits of MSN?Premium right now and get the 
>>first two months FREE*.
>>
>>
>>
>

_________________________________________________________________
Take advantage of powerful junk e-mail filters built on patented MicrosoftŽ 
SmartScreen Technology. 
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines 
  Start enjoying all the benefits of MSNŽ Premium right now and get the 
first two months FREE*.


Re: Is there any means to get the size of a log record?

Posted by Mike Matrigali <mi...@sbcglobal.net>.
I have not had time to look at the specific code.  My guess is that
you will have to add code to the redo and undo recovery loops to
track how much they have read.  This may involve changing the internal
interfaces to get at lengths of each log record - not sure.

you might look at the code that tracks how much log space has been
using in normal logging currently used for scheduling a checkpoint
as a pointer to how to track log size.

Raymond Raymond wrote:
> I am trying to do some statistics to estimate recovery speed.
> I can get how many log records the recovery process scaned
> during the recovery and how long the recovery takes.The recovery
> speed I got so far is something like
> 
> X log records/second
> 
> But, to use the recovery speed to schedule the checkpoint,
> I need it likes
> 
> X KB/second
> 
> I looked into the org.apache.derby.impl.store.raw.log.LogToFile.java .
> The checkpoint is trigger in the flush(long fileNumber, long wherePosition)
> function. The condition to trigger a checkpoint is :
> 
> if ((logWrittenFromLastCheckPoint + potentialLastFlush) > 
> checkpointInterval &&
> ?checkpointDaemon != null && !checkpointDaemonCalled && !inLogSwitch)
> 
> logWrittenFromLastCheckPoint, potentialLastFlush and?checkpointInterval
> are in size (X bytes), so, I need the revovery speed in size (e.g. X 
> KB/second).
> In another word, I want to know how much (KB) log the recovery process
> scaned during recovery. I refered to
> http://db.apache.org/derby/papers/logformats.html,
> it says the log record wrapper keeps the length of the log record.
> I checked the source code and found the length of the log record
> is only used in the getNextRecordBackward() and getNextRecordForward()
> functions in org.apache.derby.impl.store.raw.log.Scan.java. I can't
> get it outside those functions. Anyone can give me some suggestions to
> solve the problem?
> 
> Thanks.
> 
> 
> Raymond
> 
> _________________________________________________________________
> Powerful Parental Controls Let your child discover the best the Internet 
> has to offer.  
> http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines 
>  Start enjoying all the benefits of MSN® Premium right now and get the 
> first two months FREE*.
> 
> 
>