[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-2625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14164752#comment-14164752
 ] 

ASF subversion and git services commented on CLOUDSTACK-2625:
-------------------------------------------------------------

Commit 63109a97b1119cd306858cd4068e46859acc8e83 in cloudstack's branch 
refs/heads/master from [~kishan]
[ https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;h=63109a9 ]

CLOUDSTACK-2625, CLOUDSTACK-3401: Usage records are ordered by start_date which 
is not unique. While listing large datasets or when page size is small this 
will result in duplicates. Order records by id instead


> 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
>            Assignee: Kishan Kavala
>             Fix For: Future
>
>
> listUsageRecords sorts results by start_date. Using pagination, sample 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 was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to