-->
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.  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Hibernate Search 3.1beta, index not update
PostPosted: Sat Jul 19, 2008 1:37 am 
Newbie

Joined: Sat Jul 19, 2008 1:29 am
Posts: 13
Hi, sorry for my English.
My index is not updating until hibernate.search.worker.batch_size=1, but this propery is deprecated. In another way I can't write changes to index immediately after saving/updating the object.

Properties

Code:
hibernate.search.default.indexwriter.batch.max_buffered_delete_terms=1
hibernate.search.default.indexwriter.transaction.max_buffered_delete_terms=1
hibernate.search.default.indexwriter.batch.max_buffered_docs=2
hibernate.search.default.indexwriter.transaction.max_buffered_docs=2
hibernate.search.default.indexwriter.transaction.merge_factor=2
hibernate.search.default.indexwriter.batch.merge_factor=2
hibernate.search.default.indexwriter.batch.max_merge_docs=1
hibernate.search.default.indexwriter.transaction.max_merge_docs=1


not help.

Anybody can help me?
Thanks.

P.S. (Hibernate Search 3.1, Hibernate 3.4, Hibernate annotations 3.4)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 20, 2008 7:20 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi, are you using transactions and committing properly?

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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 20, 2008 11:20 am 
Newbie

Joined: Sat Jul 19, 2008 1:29 am
Posts: 13
s.grinovero wrote:
Hi, are you using transactions and committing properly?


Yes. I am using Hibernate with Spring.
Also, when I try to reindex my data without option hibernate.search.worker.batch_size some data with small number of elements are not reindex.


Top
 Profile  
 
 Post subject: Aha...this helped!
PostPosted: Mon Jul 21, 2008 4:52 pm 
Newbie

Joined: Tue Aug 02, 2005 4:53 pm
Posts: 14
I previously posted here:

http://forum.hibernate.org/viewtopic.php?t=988824

Updates were never making it into the index, but were showing up in memory, although you could not search by the new values themselves. New object were also not getting into the index and were never searchable.

However, once I added:

<prop key="hibernate.search.worker.batch_size">1</prop>

to my spring properties...viola. Now all changes are immediately searchable and make their way to the index. My guess is such a small batch size won't be all that performant...but at least it works.

So is this a bug or is there something else that we need to do to make this work without setting such a small batch size...or is that just expected behavior (in which case some documentation or entry in the FAQ would be nice)?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 22, 2008 3:38 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
no this is not expected behavior of course,
please open a new issue on JIRA:
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH

thanks,
Sanne

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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 31, 2008 11:27 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
I've taken some time to experiment with this, but couldn't reproduce it.
could someone provide a test case or a simple piece of code to show me the problem?

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


Top
 Profile  
 
 Post subject: Re: Hibernate Search 3.1beta, index not update
PostPosted: Thu Nov 20, 2008 2:47 pm 
Newbie

Joined: Sat Jul 19, 2008 1:29 am
Posts: 13
Hibernate Search 3.1 CR1 - the same problem.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 20, 2008 3:15 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
I asked this already: are you committing the transaction?
I don't know how Spring works.

The changes to the index are visible only to a transaction beginning after the commit of the transaction who did the changes, this is by design.
Limiting the batch_size to 1 is just breaking the design, it is not going to be in sync with transactions (quite dangerous, should really avoid it)

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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 20, 2008 4:27 pm 
Newbie

Joined: Sat Jul 19, 2008 1:29 am
Posts: 13
s.grinovero wrote:
I asked this already: are you committing the transaction?
I don't know how Spring works.

The changes to the index are visible only to a transaction beginning after the commit of the transaction who did the changes, this is by design.
Limiting the batch_size to 1 is just breaking the design, it is not going to be in sync with transactions (quite dangerous, should really avoid it)


Yes. I am committing the transaction (Spring do this automatically, autocommit is turned off).
I am using JTA (Glassfish).


Top
 Profile  
 
 Post subject: Re: Aha...this helped!
PostPosted: Tue Nov 25, 2008 6:08 am 
Hibernate Team
Hibernate Team

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

here are a few of my observations. I hope some of them might help you to resolve your problem.

First of all, I don't think that your chosen properties values for max_buffered_delete_terms, max_buffered_docs, etc are very good. They are pretty much all set to their required minimum. I don't think that you will get very good performance with these settings. You might be better of with the default values.

Regarding hibernate.search.worker.batch_size=1, the reason it works is that with this value set to one you are pretty much bypassing the transactional framework. Each index modification will be applied immediately. As Sanne already pointed out, this is probably not a good idea and might be even dangerous. Index changes might get applied even though your db transaction might for example roll back due to an error. In this case you end up with a corrupted index. Everything indicated a problem with transactions.

Quote:
Updates were never making it into the index, but were showing up in memory, although you could not search by the new values themselves. New object were also not getting into the index and were never searchable.

How do you know that updated where showing up in memory, if the changes were never searchable. I am not quite sure what you are referring to here.

Quote:
So is this a bug or is there something else that we need to do to make this work without setting such a small batch size...or is that just expected behavior (in which case some documentation or entry in the FAQ would be nice)?

Definitely not an intended behavior.

Regarding your Spring setup. Which version of Spring are you using and how are you using it? Which type of transaction management do you use? Programmatic or declarative? Do you use any of the Spring Hibernate templates? If you are using declarative management (which I would recommend) maybe it helps if you compare your configuration with this article on the Hibernate Wiki - Spring + Hibernate + Hibernate Search. The article references older versions of Search and Spring, but it should work with the latest version as well.

It would also help if you would post the code you are using to update and search your entities. This together with some log output might help to narrow down your problem.

Last but not least, I recommend to turn on Spring debug trace and trace the transaction log messages. Do they really behave as you expect? For example if you update an entity and then want to search on it, there must be at least one transaction commit in between.

--Hardy


Top
 Profile  
 
 Post subject: Re: Aha...this helped!
PostPosted: Tue Nov 25, 2008 3:17 pm 
Newbie

Joined: Sat Jul 19, 2008 1:29 am
Posts: 13
This problem only with JtaTransactionManager.
With HibernateTransactionManager all working fine.

Any suggestions?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 25, 2008 3:26 pm 
Hibernate Team
Hibernate Team

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

it is probably a configuration problem. How do you setup the JtaTransactionManager and how do you use it. Probably a good idea to look and ask at the Spring forums as well.

--Hardy


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 25, 2008 3:34 pm 
Newbie

Joined: Sat Jul 19, 2008 1:29 am
Posts: 13
hardy.ferentschik wrote:
Hi,

it is probably a configuration problem. How do you setup the JtaTransactionManager and how do you use it. Probably a good idea to look and ask at the Spring forums as well.

--Hardy


This is my configuration. (commented configuration is working fine)

Code:
<bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager">
        <property name="allowCustomIsolationLevels" value="true"/>
        <property name="nestedTransactionAllowed" value="true"/>
    </bean>
    <!--bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean-->

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration"/>
        <property name="configLocation" value="/WEB-INF/hibernate.cfg.xml"/>
        <property name="dataSource" ref="dataSource"/>
    </bean>

<tx:annotation-driven transaction-manager="txManager"/>


Code:
@Transactional
public void persist(User user) {
        dao.persist(user);
    }


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 26, 2008 6:55 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi, why not use org.springframework.orm.jpa.JpaTransactionManager as in the example configuration I was referring to earlier?

My understanding is that you somehow have to 'bind' your transaction manager to either the EntityManager (JpaTransactionManager) or to the Hibernate Session (HibernateTransactionManager). I don't think that JtaTransactionManager works in this case. Then again, I am not a Spring expert. Try asking the question on the Spring forum.

--Hardy


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 26, 2008 4:38 pm 
Newbie

Joined: Sat Jul 19, 2008 1:29 am
Posts: 13
hardy.ferentschik wrote:
Hi, why not use org.springframework.orm.jpa.JpaTransactionManager as in the example configuration I was referring to earlier?

--Hardy


I am not using JPA. I need JTA with transaction configuration outside application (app server admin console).

But Hibernate Search 3.0 working fine with JtaTransactionManager.
I am confused...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 17 posts ]  Go to page 1, 2  Next

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.