Re: MySQL component

Steve Loughran <[email protected]> Thu, 11 Jan 2007 14:23:44 +0000
Newsgroups gmane.comp.java.smartfrog.user
Message-ID <[email protected]>
Phillip Thurmond wrote:
> Hello all.  I'm currently implementing a performance testing system in 
> smartfrog.  i was wondering if anyone has written or knew of a smartfrog 
> component to install and manage MySQL.  I've seen one mentioned in a 
> couple of presentations, but couldn't find the code anywhere.  All of my 
> code will be licensed LGPL, so any added features (or bugs :) ) to an 
> existing component will be shared.  Thanks.
> 
> --Phillip

Phil,

I've started doing the database and mysql components, the first cuts are 
up in SVN, under core/components/database.

First, generic JDBC operations, which can be bound to hsqldb, mysql or 
whatever, and let you issue a list of commands against a database 
binding you've configured

http://smartfrog.svn.sourceforge.net/viewvc/smartfrog/trunk/core/components/database/src/org/smartfrog/services/database/core/components.sf?view=markup

So far you can issue a transaction; I'd like to get results back in as 
attributes, and I'd like to be able to use operations to test liveness 
of a database.

There is also a ConnectionOpen condition which is successful if a 
connection can be made to a database. this can be used in liveness 
tests, and in components that block until a condition is satisfied (like 
WaitFor). This lets us handle slow starting databases.

There are specific components for hsqldb and for mysql, both of which 
help setting up the jdbc bindings. For mysql I've added an extra 
liveness component that uses the ping() operation on the jdbc driver.

Alongside the jdbc components, I want the components to bring up the 
databases. HSQLDB is trivial, mysql less so. the current (draft) set can 
start mysqld on linux as the current user, with a limited (but 
extensible) set of options:

http://smartfrog.svn.sourceforge.net/viewvc/smartfrog/trunk/core/components/database/src/org/smartfrog/services/database/mysql/daemon.sf?view=markup

One of the fun things here is shutting down mysql cleanly. Our normal 
execution routines shut things down by issuing a destroy() command to 
the process, there being no portable way to issue kill signals to a 
process in Java. I worry what state this will leave the database in. 
I've added a component, mysqladmin-shutdown to issue a shutdown command, 
which can go into a new workflow component, Finally {}, that will run 
the program when it terminates

FinallyTerminateMysql extends Finally {
    action extends mysqladmin-shutdown;
}

I have to test all this stuff, which is a good opportunity for me to do 
more system testing under smartfrog work. Even so, we cannot guarantee 
that the finally action will always run, as systems can terminate in 
interestingly nondeterministic ways.

Do you know how well mysql handles a no-warning kill? While it is busy 
doing some work? I know databases are designed to handle this, but that 
doesn't imply they dont spend a long time recovering when they come back up.

-steve




-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV