For support: thank you very much. It seems to be possible, but with some work & exception handling.
The big question is: how do we make sure we don't corrupt the databases? Let's take the following scenario:
- DB A is master, DB B is A's slave
- 3 application servers run an application that uses A as master
- Server of DB A fails.
- Applications switch to DB B as master
- Applications are restarted due to update/maintenance. When they start DB A is selected as master again, because they are configured to use DB A if it works.
- Problem: DB A won't have all the modifications that were added into B while it was down.
One possible solution: when we configure persistence units in persistence.xml, we give 2 urls for each persistence unit. During execution/runtime, ObjectDB client picks the connection that represents the Master DB. (there should be a way in which DB servers know if they're masters or not)
If DB A fails, ObjectDB should automatically switch to the second URL and promote it as master, and DB A should be automatically transformed into slave when it comes online again. In this way, even though applications are restarted, ObjectDB will always connect just to the one that represents the Master, avoiding data corruption.
Does it make sense? Do you see the problem?