List:Falcon Storage Engine« Previous MessageNext Message »
From:Lars-Erik Bjørk Date:June 30 2009 6:19pm
Subject:Re: IndexRootPage::splitIndexPage
View as plain text  
Then I will change it :)

Thanks for looking at it!


On Jun 30, 2009, at 6:01 PM, Kevin Lewis wrote:

> LarsErik,
> Yes, your analysis seems to be correct in that the return true is a  
> catch22 that cannot happen.  It will only return true if the  
> recursive call returns true.
> Lars-Erik Bjørk wrote:
>> Hi all!
>> I have been looking at indexRootPage::splitIndexPage, and a small  
>> part of it seems a little strange to me. It will not provoke a bug,  
>> but it is confusing when reading it.
>> The method is declared to return a bool. When splitting an index  
>> page, the method will recursively call itself if the parent page  
>> also needs to be split. The recursion will stop when the parent  
>> page does not need to be split, or the root page is split. In this  
>> case, it will return false.
>> The recursion looks like this
>> ...
>> if (splitIndexPage (dbb, indexId, parentBdb, transId, result,  
>> &splitKey,
>>                              splitPageNumber, (parentBdb- 
>> >pageNumber == rootPageNumber)))
>>    return true;
>> ...
>> However, this is the only place the method returns true, so  
>> therefore it can actually never return true.
>> The return value, which will always be false is also used in a  
>> branch in IndexRootPage::addIndexEntry.
>> Do you agree with this? It is ok if I rewrite this to be a void  
>> method instead? It will improve the readability, and we will avoid  
>> the possibility that someone will use the return value in the future.
>> Best,
>> Lars-Erik
> -- 
> Falcon Storage Engine Mailing List
> For list archives:
> To unsubscribe:

IndexRootPage::splitIndexPageLars-Erik Bjørk30 Jun
  • Re: IndexRootPage::splitIndexPageKevin Lewis30 Jun
    • Re: IndexRootPage::splitIndexPageLars-Erik Bjørk30 Jun