dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #35868
Re: Analytics table dimensions contain duplicates: ["uidlevel3", "uidlevel4"] DHIS2 v2.17 - RESOLVED
Greg Rowles found the problem - duplicate leves in orgunitlevel table.
On Mon, Feb 23, 2015 at 8:46 AM, Pierre Dane <pierre@xxxxxxxxx> wrote:
> Hi,
>
> Our analytics run is failing with the below error. I've tried deleting all
> the data and then started reducing metadata until I had almost none in the
> database but the problem did not resolve. I've also run queries to find
> duplicates on many tables, especially all the org unit ones and I've found
> no duplicates. I've pasted the code causing the error below but I'm not
> sure exactly which dimension tables are being validated. Are these only the
> tables here:
> http://bazaar.launchpad.net/~dhis2-devs-core/dhis2/trunk/view/head:/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/dimension/DefaultDimensionService.java?
> What other tables are used as dimensions? I definitely checked all tables
> that have the columns uidlivel[n] and they don't contain duplicates so I'm
> thinking it must be a join somewhere.
>
> Thanks
>
> * ERROR 2015-02-23 08:10:23,869 Unexpected error occurred in scheduled
> task. (TaskUtils.java [taskScheduler-9])
> java.lang.IllegalStateException: Analytics table dimensions contain
> duplicates: ["uidlevel3", "uidlevel4"]
> at
> org.hisp.dhis.analytics.table.AbstractJdbcTableManager.validateDimensionColumns(AbstractJdbcTableManager.java:339)
> at
> org.hisp.dhis.analytics.table.JdbcAnalyticsTableManager.createTable(JdbcAnalyticsTableManager.java:123)
> at sun.reflect.GeneratedMethodAccessor611.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
> at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201)
> at com.sun.proxy.$Proxy100.createTable(Unknown Source)
> at
> org.hisp.dhis.analytics.table.DefaultAnalyticsTableService.createTables(DefaultAnalyticsTableService.java:198)
> at
> org.hisp.dhis.analytics.table.DefaultAnalyticsTableService.update(DefaultAnalyticsTableService.java:119)
> at
> org.hisp.dhis.analytics.scheduling.AnalyticsTableTask.run(AnalyticsTableTask.java:136)
> at org.hisp.dhis.scheduling.ScheduledTasks.run(ScheduledTasks.java:60)
> at
> org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
> at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> at java.lang.Thread.run(Thread.java:745)
>
>
> UI output:
> 2015-02-23 06:10:23 Process failed: Analytics table dimensions contain
> duplicates: ["uidlevel3", "uidlevel4"]
> 2015-02-23 06:10:23 Creating analytics tables, processes: 1, org unit
> levels: 5
> 2015-02-23 06:10:23 Updating analytics tables
> 2015-02-23 06:10:14 Updating resource tables
> 2015-02-23 06:10:14 Analytics table update process started
>
> protected void validateDimensionColumns( List<String[]> dimensions )
> + {
> + if ( dimensions == null || dimensions.isEmpty() )
> + {
> + throw new IllegalStateException( "Analytics table dimensions are empty" );
> + }
> +
> + List<String> columns = new ArrayList<>();
> +
> + for ( String[] dimension : dimensions )
> + {
> + columns.add( dimension[0] );
> + }
> +
> + Set<String> duplicates = ListUtils.getDuplicates( columns );
> +
> + if ( !duplicates.isEmpty() )
> + {
> + throw new IllegalStateException( "Analytics table dimensions contain duplicates: " + duplicates );
> + }
> + }
>
>