Bug 37583

Summary: RDBMS store not retrieving revision descriptors correctly.
Product: Slide Reporter: Rob Nielsen <rob>
Component: StoresAssignee: Slide Developer List <slide-dev>
Status: NEW ---    
Severity: normal    
Priority: P2    
Version: Nightly   
Target Milestone: ---   
Hardware: All   
OS: Windows XP   

Description Rob Nielsen 2005-11-21 23:58:44 UTC
The successors SQL query in StandardRDBMSAdapter.java appears to be wrong.  If
you perform a load of a store using this class than contains a branch , then try
to make a new branch (ie. you have 1.0, 1.0.1.0, and 1.1 and you try to make
1.0.2.0), you will get an Internal Server Error (500) as it will try to create
1.0.1.0 again.

The issue is in the retrieveRevisionDescriptors() method, line 955
The query is 

"select distinct pvh.REVISION_NO from VERSION_HISTORY vh, VERSION_HISTORY pvh,
VERSION_PREDS vp, URI u where pvh.VERSION_ID = vp.VERSION_ID and vp.VERSION_ID =
vh.VERSION_ID and vh.URI_ID = u.URI_ID and u.URI_STRING = ? and vh.REVISION_NO = ?"

but this will only return the revision_no passed in.  It seems like it should be 

"select distinct pvh.REVISION_NO from VERSION_HISTORY vh, VERSION_HISTORY pvh,
VERSION_PREDS vp, URI u where pvh.VERSION_ID = vp.PREDECESSOR_ID and
vp.VERSION_ID = vh.VERSION_ID and vh.URI_ID = u.URI_ID and u.URI_STRING = ? and
vh.REVISION_NO = ?"

(ie vp.VERSION_ID becomes vp.PREDECESSOR_ID) and this seems to fix the issue.

Steps to reproduce:
checkout file.txt
checkin file.txt
update file.txt /store/history/1/1.0
checkout file.txt
checkin file.txt

<restart slide>

update file.txt /store/history/1/1.0
checkout file.txt
checkin file.txt
<500 internal server error>