Tuesday, October 19, 2010

MySQL InnoDB failed

The InnoDB storage engine failed to start so all tables were created as MyISAM tables with MySQL’s strange behaviour. As a result, all FK constraints were removed and crashed the server thereafter. (Tip: use "show create table xxx" to check the created table schema.) It seems that during installation, MySQL is not able to create innodb temporary file as shown in error logged in the file mysql\data\.err.

101006 14:36:46 InnoDB: Error: unable to create temporary file; errno: 2
101006 14:36:46 [ERROR] Plugin 'InnoDB' init function returned error.
101006 14:36:46 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

The reason is that when innodb starts the tmpdir defined in my.ini should have existed.

Tuesday, October 12, 2010

Timer Daemon thread

public Timer(boolean isDaemon)

Creates a new timer whose associated thread may be specified to run as a daemon (background).A daemon thread exit automatically when JVM exits. If it is not a daemon (foreground), timer.cancel() need to called explicitly to make the thread exit.

When a JVM shutdown hook is registered, it waits for all non-daemon threads exit with thread.join(). I run into this issue when there is a non-daemon timer thread and block the JVM from exiting.