[Hibernate-JIRA] Created: (HSEARCH-998) Unlock at startup using SimpleFSLockFactory
by David Polo (JIRA)
Unlock at startup using SimpleFSLockFactory
-------------------------------------------
Key: HSEARCH-998
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-998
Project: Hibernate Search
Issue Type: Bug
Components: massindexer
Affects Versions: 4.0.0.CR2
Environment: Java 1.6, Hibernate Search 4.0.0.CR2 on Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bits
Reporter: David Polo
I'm using SimpleFSLockFactory and I'm getting this exception after an unexpected shutdown of the application during indexation:
org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out
The workaround consists in executing this code at startup in order to unlock the indexes:
FullTextSession fullTextSession = Search.getFullTextSession(hbSession);
MutableSearchFactory searchFactory = (MutableSearchFactory) fullTextSession
.getSearchFactory();
IndexReader indexReader = fullTextSession.getSearchFactory()
.getIndexReaderAccessor().open("");
Map<Class<?>, EntityIndexBinder> indexBindingsForEntity = searchFactory
.getIndexBindingForEntity();
for (EntityIndexBinder eib : indexBindingsForEntity.values()) {
IndexManager[] indexManagers = eib.getIndexManagers();
DirectoryBasedIndexManager indexManager = (DirectoryBasedIndexManager) indexManagers[0];
Directory indexDirectory = indexManager.getDirectoryProvider()
.getDirectory();
if (IndexWriter.isLocked(indexDirectory)) {
IndexWriter.unlock(indexDirectory);
}
}
I have a single application that executes this code at startup so I think it's safe to unlock the Directory at this time.
I'm doing this because I'm using SimpleFSLockFactory and it leaves write.lock files.
I need to unlock at startup because I think using NativeFSLockFactory is not an option for me (I'm using NFS).
It will be a good thing if Hibernate Search have an "unlock at startup" option. It could be used only in cases like this (not all cases!).
In Solr there is an option:
<unlockOnStartup>true</unlockOnStartup>
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 10 months
[Hibernate-JIRA] Created: (HHH-5927) Performance risk: Suboptimal synchronization in org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan
by Strong Liu (JIRA)
Performance risk: Suboptimal synchronization in org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan
---------------------------------------------------------------------------------------------------------
Key: HHH-5927
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5927
Project: Hibernate Core
Issue Type: Improvement
Components: core
Reporter: Strong Liu
Attachments: hotspot.png
with Order Demo (real-life simulation attempt test app) I have noticed that there is thread contention on createNamesQuery() which sounds suspicious.
After investigation it boils down to org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan. It serves as a cache (internal, not replacable) for queries using LRU algorithm (supplied from Apache utils).
Generally speaking, blocking threads in any sort of caches indicates a problem. From about 2000 calls, 700 got blocked (which is also not nice for context switching).
I guess, one of the problems is that there is exclusive synchronization in get method:
public synchronized Object get(Object key) {...}
which could be replaced by a more granular read-write lock.
org/hibernate/engine/query/QueryPlanCache.java
org/hibernate/util/SoftLimitMRUCache.java
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 10 months
[Hibernate-JIRA] Created: (HHH-6983) remove common-collections dependency
by Strong Liu (JIRA)
remove common-collections dependency
------------------------------------
Key: HHH-6983
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6983
Project: Hibernate ORM
Issue Type: Improvement
Components: core
Reporter: Strong Liu
Assignee: Strong Liu
dhcp-14-237:hibernate-core stliu$ find . -name "*.java" | xargs grep "import org.apache.commons.collections"
./hibernate-core/src/main/java/org/hibernate/engine/internal/StatefulPersistenceContext.java:import org.apache.commons.collections.map.AbstractReferenceMap;
./hibernate-core/src/main/java/org/hibernate/engine/internal/StatefulPersistenceContext.java:import org.apache.commons.collections.map.ReferenceMap;
./hibernate-core/src/main/java/org/hibernate/internal/util/collections/SimpleMRUCache.java:import org.apache.commons.collections.map.LRUMap;
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 10 months
[Hibernate-JIRA] Created: (HHH-6483) Add addJar() and addClassesFromPackage() to EntityManagerFactoryBuilder
by Ondra Žižka (JIRA)
Add addJar() and addClassesFromPackage() to EntityManagerFactoryBuilder
-----------------------------------------------------------------------
Key: HHH-6483
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6483
Project: Hibernate Core
Issue Type: New Feature
Components: entity-manager
Affects Versions: 4.0.0.next
Reporter: Ondra Žižka
JPA's persistence.xml has <jar-file> :
{code}
<persistence>
<persistence-unit name="TestPU">
<jta-data-source>java:/TestDS</jta-data-source>
<jar-file>foo/bar/entities.jar</jar-file>
</persistence-unit>
</persistence>
{code}
It would be fine to have Ejb3Configuration.addClassesFromJar() with the same effect.
Also, Ejb3Configuration.addClassesFromPackage() would be handy, which would find package-info.class and scan it's place (dir, jar, ...) for entities
(assuming a package is in one place only).
After HHH-6159, they would be EntityManagerFactoryBuilder.addClassesFromJar() and EntityManagerFactoryBuilder.addClassesFromPackage(), respectively.
Without this feature, users tend to hack their own scanning or use external lib like Scannotation, which is pitty since scanning code is already in Hibernate.
Thanks for considering.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 10 months
[Hibernate-JIRA] Created: (ANN-640) use property names defined in CompositeUserType as default column names
by Michael Newcomb (JIRA)
use property names defined in CompositeUserType as default column names
-----------------------------------------------------------------------
Key: ANN-640
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-640
Project: Hibernate Annotations
Issue Type: New Feature
Affects Versions: 3.3.0.ga
Reporter: Michael Newcomb
Priority: Minor
Consider:
public class LongitudeLatitude
{
protected double longitude;
protected double latitude;
}
public class LongitudeLatitudeCompositeUserType
implements CompositeUserType
{
public String[] getPropertyNames()
{
return new String[] { "longitude", "latitude" };
}
public Type[] getPropertyTypes()
{
return new Type[] { Hibernate.DOUBLE, Hibernate.DOUBLE };
}
...
}
@Entity
public class Test
{
@Basic(optional = false)
@Type(type = "foo.bar.LongitudeLatitudeCompositeUserType")
@Columns(columns = { @Column(name = "location_longitude"), @Column(name = "location_latitude") })
protected LongitudeLatitude location;
}
Why does the developer need to specify each column?
I'd really rather let the CompositeUserType take care of that for me. Now, I have to tie the @Columns to the # of properties in my CompositeUserType AND the order in which they are defined? This seems to defeat the purpose of having a class (CompositeUserType) to tell Hibernate how to store it.
Couldn't Hibernate prepend the property name 'location' and '_' to the front of each property name in the CompositeUserType?
Perhaps (more than likely) I'm doing something wrong, but I get a failure if I do not specify the columns.
Thanks,
Michael
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 10 months
[Hibernate-JIRA] Created: (HHH-7106) Documentation doesnt explain how to create audited tables
by Paul Taylor (JIRA)
Documentation doesnt explain how to create audited tables
---------------------------------------------------------
Key: HHH-7106
URL: https://hibernate.onjira.com/browse/HHH-7106
Project: Hibernate ORM
Issue Type: Bug
Components: envers
Affects Versions: 4.0.1
Reporter: Paul Taylor
The documentation doesnt explain how to create audited tables, it implies by just putting evers on your classpath (and creating event listeners on versions of hibernate earlier than 4) it will just work but it doesn't. To get it to work I add to add
config.setProperty(Environment.HBM2DDL_AUTO, "create-drop");
to my configuration, without this a call to
new SchemaExport(config).create(true, true);
would not create the audited tables.
Even now I'm not sure this is the correct way to do things but it is the only thing I've got to work. Although you might think this an unimportant issue because it is only documentation you would underestimate how difficult and fustrating it is to deleve into a new project when the documentation is inadequate, it almost led to be abandoning Envers.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 10 months