Monday, June 11, 2007
Guaranteed db activation in all JVM's before table unlock in HA-JDBC ?
Say we have multiple JVM members accessing a HA-JDBC database cluster which involves a table locking synchronization strategy. Currently after a (inactive) db is synchronized, the code in ha-jdbc 1.1.11, method
My question is that when the JGroups notification of the activation to other JVM's is returned, does it mean
a) all other JVM's have successfully received the notification, or
b) some (or none or all) of the other JVM's have successfully received the notification, or
c) whether this only means the notification has been sent to other JVM's which may or may not receive the notification ?
If it is (b) or (c), is there any way to achieve/guarantee (a) ? The reason is that, for data consistency purposes, I am trying to provide the guarantee that all JVM's must have the (inactive) database activated before the table locks are released, or otherwise I'd rather to have the activation fail (ie inactive db stays inactive).
Unfortunately, at least for now, it turns out the answer is (c), as quoted from Paul Ferraro, the creator of HA-JDBC, at the ha-jdbc-user forum:
would activate the inactive db (both in the local JVM and other JVM's via jgroup notification) before executing a rollback which would unlock the tables in the active db.private void LocalDatabaseCluster#activate(Database, List, SynchronizationStrategy)
throws java.sql.SQLException
My question is that when the JGroups notification of the activation to other JVM's is returned, does it mean
a) all other JVM's have successfully received the notification, or
b) some (or none or all) of the other JVM's have successfully received the notification, or
c) whether this only means the notification has been sent to other JVM's which may or may not receive the notification ?
If it is (b) or (c), is there any way to achieve/guarantee (a) ? The reason is that, for data consistency purposes, I am trying to provide the guarantee that all JVM's must have the (inactive) database activated before the table locks are released, or otherwise I'd rather to have the activation fail (ie inactive db stays inactive).
Unfortunately, at least for now, it turns out the answer is (c), as quoted from Paul Ferraro, the creator of HA-JDBC, at the ha-jdbc-user forum:
"Excellent question...
The distributed cluster state is implemented using a JGroups NotificationBus. Database activations and deactivations trigger appropriate notification events to listening members. I had always thought that NotificationBus operated synchronously, i.e. that NotificationBus.sendNotification(...) would not return until all nodes complete their NotificationBus.Consumer.handleNotificaiton(...) listener methods. I just completed a test against both JGroups 2.2.9.4 and 2.5-beta-2 - unfortunately, this is not the case. A synchronous messaging bus requires the use of a RequestCollator, and is not used by NotificationBus. I don't remember at what point I made this assumption - but I was wrong.
So the answer to your question - although my intention was (a), currently, it is (c). This needs to change. I need to re-implement DistributableDatabaseCluster (DistributableStateManager, in 2.0) to use a MessageDispatcher, DistributedQueue, or some other construct that utilizes a RequestCollator...."