[ZBX-12643] no records in "users" table: wrong method of detecting if it's server or proxy Created: 2017 Aug 30 Updated: 2024 Apr 10 Resolved: 2018 Jan 28 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Proxy (P), Server (S) |
Affects Version/s: | 3.0.10 |
Fix Version/s: | 3.0.15rc1, 3.4.7rc1, 4.0.0alpha3, 4.0 (plan) |
Type: | Problem report | Priority: | Trivial |
Reporter: | Ilya Ableev | Assignee: | Vladislavs Sokurenko |
Resolution: | Fixed | Votes: | 1 |
Labels: | db | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Issue Links: |
|
||||||||
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. Digging code of zabbix server, discovered interesting method to detect if it's zabbix server or proxy: 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... |
Comments |
Comment by richlv [ 2017 Aug 30 ] |
looks like it was a problem with the database - what is the bug in zabbix, what's wrong with that method ? |
Comment by Vladislavs Sokurenko [ 2017 Aug 30 ] |
Could you please provide log, there might have been more error messages. |
Comment by Vladislavs Sokurenko [ 2017 Aug 30 ] |
It looks like a bug in zabbix, it does not handle a problem with a database as it should. Thank you for your report. |
Comment by Vladislavs Sokurenko [ 2017 Dec 12 ] |
Hello ableev any hints on how to reproduce the issue ? Currently it looks like your database was empty (not containing any users) so server decided that it's proxy database. |
Comment by Valdis Kauķis (Inactive) [ 2017 Dec 12 ] |
The current error message:
is misleading. All we know is that there are no users in the database, but there are other valid reasons for that, e.g. user forgot to load data from database/mysql/data.sql. We propose to make the error message more transparent (and less assertive):
|
Comment by Vladislavs Sokurenko [ 2018 Jan 09 ] |
Fixed in development branch: |
Comment by dimir [ 2018 Jan 19 ] |
(1) I don't like that error message, martins-v, do you think the following would be better: 15203:20171212:132246.229 cannot use database "zabbix" because its "users" table is empty (is this Zabbix proxy database?) martins-v Yes, I like this version better. Could be shortened to: 15203:20171212:132246.229 cannot use database "zabbix": its "users" table is empty (is this the Zabbix proxy database?) <dimir> vso, if you agree, please apply modification. vso RESOLVED in r77117 <dimir> CLOSED |
Comment by Vladislavs Sokurenko [ 2018 Jan 25 ] |
Fixed in:
|