List:Falcon Storage Engine« Previous MessageNext Message »
From:Lars-Erik Bjørk Date:June 30 2009 1:41pm
View as plain text  
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 

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.



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