Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-12643

no records in "users" table: wrong method of detecting if it's server or proxy

    Details

    • Team:
      Team A
    • Sprint:
      Sprint 15, Sprint 20, Sprint 21, Sprint 22, Sprint 23, Sprint 24, Sprint 25, Sprint 26
    • Story Points:
      1

      Description

      Everything started with a message after upgrading from 2.4 to 3.0: cannot use database "zabbix": Zabbix server cannot work with a Zabbix proxy database.
      Was wondered, because proxy was never used on that server.

      Digging code of zabbix server, discovered interesting method to detect if it's zabbix server or proxy:
      ./src/libs/zbxdbhigh/db.c

      2687     if (NULL == (result = DBselectN("select userid from users", 1)))
      2688     {
      2689         zabbix_log(LOG_LEVEL_DEBUG, "cannot select records from \"users\" table");
      2690         goto out;
      2691     }
      2692
      2693     if (NULL != (row = DBfetch(result)))
      2694     {
      2695         zabbix_log(LOG_LEVEL_DEBUG, "there is at least 1 record in \"users\" table");
      2696         ret = ZBX_DB_SERVER;
      2697     }
      2698     else
      2699     {
      2700         zabbix_log(LOG_LEVEL_DEBUG, "no records in \"users\" table");
      2701         ret = ZBX_DB_PROXY;
      2702     }
      

      In my database:

      mysql> select count(*) from users;
      +----------+
      | count(*) |
      +----------+
      |       85 |
      +----------+
      1 row in set (0.00 sec)
      
      mysql> select userid from users limit 1;
      Empty set, 24832 warnings (0.00 sec)
      
      mysql> SHOW WARNINGS;
      ERROR 2013 (HY000): Lost connection to MySQL server during query
      

      So obviously the problem is with database (MySQL 5.7.18-16), but I think that the root of the problem is method of detecting server/proxy.

      FLUSH TABLES helped, everything works fine now.

      Sorry if it is not relevant but I spent not just few minutes figuring out what exactly wrong with database type...

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vso Vladislavs Sokurenko
                Reporter:
                ableev Ilya Ableev
              • Votes:
                1 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: