<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Florian,<br>
<br>
Sorry from the beginning, this will be a long email. The modifications
I've made aren't really encountered in a regular setup, that's why I
said, I posting my work, _maybe_ it benefits somebody.<br>
<br>
The mysql RA checks if mysql is up by looking at the pid, if [ ! -e
$OCF_RESKEY_pid]; then => not running. I've had to go through a case
where:<br>
- mysql is installed (at the end of the installation process it starts)<br>
- the hostname of the server is changed without shutting down mysql
first (thus the pid is still there, but named after the old hostname)<br>
- trying to start mysql after hostname changed without checking for
running instances => pid manager quit without updating pid file.<br>
<br>
For this case I've added the double_check() function which verifies if
there is a network socket. If ! -e $OCF_RESKEY_pid && no
network socket, mysql is down => $OCF_NOT_RUNNING.<br>
If ! -e $OCF_RESKEY_pid && network socket exists =>
pid_check().<br>
<br>
pid_check() finds if running pid != $OCF_RESKEY_pid and returns
$OCF_ERR_INSTALLED + email alert.<br>
<br>
If pid is ok and mysql is running, begin a detailed database check.
First query contents of a table, if $? -eq 0 => $OCF_SUCCESS, else
run db_check().<br>
<br>
db_check() queries the defined database (cluster, in this example), if
it works => $OCF_SUCCESS, else check "show databases". If $? -eq 0,
"cluster" database not installed, return $OCF_ERR_INSTALLED + email,
else $OCF_ERR_GENERIC + email => no rights for the current user to
do a "show database" or no database available.<br>
<br>
If db_check() returns 0, it means that the table query is not done
properly, but the database exists => $OCF_ERR_INSTALLED + email.<br>
<br>
Again, I stress this isn't a normal setup, meaning on a standard setup
you wouldn't require anything else than the mysql_monitor() query (ok,
maybe the double_check and pid_check functions would be required, for
any _paranoid_ setups). In my setup, these were required, especially
the email sending part and having different checks for the mysql
database, table, etc.<br>
<br>
Attached are only the changes, no diff's this time, basically only the
mysql_status() function changed, the rest have been added, so I think
they can be read better this way.<br>
<br>
Regards,<br>
<br>
Dan<br>
<br>
Florian Haas wrote:
<blockquote cite="mid:4CBEEC5B.4060203@linbit.com" type="cite">
  <pre wrap="">Hi Dan,

Thanks for the contribution -- but unfortunately that patch is pretty
much impossible to review as it is. Can you please break this down into
logical chunks, use "diff -u" (or "hg diff") format, and most
importantly explain _why_ you made the changes you made?

Cheers,
Florian

  </pre>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Pacemaker mailing list: <a class="moz-txt-link-abbreviated" href="mailto:Pacemaker@oss.clusterlabs.org">Pacemaker@oss.clusterlabs.org</a>
<a class="moz-txt-link-freetext" href="http://oss.clusterlabs.org/mailman/listinfo/pacemaker">http://oss.clusterlabs.org/mailman/listinfo/pacemaker</a>

Project Home: <a class="moz-txt-link-freetext" href="http://www.clusterlabs.org">http://www.clusterlabs.org</a>
Getting started: <a class="moz-txt-link-freetext" href="http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf">http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf</a>
Bugs: <a class="moz-txt-link-freetext" href="http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker">http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker</a>
  </pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">-- 
Dan FRINCU
Systems Engineer
CCNA, RHCE
Streamwide Romania
</pre>
</body>
</html>