Redundant field updates on proxy during proxy-server configuration sync

XMLWordPrintable

    • Type: Problem report
    • Resolution: Unresolved
    • Priority: Major
    • None
    • Affects Version/s: 7.0.17, 7.2.11, 7.4.1, 8.0.0alpha1
    • Component/s: Proxy (P)
    • None
    • Support backlog

      To solve dependencies when removing/updating records proxy renames some text fields and sets some id fields to NULL for all changed objects. This is done even if those fields were not included in changes.

      Investigate possibility to exclude unchanged 'rename/reset' fields from such updates.

      Experimental code:

      diff --git a/src/zabbix_proxy/proxyconfigwrite/proxyconfigwrite.c b/src/zabbix_proxy/proxyconfigwrite/proxyconfigwrite.c
      index dc193455add..064558e3030 100644
      --- a/src/zabbix_proxy/proxyconfigwrite/proxyconfigwrite.c
      +++ b/src/zabbix_proxy/proxyconfigwrite/proxyconfigwrite.c
      @@ -97,6 +97,17 @@ static int	zbx_flags128_isset(zbx_flags128_t *flags, int bit)
       	return (0 != (flags->blocks[bit >> 6] & (__UINT64_C(1) << (bit & 0x3f)))) ? SUCCEED : FAIL;
       }
       
      +static int	zbx_flags128_isand(zbx_flags128_t *flags1, zbx_flags128_t *flags2)
      +{
      +	for (zbx_uint64_t i = 0; i < sizeof(flags1->blocks) / sizeof(zbx_uint64_t); i++)
      +	{
      +		if (0 != (flags1->blocks[i] & flags2->blocks[i]))
      +				return SUCCEED;
      +	}
      +
      +	return FAIL;
      +}
      +
       static int	zbx_flags128_isclear(zbx_flags128_t *flags)
       {
       	if (0 != flags->blocks[0])
      @@ -784,14 +795,14 @@ static int	proxyconfig_prepare_rows(zbx_table_data_t *td, id_unhash_func_t unhas
       
       	for (int i = 0; i < td->updates.values_num; i++)
       	{
      -		zbx_vector_uint64_append(&updateids, td->updates.values[i]->recid);
      -
      -		/* force renamed/reset fields to be updated */
      -
      +		/* force renamed fields to be updated */
       		if (-1 != rename_index)
       			zbx_flags128_set(&td->updates.values[i]->flags, rename_index);
      +		else if (SUCCEED != zbx_flags128_isand(&td->updates.values[i]->flags, &reset_flags))
      +			continue;
       
       		zbx_flags128_or(&td->updates.values[i]->flags, &reset_flags);
      +		zbx_vector_uint64_append(&updateids, td->updates.values[i]->recid);
       	}
       
       	if (0 != td->reset_fields.values_num)
      
      

            Assignee:
            Zabbix Development Team
            Reporter:
            Andris Zeila
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: