Skip to content

MySQL error when SELECT disk_offering_view / service_offering_view #5175

Closed

Description

@GabrielBrascher
ISSUE TYPE
  • Enhancement Request
COMPONENT NAME
DB
CLOUDSTACK VERSION
4.15.0.0, 4.15.1.0-RC3, 4.16
CONFIGURATION
OS / ENVIRONMENT
mysql --version
mysql  Ver 14.14 Distrib 5.7.34, for Linux (x86_64)

SUMMARY

Seems to be related to MySQL only; MariaDB looks to be working fine. After some MySQL configurations to "disable" only_full_group_by then the select works.

This might be more a documentation than a cloudstack issue, but it is important to raise and track alternatives to solve/mitigate it.
This could bring problems to unaware users.

Bear in mind that the CloudStack mgmt/UI seems to be all good, even with the selects that failed; thus this is a minor issue.

STEPS TO REPRODUCE
Run a MySQL 'select' query on disk_offering_view or service_offering_view
EXPECTED RESULTS
Select offerings views in MySQL
ACTUAL RESULTS
mysql> select * from disk_offering_view limit 1;
ERROR 1055 (42000): Expression #34 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'cloud.vsphere_storage_policy.value' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
mysql> select * from service_offering_view limit 1;
ERROR 1055 (42000): Expression #34 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'cloud.vsphere_storage_policy.value' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Might be related to schema-41400to41500.sql#L423.

Activity

  1. added this to the 4.16.0.0 milestone on Jul 16, 2021
  2. nvazquez commented on Jul 23, 2021

    @nvazquez
    Contributor

    @harikrishna-patnala seems like vsphere_storage_policy may be conflicting here, any input?

  3. nvazquez commented on Aug 16, 2021

    @nvazquez
    Contributor
  4. yadvr commented on Sep 2, 2021

    @yadvr
    Member
  5. modified the milestones: 4.16.0.0, 4.15.2.0 on Sep 2, 2021
  6. nvazquez commented on Sep 2, 2021

    @nvazquez
    Contributor

    @harikrishna-patnala please provide your input after your investigation, thanks

  7. weizhouapache commented on Sep 2, 2021

    @weizhouapache
    Member

    @nvazquez
    I think it is not a bug in cloudstack. cloudstack has already set sql_mode in ./client/conf/db.properties.in

    db.cloud.url.params=prepStmtCacheSize=517&cachePrepStmts=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'&serverTimezone=UTC
    

    to fix the issue , users have to change the mysql setting in mysql.conf , or change mysql global setting by queries if mysql cannot be restarted.

    here is an example

    mysql> select * from service_offering_view;
    ERROR 1055 (42000): Expression #34 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'cloud.vsphere_storage_policy.value' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
    
    mysql> select @@sql_mode;
    +-----------------------------------------------------------------------------------------------------------------------+
    | @@sql_mode                                                                                                            |
    +-----------------------------------------------------------------------------------------------------------------------+
    | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION |
    +-----------------------------------------------------------------------------------------------------------------------+
    1 row in set (0.00 sec)
    
    mysql> select @@global.sql_mode;
    +-----------------------------------------------------------------------------------------------------------------------+
    | @@global.sql_mode                                                                                                     |
    +-----------------------------------------------------------------------------------------------------------------------+
    | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION |
    +-----------------------------------------------------------------------------------------------------------------------+
    1 row in set (0.00 sec)
    
    mysql> set global sql_mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION";
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> set sql_mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION";
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> 
    mysql> select * from service_offering_view limit 1;
    +----+--------------------------------------+----------------+----------------+-------------------+---------------------+------+---------+-------------------+------------+-----------------+----------+----------+---------------+-----------------+---------------------+----------------------------+------------------+----------------------+-----------------------------+----------------+--------------------+---------------------------+-----------------+---------------------+----------------------------+------------+----------------+------+-------+----------+---------+---------+------------+---------------+----------+-------------+---------+----------+-------------+--------------------+-------------------------+------------------------+-----------+-------------+-------------+-------------+---------+-----------+-----------+---------+---------+------------+------------+
    | id | uuid                                 | name           | display_text   | provisioning_type | created             | tags | removed | use_local_storage | system_use | customized_iops | min_iops | max_iops | hv_ss_reserve | bytes_read_rate | bytes_read_rate_max | bytes_read_rate_max_length | bytes_write_rate | bytes_write_rate_max | bytes_write_rate_max_length | iops_read_rate | iops_read_rate_max | iops_read_rate_max_length | iops_write_rate | iops_write_rate_max | iops_write_rate_max_length | cache_mode | root_disk_size | cpu  | speed | ram_size | nw_rate | mc_rate | ha_enabled | limit_cpu_use | host_tag | default_use | vm_type | sort_key | is_volatile | deployment_planner | dynamic_scaling_enabled | vsphere_storage_policy | domain_id | domain_uuid | domain_name | domain_path | zone_id | zone_uuid | zone_name | min_cpu | max_cpu | min_memory | max_memory |
    +----+--------------------------------------+----------------+----------------+-------------------+---------------------+------+---------+-------------------+------------+-----------------+----------+----------+---------------+-----------------+---------------------+----------------------------+------------------+----------------------+-----------------------------+----------------+--------------------+---------------------------+-----------------+---------------------+----------------------------+------------+----------------+------+-------+----------+---------+---------+------------+---------------+----------+-------------+---------+----------+-------------+--------------------+-------------------------+------------------------+-----------+-------------+-------------+-------------+---------+-----------+-----------+---------+---------+------------+------------+
    |  1 | 5a79c934-c955-4681-b479-6ae76e29d7bb | Small Instance | Small Instance | thin              | 2021-08-23 06:26:32 | NULL | NULL    |                 0 |          0 |            NULL |     NULL |     NULL |          NULL |            NULL |                NULL |                       NULL |             NULL |                 NULL |                        NULL |           NULL |               NULL |                      NULL |            NULL |                NULL |                       NULL | NULL       |              0 |    1 |   500 |      512 |    NULL |    NULL |          0 |             0 | NULL     |           0 | NULL    |        0 |           0 | NULL               |                       1 | NULL                   | NULL      | NULL        | NULL        | NULL        | NULL    | NULL      | NULL      | 1       | 1       | 512        | 512        |
    +----+--------------------------------------+----------------+----------------+-------------------+---------------------+------+---------+-------------------+------------+-----------------+----------+----------+---------------+-----------------+---------------------+----------------------------+------------------+----------------------+-----------------------------+----------------+--------------------+---------------------------+-----------------+---------------------+----------------------------+------------+----------------+------+-------+----------+---------+---------+------------+---------------+----------+-------------+---------+----------+-------------+--------------------+-------------------------+------------------------+-----------+-------------+-------------+-------------+---------+-----------+-----------+---------+---------+------------+------------+
    1 row in set (0.01 sec)
    
  8. harikrishna-patnala commented on Sep 3, 2021

    @harikrishna-patnala
    Member

    Thanks @weizhouapache .
    I've created doc PR as a short note to change the SQL mode.
    Let me know if this is fine apache/cloudstack-documentation#239

  9. yadvr commented on Sep 3, 2021

    @yadvr
    Member

    Closing this as we've the doc PR now apache/cloudstack-documentation#239

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions