dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #28855
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14484: Event aggregate anaytics, returning 409 if the query returned more rows than max limit. A partial...
------------------------------------------------------------
revno: 14484
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-03-27 12:27:32 +0100
message:
Event aggregate anaytics, returning 409 if the query returned more rows than max limit. A partial aggregate response is not useful so this saves sending lots of data back to the client with no purpose.
modified:
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.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/event/data/DefaultEventAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java 2014-03-27 11:13:02 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java 2014-03-27 11:27:32 +0000
@@ -159,6 +159,11 @@
analyticsManager.getAggregatedEventData( query, grid );
}
+ if ( grid.getHeight() > MAX_ROWS_LIMIT )
+ {
+ throw new IllegalQueryException( "Number of rows produced by query is larger than the max limit: " + MAX_ROWS_LIMIT );
+ }
+
// ---------------------------------------------------------------------
// Meta-data
// ---------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java 2014-03-27 11:13:02 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java 2014-03-27 11:27:32 +0000
@@ -115,7 +115,7 @@
}
// ---------------------------------------------------------------------
- // Limit
+ // Limit, add one to max to enable later check against max limit
// ---------------------------------------------------------------------
if ( params.hasLimit() )
@@ -124,7 +124,7 @@
}
else
{
- sql += "limit " + EventAnalyticsService.MAX_ROWS_LIMIT;
+ sql += "limit " + ( EventAnalyticsService.MAX_ROWS_LIMIT + 1 );
}
// ---------------------------------------------------------------------