From: Florian G. <re...@us...> - 2007-03-01 23:52:04
|
Update of /cvsroot/perfparse/_perfparse/db_tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13565/db_tools Modified Files: convert.c Log Message: start rework database upgrade Index: convert.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/db_tools/convert.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** convert.c 12 Dec 2006 23:44:18 -0000 1.11 --- convert.c 1 Mar 2007 23:52:02 -0000 1.12 *************** *** 3,7 **** * convert.c - Automatic conversion of database for new versions. * ! * Copyright (c) 2004 Ben Clewett (per...@cl...) * $Id$ * --- 3,8 ---- * convert.c - Automatic conversion of database for new versions. * ! * Copyright (c) 2004-2007 Ben Clewett (per...@cl...), ! * Florian Gleixner * $Id$ * *************** *** 83,87 **** DB_VERSION_CHAR); printf (_("Starting...\n\n")); - sleep (1); } else --- 84,87 ---- *************** *** 105,144 **** version = getVersion (); ! if (version < 0.15) ! { ! printf (_("Warning, this stage may take some time:\n")); ! addField ("perfdata_service_raw", "nagios_status", ! "TINYINT DEFAULT NULL"); ! } ! ! if (version < 0.16) ! { ! addField ("perfdata_graphs", "refresh_time", ! "INT NOT NULL DEFAULT 0"); ! } ! ! if (version < 0.17) ! { ! /* ! * Add and populate the new ID fields: ! */ ! addIdFields (); ! } ! ! if (version < 0.18) { ! /* ! * Drop the old summary tables: ! */ ! query ("DROP TABLE IF EXISTS perfdata_summary"); ! query ("DROP TABLE IF EXISTS perfdata_summary_data"); ! /* ! * Also drop new ones, error in last version Ben :) ! */ ! query ("DROP TABLE IF EXISTS perfdata_bin_summary_data"); } if (version < 0.20) { int i_steps=20; int i=0; --- 105,153 ---- version = getVersion (); ! if (version < 0.19) { ! printf(_("Conversion from older database schemas not supported.\n")); ! printf(_("Please visit the perfparse project page to get a older version (0.106.1) of perfparse")); ! exit(1); } if (version < 0.20) { + char yesno; + printf(_("The database schema for perfparse changed dramatically. ")); + printf(_("Changing the tables\nwould be too error-prone, so we decided to copy the data into a new database.\n")); + printf(_("This step can take days for large databases. ")); + printf(_("You should have prepared a new\ndatabase for this conversion step. ")); + printf(_("This database should contain the v 0.20\ndatabase schema. ")); + printf(_("You should have enough disk space to duplicate your old\ndatabase. ")); + printf(_("To minimize downtime you can use the new schema with your new\nperfparse while old data are copied. ")); + printf(_("For more information visit\nhttp://perfparse.de/tiki-index.php?page=DatabaseUpgrade \n")); + printf(_("\nAre you sure to start the conversion (y/n)? ")); + while((yesno=getchar())) { + if(yesno == 'y') + break; + if(yesno == 'n') { + printf(_("\nBye.\n")); + exit(1); + } + } + + printf(_("\n\nIn the next step you will have to provide data of the old and the new database.\n")); + printf(_("With the commandline or in the configuration file you provided these data:\n")); + printf(_("Database Host:\t%s\n"),config_get_value_as_string(CONFIG_ITEM_ID_DB_HOST)); + printf(_("Database User:\t%s\n"),config_get_value_as_string(CONFIG_ITEM_ID_DB_USER)); + printf(_("Database Password:\t%s\n"),config_get_value_as_string(CONFIG_ITEM_ID_DB_PWD)); + printf(_("Database Name:\t%s\n"),config_get_value_as_string(CONFIG_ITEM_ID_DB_DATABASE)); + printf(_("Database TCP Port:\t%d\n"),config_get_value_as_integer(CONFIG_ITEM_ID_DB_PORT)); + printf(_("Database Unix Socket:\t%s\n"),config_get_value_as_string(CONFIG_ITEM_ID_DB_SOCKET)); + printf(_("\n\nAre these values for the old or new database? (o/n)")); + + while((yesno=getchar())) { + if(yesno == 'o' || yesno == 'n' ) + break; + } + + + /* int i_steps=20; int i=0; *************** *** 201,204 **** --- 210,214 ---- } + */ /* if(i_cont_step < i++) { *************** *** 221,225 **** } */ ! if(i_cont_step < i++) { printf(_("[Step %d/%d] Fixing keys of perfdata_host table pt. 3\n"),i,i_steps); --- 231,235 ---- } */ ! /* if(i_cont_step < i++) { printf(_("[Step %d/%d] Fixing keys of perfdata_host table pt. 3\n"),i,i_steps); *************** *** 263,266 **** --- 273,278 ---- setConversionStep(i); } + + */ } |