-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Copying an index (manual indexing)
PostPosted: Wed Mar 07, 2012 6:39 pm 
Regular
Regular

Joined: Tue May 17, 2011 1:45 am
Posts: 52
Hi,

I am using JBoss as my application server where I am hosting by job service WAR. The indexing is a manual index where I have a java class that handles the update process of the index. I use a Spring scheduler that invokes the indexing class after every X minutes.

However I have a requirement to reindex everything once in every 24 hrs. The problem is this index is used by other applications. So when reindexing is happening the entire index will be purged and recreated. This will give the end user a very bad experience .

What I want is an ability to run the reindexing process in another system and later copy the index to this filesystem, However what I have observed that deleting the index in the current machine is not being allowed by Linux since the file system is being used by the application.

Is there a way I can delete an index and copy a new index to the same path.


Top
 Profile  
 
 Post subject: Re: Copying an index (manual indexing)
PostPosted: Thu Mar 08, 2012 6:57 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

you really should use two directories. How else do you guarantee that Lucene will see a complete (non corrupt) index. Having to directories is also the approach which the JMS master/slave setup uses provided by Search. Have you considered the master/slave setup? Otherwise you can implement your own DirectoryProvider and use the existing directory providers as guide.

--Hardy


Top
 Profile  
 
 Post subject: Re: Copying an index (manual indexing)
PostPosted: Thu Mar 08, 2012 8:34 pm 
Regular
Regular

Joined: Tue May 17, 2011 1:45 am
Posts: 52
Thanks for the reply.

The thing is I cannot use JMS in my infrastructure. I will have the same VM. It would be best that I can use two directories, one will be acting as master and slave (but without JMS). All searches should happen on the slave directory while all updates should happen in the master.

IS there a way?

Thanks David


Top
 Profile  
 
 Post subject: Re: Copying an index (manual indexing)
PostPosted: Mon Mar 12, 2012 9:37 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
david2011 wrote:
The thing is I cannot use JMS in my infrastructure. I will have the same VM.

If it is in the same JVM why do you not just depend on the automatic indexing? And why a full rebuild every 24hrs? Couldn't you just re-index the entities which have changed (eg by checking a last modified field in the db)?

In your current approach you need to applications (one search and one index application). Having a master/slave setup truly within the same JVM and app is not possible. I guess that's not what you mean anyways.

david2011 wrote:
It would be best that I can use two directories, one will be acting as master and slave (but without JMS). All searches should happen on the slave directory while all updates should happen in the master.


One idea could be that you jusr use filesystem-slave and filesystem-master as directory providers for these two apps without setting the jms backend on the slave. This should just work fine, however, any index updates request triggered by the slave (your search app) would get ignored or would get applied into an index which gets overwritten in the next index sync.

--Hardy


Top
 Profile  
 
 Post subject: Re: Copying an index (manual indexing)
PostPosted: Wed Mar 14, 2012 7:40 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
I agree with Hardy, using JMS seems like the clean approach. JMS is not limited only to be used on different servers communicating, it's also nice to use to loosely couple different applications running in the same JVM.

But in this simple case you don't need the JMS connection at all, just take the pattern we describe on the reference as the "JMS master/slave" for the indexes: essentially the user facing application deals with two indexes, one "being copied" and one used for searching, and then is able to switch between them dynamically. The master periodically copies the index.

As a backend, you can either:
- leave indexes enabled - might be nice for users.
- disable indexing
- use the blackhole backend
- use the new soft delete approach

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.