[ZBX-5730] "mediumtext" columns instead of "text" sometimes appear in zabbix DB schema after v1.6 Created: 2012 Oct 24  Updated: 2017 May 30  Resolved: 2015 Mar 30

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Documentation (D)
Affects Version/s: 1.8.15, 2.0.3, 2.1.0
Fix Version/s: None

Type: Incident report Priority: Minor
Reporter: Oleksii Zagorskyi Assignee: Unassigned
Resolution: Won't fix Votes: 0
Labels: consistency, db, dbintegrity, dbpatches, mysql, upgrade, utf8
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate

 Description   

Goal of creation this issue report first of all is a some place where to describe everything.

Probably we could add some notes to documentation but we will discuss this in comments.

In v1.6 DB schema has 5 columns with "text" type:

node_cksum.cksum
history_log.value
history_text.value
proxy_history.value
items.params

Just a note - v1.8 schema has the same 5 "text" columns, v2.0 has much more "text" columns.

If perform conversion to UFT8 (designed in upgrade 1.6->1.8) they all will get new "mediumtext" type.
See a nice article http://www.mysqlperformanceblog.com/2009/03/17/converting-character-sets/

After applying 1.6->1.8 SQL patch there will remain only 4 such columns:

history_log.value
history_text.value
proxy_history.value
items.params

Then after applying 1.8->2.0 SQL patch there will remain only 3 such columns:

history_log.value
history_text.value
items.params

What a problem is here? See:

Sometimes people need to check DB schema to make sure that all is correct.
And if such inconsistencies appear then we have a question - what is that?, when and why it appeared ?
To make sure that all is fine we need to know exact reason of this inconsistency and fix it.
It's NOT very easy to figure out pure reason.

Some real scenarios:
#1 user started to use v1.6 and in V2.0 got 3 "mediumtext" columns.
#2 user skipped UTF8 conversion (during 1.6->1.8) for some reason and did fix it now and got:

  • 4 columns - if convert in v1.8 a DB created in 1.6;
  • 5 columns - if convert in v1.8 a DB created in 1.8;
  • a lot of columns if convert in v2.0
    #3 user created v1.8+ database accidentally without specifying "... character set utf8". then see scenario #2

How to fix.
for scenario #1, #2:
If you have up to 5 columns with the "mediumtext", here is ready SQLs (if currently used schema is v2.0):

ALTER TABLE node_cksum MODIFY value cksum NOT NULL;
ALTER TABLE history_log MODIFY value text NOT NULL;
ALTER TABLE history_text MODIFY value text NOT NULL;
ALTER TABLE proxy_history MODIFY value text NOT NULL;
ALTER TABLE items MODIFY params text NOT NULL;

for scenario #2, #3:
Need to convert all tables, repeat this SQL for all tables:

ALTER TABLE <tablename_here> CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;

and then check and change "mediumtext" to "text" as shown above for ALL appeared "mediumtext" columns.



 Comments   
Comment by Alexander Vladishev [ 2015 Mar 30 ]

I close the issue. In documentation shouldn't be described custom manipulations with a database and related problems.

Comment by Oleksii Zagorskyi [ 2015 Mar 30 ]

We could check that and fix if required by upgrade patches.
Not sure it worth to do ...

Comment by richlv [ 2015 Mar 30 ]

just to clarify, this could happen if a user would follow zabbix documentation, no custom modifications needed.

after some discussion it has been decided that this is an edge case and there's probably no need to handle it, but this issue should pop up in search results, which is good if somebody actually steps on this

zalex_ua 1st sentence sounds a bit incorrectly (can have 2 meanings).
Actually if user started to use 1.6 and followed documentation - he will have those 'mediumtext' columns.

Generated at Fri Apr 19 10:13:12 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.