← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9993: Fixed issue that caused resource table generation to hang in some situations. Improved logging.

 

------------------------------------------------------------
revno: 9993
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-03-05 22:37:21 +0100
message:
  Fixed issue that caused resource table generation to hang in some situations. Improved logging.
modified:
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java	2013-03-05 10:28:10 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java	2013-03-05 21:37:21 +0000
@@ -40,6 +40,8 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategory;
@@ -71,9 +73,12 @@
 /**
  * @author Lars Helge Overland
  */
+@Transactional
 public class DefaultResourceTableService
     implements ResourceTableService
 {
+    private static final Log log = LogFactory.getLog( DefaultResourceTableService.class );
+    
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -138,19 +143,33 @@
     // All
     // -------------------------------------------------------------------------
 
-    @Transactional
     public void generateAll()
     {
         sqlViewService.dropAllSqlViewTables();
 
         generateOrganisationUnitStructures();
+        log.info( "Organisation unit structure table generated" );
+        
         generateCategoryOptionComboNames();
-        generateCategoryTable();
+        log.info( "Category option combo name table generated" );
+        
         generateDataElementGroupSetTable();
-        generateDataElementTable();
+        log.info( "Data element group set table generated" );
+        
         generateIndicatorGroupSetTable();
+        log.info( "Indicator group set table generated" );
+
         generateOrganisationUnitGroupSetTable();
+        log.info( "Organisation unit group set table generated" );
+
+        generateCategoryTable();
+        log.info( "Category table generated" );
+
+        generateDataElementTable();
+        log.info( "Data element table generated" );
+        
         generatePeriodTable();
+        log.info( "Period table generated" );
         
         sqlViewService.createAllViewTables();
     }

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java	2013-03-05 10:28:10 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java	2013-03-05 21:37:21 +0000
@@ -95,7 +95,7 @@
     {
         try
         {
-            jdbcTemplate.update( "DROP TABLE " + TABLE_NAME_ORGANISATION_UNIT_STRUCTURE );            
+            jdbcTemplate.update( "DROP TABLE IF EXISTS " + TABLE_NAME_ORGANISATION_UNIT_STRUCTURE );            
         }
         catch ( BadSqlGrammarException ex )
         {
@@ -128,7 +128,7 @@
     {
         try
         {
-            jdbcTemplate.update( "DROP TABLE " + TABLE_NAME_CATEGORY_OPTION_COMBO_NAME );            
+            jdbcTemplate.update( "DROP TABLE IF EXISTS " + TABLE_NAME_CATEGORY_OPTION_COMBO_NAME );            
         }
         catch ( BadSqlGrammarException ex )
         {
@@ -151,7 +151,7 @@
     {
         try
         {
-            jdbcTemplate.update( "DROP TABLE " + CreateDataElementGroupSetTableStatement.TABLE_NAME );
+            jdbcTemplate.update( "DROP TABLE IF EXISTS " + CreateDataElementGroupSetTableStatement.TABLE_NAME );
         }
         catch ( BadSqlGrammarException ex )
         {
@@ -171,7 +171,7 @@
     {
         try
         {
-            jdbcTemplate.update( "DROP TABLE " + CreateIndicatorGroupSetTableStatement.TABLE_NAME );
+            jdbcTemplate.update( "DROP TABLE IF EXISTS " + CreateIndicatorGroupSetTableStatement.TABLE_NAME );
         }
         catch ( BadSqlGrammarException ex )
         {
@@ -191,7 +191,7 @@
     {
         try
         {
-            jdbcTemplate.update( "DROP TABLE " + CreateOrganisationUnitGroupSetTableStatement.TABLE_NAME );
+            jdbcTemplate.update( "DROP TABLE IF EXISTS " + CreateOrganisationUnitGroupSetTableStatement.TABLE_NAME );
         }
         catch ( BadSqlGrammarException ex )
         {
@@ -211,7 +211,7 @@
     {
         try
         {
-            jdbcTemplate.update( "DROP TABLE " + CreateCategoryTableStatement.TABLE_NAME );
+            jdbcTemplate.update( "DROP TABLE IF EXISTS " + CreateCategoryTableStatement.TABLE_NAME );
         }
         catch ( BadSqlGrammarException ex )
         {
@@ -231,7 +231,7 @@
     {
         try
         {
-            jdbcTemplate.update( "DROP TABLE " + TABLE_NAME_DATA_ELEMENT_STRUCTURE );            
+            jdbcTemplate.update( "DROP TABLE IF EXISTS " + TABLE_NAME_DATA_ELEMENT_STRUCTURE );            
         }
         catch ( BadSqlGrammarException ex )
         {
@@ -254,7 +254,7 @@
     {
         try
         {
-            jdbcTemplate.update( "DROP TABLE " + TABLE_NAME_PERIOD_STRUCTURE );            
+            jdbcTemplate.update( "DROP TABLE IF EXISTS " + TABLE_NAME_PERIOD_STRUCTURE );            
         }
         catch ( BadSqlGrammarException ex )
         {