[CDO] Multi master (clone) [message #923803] |
Wed, 26 September 2012 03:57  |
Eclipse User |
|
|
|
I was told to ask this question on the emf forum so here it is.. I managed to create a CDO master and clone following the examples in org.eclipse.emf.cdo.examples. (I'm trying to achieve the architecture described like http://www.eclipse.org/forums/index.php/m/880089/)
I still have one problem now.. I've set up 2 clients, one connected to the master and one to the clone. When I save an object in the clone, everything is synchronized well, but the other way around (save object in master) doesn't work. The changes aren't pushed (or pulled) from master to clone. Anybody had this problem before?
Thanks in advance!
|
|
|
|
Re: [CDO] Multi master (clone) [message #923993 is a reply to message #923816] |
Wed, 26 September 2012 07:39   |
Eclipse User |
|
|
|
Thanks for your answer. Creating an executable example is not that easy because I now have 2 seperate clients, a clone and a master.. So before I do that, some code might do the trick. First of all, the 'PassiveUpdateMode.ADDITIONS' you mentioned is part of the client, right? The session is created and a setPassiveUpdateMode() is done?
The code of my clients is identical, only the repository is different (clone or master):
System.out.println("Client starting...");
IManagedContainer container = OfflineExampleUtil.createContainer();
IConnector connector = Net4jUtil.getConnector(container, AbstractOfflineExampleServer.TRANSPORT_TYPE, "localhost:"
+ 2036);
CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
configuration.setConnector(connector);
configuration.setRepositoryName("cdo");
CDONet4jSession session = configuration.openNet4jSession();
session.options().setPassiveUpdateEnabled(true);
session.options().setPassiveUpdateMode(PassiveUpdateMode.ADDITIONS);
// session.getPackageRegistry().putEPackage(VlaamsparlementPackage.eINSTANCE);
CDORepositoryInfo repositoryInfo = session.getRepositoryInfo();
System.out.println("Connected to " + repositoryInfo.getName());
return session;
This is the code to create the master:
CDOServerUtil.createRepository(name, store, props);
And this is (some of) the code to create the clone:
...
CDOServerUtil.createOfflineClone(name, store, props, synchronizer);
...
protected IRepositorySynchronizer createRepositorySynchronizer(String connectorDescription, String repositoryName)
{
CDOSessionConfigurationFactory factory = createSessionConfigurationFactory(connectorDescription, repositoryName);
IRepositorySynchronizer synchronizer = CDOServerUtil.createRepositorySynchronizer(factory);
synchronizer.setRetryInterval(2);
synchronizer.setMaxRecommits(10);
synchronizer.setRecommitInterval(2);
synchronizer.setRawReplication(true);
return synchronizer;
}
I make use of the AbstractOfflineExampleServer which is used in org.eclipse.emf.cdo.examples.
Does this help to solve the problem in any way?
[Updated on: Wed, 26 September 2012 08:08] by Moderator
|
|
|
Re: [CDO] Multi master (clone) [message #924802 is a reply to message #923993] |
Thu, 27 September 2012 02:16   |
Eclipse User |
|
|
|
Am 26.09.2012 13:39, schrieb Ricky de Klerck:
> Thanks for your answer. To create an executable example is not that easy because I now have 2 seperate clients, a
> clone and a master.. So before I do that, some code might do the trick. First of all, the
> 'PassiveUpdateMode.ADDITIONS' you mentioned is part of the client, right? The session is created and a
> setPassiveUpdateMode() is done?
No, in a "normal" client you don't need PassiveUpdateMode.ADDITIONS and probably shouldn't use it as it leads to
substantially more network traffic. I just mentioned it because the "client" in the RepositorySynchronizer uses this
mode to receive all changes and additions from the master:
CDOSessionConfiguration masterConfiguration = remoteSessionConfigurationFactory.createSessionConfiguration();
masterConfiguration.setPassiveUpdateMode(PassiveUpdateMode.ADDITIONS);
masterConfiguration.setLockNotificationMode(LockNotificationMode.ALWAYS);
remoteSession = (InternalCDOSession)masterConfiguration.openSession();
ensureNOOPRevisionCache();
> The code of my clients is identical, only the repository is different (clone or master):
That should be okay.
> System.out.println("Client starting...");
> IManagedContainer container = OfflineExampleUtil.createContainer();
> IConnector connector = Net4jUtil.getConnector(container, AbstractOfflineExampleServer.TRANSPORT_TYPE, "localhost:"
> + 2036);
The port is correct?
> CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
> configuration.setConnector(connector);
> configuration.setRepositoryName("cdo");
>
> CDONet4jSession session = configuration.openNet4jSession();
> session.options().setPassiveUpdateEnabled(true);
> session.options().setPassiveUpdateMode(PassiveUpdateMode.ADDITIONS);
It's a little bit faster to set these already on the configuration used to open the session.
> // session.getPackageRegistry().putEPackage(VlaamsparlementPackage.eINSTANCE);
putEPackage() is indeed not needed anymore for generated and deployed packages with post 3.0 versions of CDO.
> CDORepositoryInfo repositoryInfo = session.getRepositoryInfo();
> System.out.println("Connected to " + repositoryInfo.getName());
>
> return session;
>
> This is the code to create the master:
> CDOServerUtil.createRepository(name, store, props);
>
> And this is (some of) the code to create the clone:
>
> ..
> CDOServerUtil.createOfflineClone(name, store, props, synchronizer);
> ..
>
> protected IRepositorySynchronizer createRepositorySynchronizer(String connectorDescription, String repositoryName)
> {
> CDOSessionConfigurationFactory factory = createSessionConfigurationFactory(connectorDescription, repositoryName);
>
> IRepositorySynchronizer synchronizer = CDOServerUtil.createRepositorySynchronizer(factory);
> synchronizer.setRetryInterval(2);
> synchronizer.setMaxRecommits(10);
> synchronizer.setRecommitInterval(2);
> synchronizer.setRawReplication(true);
> return synchronizer;
> }
That looks okay to me.
> I make use of the AbstractOfflineExampleServer which is used in org.eclipse.emf.cdo.examples.
>
> Does this help to solve the problem in any way?
I don't think so ;-(
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: [CDO] Multi master (clone) [message #990811 is a reply to message #990791] |
Fri, 14 December 2012 05:44  |
Eclipse User |
|
|
|
Am 14.12.2012 10:57, schrieb Ricky de Klerck:
> Eike,
>
> We found a problem in the 'org.eclipse.emf.cdo.server.db' plugin. In a few classes, for example
> 'AbstractHorizontalMappingStrategy', double quotes were added to the table alias. We've tested it with MySQL version
> 5.5.25, but it doesn't work because of these quotes.. the MySQL syntax won't accept it. When I remove the quotes,
> everything works fine again. But you must have added them for a reason, because they weren't there in the previous
> version..
That has been reverted already. Please use a newer drop. If the problem is still there, please submit a bugzilla and
tell us exactly where you've found the quotes.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|