db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Created: (DERBY-4685) Dead/unreachable code in OpenConglomerate.lockPositionForWrite()
Date Tue, 01 Jun 2010 19:28:38 GMT
Dead/unreachable code in OpenConglomerate.lockPositionForWrite()
----------------------------------------------------------------

                 Key: DERBY-4685
                 URL: https://issues.apache.org/jira/browse/DERBY-4685
             Project: Derby
          Issue Type: Improvement
          Components: Store
    Affects Versions: 10.7.0.0
            Reporter: Knut Anders Hatlen
            Priority: Minor


OpenConglomerate.lockPositionForWrite() contains this code twice:

            if (!waitForLock)
            {
                // throw lock timeout error.
                throw StandardException.newException(SQLState.LOCK_TIMEOUT);
            }

The second occurrence of this code can never end up throwing an exception, since waitForLock
is guaranteed to be true there because of the identical check a couple of lines above. (Judging
by the similar method lockPositionForRead(), it is probably the first check that should be
removed, so that the latch on the page is released before the exception is thrown.)

Also, the method is always called with forInsert==false, so the forInsert parameter can be
removed. (I also suspect that the method doesn't work correctly if ever used in an insert
operation, since it calls latchPage(RowPosition) which will unlatch the page if the row isn't
found on the page, and I assume that a row that is about to be inserted does not exist yet.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message