[ZBX-8307] zabbix proxy sqlite / db upgrade 2.0 => 2.2 not working Created: 2014 Jun 05  Updated: 2022 Aug 16  Resolved: 2014 Jul 14

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Documentation (D), Proxy (P)
Affects Version/s: 2.2.2
Fix Version/s: 2.3.2

Type: Incident report Priority: Critical
Reporter: dakol Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: proxy, sqlite, upgrade
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates ZBXNEXT-6181 Zabbix Proxy should drop SQLite Datab... Closed

 Description   

Upgrade from 2.0.10 to 2.2.2.
Zabbix Server (PosgreSQL) went ok

Zabbix Proxy (SQLite) went ko

29381:20140605:140040.434 query [txnlev:0] [select 1 from sqlite_master where tbl_name='dbversion' and type='table']
29381:20140605:140040.435 The proxy does not match Zabbix database. Current database version (mandatory/optional): UNKNOWN. Required mandatory version: 02020000.
29381:20140605:140040.437 End of DBcheck_version():FAIL
29490:20140605:140238.156 Starting Zabbix Proxy (active) [zabbix-proxy-mlb-prod-2y.sup]. Zabbix 2.2.2 (revision 42525).

but no luck.



 Comments   
Comment by Aleksandrs Saveljevs [ 2014 Jun 05 ]

Perhaps we should document that database upgrade for SQLite is not supported. Instead, proxy's database file should simply be removed. When started, proxy will recreate it automatically.

Comment by Oleksii Zagorskyi [ 2014 Jun 06 ]

Interesting, could proxy do that (delete the file) itself ?

Comment by Martins Valkovskis [ 2014 Jun 06 ]

[1]
Currently noted that automatic DB upgrade not supported for SQLite:

zalex_ua for now it's ok.
But most of us agree that something should be changed on proxy code with sqlite support.
After that these notes probably should be changed.

sasha added the message "Zabbix does not support SQLite3 database upgrade." on proxy an server sides.

CLOSED

Comment by Marc [ 2014 Jun 06 ]

Yeah, please document that. I run into the same issue a couple of month ago too and it took me some time to solve. Beside documenting it I'd appreciate a dedicated log messages that informs about this limitation.

As for deletion I'd prefer the process would not do it automatically. The process can't reliably know whether the data might still be of any interest to the user or not.

But an additional option to allow that, which of course by default is disabled, might be a compromise.

Comment by dimir [ 2014 Jun 06 ]

Good idea, okkuv9xh, to have proxy configuration parameter allowing that.

Comment by Oleksii Zagorskyi [ 2014 Jun 06 ]

There were discussion with devs about the idea to automatically remove db file with smart logic.
We finished that idea looks good and would worth to develop it.

Considering possibly existing historical data - there no way to do something with it.
For example if server already upgraded and running - proxy should not be pointed to the server. There no way than delete db file and let proxy recreate it.
It should be only in case of major upgrade. Not sure what to do with optional patches.

As for configuration option which is disabled by default - I don't agree.
Do we have any similar configuration thing for server upgrade? No! Why then we need it for proxy?
It should be upgraded automatically! (IMO)

Comment by Marc [ 2014 Jun 06 ]

I see your point zalex_ua. Just speaking for myself and for my current setup I could live with that.

Nevertheless, deleting is generally an irreversible action. Users may have done some custom stuff like adding indirect connected data that might be joined with zabbix data in queries.
Sure one can argue that this is not supported by upstream. Anyway the possibility for doing so, is an elementary option in the realm of FOSS.

The implementation of a clever algorithm, that might take care of any possible variable that might theoretically exist, sounds to me a lot more effort - when even successfully doable at all.

As for referring to the way things are already done, I'd say: Let's do it the right way and make sqlite databases upgradeable in the same way it is already done for other database backends.

Addendum:
As for server upgrade, it made my live a lot easier, since i had over 30 proxies that had to be updated separately. Beside the fact that I don't want to rollback 30 proxies when it turns out that there are unexpected serious issues with the new release.
I know that's not supported as well. but in cases where it still works it's a blessing.
But that has actually nothing to do with how to take care about the proxy database

Comment by Oleksii Zagorskyi [ 2014 Jun 06 ]

sasha in that discussion said:

it is fairly hard to do database upgrade in SQLite.
For instance, in order to change a field's type or rename it, one has to recreate a table.
We should write absolutely different code to upgrade SQLite3. For a proxy it isn't so important. It is simpler to delete and create the new database.

Comment by Marc [ 2014 Jun 06 ]

Never said that sqlite upgrade would be an easy(er) way

In case the aim is use "[...] similar configuration thing for server upgrade", then I'd suggest to implement sqlite upgrade but not to implement something new that is not done somewhere else as well.

In doubt, I believe it's by far better just to print/log a clear information about the current limitation.

Addendum:
Or to make the automatic deletion optional, of course. At least to allow opt-out.

Comment by richlv [ 2014 Jun 06 ]

auto-deleting would be bad, as noted that's irreversible.
i'd vote for nice message in the logfile.

Comment by Juris Miščenko (Inactive) [ 2014 Jul 09 ]

For the time being, we are not going to implement a ``smart'' mechanism for upgrading SQLite databases. A log message has been added to note that SQLite DBs are not supported.

Change implemented at svn://svn.zabbix.com/branches/dev/ZBX-8307

Comment by Juris Miščenko (Inactive) [ 2014 Jul 14 ]

Fix merged in 2.3.3 (trunk) r47286

Comment by Oleksii Zagorskyi [ 2014 Jul 14 ]

FYI - svn r47286 log message uses wrong issue number "ZBX-8037"

sasha Thanks! FIXED

Generated at Wed May 14 11:02:02 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.