Sort function in a POST query does not work

Bug #1708982 reported by Mark Zhu
This bug report is a duplicate of:  Bug #1624502: Sort is not working for stats query. Edit Remove
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
New
Undecided
Sundaresan Rajangam

Bug Description

Hi,

On a setup with 4 nodes (running Centos 7.3):
-Openstack node (Mitaka)
-Contrail config, controller, analytics node (Contrail 3.2)
-2 compute nodes
The Openstack was installed first, then Contrail was installed and provisioned using the fab tool.

In the query below, the sort field is "stats_info.__key". The results are always sorted in ascending order regardless of sort order (ASCENDING = 1, DESCENDING = 2)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[root@node-46 ~]# cat q10
{
        "start_time": "now-1m",
        "end_time": "now",
        "select_fields": ["Source", "T", "CLASS(T)", "COUNT(stats_info)", "stats_info.__key", "stats_info.reads", "SUM(stats_info.reads)", "CLASS(stats_info.reads)", "MAX(stats_info.reads)", "MIN(stats_info.reads)", "PERCENTILES(stats_info.reads)", "AVG(stats_info.reads)", "stats_info.read_fails", "SUM(stats_info.read_fails)", "CLASS(stats_info.read_fails)", "MAX(stats_info.read_fails)", "MIN(stats_info.read_fails)", "PERCENTILES(stats_info.read_fails)", "AVG(stats_info.read_fails)", "stats_info.writes", "SUM(stats_info.writes)", "CLASS(stats_info.writes)", "MAX(stats_info.writes)", "MIN(stats_info.writes)", "PERCENTILES(stats_info.writes)", "AVG(stats_info.writes)", "stats_info.write_fails", "SUM(stats_info.write_fails)", "CLASS(stats_info.write_fails)", "MAX(stats_info.write_fails)", "MIN(stats_info.write_fails)", "PERCENTILES(stats_info.write_fails)", "AVG(stats_info.write_fails)", "stats_info.write_back_pressure_fails", "SUM(stats_info.write_back_pressure_fails)", "CLASS(stats_info.write_back_pressure_fails)", "MAX(stats_info.write_back_pressure_fails)", "MIN(stats_info.write_back_pressure_fails)", "PERCENTILES(stats_info.write_back_pressure_fails)", "AVG(stats_info.write_back_pressure_fails)", "name"],
        "table": "StatTable.CollectorDbStats.stats_info",
        "where": [[{ "name": "Source", "value": "", "op": 7}]],
        "sort_fields":["stats_info.__key"],"sort":2
}
[root@node-46 ~]#
[root@node-46 ~]#
[root@node-46 ~]# curl -X POST --data @q10 10.240.150.170:8081/analytics/query --header "Content-Type:application/json" | python -mjson.tool | grep stats_info.__key
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 59040 0 57609 100 1431 54586 1355 0:00:01 0:00:01 --:--:-- 54605
            "stats_info.__key": "AlarmgenStatus:counters",
            "stats_info.__key": "AlarmgenUpdate:i",
            "stats_info.__key": "AlarmgenUpdate:o",
            "stats_info.__key": "AnalyticsApiStats:api_stats",
            "stats_info.__key": "CassandraStatusData:cassandra_compaction_task",
            "stats_info.__key": "CassandraStatusData:thread_pool_stats",
            "stats_info.__key": "CollectorDbStats:cql_stats",
            "stats_info.__key": "CollectorDbStats:cql_stats.errors",
            "stats_info.__key": "CollectorDbStats:cql_stats.stats",
            "stats_info.__key": "CollectorDbStats:errors",
            "stats_info.__key": "CollectorDbStats:stats_info",
            "stats_info.__key": "CollectorDbStats:table_info",
            "stats_info.__key": "ComputeCpuState:cpu_info",
            "stats_info.__key": "DatabaseUsageInfo:database_usage",
            "stats_info.__key": "FieldNames:fields",
            "stats_info.__key": "ModuleClientState:msg_type_diff",
            "stats_info.__key": "ModuleClientState:tx_msg_diff",
            "stats_info.__key": "NodeStatus:disk_usage_info",
            "stats_info.__key": "NodeStatus:process_mem_cpu_usage",
            "stats_info.__key": "NodeStatus:system_cpu_usage",
            "stats_info.__key": "NodeStatus:system_mem_usage",
            "stats_info.__key": "QueryPerfInfo:query_stats",
            "stats_info.__key": "SandeshMessageStat:msg_info",
            "stats_info.__key": "UveVMInterfaceAgent:flow_rate",
            "stats_info.__key": "UveVMInterfaceAgent:if_stats",
            "stats_info.__key": "UveVirtualNetworkAgent:vn_stats",
            "stats_info.__key": "VirtualMachineStats:cpu_stats",
            "stats_info.__key": "VncApiStatsLog:api_stats",
            "stats_info.__key": "VrouterStatsAgent:flow_rate",
            "stats_info.__key": "VrouterStatsAgent:phy_band_in_bps",
            "stats_info.__key": "VrouterStatsAgent:phy_band_out_bps",
            "stats_info.__key": "VrouterStatsAgent:phy_flow_rate",
            "stats_info.__key": "VrouterStatsAgent:phy_if_stats",
            "stats_info.__key": "VrouterStatsAgent:vhost_stats",
[root@node-46 ~]#
[root@node-46 ~]#

===================
Expected result:
The results should be sorted in appropriate order

Mark Zhu (markzhu)
information type: Proprietary → Public
Sachin Bansal (sbansal)
Changed in juniperopenstack:
assignee: nobody → Anish Mehta (amehta00)
Anish Mehta (amehta00)
Changed in juniperopenstack:
assignee: Anish Mehta (amehta00) → Sundaresan Rajangam (srajanga)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.