diff --git a/etc/db/storm_mysql_tbl.sql b/etc/db/storm_mysql_tbl.sql index aabea6ec..c99e495c 100644 --- a/etc/db/storm_mysql_tbl.sql +++ b/etc/db/storm_mysql_tbl.sql @@ -23,7 +23,7 @@ CREATE TABLE IF NOT EXISTS db_version ( description VARCHAR(100)); DELETE FROM storm_db.db_version; -INSERT INTO storm_db.db_version (major,minor,revision,description) VALUES (1,7,1,'27 Jan 2015'); +INSERT INTO storm_db.db_version (major,minor,revision,description) VALUES (1,7,2,'10 Mar 2015'); CREATE TABLE IF NOT EXISTS request_queue ( ID int not null auto_increment, @@ -278,6 +278,7 @@ ALTER TABLE status_Put add constraint FK_status_Put_3223 foreign key (request_PutID) references request_Put (ID) ON DELETE CASCADE; CREATE INDEX statusCode_index on status_Put (statusCode); +CREATE INDEX statusCodeGet_index on status_Get (statusCode); CREATE INDEX transferURL_index ON status_Put (transferURL(255)); ALTER TABLE request_BoL diff --git a/etc/db/storm_mysql_update_from_1.7.1_to_1.7.2.sql b/etc/db/storm_mysql_update_from_1.7.1_to_1.7.2.sql new file mode 100644 index 00000000..017115a1 --- /dev/null +++ b/etc/db/storm_mysql_update_from_1.7.1_to_1.7.2.sql @@ -0,0 +1,5 @@ +DELETE FROM storm_db.db_version; +INSERT INTO storm_db.db_version (major,minor,revision,description) VALUES (1,7,2,'10 Mar 2015'); + +CREATE INDEX statusCodeGet_index on storm_db.status_Get (statusCode); + diff --git a/pom.xml b/pom.xml index 7d814fe8..749e5e5d 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ StoRM Backend server org.italiangrid.storm storm-backend-server - 1.11.7 + 1.11.8 diff --git a/src/main/assemblies/assembly.xml b/src/main/assemblies/assembly.xml index f5758af7..067cad89 100644 --- a/src/main/assemblies/assembly.xml +++ b/src/main/assemblies/assembly.xml @@ -1,103 +1,104 @@ - - storm-backend - - false - - - tar.gz - - - - - - - - xerces:xerces - org.italiangrid:storm-native-interface - - false - usr/share/java/storm-backend-server - - - - - - - - etc - - lcmaps.db - logging.xml - namespace-1.5.0.xsd - namespace.xml - path-authz.db - storm.properties.template - used-space.ini.template - welcome.txt - - etc/storm/backend-server - - - - - etc/db - - storm_be_ISAM_mysql_update_from_1.0.0_to_1.1.0.sql - storm_mysql_grant.sql - storm_mysql_tbl.sql - storm_mysql_update_from_1.7.0_to_1.7.1.sql - - etc/storm/backend-server/db - - - - - src - var/log/storm - - **/* - - 0755 - - - - - - - - etc/db/storm_database_config.sh - etc/storm/backend-server/db - 0755 - - - - target/${artifactId}.jar - usr/share/java/storm-backend-server - - - - etc/init.d/storm-backend-server - etc/init.d - 0755 - - - - etc/logrotate.d/storm-backend-server - etc/logrotate.d - - - - etc/sysconfig/storm-backend-server - etc/sysconfig - - - + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> + + storm-backend + + false + + + tar.gz + + + + + + + + xerces:xerces + org.italiangrid:storm-native-interface + + false + usr/share/java/storm-backend-server + + + + + + + + etc + + lcmaps.db + logging.xml + namespace-1.5.0.xsd + namespace.xml + path-authz.db + storm.properties.template + used-space.ini.template + welcome.txt + + etc/storm/backend-server + + + + + etc/db + + storm_be_ISAM_mysql_update_from_1.0.0_to_1.1.0.sql + storm_mysql_grant.sql + storm_mysql_tbl.sql + storm_mysql_update_from_1.7.0_to_1.7.1.sql + storm_mysql_update_from_1.7.1_to_1.7.2.sql + + etc/storm/backend-server/db + + + + + src + var/log/storm + + **/* + + 0755 + + + + + + + + etc/db/storm_database_config.sh + etc/storm/backend-server/db + 0755 + + + + target/${artifactId}.jar + usr/share/java/storm-backend-server + + + + etc/init.d/storm-backend-server + etc/init.d + 0755 + + + + etc/logrotate.d/storm-backend-server + etc/logrotate.d + + + + etc/sysconfig/storm-backend-server + etc/sysconfig + + + diff --git a/src/main/java/it/grid/storm/catalogs/surl/SURLStatusDAO.java b/src/main/java/it/grid/storm/catalogs/surl/SURLStatusDAO.java index 2338ade9..3bd4f1a3 100644 --- a/src/main/java/it/grid/storm/catalogs/surl/SURLStatusDAO.java +++ b/src/main/java/it/grid/storm/catalogs/surl/SURLStatusDAO.java @@ -108,8 +108,8 @@ 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()); - + stat.setInt(3, surl.uniqueId()); + if (user != null) { stat.setString(4, user.getDn()); } @@ -120,7 +120,7 @@ public boolean abortActivePtPsForSURL(GridUserInterface user, TSURL surl, surl, updateCount); return (updateCount != 0); - + } catch (SQLException e) { String msg = String.format("abortActivePtPsForSURL: SQL error: %s", e.getMessage()); @@ -493,6 +493,22 @@ public void markSURLsReadyForRead(TRequestToken token, List surls) { } + private String quoteSURLUniqueIDs(List surls) { + + StringBuilder sb = new StringBuilder(); + + for (TSURL s : surls) { + if (sb.length() > 0) { + sb.append(","); + } + + sb.append(s.uniqueId()); + } + + return sb.toString(); + + } + private String quoteSURLList(List surls) { StringBuilder sb = new StringBuilder(); @@ -523,10 +539,11 @@ public void releaseSURL(TSURL surl) { + "ON sg.request_GetID=rg.ID AND rg.request_queueID=rq.ID " + "SET sg.statusCode=21" + "WHERE (sg.statusCode=22 OR sg.statusCode=0) " - + "AND rg.sourceSURL = ?"; + + "AND rg.sourceSURL = ? and rg.sourceSURL_uniqueID = ?"; stat = con.prepareStatement(query); stat.setString(1, surl.getSURLString()); + stat.setInt(2, surl.uniqueId()); stat.executeUpdate(); } catch (SQLException e) { @@ -556,6 +573,7 @@ public void releaseSURLs(GridUserInterface user, List surls) { + "ON sg.request_GetID=rg.ID AND rg.request_queueID=rq.ID " + "SET sg.statusCode=21 " + "WHERE (sg.statusCode=22 OR sg.statusCode=0) " + + "AND rg.sourceSURL_uniqueID IN (" + quoteSURLUniqueIDs(surls) + ") " + "AND rg.sourceSURL IN (" + quoteSURLList(surls) + ") " + "AND rq.client_dn = ?"; @@ -592,6 +610,7 @@ public void releaseSURLs(List surls) { + "ON sg.request_GetID=rg.ID AND rg.request_queueID=rq.ID " + "SET sg.statusCode=21 " + "WHERE (sg.statusCode=22 OR sg.statusCode=0) " + + "AND rg.sourceSURL_uniqueID IN (" + quoteSURLUniqueIDs(surls) + ") " + "AND rg.sourceSURL IN (" + quoteSURLList(surls) + ")"; stat = con.prepareStatement(query); @@ -624,6 +643,7 @@ public void releaseSURLs(TRequestToken token, List surls) { + "ON sg.request_GetID=rg.ID AND rg.request_queueID=rq.ID " + "SET sg.statusCode=21 " + "WHERE (sg.statusCode=22 OR sg.statusCode=0) " + + "AND rg.sourceSURL_uniqueID IN (" + quoteSURLUniqueIDs(surls) + ") " + "AND rg.sourceSURL IN (" + quoteSURLList(surls) + ") " + "AND rq.r_token = ?"; @@ -670,10 +690,12 @@ public boolean surlHasOngoingPtGs(TSURL surl) { String query = "SELECT rq.ID, rg.ID, sg.statusCode " + "FROM request_queue rq JOIN (request_Get rg, status_Get sg) " + "ON (rg.request_queueID = rq.ID AND sg.request_GetID = rg.ID) " - + "WHERE ( rg.sourceSURL = ? and sg.statusCode = 22)"; + + "WHERE ( rg.sourceSURL = ? and rg.sourceSURL_uniqueID = ? " + + "and sg.statusCode = 22 )"; stat = con.prepareStatement(query); stat.setString(1, surl.getSURLString()); + stat.setInt(2, surl.uniqueId()); rs = stat.executeQuery(); return rs.next(); @@ -705,7 +727,8 @@ public boolean surlHasOngoingPtPs(TSURL surl, TRequestToken ptpRequestToken) { String query = "SELECT rq.ID, rp.ID, sp.statusCode " + "FROM request_queue rq JOIN (request_Put rp, status_Put sp) " + "ON (rp.request_queueID=rq.ID AND sp.request_PutID=rp.ID) " - + "WHERE ( rp.targetSURL = ? and sp.statusCode=24 )"; + + "WHERE ( rp.targetSURL = ? and rp.targetSURL_uniqueID = ? " + + "and sp.statusCode=24 )"; if (ptpRequestToken != null) { query += " AND rq.r_token != ?"; @@ -713,9 +736,10 @@ public boolean surlHasOngoingPtPs(TSURL surl, TRequestToken ptpRequestToken) { stat = con.prepareStatement(query); stat.setString(1, surl.getSURLString()); + stat.setInt(2, surl.uniqueId()); if (ptpRequestToken != null) { - stat.setString(2, ptpRequestToken.getValue()); + stat.setString(3, ptpRequestToken.getValue()); } rs = stat.executeQuery(); diff --git a/src/main/java/it/grid/storm/catalogs/surl/SURLStatusManagerImpl.java b/src/main/java/it/grid/storm/catalogs/surl/SURLStatusManagerImpl.java index 6de508df..6a507d23 100644 --- a/src/main/java/it/grid/storm/catalogs/surl/SURLStatusManagerImpl.java +++ b/src/main/java/it/grid/storm/catalogs/surl/SURLStatusManagerImpl.java @@ -32,7 +32,7 @@ public boolean abortAllPutRequestsForSURL(GridUserInterface user, TSURL surl, String explanation) { final SURLStatusDAO dao = new SURLStatusDAO(); - return dao.abortActivePtGsForSURL(user, surl, explanation); + return dao.abortActivePtPsForSURL(user, surl, explanation); }