Skip to content

Commit

Permalink
Tentative fix for STOR-718
Browse files Browse the repository at this point in the history
The query to update the status of ongoing PtG and PtP requests
should leverage the index on surls unique_id column in order
to save mysql lots of useless work.
  • Loading branch information
andreaceccanti committed Jan 23, 2015
1 parent 9eeca48 commit ef70871
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<name>StoRM Backend server</name>
<groupId>org.italiangrid.storm</groupId>
<artifactId>storm-backend-server</artifactId>
<version>1.11.6</version>
<version>1.11.7-SNAPSHOT</version>

<properties>

Expand Down
16 changes: 9 additions & 7 deletions src/main/java/it/grid/storm/catalogs/surl/SURLStatusDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public boolean abortActivePtGsForSURL(GridUserInterface user, TSURL surl,
+ "JOIN (request_Get rg, request_queue rq) "
+ "ON sg.request_GetID=rg.ID AND rg.request_queueID=rq.ID "
+ "SET sg.statusCode=20, rq.status=20, sg.explanation=? "
+ "WHERE (sg.statusCode=22 OR sg.statusCode=17) "
+ "AND rg.sourceSURL = ? ";
+ "WHERE rg.sourceSURL = ? and rg.sourceSURL_uniqueID = ? "
+ "AND (sg.statusCode=22 OR sg.statusCode=17) ";

if (user != null) {
query += "AND rq.client_dn = ?";
Expand All @@ -57,9 +57,10 @@ public boolean abortActivePtGsForSURL(GridUserInterface user, TSURL surl,

stat.setString(1, explanation);
stat.setString(2, surl.getSURLString());
stat.setInt(3, surl.uniqueId());

if (user != null) {
stat.setString(3, user.getDn());
stat.setString(4, user.getDn());
}

final int updateCount = stat.executeUpdate();
Expand Down Expand Up @@ -97,8 +98,8 @@ public boolean abortActivePtPsForSURL(GridUserInterface user, TSURL surl,
+ "JOIN (request_Put rp, request_queue rq) "
+ "ON sp.request_PutID=rp.ID AND rp.request_queueID=rq.ID "
+ "SET sp.statusCode=20, rq.status=20, sp.explanation=? "
+ "WHERE (sp.statusCode=24 OR sp.statusCode=17) "
+ "AND rp.targetSURL = ? ";
+ "WHERE rp.targetSURL = ? and rp.targetSURL_uniqueID = ? "
+ "AND (sp.statusCode=24 OR sp.statusCode=17)";

if (user != null) {
query += "AND rq.client_dn = ?";
Expand All @@ -107,9 +108,10 @@ public boolean abortActivePtPsForSURL(GridUserInterface user, TSURL surl,
stat = con.prepareStatement(query);
stat.setString(1, explanation);
stat.setString(2, surl.getSURLString());

stat.setInt(3, surl.uniqueId());

if (user != null) {
stat.setString(3, user.getDn());
stat.setString(4, user.getDn());
}

final int updateCount = stat.executeUpdate();
Expand Down

0 comments on commit ef70871

Please sign in to comment.