* @throws InvalidLogException
*/
public void initLogManager() throws IOException, InvalidLogException
{
LogAnchor scanPoint = new LogAnchor();
LogScanner scanner;
UserLogRecord logRecord;
LogFileManager.LogFileReader reader;
// Read and verify control file
boolean controlFileExists = true;
try
{
this.readControlFile();
}
catch ( FileNotFoundException e )
{
controlFileExists = false;
}
if ( controlFileExists )
{
boolean invalidLog = false;
// Set the min log anchor from the control file
minLogAnchor.resetLogAnchor( controlFileRecord.minNeededLogFile,
controlFileRecord.minNeededLogFileOffset, controlFileRecord.minNeededLSN );
scanPoint.resetLogAnchor( minLogAnchor );
logRecord = new UserLogRecord();
scanner = new DefaultLogScanner( scanPoint, logFileManager );
try
{
while ( scanner.getNextRecord( logRecord ) )
{
// No need to do anything with the log record
}
}
catch ( InvalidLogException e )
{
invalidLog = true;
}
finally
{
scanner.close();
}
long lastGoodLogFileNumber = scanner.getLastGoodFileNumber();
long lastGoodLogFileOffset = scanner.getLastGoodOffset();
currentLogFileNumber = lastGoodLogFileNumber;
if ( ( lastGoodLogFileNumber < LogAnchor.MIN_LOG_NUMBER ) ||
( lastGoodLogFileOffset < LogAnchor.MIN_LOG_OFFSET ) )
{