From: Kevin Lewis Date: June 30 2009 4:01pm Subject: Re: IndexRootPage::splitIndexPage List-Archive: http://lists.mysql.com/falcon/775 Message-Id: <4A4A36EF.4010700@sun.com> MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT 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 > >