mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-9006 - ListTemplates API returns result in inconsistent order when called concurrently
This commit is contained in:
parent
1f6781babc
commit
c90723f491
|
|
@ -89,7 +89,7 @@ public class Filter {
|
|||
if (_orderBy == null) {
|
||||
_orderBy = order.insert(0, " ORDER BY ").toString();
|
||||
} else {
|
||||
_orderBy = order.insert(0, _orderBy).toString();
|
||||
_orderBy = order.insert(0, _orderBy + ", ").toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3106,6 +3106,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService, Confi
|
|||
Boolean isAscending = Boolean.parseBoolean(_configDao.getValue("sortkey.algorithm"));
|
||||
isAscending = (isAscending == null ? Boolean.TRUE : isAscending);
|
||||
Filter searchFilter = new Filter(TemplateJoinVO.class, "sortKey", isAscending, startIndex, pageSize);
|
||||
searchFilter.addOrderBy(TemplateJoinVO.class, "tempZonePair", isAscending);
|
||||
|
||||
SearchBuilder<TemplateJoinVO> sb = _templateJoinDao.createSearchBuilder();
|
||||
sb.select(null, Func.DISTINCT, sb.entity().getTempZonePair()); // select distinct (templateId, zoneId) pair
|
||||
|
|
|
|||
|
|
@ -383,6 +383,7 @@ public class TemplateJoinDaoImpl extends GenericDaoBase<TemplateJoinVO, Long> im
|
|||
Boolean isAscending = Boolean.parseBoolean(_configDao.getValue("sortkey.algorithm"));
|
||||
isAscending = (isAscending == null ? Boolean.TRUE : isAscending);
|
||||
Filter searchFilter = new Filter(TemplateJoinVO.class, "sortKey", isAscending, null, null);
|
||||
searchFilter.addOrderBy(TemplateJoinVO.class, "tempZonePair", isAscending);
|
||||
List<TemplateJoinVO> uvList = new ArrayList<TemplateJoinVO>();
|
||||
// query details by batches
|
||||
int curr_index = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue