← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7735: Dropping data mart indexes one by one instead of together to reduce period where indexes are off....

 

------------------------------------------------------------
revno: 7735
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-07-26 22:37:31 +0200
message:
  Dropping data mart indexes one by one instead of together to reduce period where indexes are off. Added separate batch handlers for data mart temp tables.
added:
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedDataValueTempBatchHandler.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedIndicatorValueTempBatchHandler.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedOrgUnitDataValueTempBatchHandler.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedOrgUnitIndicatorValueTempBatchHandler.java
modified:
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartManager.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/JdbcDataMartManager.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedDataValueBatchHandler.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedIndicatorValueBatchHandler.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedOrgUnitDataValueBatchHandler.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedOrgUnitIndicatorValueBatchHandler.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/maintenance/PerformMaintenanceAction.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-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartManager.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartManager.java	2012-07-26 16:50:38 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartManager.java	2012-07-26 20:37:31 +0000
@@ -18,24 +18,14 @@
     Set<DataElementOperand> getOperandsWithData( Set<DataElementOperand> operands );
 
     Map<DataElementOperand, String> getDataValueMap( int periodId, int sourceId );
-
-    /**
-     * Creates indexes on the aggregateddatavalue and aggregatedindicatorvalue
-     * tables.
-     * 
-     * @param dataElement indicates whether to create an index on aggregateddatavalue.
-     * @param indicator indicates whether to create an index on aggregatedindicatorvalue.
-     */
-    void createAggregatedValueIndex( boolean dataElement, boolean indicator );
-    
-    /**
-     * Drops the indexes on the aggregateddatavalue and aggregatedindicatorvalue
-     * tables.
-     * 
-     * @param dataElement indicates whether to drop the index on aggregateddatavalue.
-     * @param indicator indicates whether to drop the index on aggregatedindicatorvalue.
-     */
-    void dropAggregatedValueIndex( boolean dataElement, boolean indicator );
+    
+    void createDataValueIndex();
+    
+    void createIndicatorValueIndex();
+    
+    void dropDataValueIndex();
+    
+    void dropIndicatorValueIndex();
     
     /**
      * Deletes AggregatedDataValues registered for the given parameters.
@@ -51,10 +41,14 @@
      */
     void deleteAggregatedIndicatorValues( Collection<Integer> periodIds );
     
-    void createAggregatedOrgUnitValueIndex( boolean dataElement, boolean indicator );
-    
-    void dropAggregatedOrgUnitValueIndex( boolean dataElement, boolean indicator );
-
+    void createOrgUnitDataValueIndex();
+    
+    void createOrgUnitIndicatorValueIndex();
+    
+    void dropOrgUnitDataValueIndex();
+    
+    void dropOrgUnitIndicatorValueIndex();
+    
     void deleteAggregatedOrgUnitIndicatorValues( Collection<Integer> periodIds );
 
     void deleteAggregatedOrgUnitDataValues( Collection<Integer> periodIds );

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/JdbcDataMartManager.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/JdbcDataMartManager.java	2012-07-26 16:50:38 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/JdbcDataMartManager.java	2012-07-26 20:37:31 +0000
@@ -140,63 +140,27 @@
     // -------------------------------------------------------------------------
 
     @Override
-    public void createAggregatedValueIndex( boolean dataElement, boolean indicator )
-    {
-        if ( dataElement )
-        {
-            try
-            {
-                final String sql = "CREATE INDEX aggregateddatavalue_index ON aggregateddatavalue (dataelementid, categoryoptioncomboid, periodid, organisationunitid)";        
-                statementManager.getHolder().executeUpdate( sql, true );
-            }
-            catch ( Exception ex )
-            {
-                log.debug( "Index already exists" );
-            }
-        }
-        
-        if ( indicator )
-        {
-            try
-            {
-                final String sql = "CREATE INDEX aggregatedindicatorvalue_index ON aggregatedindicatorvalue (indicatorid, periodid, organisationunitid)";        
-                statementManager.getHolder().executeUpdate( sql, true );
-            }
-            catch ( Exception ex )
-            {
-                log.debug( "Index already exists" );
-            }
-        }
-    }
-
-    @Override
-    public void dropAggregatedValueIndex( boolean dataElement, boolean indicator )
-    {
-        if ( dataElement )
-        {
-            try
-            {
-                final String sql = "DROP INDEX aggregateddatavalue_index";
-                statementManager.getHolder().executeUpdate( sql, true );
-            }
-            catch ( Exception ex )
-            {
-                log.debug( "Index does not exist" );
-            }
-        }
-        
-        if ( indicator )
-        {
-            try
-            {
-                final String sql = "DROP INDEX aggregatedindicatorvalue_index";
-                statementManager.getHolder().executeUpdate( sql, true );
-            }
-            catch ( Exception ex )
-            {
-                log.debug( "Index does not exist" );
-            }
-        }
+    public void createDataValueIndex()
+    {
+        executeSilently( "CREATE INDEX aggregateddatavalue_index ON aggregateddatavalue (dataelementid, categoryoptioncomboid, periodid, organisationunitid)" );
+    }
+
+    @Override
+    public void createIndicatorValueIndex()
+    {
+        executeSilently( "CREATE INDEX aggregatedindicatorvalue_index ON aggregatedindicatorvalue (indicatorid, periodid, organisationunitid)" );
+    }
+
+    @Override
+    public void dropDataValueIndex()
+    {
+        executeSilently( "DROP INDEX aggregateddatavalue_index" );
+    }
+
+    @Override
+    public void dropIndicatorValueIndex()
+    {
+        executeSilently( "DROP INDEX aggregatedindicatorvalue_index" );
     }
 
     @Override
@@ -224,63 +188,27 @@
     // -------------------------------------------------------------------------
 
     @Override
-    public void createAggregatedOrgUnitValueIndex( boolean dataElement, boolean indicator )
-    {
-        if ( dataElement )
-        {
-            try
-            {
-                final String sql = "CREATE INDEX aggregatedorgunitdatavalue_index ON aggregatedorgunitdatavalue (dataelementid, categoryoptioncomboid, periodid, organisationunitid, organisationunitgroupid)";        
-                statementManager.getHolder().executeUpdate( sql, true );
-            }
-            catch ( Exception ex )
-            {
-                log.debug( "Index already exists" );
-            }
-        }
-        
-        if ( indicator )
-        {
-            try
-            {
-                final String sql = "CREATE INDEX aggregatedorgunitindicatorvalue_index ON aggregatedorgunitindicatorvalue (indicatorid, periodid, organisationunitid, organisationunitgroupid)";        
-                statementManager.getHolder().executeUpdate( sql, true );
-            }
-            catch ( Exception ex )
-            {
-                log.debug( "Index already exists" );
-            }
-        }
-    }
-
-    @Override
-    public void dropAggregatedOrgUnitValueIndex( boolean dataElement, boolean indicator )
-    {
-        if ( dataElement )
-        {
-            try
-            {
-                final String sql = "DROP INDEX aggregatedorgunitdatavalue_index";
-                statementManager.getHolder().executeUpdate( sql, true );
-            }
-            catch ( Exception ex )
-            {
-                log.debug( "Index does not exist" );
-            }
-        }
-        
-        if ( indicator )
-        {
-            try
-            {
-                final String sql = "DROP INDEX aggregatedorgunitindicatorvalue_index";
-                statementManager.getHolder().executeUpdate( sql, true );
-            }
-            catch ( Exception ex )
-            {
-                log.debug( "Index does not exist" );
-            }
-        }
+    public void createOrgUnitDataValueIndex()
+    {
+        executeSilently( "CREATE INDEX aggregatedorgunitdatavalue_index ON aggregatedorgunitdatavalue (dataelementid, categoryoptioncomboid, periodid, organisationunitid, organisationunitgroupid)" );
+    }
+
+    @Override
+    public void createOrgUnitIndicatorValueIndex()
+    {
+        executeSilently( "CREATE INDEX aggregatedorgunitindicatorvalue_index ON aggregatedorgunitindicatorvalue (indicatorid, periodid, organisationunitid, organisationunitgroupid)" );        
+    }
+
+    @Override
+    public void dropOrgUnitDataValueIndex()
+    {
+        executeSilently( "DROP INDEX aggregatedorgunitdatavalue_index" );
+    }
+
+    @Override
+    public void dropOrgUnitIndicatorValueIndex()
+    {
+        executeSilently( "DROP INDEX aggregatedorgunitindicatorvalue_index" );
     }
 
     @Override

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java	2012-07-26 16:50:38 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java	2012-07-26 20:37:31 +0000
@@ -53,10 +53,10 @@
 import org.hisp.dhis.expression.ExpressionService;
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.jdbc.batchhandler.AggregatedDataValueBatchHandler;
-import org.hisp.dhis.jdbc.batchhandler.AggregatedIndicatorValueBatchHandler;
-import org.hisp.dhis.jdbc.batchhandler.AggregatedOrgUnitDataValueBatchHandler;
-import org.hisp.dhis.jdbc.batchhandler.AggregatedOrgUnitIndicatorValueBatchHandler;
+import org.hisp.dhis.jdbc.batchhandler.AggregatedDataValueTempBatchHandler;
+import org.hisp.dhis.jdbc.batchhandler.AggregatedIndicatorValueTempBatchHandler;
+import org.hisp.dhis.jdbc.batchhandler.AggregatedOrgUnitDataValueTempBatchHandler;
+import org.hisp.dhis.jdbc.batchhandler.AggregatedOrgUnitIndicatorValueTempBatchHandler;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
@@ -342,22 +342,22 @@
             for ( List<OrganisationUnit> organisationUnitPage : organisationUnitPages )
             {
                 futures.add( dataElementDataMart.exportDataValues( allOperands, periods, organisationUnitPage, 
-                    null, new DataElementOperandList( indicatorOperands ), hierarchy, AggregatedDataValueBatchHandler.class, key ) );
+                    null, new DataElementOperandList( indicatorOperands ), hierarchy, AggregatedDataValueTempBatchHandler.class, key ) );
             }
 
             ConcurrentUtils.waitForCompletion( futures );
         }
         
         clock.logTime( "Exported values for data element operands (" + allOperands.size() + "), pages: " + organisationUnitPages.size() + ", " + SystemUtils.getMemoryString() );
-        notifier.notify( id, DATAMART, "Dropping data element data indexes" );
-
-        // ---------------------------------------------------------------------
-        // 3. Drop potential indexes
-        // ---------------------------------------------------------------------
-
-        dataMartManager.dropAggregatedValueIndex( true, isIndicators ); //TODO
+        notifier.notify( id, DATAMART, "Dropping data element index" );
+
+        // ---------------------------------------------------------------------
+        // 3. Drop data element index
+        // ---------------------------------------------------------------------
+
+        dataMartManager.dropDataValueIndex();
         
-        clock.logTime( "Dropped potential indexes" );
+        clock.logTime( "Dropped data element index" );
         notifier.notify( id, DATAMART, "Deleting existing data element data" );
         
         // ---------------------------------------------------------------------
@@ -377,9 +377,18 @@
         
         clock.logTime( "Copied data element data from temporary table" );
         notifier.notify( id, DATAMART, "Exporting data for indicator data" );
+
+        // ---------------------------------------------------------------------
+        // 6. Create data element index
+        // ---------------------------------------------------------------------
+
+        dataMartManager.createDataValueIndex();
+
+        clock.logTime( "Created data element index" );
+        notifier.notify( id, DATAMART, "Exporting data for indicator data" );
         
         // ---------------------------------------------------------------------
-        // 6. Export indicator values
+        // 7. Export indicator values
         // ---------------------------------------------------------------------
 
         if ( isIndicators )
@@ -389,25 +398,27 @@
             for ( List<OrganisationUnit> organisationUnitPage : organisationUnitPages )
             {
                 futures.add( indicatorDataMart.exportIndicatorValues( indicators, periods, organisationUnitPage,
-                    null, indicatorOperands, AggregatedIndicatorValueBatchHandler.class, key ) );
+                    null, indicatorOperands, AggregatedIndicatorValueTempBatchHandler.class, key ) );
             }
 
             ConcurrentUtils.waitForCompletion( futures );
         }
         
         clock.logTime( "Exported values for indicators (" + indicators.size() + "), pages: " + organisationUnitPages.size() + ", " + SystemUtils.getMemoryString() );
+        notifier.notify( id, DATAMART, "Dropping indicator index" );
         
         // ---------------------------------------------------------------------
-        // 7. Drop aggregated data cache
+        // 8. Drop aggregated data cache and indicator index
         // ---------------------------------------------------------------------
 
         crossTabService.dropAggregatedDataCache( key );
-        
-        clock.logTime( "Dropped aggregated data cache, " + SystemUtils.getMemoryString() );
+        dataMartManager.dropIndicatorValueIndex();
+
+        clock.logTime( "Dropped indicator index, " + SystemUtils.getMemoryString() );
         notifier.notify( id, DATAMART, "Deleting existing indicator data" );
 
         // ---------------------------------------------------------------------
-        // 8. Delete existing aggregated indicator values
+        // 9. Delete existing aggregated indicator values
         // ---------------------------------------------------------------------
 
         dataMartManager.deleteAggregatedIndicatorValues( periodIds );
@@ -416,7 +427,7 @@
         notifier.notify( id, DATAMART, "Copying indicator data from temporary table" );
 
         // ---------------------------------------------------------------------
-        // 9. Copy aggregated data values from temporary table
+        // 10. Copy aggregated data values from temporary table
         // ---------------------------------------------------------------------
 
         dataMartManager.copyAggregatedIndicatorValuesFromTemp();
@@ -425,12 +436,12 @@
         notifier.notify( id, DATAMART, "Creating indexes" );
         
         // ---------------------------------------------------------------------
-        // 10. Create potential indexes
+        // 11. Create indicator index
         // ---------------------------------------------------------------------
         
-        dataMartManager.createAggregatedValueIndex( true, isIndicators );
+        dataMartManager.createIndicatorValueIndex();
         
-        clock.logTime( "Created indexes" );        
+        clock.logTime( "Created indicator index" );        
         clock.logTime( "Aggregated data export done" );
         
         final boolean isGroups = organisationUnitGroups != null && organisationUnitGroups.size() > 0;
@@ -467,7 +478,7 @@
                 for ( List<OrganisationUnit> organisationUnitPage : organisationUnitPages )
                 {
                     futures.add( dataElementDataMart.exportDataValues( allOperands, periods, organisationUnitPage, 
-                        organisationUnitGroups, new DataElementOperandList( indicatorOperands ), hierarchy, AggregatedOrgUnitDataValueBatchHandler.class, key ) );
+                        organisationUnitGroups, new DataElementOperandList( indicatorOperands ), hierarchy, AggregatedOrgUnitDataValueTempBatchHandler.class, key ) );
                 }
 
                 ConcurrentUtils.waitForCompletion( futures );
@@ -480,9 +491,9 @@
             // 3. Drop potential indexes
             // -----------------------------------------------------------------
 
-            dataMartManager.dropAggregatedOrgUnitValueIndex( true, isIndicators ); //TODO
+            dataMartManager.dropOrgUnitDataValueIndex();
 
-            clock.logTime( "Dropped potential org unit indexes" );
+            clock.logTime( "Dropped org unit data element index" );
             notifier.notify( id, DATAMART, "Deleting existing data element data" );
 
             // ---------------------------------------------------------------------
@@ -492,7 +503,7 @@
             dataMartManager.deleteAggregatedOrgUnitDataValues( periodIds );
             
             clock.logTime( "Deleted existing aggregated org unit datavalues" );
-            notifier.notify( id, DATAMART, "Exporting data for data elements" );
+            notifier.notify( id, DATAMART, "Copying org unit data element data" );
 
             // ---------------------------------------------------------------------
             // 5. Copy aggregated org unit data values from temporary table
@@ -502,6 +513,15 @@
             
             clock.logTime( "Copied aggregated org unit data element data from temporary table" );
             notifier.notify( id, DATAMART, "Exporting org unit indicator data" );
+
+            // ---------------------------------------------------------------------
+            // 6. Create org unit data element index
+            // ---------------------------------------------------------------------
+
+            dataMartManager.createOrgUnitDataValueIndex();
+
+            clock.logTime( "Created org unit data element index" );
+            notifier.notify( id, DATAMART, "Exporting data for indicator data" );
             
             // ---------------------------------------------------------------------
             // 6. Export indicator values
@@ -514,7 +534,7 @@
                 for ( List<OrganisationUnit> organisationUnitPage : organisationUnitPages )
                 {
                     futures.add( indicatorDataMart.exportIndicatorValues( indicators, periods, organisationUnitPage,
-                        organisationUnitGroups, indicatorOperands, AggregatedOrgUnitIndicatorValueBatchHandler.class, key ) );
+                        organisationUnitGroups, indicatorOperands, AggregatedOrgUnitIndicatorValueTempBatchHandler.class, key ) );
                 }
 
                 ConcurrentUtils.waitForCompletion( futures );
@@ -523,12 +543,13 @@
             clock.logTime( "Exported values for indicators (" + indicators.size() + "), pages: " + organisationUnitPages.size() + ", " + SystemUtils.getMemoryString() );
 
             // ---------------------------------------------------------------------
-            // 7. Drop aggregated data cache
+            // 7. Drop aggregated data cache and indicator index
             // ---------------------------------------------------------------------
 
             crossTabService.dropAggregatedOrgUnitDataCache( key );
-            
-            clock.logTime( "Dropped aggregated org unit data cache, " + SystemUtils.getMemoryString() );
+            dataMartManager.dropOrgUnitIndicatorValueIndex();
+                        
+            clock.logTime( "Dropped org unit indicator index, " + SystemUtils.getMemoryString() );
             notifier.notify( id, DATAMART, "Deleting existing indicator data" );
 
             // ---------------------------------------------------------------------
@@ -550,10 +571,10 @@
             notifier.notify( id, DATAMART, "Creating data element indexes" );
             
             // ---------------------------------------------------------------------
-            // 10. Create potential indexes
+            // 10. Create org unit indicator index
             // ---------------------------------------------------------------------
 
-            dataMartManager.createAggregatedOrgUnitValueIndex( true, isIndicators );
+            dataMartManager.createOrgUnitIndicatorValueIndex();
             
             clock.logTime( "Created org unit indexes" );
             clock.logTime( "Aggregated organisation unit data export done" );            

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedDataValueBatchHandler.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedDataValueBatchHandler.java	2012-07-26 16:50:38 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedDataValueBatchHandler.java	2012-07-26 20:37:31 +0000
@@ -53,7 +53,7 @@
     
     protected void setTableName()
     {
-        statementBuilder.setTableName( "aggregateddatavalue_temp" );
+        statementBuilder.setTableName( "aggregateddatavalue" );
     }
     
     protected void setUniqueColumns()

=== added file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedDataValueTempBatchHandler.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedDataValueTempBatchHandler.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedDataValueTempBatchHandler.java	2012-07-26 20:37:31 +0000
@@ -0,0 +1,45 @@
+package org.hisp.dhis.jdbc.batchhandler;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.amplecode.quick.JdbcConfiguration;
+
+public class AggregatedDataValueTempBatchHandler
+    extends AggregatedDataValueBatchHandler
+{
+    public AggregatedDataValueTempBatchHandler( JdbcConfiguration config )
+    {
+        super( config );
+    }
+
+    @Override
+    protected void setTableName()
+    {
+        statementBuilder.setTableName( "aggregateddatavalue_temp" );
+    }
+}

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedIndicatorValueBatchHandler.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedIndicatorValueBatchHandler.java	2012-07-26 16:50:38 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedIndicatorValueBatchHandler.java	2012-07-26 20:37:31 +0000
@@ -53,7 +53,7 @@
 
     protected void setTableName()
     {
-        statementBuilder.setTableName( "aggregatedindicatorvalue_temp" );
+        statementBuilder.setTableName( "aggregatedindicatorvalue" );
     }
 
     protected void setUniqueColumns()

=== added file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedIndicatorValueTempBatchHandler.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedIndicatorValueTempBatchHandler.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedIndicatorValueTempBatchHandler.java	2012-07-26 20:37:31 +0000
@@ -0,0 +1,45 @@
+package org.hisp.dhis.jdbc.batchhandler;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.amplecode.quick.JdbcConfiguration;
+
+public class AggregatedIndicatorValueTempBatchHandler
+    extends AggregatedIndicatorValueBatchHandler
+{
+    public AggregatedIndicatorValueTempBatchHandler( JdbcConfiguration config )
+    {
+        super( config );
+    }
+
+    @Override
+    protected void setTableName()
+    {
+        statementBuilder.setTableName( "aggregatedindicatorvalue_temp" );
+    }
+}

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedOrgUnitDataValueBatchHandler.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedOrgUnitDataValueBatchHandler.java	2012-07-26 16:50:38 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedOrgUnitDataValueBatchHandler.java	2012-07-26 20:37:31 +0000
@@ -52,7 +52,7 @@
     
     protected void setTableName()
     {
-        statementBuilder.setTableName( "aggregatedorgunitdatavalue_temp" );
+        statementBuilder.setTableName( "aggregatedorgunitdatavalue" );
     }
     
     protected void setUniqueColumns()

=== added file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedOrgUnitDataValueTempBatchHandler.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedOrgUnitDataValueTempBatchHandler.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedOrgUnitDataValueTempBatchHandler.java	2012-07-26 20:37:31 +0000
@@ -0,0 +1,44 @@
+package org.hisp.dhis.jdbc.batchhandler;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.amplecode.quick.JdbcConfiguration;
+
+public class AggregatedOrgUnitDataValueTempBatchHandler
+    extends AggregatedOrgUnitDataValueBatchHandler
+{
+    public AggregatedOrgUnitDataValueTempBatchHandler( JdbcConfiguration config )
+    {
+        super( config );
+    }
+
+    protected void setTableName()
+    {
+        statementBuilder.setTableName( "aggregatedorgunitdatavalue_temp" );
+    }    
+}

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedOrgUnitIndicatorValueBatchHandler.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedOrgUnitIndicatorValueBatchHandler.java	2012-07-26 16:50:38 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedOrgUnitIndicatorValueBatchHandler.java	2012-07-26 20:37:31 +0000
@@ -52,7 +52,7 @@
 
     protected void setTableName()
     {
-        statementBuilder.setTableName( "aggregatedorgunitindicatorvalue_temp" );
+        statementBuilder.setTableName( "aggregatedorgunitindicatorvalue" );
     }
 
     protected void setUniqueColumns()

=== added file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedOrgUnitIndicatorValueTempBatchHandler.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedOrgUnitIndicatorValueTempBatchHandler.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/AggregatedOrgUnitIndicatorValueTempBatchHandler.java	2012-07-26 20:37:31 +0000
@@ -0,0 +1,44 @@
+package org.hisp.dhis.jdbc.batchhandler;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.amplecode.quick.JdbcConfiguration;
+
+public class AggregatedOrgUnitIndicatorValueTempBatchHandler
+    extends AggregatedOrgUnitIndicatorValueBatchHandler
+{
+    public AggregatedOrgUnitIndicatorValueTempBatchHandler( JdbcConfiguration config )
+    {
+        super( config );
+    }
+
+    protected void setTableName()
+    {
+        statementBuilder.setTableName( "aggregatedorgunitindicatorvalue_temp" );
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/maintenance/PerformMaintenanceAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/maintenance/PerformMaintenanceAction.java	2012-07-25 16:22:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/maintenance/PerformMaintenanceAction.java	2012-07-26 20:37:31 +0000
@@ -154,11 +154,15 @@
         
         if ( dataMartIndex )
         {
-            dataMartManager.dropAggregatedValueIndex( true, true );
-            dataMartManager.createAggregatedValueIndex( true, true );
+            dataMartManager.dropDataValueIndex();
+            dataMartManager.dropIndicatorValueIndex();
+            dataMartManager.dropOrgUnitDataValueIndex();
+            dataMartManager.dropOrgUnitIndicatorValueIndex();
             
-            dataMartManager.dropAggregatedOrgUnitValueIndex( true, true );
-            dataMartManager.createAggregatedOrgUnitValueIndex( true, true );
+            dataMartManager.createDataValueIndex();
+            dataMartManager.createIndicatorValueIndex();
+            dataMartManager.createOrgUnitDataValueIndex();
+            dataMartManager.createOrgUnitIndicatorValueIndex();
             
             completenessService.dropIndex();
             completenessService.createIndex();