-
-
Notifications
You must be signed in to change notification settings - Fork 427
Description
Describe the bug
Upgrade from 0.8.8 to 1.2.25 (latest) fails on db upgrade somewhere between 0.8.8 to 1.0.5 due to missing data source profile id.
To Reproduce
Steps to reproduce the behavior:
Upgrade from 0.8.8 to >1.0.0 and observe /var/www/html/cacti/log/cacti.log for error messages like:
CMDPHP ERROR: A DB Exec Failed!, Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE data_source_profile_id = 0' at line 1
Expected behavior
Expect database upgrade to complete without errors.
Desktop (please complete the following information)
-
OS: Ubuntu 22.04.3 LTS
-
Browser: Firefox
-
Version 118.0.1
Additional context
We have an old cacti 0.8.8 install that we are migrating to a new server. I have set up a new server and installed all required packages. I did an mysqldump of old database and imported to new.
Installation wizard fails on updating database from 1.0.4 to 1.0.5 and after looking at the files in /var/www/html/cacti/install/upgrades i can see that in 1_0_0.php the table is created and in 1_0_5.php installer attempts to fetch the id from data_source_profiles but it fails and returns an empty string as the table is empty.
When grepping for data_source_profiles in all the upgrade php scripts, only the following is found:
1_0_0.php: db_install_execute("CREATE TABLE IF NOT EXISTS `data_source_profiles` (
1_0_0.php: db_install_execute("CREATE TABLE IF NOT EXISTS `data_source_profiles_cf` (
1_0_0.php: db_install_execute("CREATE TABLE IF NOT EXISTS `data_source_profiles_rra` (
1_0_0.php: $id = sql_save($save, 'data_source_profiles');
1_0_0.php: db_install_execute("INSERT INTO data_source_profiles_rra
1_0_0.php: db_install_execute("REPLACE INTO data_source_profiles_cf
1_0_5.php: $profile_id_results = db_install_fetch_cell('SELECT id FROM data_source_profiles ORDER BY `default` DESC LIMIT 1');
I am not able to really understand why data_source_profiles is empty, but apparently this is a bug considering there is no fallback in 1_0_5.php in case it is..
Please advice if there is anything i can do manually to solve this.
To be noted, i also emptied host_snmp_cache as it failed on duplicate primary keys. I figured i would rerun the poller once upgrade is finished. I dont think this is relevant to the issue at hand.