<?xml version="1.0" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugzilla.globus.org/bugzilla/bugzilla.dtd">

<bugzilla version="3.2.3"
          urlbase="http://bugzilla.globus.org/bugzilla/"
          maintainer="bacon@mcs.anl.gov"
>

    <bug>
          <bug_id>2764</bug_id>
          
          <creation_ts>2005-02-18 10:39</creation_ts>
          <short_desc>Remove Postgresql specific queries from RFT</short_desc>
          <delta_ts>2005-06-14 11:21:16</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>RFT</product>
          <component>RFT</component>
          <version>development</version>
          <rep_platform>Macintosh</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          
          <priority>P3</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>4.2</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ravi Madduri">madduri@mcs.anl.gov</reporter>
          <assigned_to name="Ravi Madduri">madduri@mcs.anl.gov</assigned_to>
          <cc>ghulamhu@us.ibm.com</cc>
    
    <cc>millerjj@us.ibm.com</cc>
    
    <cc>nitswamy@in.ibm.com</cc>
    
    <cc>ogsa-bugs@globus.org</cc>
    
    <cc>paxhia@us.ibm.com</cc>
    
    <cc>seelbach@us.ibm.com</cc>
    
    <cc>tboehm@de.ibm.com</cc>

      

      
          <long_desc isprivate="0">
            <who name="Ravi Madduri">madduri@mcs.anl.gov</who>
            <bug_when>2005-02-18 10:39:04</bug_when>
            <thetext>Find a way to generate primary keys instead of using database to do that. For eg: i can have a UUID as 
request_id and use it in my inserts.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who name="Frank Paxhia">paxhia@us.ibm.com</who>
            <bug_when>2005-03-01 11:20:55</bug_when>
            <thetext>I agree GT4 should be database neutral.  I don&apos;t think you need to find 
another way to generate IDs, or use other identifiers like UUID as an index 
into the requests.
Postgres, MySql, Cloudscape/Derby and other databases have ways of generating 
sequential IDs.  This is usually defined when you create the tables. 
 
In GT4, in the ReliableFileTransferDbAdapter.java code you reference a 
Postgres extension (ie. SEQUENCE) with the following statement:
         ResultSet rs = statement.executeQuery(&quot;SELECT last_value  FROM &quot;   
+ &quot;request_seq&quot;);

In GT3, in the TransferDbAdapter.java code you use a more database generic 
statement:

 ResultSet rs = statement.executeQuery(&quot;SELECT COUNT(id) FROM &quot; + &quot;request&quot;);

Why not use this more generic mechanism?




</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who name="Ravi Madduri">madduri@mcs.anl.gov</who>
            <bug_when>2005-03-01 12:56:38</bug_when>
            <thetext>Because when rft resources reach end of their life time they are removed from the database and select 
count(id) from request; may result in a id that is already been used. it worked in gt3.2 as the records in 
the database were never cleaned by the service</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who name="Charles Bacon">bacon@mcs.anl.gov</who>
            <bug_when>2005-03-04 14:01:53</bug_when>
            <thetext>Via the email gateway:

Ravi I have a few doubts about your response and would like further 
clarification regarding this. Lets consider the following steps:
(1) state of a transfer request is active now.
(2) the database is accessed and a row is created
(3) Lets assume the autoincrement column is used to generate ids so an id 
is chosen
(4) the service has the id of the request and it can use that id to refer 
to the respective row in the database
(5) The service uses the id by doing select count(id), lets say in the 
following situations:
        -&gt; when the marker is changed
        -&gt; when the container goes down and comes back up again
        -&gt; when the lifetime of the request expires
(6) Finally, in an ideal case the transfer request reaches the &quot;Finished&quot; 
state and a transfer is successfully completed. 
(7) The service starts the cleanup process..

        Now I have no idea how does this cleanup process works,, like what 
are the details. How does this cleanup process makes the use of sequence 
in Postgres safer, agreeable and feasible and why and how does it make the 
count(id) problematic? 
Probably I am not understanding exactly what are the pros and cons of one 
technique over another? We agree that the service persists its state data, 
hence the ids its keeping track of, is aware of, is using to access the 
db. What I dont understand is how the service persists the id data, if 
sequence is used and why it wont persist the id data if count(id) is used 
and what are the impacts of the cleanup process on either of these 
techniques?
I really appreciate some further clarification regarding this issue. 
Thanks a lot,

Shama Ghulamhussain
IBM Advanced Systems Infrastructure Development
T/L: 295 8284
ghulamhu@us.ibm.com</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who name="Ravi Madduri">madduri@mcs.anl.gov</who>
            <bug_when>2005-03-18 18:47:28</bug_when>
            <thetext>Created an attachment (id=539)
removing select last_value from request_seq query

Ok this is what you got to do. 
1.remove request_seq from rft database schema.
2. Apply this patch if possible or do something that I do here. You 
basically should insert the requestId instead of database inserting it 
with next value of sequence.
3. See if you can get away doing the same trick with transfer table. And 
let me know how it works out.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who name="Ravi Madduri">madduri@mcs.anl.gov</who>
            <bug_when>2005-04-01 16:46:51</bug_when>
            <thetext>Any updates on this one ?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who name="Ravi Madduri">madduri@mcs.anl.gov</who>
            <bug_when>2005-06-14 11:21:16</bug_when>
            <thetext>I just comitted changes to trunk and globus_4_0_branch that would work around from using sequences in 
postgres. I tested my changes with mysql.</thetext>
          </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>539</attachid>
            <date>2005-03-18 18:47</date>
            <desc>removing select last_value from request_seq query</desc>
            <filename>diff</filename>
            <type>text/plain</type>
            <size>2296</size>
            <attacher>madduri@mcs.anl.gov</attacher>
            <data encoding="base64">SW5kZXg6IHNyYy9vcmcvZ2xvYnVzL3RyYW5zZmVyL3JlbGlhYmxlL3NlcnZpY2UvZGF0YWJhc2Uv
UmVsaWFibGVGaWxlVHJhbnNmZXJEYkFkYXB0ZXIuamF2YQo9PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ClJDUyBmaWxlOiAv
aG9tZS9nbG9iZGV2L0NWUy9nbG9idXMtcGFja2FnZXMvd3MtdHJhbnNmZXIvcmVsaWFibGUvc2Vy
dmljZS9qYXZhL3NvdXJ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gICAgICAgICAgICB0aGlzLnF1ZXJ5Q29uc3RhbnQgPSBzdGF0
ZW1lbnQKLSAgICAgICAgICAgICAgICAgICAgLmV4ZWN1dGVVcGRhdGUoIklOU0VSVCBJTlRPIHJl
cXVlc3QoY29uY3VycmVuY3ksIgorICAgICAgICAgICAgICAgICAgICAuZXhlY3V0ZVVwZGF0ZSgi
SU5TRVJUIElOVE8gcmVxdWVzdChpZCwgY29uY3VycmVuY3ksIgogICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICsgInRlcm1pbmF0aW9uX3RpbWUsIiArICJhbGxfb3Jfbm9uZSxtYXhBdHRlbXB0
cywiCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAidXNlcm5hbWUsc3RhcnRlZCxkZWxl
Z2F0ZWRfZXByLHVzZXJfc3ViamVjdCkiIAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICsg
IiBWQUxVRVMgKCIgKyBjb25jdXJyZW5jeSArICIsIgorICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICsgIiBWQUxVRVMgKCIgKyByZXF1ZXN0SWQgKyAiLCIgIAorICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICsgY29uY3VycmVuY3kgKyAiLCIKICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICArIHRlcm1pbmF0aW9uVGltZS5nZXRUaW1lSW5NaWxsaXMoKSArICIsIgogICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICsgYWxsT3JOb25lLmJvb2xlYW5WYWx1ZSgpICsgIiwiCiAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgKyByZXF1ZXN0LmdldE1heEF0dGVtcHRzKCkgKyAiLCciICsg
dXNlcm5hbWUgKyAiJywiCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiZmFsc2UsJyIr
IGRlbGVnYXRpb25FUFJTdHJpbmcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICInLCci
ICsgdXNlclN1YmplY3QgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiJykiKTsKLSAg
ICAgICAgICAgIFJlc3VsdFNldCBycyA9IHN0YXRlbWVudC5leGVjdXRlUXVlcnkoIlNFTEVDVCBs
YXN0X3ZhbHVlICBGUk9NICIKLSAgICAgICAgICAgICAgICAgICAgKyAicmVxdWVzdF9zZXEiKTsK
IAotICAgICAgICAgICAgd2hpbGUgKHJzICE9IG51bGwgJiYgcnMubmV4dCgpKSB7Ci0gICAgICAg
ICAgICAgICAgcmVxdWVzdElkID0gcnMuZ2V0SW50KDEpOwotICAgICAgICAgICAgfQogICAgICAg
ICAgICAgdGhpcy5xdWVyeUNvbnN0YW50ID0gc3RvcmVUcmFuc2ZlcnMocmVxdWVzdElkLCByZXF1
ZXN0KTsKICAgICAgICAgICAgIHJldHVybiByZXF1ZXN0SWQ7CiAgICAgICAgIH0gY2F0Y2ggKFNR
TEV4Y2VwdGlvbiBlKSB7Cg==
</data>        

          </attachment>
      

    </bug>

</bugzilla>