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

History syncers lock each other when updating ids during maintenance

XMLWordPrintable

    • Sprint 58 (Nov 2019)
    • 0.125

      Steps:
      History syncer A insert suppression for a problem and to do that it performs update of ids for table name "event_suppress".

      When history syncer B will attempt to do the same it must wait for History syncer A to finish it's transaction which can take long time especially if some other syncer also is waiting, this result in error below:

      [Z3005] query failed: [1205] Lock wait timeout exceeded; try restarting transaction [update ids set nextid=nextid+1 where table_name='event_suppress' and field_name='event_suppressid']
      slow query: 51.120500 sec, "update ids set nextid=nextid+1 where table_name='event_suppress' and field_name='event_suppressid'"

      This makes Zabbix server unusable during maintenance, ids should be cached in order to let history syncers to work in parallel.

      diff --git a/src/libs/zbxdbcache/dbcache.c b/src/libs/zbxdbcache/dbcache.c
      index 5614882097..5c76707418 100644
      --- a/src/libs/zbxdbcache/dbcache.c
      +++ b/src/libs/zbxdbcache/dbcache.c
      @@ -57,7 +57,7 @@ static size_t		sql_alloc = 64 * ZBX_KIBIBYTE;
       
       extern unsigned char	program_type;
       
      -#define ZBX_IDS_SIZE	8
      +#define ZBX_IDS_SIZE	9
       
       #define ZBX_HC_ITEMS_INIT_SIZE	1000
       
      diff --git a/src/libs/zbxdbhigh/db.c b/src/libs/zbxdbhigh/db.c
      index f20676750d..8b2f51e2c4 100644
      --- a/src/libs/zbxdbhigh/db.c
      +++ b/src/libs/zbxdbhigh/db.c
      @@ -723,7 +723,8 @@ zbx_uint64_t	DBget_maxid_num(const char *tablename, int num)
       			0 == strcmp(tablename, "dhosts") ||
       			0 == strcmp(tablename, "alerts") ||
       			0 == strcmp(tablename, "escalations") ||
      -			0 == strcmp(tablename, "autoreg_host"))
      +			0 == strcmp(tablename, "autoreg_host") ||
      +			0 == strcmp(tablename, "event_suppress"))
       		return DCget_nextid(tablename, num);
       
       	return DBget_nextid(tablename, num);
      

            vso Vladislavs Sokurenko
            vso Vladislavs Sokurenko
            Team A
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: