Changeset 5864
- Timestamp:
- Nov 10, 2011, 9:15:24 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 6 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/3.0-stable (added) merged: 5851,5858-5861 /tags/3.0.1 (added) merged: 5862
- Property svn:mergeinfo changed
-
trunk/credits.txt
r5805 r5864 1 1 $Id$ 2 2 3 The current BASE team is (at BASE 3.0 -betarelease)3 The current BASE team is (at BASE 3.0.1 release) 4 4 {{{ 5 5 Jari Häkkinen -
trunk/doc/src/docbook/overview/resources.xml
r5782 r5864 135 135 contains information about the plans for future development, including 136 136 the tickets that should be fixed for each milestone. Usually, only 137 the next upcoming release has a date set. The <guilabel>BASE 2.x</guilabel>137 the next upcoming release has a date set. The <guilabel>BASE Future Release</guilabel> 138 138 milestone is used to collected tickets that we think should be fixed 139 139 but are less important or require too much work. Contributions are welcome. … … 191 191 </para> 192 192 </sect2> 193 </sect1>194 <sect1 id="resources.coreplugins">195 <title>Core plug-in configurations</title>196 <para>197 In the section called <guilabel>Plug-ins</guilabel> on the home page, is a198 link to199 <ulink200 url="http://base.thep.lu.se/chrome/site/doc/historical/admin/plugin_configuration/coreplugins.html">201 a page that lists the core plug-ins</ulink>.202 All plug-ins that are included in the installation of203 BASE are listed on this page, some together with one or several examples of suitable204 configuration files. These configuration files can be downloaded and imported with the205 plug-in configuration importer in BASE.206 </para>207 193 </sect1> 208 194 <sect1 id="resources.plugins"> -
trunk/src/core/net/sf/basedb/core/Install.java
r5853 r5864 118 118 method. 119 119 */ 120 public static final int NEW_SCHEMA_VERSION = Integer.valueOf(10 0).intValue();120 public static final int NEW_SCHEMA_VERSION = Integer.valueOf(102).intValue(); 121 121 122 122 public static synchronized int createTables(SchemaGenerator.Mode mode, ProgressReporter progress, -
trunk/src/core/net/sf/basedb/core/Update.java
r5837 r5864 95 95 </td> 96 96 </tr> 97 97 <tr> 98 <td>101 and 102</td> 99 <td> 100 Fixes an issue with duplicate {@link FileSetMemberData} entries 101 due to a bug in the upgrade program. Make sure that the unique 102 constraint that should prevent duplicates exists. 103 </td> 104 </tr> 105 98 106 </table> 99 107 … … 122 130 throws BaseException 123 131 { 124 final int total_progress_steps = Install.NEW_SCHEMA_VERSION;125 final float progress_factor = 100F / total_progress_steps;126 132 if (progress != null) progress.display(0, "Updating database..."); 127 133 org.hibernate.Session session = null; … … 141 147 session = HibernateUtil.newSession(); 142 148 int schemaVersion = getSchemaVersion(session); 149 final int total_progress_steps = 1 + Install.NEW_SCHEMA_VERSION - schemaVersion; 150 final float progress_step = 100F / total_progress_steps; 151 float progress_current = progress_step; 143 152 144 153 if (schemaVersion == 99) 145 154 { 146 155 // Final update to BASE 3 147 if (progress != null) progress.display((int)( 1*progress_factor), "--Updating schema version: " + schemaVersion + " -> 100...");156 if (progress != null) progress.display((int)(progress_current), "--Updating schema version: " + schemaVersion + " -> 100..."); 148 157 schemaVersion = updateToSchemaVersion100(session); 149 158 progress_current += progress_step; 159 160 // Skipping directly to 102 since the updateToBase3() 161 // has already fixed those issues 162 if (progress != null) progress.display((int)(progress_current), "--Updating schema version: " + schemaVersion + " -> 102..."); 163 schemaVersion = setSchemaVersionInTransaction(session, 102); 164 progress_current += 2 * progress_step; 165 } 166 167 // The 101 and 102 updates are only needed when updating from a BASE 3.0.0 installation 168 if (schemaVersion < 101) 169 { 170 if (progress != null) progress.display((int)(progress_current), "--Updating schema version: " + schemaVersion + " -> 101..."); 171 schemaVersion = updateToSchemaVersion101(session); 172 progress_current += progress_step; 173 } 174 175 if (schemaVersion < 102) 176 { 177 if (progress != null) progress.display((int)(progress_current), "--Updating schema version: " + schemaVersion + " -> 102..."); 178 schemaVersion = updateToSchemaVersion102(session); 179 progress_current += progress_step; 150 180 } 151 181 … … 435 465 } 436 466 467 /** 468 Remove duplicate file set members. 469 470 @return The new schema version (=101) 471 */ 472 private static int updateToSchemaVersion101(org.hibernate.Session session) 473 throws BaseException 474 { 475 final int schemaVersion = 101; 476 org.hibernate.Transaction tx = null; 477 try 478 { 479 tx = HibernateUtil.newTransaction(session); 480 481 org.hibernate.Query query = HibernateUtil.createQuery(session, 482 "SELECT fsm FROM FileSetMemberData fsm"); 483 List<FileSetMemberData> members = HibernateUtil.loadList(FileSetMemberData.class, query, null); 484 Set<String> allMembers = new HashSet<String>(); 485 for (FileSetMemberData member : members) 486 { 487 int fileSetId = member.getFileSet().getId(); 488 int fileTypeId = member.getDataFileType().getId(); 489 int fileId = member.getFile().getId(); 490 String unique = fileSetId + "." + fileTypeId + "." + fileId; 491 if (!allMembers.add(unique)) 492 { 493 // This combination has been seen before 494 session.delete(member); 495 } 496 } 497 498 // Update the schema version number 499 setSchemaVersion(session, schemaVersion); 500 501 // Commit the changes 502 HibernateUtil.commit(tx); 503 log.info("updateToSchemaVersion101: OK"); 504 } 505 catch (BaseException ex) 506 { 507 if (tx != null) HibernateUtil.rollback(tx); 508 log.error("updateToSchemaVersion101: FAILED", ex); 509 throw ex; 510 } 511 return schemaVersion; 512 } 513 514 /** 515 Add unique index on FileSetMembers(fileset_id,datafiletype_id,file_id) 516 517 @return The new schema version (=102) 518 */ 519 private static int updateToSchemaVersion102(org.hibernate.Session session) 520 throws BaseException 521 { 522 final int schemaVersion = 102; 523 try 524 { 525 526 // Try to drop just to make sure that we don't create duplicated indexes 527 dropIndex(session, true, "FileSetMembers", "fileset_id", "datafiletype_id", "file_id"); 528 // Create the index 529 createIndex(session, true, "FileSetMembers_uniquefile", "FileSetMembers", "fileset_id", "datafiletype_id", "file_id"); 530 531 // Update the schema version number 532 setSchemaVersionInTransaction(session, schemaVersion); 533 534 log.info("updateToSchemaVersion102: OK"); 535 } 536 catch (SQLException ex) 537 { 538 log.error("updateToSchemaVersion102: FAILED", ex); 539 throw new BaseException(ex); 540 } 541 catch (BaseException ex) 542 { 543 log.error("updateToSchemaVersion102: FAILED", ex); 544 throw ex; 545 } 546 return schemaVersion; 547 } 548 437 549 // Item type codes for item types that was removed since BASE 2 438 550 private static final int LABELEDEXTRACT = 204; … … 491 603 progress.display(15, "--Removing unique constraint on FileSetMembers"); 492 604 dropIndex(session, true, "FileSetMembers", "fileset_id", "datafiletype_id"); 605 createIndex(session, true, "FileSetMembers_uniquefile", "FileSetMembers", "fileset_id", "datafiletype_id", "file_id"); 493 606 fixPlatformFileTypes(session); 494 607 … … 1166 1279 FileSetData fileSet = null; 1167 1280 1281 // Keep track of duplicate files (since more than one image may reference the same fileId) 1282 Set<Integer> files = new HashSet<Integer>(); 1283 1168 1284 while (it2.hasNext()) 1169 1285 { 1170 1286 Object[] imgRow = (Object[])it2.next(); 1171 1287 Integer fileId = (Integer)imgRow[2]; 1172 if (fileId != null )1288 if (fileId != null && files.add(fileId)) 1173 1289 { 1174 1290 if (fileSet == null) -
trunk/src/test/TestFile.java
r5758 r5864 82 82 "data/base2.thep.lu.se.crt", null, null); 83 83 int extId1 = test_create("http://base.thep.lu.se/robots.txt", false, false); 84 int extId2 = test_create("https://base2.thep.lu.se/base/base-2.1 5.0.tar.gz.MD5", false, false);84 int extId2 = test_create("https://base2.thep.lu.se/base/base-2.17.2.tar.gz.MD5", false, false); 85 85 int extId3 = test_create("http://base.thep.lu.se/login", false, false); 86 86 test_load(id1); … … 96 96 test_download(id1, "data/test.upload.txt"); 97 97 test_download(extId1, "data/test.download.robots.txt"); 98 test_download(extId2, "data/test.download.base-2.1 5.0.MD5");98 test_download(extId2, "data/test.download.base-2.17.2.md5"); 99 99 test_download(extId3, null); 100 100
Note: See TracChangeset
for help on using the changeset viewer.