Changeset 4341
- Timestamp:
- Jun 17, 2008, 2:06:53 PM (15 years ago)
- Location:
- trunk/src/core/net/sf/basedb/core
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/Experiment.java
r4257 r4341 169 169 170 170 private long addedBytes = 0; 171 private long updatedBytes = 0; 171 172 172 173 /** … … 244 245 { 245 246 getData().setBytes(addedBytes); 246 addedBytes = 0;247 247 } 248 else if (action == Transactional.Action.UPDATE && addedBytes != 0)248 else if (action == Transactional.Action.UPDATE && addedBytes != updatedBytes) 249 249 { 250 250 /* … … 261 261 WHERE xpm.id = :experiment 262 262 */ 263 query.setLong("addedBytes", addedBytes );263 query.setLong("addedBytes", addedBytes - updatedBytes); 264 264 query.setInteger("experiment", getId()); 265 265 query.executeUpdate(); 266 addedBytes = 0;266 updatedBytes = addedBytes; 267 267 } 268 268 } -
trunk/src/core/net/sf/basedb/core/Install.java
r4334 r4341 107 107 method. 108 108 */ 109 public static final int NEW_SCHEMA_VERSION = Integer.valueOf( 59).intValue();109 public static final int NEW_SCHEMA_VERSION = Integer.valueOf(60).intValue(); 110 110 111 111 public static synchronized void createTables(boolean update, final ProgressReporter progress) -
trunk/src/core/net/sf/basedb/core/Update.java
r4335 r4341 682 682 </td> 683 683 </tr> 684 <tr> 685 <td>60</td> 686 <td> 687 Not a schema change as such. We need to update incorrect quota values 688 for experiments. See http://base.thep.lu.se/ticket/1056 689 </td> 690 </tr> 684 691 685 692 </table> … … 957 964 if (progress != null) progress.display((int)(58*progress_factor), "--Updating schema version: " + schemaVersion + " -> 59..."); 958 965 schemaVersion = setSchemaVersionInTransaction(session, 59); 966 } 967 968 if (schemaVersion < 60) 969 { 970 if (progress != null) progress.display((int)(59*progress_factor), "--Updating schema version: " + schemaVersion + " -> 60..."); 971 schemaVersion = updateToSchemaVersion60(session); 959 972 } 960 973 … … 2323 2336 if (tx != null) HibernateUtil.rollback(tx); 2324 2337 log.error("updateToSchemaVersion57: FAILED", ex); 2338 throw ex; 2339 } 2340 return schemaVersion; 2341 } 2342 2343 /** 2344 Update incorrect quota values for experiments. 2345 2346 @return The new schema version (=60) 2347 */ 2348 private static int updateToSchemaVersion60(org.hibernate.Session session) 2349 throws BaseException 2350 { 2351 final int schemaVersion = 60; 2352 org.hibernate.Transaction tx = null; 2353 try 2354 { 2355 tx = HibernateUtil.newTransaction(session); 2356 2357 org.hibernate.Query query = HibernateUtil.createQuery(session, 2358 "SELECT exp FROM ExperimentData exp"); 2359 List<ExperimentData> experiments = 2360 HibernateUtil.loadList(ExperimentData.class, query, null); 2361 for (ExperimentData exp : experiments) 2362 { 2363 exp.getDiskUsage().setBytes(exp.getBytes()); 2364 } 2365 2366 // Update the schema version number 2367 setSchemaVersion(session, schemaVersion); 2368 2369 // Commit the changes 2370 HibernateUtil.commit(tx); 2371 log.info("updateToSchemaVersion60: OK"); 2372 } 2373 catch (BaseException ex) 2374 { 2375 if (tx != null) HibernateUtil.rollback(tx); 2376 log.error("updateToSchemaVersion60: FAILED", ex); 2325 2377 throw ex; 2326 2378 }
Note: See TracChangeset
for help on using the changeset viewer.