Hello,
I found a bug on cacti 0.6.7, which may lead to a loss of datasources.
Here is how to reproduce it:
I started creating a new DataSource, and stopped for about two hours,
before having saved changes (eating time) .
Returned, I completed my ds.php?action=edit form, and
pressed "Save" button.
The result is I do not have any Master DataSources in my list:
SELECT ID, SubDSID, SubFieldID, Name FROM rrd_ds ORDER BY Name;
does not show any record with SubDSID Or SubFieldID = 0
The culpitre may be in CLEANUP code, and the problem happens
under some conditions (may be session timeout, or something else).
/* ------------------ CLEANUP ------------------ */^M
/* if the data input source changed, make sure to delete any children this ds has */^M
mysql_query("delete from rrd_ds where subdsid=$id",$cnn_id);^M
^M
/* ... same goes for the items in src_data */^M
mysql_query("delete from src_data where dsid=$id",$cnn_id);^M
^M
/* we have to make sure to kill the children's DS's in src_data */^M
$sql_id = mysql_query("select id from rrd_ds where subdsid=$id", $cnn_id);^M
^M
for ($i = 0; $i < mysql_num_rows($sql_id); $i++) {^M
mysql_query("delete from src_data where dsid=" . mysql_result($sql_id, $i, "id"),$cnn_id);^M
}^M
^M
/* ------------------ CLEANUP ------------------ */^M
Not to say I have lost a lot of data,
and this may happens to someone else if not corrected.
Sorry, I just don't have enough time to debug it myself now,
I just wanted you to know about it.
Good luck
Luc
I have lost all my datasources
Moderators: Developers, Moderators
Yeah, that is no good. Here is what I make of the problem.
From what I get, this is the only SQL query listed that could be causing the problem:
I think what happened, is for some reason '$id' was set to '0'. That really *shouldn't* happen since it should always contain the current ID. You mentioned that you were adding a new data source, so the '$id' variable came from MySQL's 'LAST_INSERT_ID' function. This is what I am guessing the cultprit is in your case.
I have fixed this however so it will not happen to you (or anyone else) in the future.
-Ian
From what I get, this is the only SQL query listed that could be causing the problem:
Code: Select all
delete from rrd_ds where subdsid=$id
I have fixed this however so it will not happen to you (or anyone else) in the future.
-Ian
Who is online
Users browsing this forum: No registered users and 1 guest