See www.zabbix.com for the official Zabbix site.

Docs/specs/ZBXNEXT-1693

From Zabbix.org
Jump to: navigation, search

New numeric data type: small integer

ZBXNEXT-1693

Status: Draft

Owner: Alexei

Summary

A new smaller integer type will make the database smaller and more consistent. It will also lead to minor performance improvements.

New table field type: t_int8

A new data type will be introduced, t_int8. It has a range of -128..127. It is defined as:

 MySQL: tinyint
 PostgreSQL: smallint # actual range of -32768 to +32767
 Oracle: number(3)    # actual range of -999 to 999
 DB2: smallint        # actual range of -32768 to +32767
 SQLite: tinyint      # for consistency, alias to 'integer'
 PHP code: DB::FIELD_TYPE_INT8
 C code: char, ZBX_TYPE_INT8

Affected database related files

 create/bin/get_php.php
 create/bin/gen_schema.pl
 create/schema.tmpl

Server and proxy side changes

Optionally type of affected database fields should be changed from 'integer' to 'char' in various structures defined in include/db.h and other files.

Database changes

Type of all these fields should be converted from t_integer to a new numeric type t_int8 having range of -128..127.

Check any database changes starting from revision 34709 to see if there are any new fields that also needs to be converted.

If existing value is out of range of -128..127, Zabbix Server should fail and a critical error message "Cannot upgrade database structure: field %s.%s is out of range of -128..127. Exiting ..." will be written to zabbix_server.log.

The upgrade procedure must change all fields for each table by executing a single SQL (alter table) statement. It is especially important for larger tables like events and history_log.

 actions.eval_type
 actions.event_source
 actions.status
 alerts.alerttype
 alerts.retries
 alerts.status
 auditlog.action
 auditlog.resourcetype
 conditions.conditiontype
 conditions.operator
 config.dropdown_first_remember
 config.dropdown_fist_entry
 config.event_ack_enable
 config.ok_ack_style
 config.ok_unack_style
 config.problem_ack_style
 config.problem_unack_style
 config.snmpstrap_logging
 dchecks.snmpv3_authprotocol
 dchecks.snmpv3_privprotocol
 dchecks.snmpv3_securitylevel
 dchecks.type
 dchecks.uniq
 dhosts.status
 drules.status
 dservices.status
 dservices.type
 escalations.status
 events.acknowledged
 events.object
 events.source
 events.value
 expressions.case_sensitive
 expressions.expression_type
 graphs.flags
 graphs.graphtype
 graphs_items.calc_fnc
 graphs_items.drawtype
 graphs_items.type
 graphs_items.yaxiside
 graphs.show_3d
 graphs.show_legend
 graphs.show_triggers
 graphs.show_work_period
 graphs.ymax_type
 graphs.ymin_type
 graph_theme.gridview
 graph_theme.legendview
 groups.internal
 history_log.severity
 host_inventory.inventory_mode
 hosts.available
 hosts.ipmi_authtype
 hosts.ipmi_available
 hosts.ipmi_privilege
 hosts.jmx_available
 hosts.maintenance_status
 hosts.maintenance_type
 hosts.snmp_available
 hosts.status
 httpstepitem.type
 httptest.authentication
 httptestitem.type
 httptest.retries
 httptest.status
 icon_mapping.inventory_link
 images.imagetype
 interface.main
 interface.type
 interface.useip
 items.authtype
 items.data_type
 items.delta
 items.flags
 items.inventory_link
 items.multiplier
 items.snmpv3_authprotocol
 items.snmpv3_privprotocol
 items.status
 items.type
 items.value_type
 maintenance.maintenance_type
 media.active
 media.severity
 mediatype.status
 mediatype.type
 node_cksum.cksumtype
 nodes.nodetype
 opcommand.authtype
 opcommand.execute_on
 opcommand.type
 opconditions.conditiontype
 opconditions.operator
 operations.evaltype
 operations.operationtype
 opmessage.default_msg
 profiles.type
 proxy_dhistory.status
 proxy_dhistory.type
 proxy_history.severity
 proxy_history.status
 rights.permission
 screens_items.dynamic
 screens_items.halign
 screens_items.resourcetype
 screens_items.sort_triggers
 screens_items.style
 screens_items.valign
 scripts.execute_on
 scripts.host_access
 scripts.type
 service_alarms.value
 services.algorithm
 services_links.soft
 services.showsla
 services.status
 service_times.type
 sessions.status
 sysmaps_elements.areatype
 sysmaps_elements.elementsubtype
 sysmaps_elements.elementtype
 sysmaps_elements.label_location
 sysmaps_elements.use_iconmap
 sysmaps_elements.viewtype
 sysmaps.expandproblem
 sysmaps.grid_align
 sysmaps.grid_show
 sysmaps.grid_size
 sysmaps.highlight
 sysmaps.label_format
 sysmaps.label_location
 sysmaps.label_type
 sysmaps.label_type_host
 sysmaps.label_type_hostgroup
 sysmaps.label_type_image
 sysmaps.label_type_map
 sysmaps.label_type_trigger
 sysmaps_links.drawtype
 sysmaps_link_triggers.drawtype
 sysmaps.markelements
 sysmaps.show_unack
 sysmap_url.elementtype
 timeperiods.day
 timeperiods.dayofweek
 timeperiods.every
 timeperiods.month
 timeperiods.timeperiod_type
 triggers.flags
 triggers.priority
 triggers.status
 triggers.type
 triggers.value
 triggers.value_flags
 users.autologin
 users.type
 usrgrp.debug_mode
 usrgrp.gui_access
 usrgrp.users_status

API and Interface changes

Validation code in DB.php (function checkValueTypes) should be extended to support new value type.

Documentation

  • whatsnew (performance/memory usage aspect)
  • Upgrade notes
    • Upgrade procedure may take time in case of large tables 'history_log' and/or 'events'.

ChangeLog

  • N/A