dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #26160
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12961: Analytics tables, disabling auto vacuum of tables since it sometimes locks the tables. We do a fu...
------------------------------------------------------------
revno: 12961
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-11-18 14:30:37 +0100
message:
Analytics tables, disabling auto vacuum of tables since it sometimes locks the tables. We do a full vacuum after analytics tables are generated and they are never written to beyond the drop-create step so auto vacuum is not required.
modified:
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTableManager.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTargetTableManager.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java
dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java
dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java
dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/HsqlStatementBuilder.java
dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java
dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.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-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java 2013-10-01 08:49:54 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java 2013-11-18 13:30:37 +0000
@@ -100,7 +100,9 @@
sqlCreate += col[0] + " " + col[1] + ",";
}
- sqlCreate += "daysxvalue " + dbl + ", daysno integer not null, value " + dbl + ")";
+ sqlCreate += "daysxvalue " + dbl + ", daysno integer not null, value " + dbl + ") ";
+
+ sqlCreate += statementBuilder.getTableOptions( false );
log.info( "Create SQL: " + sqlCreate );
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTableManager.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTableManager.java 2013-11-18 13:30:37 +0000
@@ -73,7 +73,9 @@
sqlCreate += col[0] + " " + col[1] + ",";
}
- sqlCreate += "value date)";
+ sqlCreate += "value date) ";
+
+ sqlCreate += statementBuilder.getTableOptions( false );
log.info( "Create SQL: " + sqlCreate );
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTargetTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTargetTableManager.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTargetTableManager.java 2013-11-18 13:30:37 +0000
@@ -81,7 +81,9 @@
sqlCreate += col[0] + " " + col[1] + ",";
}
- sqlCreate += "value double precision)";
+ sqlCreate += "value double precision) ";
+
+ sqlCreate += statementBuilder.getTableOptions( false );
log.info( "Create SQL: " + sqlCreate );
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java 2013-10-30 16:31:33 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java 2013-11-18 13:30:37 +0000
@@ -114,7 +114,9 @@
sqlCreate += col[0] + " " + col[1] + ",";
}
- sqlCreate = removeLast( sqlCreate, 1 ) + ")";
+ sqlCreate = removeLast( sqlCreate, 1 ) + ") ";
+
+ sqlCreate += statementBuilder.getTableOptions( false );
log.info( "Create SQL: " + sqlCreate );
=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java 2013-10-14 10:30:06 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java 2013-11-18 13:30:37 +0000
@@ -94,6 +94,16 @@
String getVacuum( String table );
/**
+ * Returns a sql statement to include in create table statements with applies
+ * options to the table. Returns an empty string if all options are set to the
+ * default value.
+ *
+ * @param autoVacuum whether to enable automatic vacuum, default is true.
+ * @return a sql option string.
+ */
+ String getTableOptions( boolean autoVacuum );
+
+ /**
* Returns the name of a double column type.
* @return the name of a double column type.
*/
=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java 2013-10-14 10:30:06 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java 2013-11-18 13:30:37 +0000
@@ -53,6 +53,12 @@
{
return null;
}
+
+ @Override
+ public String getTableOptions( boolean autoVacuum )
+ {
+ return "";
+ }
@Override
public String getRegexpMatch()
=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/HsqlStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/HsqlStatementBuilder.java 2013-10-14 10:30:06 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/HsqlStatementBuilder.java 2013-11-18 13:30:37 +0000
@@ -55,6 +55,12 @@
}
@Override
+ public String getTableOptions( boolean autoVacuum )
+ {
+ return "";
+ }
+
+ @Override
public String getRegexpMatch()
{
return "regexp";
=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java 2013-10-14 10:30:06 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java 2013-11-18 13:30:37 +0000
@@ -55,6 +55,12 @@
}
@Override
+ public String getTableOptions( boolean autoVacuum )
+ {
+ return ""; //TODO implement
+ }
+
+ @Override
public String getRegexpMatch()
{
return "regexp";
=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java 2013-10-14 10:30:06 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java 2013-11-18 13:30:37 +0000
@@ -55,6 +55,24 @@
}
@Override
+ public String getTableOptions( boolean autoVacuum )
+ {
+ String sql = "";
+
+ if ( !autoVacuum )
+ {
+ sql += "autovacuum_enabled = false";
+ }
+
+ if ( !sql.isEmpty() )
+ {
+ sql = "with (" + sql + ")";
+ }
+
+ return sql;
+ }
+
+ @Override
public String getRegexpMatch()
{
return "~";