jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William R. J. Ribeiro <wribe...@tricode.nl>
Subject In deph Jackrabbit clustering question
Date Mon, 27 Sep 2010 15:29:40 GMT
Hello everybody,

I got a question about Clustering Jackrabbit (v 1.6.2). I'm trying to figure out
how the clustering schematics works. I got a custom in-memory database that I
integrated with Jackrabbit: I already got custom PersistenceManager and
FileSystem implementations plus some other required classes. They are working
fine since I got my test repositories running with all functionality. 

The new feature that I want to support is Clustering. I started implementing my
custom Journal class, extending from AbstractJournal, but there are some points
that I really don't get.

I start 2 repositories/cluster nodes in the same machine but with different
configurations. Each repo has it's own unique ID and I think they are compliant
to the configuration rules stated here
(http://wiki.apache.org/jackrabbit/Clustering) since both repos start without
any problems. 

I try to add content to one of the repos like this:
========================== JAVA CODE =====================================
Workspace ws = session.getWorkspace();
List<String> prefixes = Arrays.asList(ws.getNamespaceRegistry().getPrefixes());
  if( prefixes == null || !prefixes.contains("wiki")){
   
ws.getNamespaceRegistry().registerNamespace("wiki","http://www.barik.net/wiki/1.0");
  }
	
  Node rootNode = keepAliveSession.getRootNode();
  Node encyclopedia = null;
  if(!rootNode.hasNode("wiki:encyclopedia")){
    encyclopedia = rootNode.addNode("wiki:encyclopedia");
  }
  else{
    encyclopedia = rootNode.getNode("wiki:encyclopedia");
  }
========================== END OF JAVA CODE ===============================

At this point, even before saving the session, a new Record is created and
stored in the shared Journal thus creating a new Revision. On the
synchronization thread of the other repo, I can see it retrieves this new
Revision record(NamespaceRecord) from the Journal and it's NamespaceRegistryImpl
updates two files: ns_reg.properties and ns_idx.properties. Both repos are now
synced to the Journal (revision 1, at this point). 

In the same session I continue to add some more dummy content:
========================== JAVA CODE =====================================
for (int i = 0; i < iterations; i++) {
  Node p = encyclopedia.addNode("wiki:entry");
  p.setProperty("wiki:title", new StringValue("Rose " + i));
  p.setProperty("wiki:content", new StringValue("A rose is a flowering shrub. "
+ i));
  p.setProperty(JcrConstants.JCR_LASTMODIFIED, System.currentTimeMillis());
}
session.save();
========================== END OF JAVA CODE ===============================
No this is where things starts to get fuzzy. First of all, the new nodes are
only "flushed" when the session is saved, what is not the case with the
Namespace. Okay, after the session is saved, the synchronization thread of the
other repo get's a ChangeLogRecord from the Journal with a bunch of changes. The
SharedItemStateManager comes into play and persists the new changes ... or at
least it was suppose to. I cannot track/find where it actually does it! I really
don't get anything more by this point. The LockManagerImpl, SearchManager also
consume the events but I don't know what it does exactly.

Anyway ... I can't understand how this mechanism works. I need to find the
method that invokes the FileSystem  for persisting the new items found in the
Journal's records. 

Can anybody give me a light on this issue? I just found this that might help me:
http://jackrabbit.apache.org/jackrabbit-architecture.html

Thanks a lot.
Cheers



Mime
View raw message