[ https://issues.apache.org/jira/browse/CLOUDSTACK-2625?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kishan Kavala updated CLOUDSTACK-2625: -------------------------------------- Affects Version/s: 4.2.0 > Duplicate usage records when listing large number of records > ------------------------------------------------------------ > > Key: CLOUDSTACK-2625 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-2625 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Components: Usage > Affects Versions: 4.2.0 > Reporter: Kishan Kavala > Fix For: 4.2.0 > > > listUsageRecords sorts results by start_date. Using pagination, sa,ple mysql > query is as follows. > SELECT cloud_usage.id, cloud_usage.zone_id, cloud_usage.account_id, > cloud_usage.domain_id, cloud_usage.description, cloud_usage.usage_display, > cloud_usage.usage_type, cloud_usage.raw_usage, cloud_usage.vm_instance_id, > cloud_usage.vm_name, cloud_usage.offering_id, cloud_usage.template_id, > cloud_usage.usage_id, cloud_usage.type, cloud_usage.size, > cloud_usage.virtual_size, cloud_usage.network_id, cloud_usage.start_date, > cloud_usage.end_date FROM cloud_usage WHERE cloud_usage.usage_type = 9 AND > cloud_usage.start_date BETWEEN '2012-01-01 00:00:00' AND '2013-01-31 > 23:59:59' > AND cloud_usage.end_date BETWEEN '2012-01-01 00:00:00' AND '2013-01-31 > 23:59:59' ORDER BY cloud_usage.start_date DESC LIMIT 18000, 2000 > start_date is not unique and when querying large datasets, multiple pages can > return the same data. > ORDER BY cloud_usage.start_date doesn't create a stable sorted dataset. > Query should include id in ORDER BY to make it stable. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira