Hibernate Search + Infinispan + S3 - 防止字母数字文件名

时间:2013-06-27 11:00:07

标签: hibernate amazon-s3 hibernate-search infinispan jclouds

我正在寻找使用Infinispan配置Hibernate Search的帮助,在S3上存储索引

目前,它似乎主要是工作,但它创建的一个索引文件有一个字母数字名称,它返回抛出以下错误:

Exception in thread "LuceneIndexesMetadata-CloudCacheStore-3" java.lang.IllegalArgumentException: bucketId: A566834176 (expected: integer)
    at org.infinispan.loaders.bucket.Bucket.setBucketId(Bucket.java:77)
    at org.infinispan.loaders.cloud.CloudCacheStore.readFromBlob(CloudCacheStore.java:446)
    at org.infinispan.loaders.cloud.CloudCacheStore.scanBlobForExpiredEntries(CloudCacheStore.java:291)
    at org.infinispan.loaders.cloud.CloudCacheStore.purge(CloudCacheStore.java:283)
    at org.infinispan.loaders.cloud.CloudCacheStore.purgeInternal(CloudCacheStore.java:335)
    at org.infinispan.loaders.AbstractCacheStore$2.run(AbstractCacheStore.java:111)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:680)

作为旁注,对索引启用压缩会导致'.bz2'扩展,从而在每个索引文件上抛出此错误。

我不确定问题出在哪里。它应该只创建具有整数名称的索引文件吗?是否有某个配置项将使用不同的读取方法,允许使用字母数字名称(从而允许我使用压缩)?

可能是版本差异。以下列出了我目前正在使用的内容:

Hibernate(core,entitymanager,search,search-infinispan):4.2.0.Final Infinispan(核心,lucene目录,cachestore-cloud):5.1.8.Final JClouds(core,blobstore,allblobstore,provider.aws-s3):1.1.1

以下是我的一些配置文件:

的persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
    <persistence-unit name="###">
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
            <property name="hibernate.search.default.directory_provider" value="infinispan"/> 
            <property name="hibernate.search.infinispan.configuration_resourcename" value="infinispan.xml"/>
        </properties>
    </persistence-unit>
</persistence>

infinispan.xml

<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:infinispan:config:5.1 http://www.infinispan.org/schemas/infinispan-config-5.1.xsd" xmlns="urn:infinispan:config:5.1">


<!-- *************************** -->
<!-- System-wide global settings -->
<!-- *************************** -->
<global>
    <globalJmxStatistics enabled="false" cacheManagerName="HibernateSearch" allowDuplicateDomains="true" />

    <transport clusterName="HibernateSearch-Infinispan-cluster" distributedSyncTimeout="30000">
        <properties>
            <property name="configurationFile" value="infinispan-s3.xml"/>
        </properties>
    </transport>

    <shutdown hookBehavior="REGISTER" />
</global>


<!-- *************************** -->
<!-- Default "template" settings -->
<!-- *************************** -->
<default>
    <locking lockAcquisitionTimeout="30000" writeSkewCheck="false" concurrencyLevel="500" useLockStriping="false" />

    <!-- Invocation batching is required for use with the Lucene Directory -->
    <invocationBatching enabled="true" />

    <clustering mode="invalidation">
        <!-- Prefer loading all data at startup than later -->
        <stateTransfer timeout="60000" fetchInMemoryState="false" />
        <!-- Network calls are synchronous by default -->
        <sync replTimeout="30000" />
    </clustering>
    <jmxStatistics enabled="false" />
    <eviction maxEntries="-1" strategy="NONE" />
    <expiration maxIdle="300000" />

<loaders passivation="false" shared="false" preload="true">
    <loader class="org.infinispan.loaders.cloud.CloudCacheStore" fetchPersistentState="false" ignoreModifications="false" purgeOnStartup="false">
         <properties>
            <property name="identity" value="${AWS_ACCESS_KEY_ID}"/>
            <property name="password" value="${AWS_SECRET_KEY}"/>
            <property name="bucketPrefix" value="${PARAM2}"/>
            <property name="cloudService" value="aws-s3"/>
            <property name="compress" value="false"/>
        </properties>
        <async
                   enabled="true"
                   flushLockTimeout="15000"
                   threadPoolSize="10"
        />
    </loader>
</loaders>

</default>

<!-- *************************************** -->
<!--  Cache to store Lucene's file metadata  -->
<!-- *************************************** -->
<namedCache
    name="LuceneIndexesMetadata">
    <clustering
        mode="invalidation">
        <stateTransfer
            fetchInMemoryState="false" />
        <!--<sync
            replTimeout="30000" /> -->
    </clustering>
</namedCache>

<!-- **************************** -->
<!--  Cache to store Lucene data  -->
<!-- **************************** -->
<namedCache
    name="LuceneIndexesData">
    <clustering
        mode="invalidation">
        <stateTransfer
            fetchInMemoryState="false" />
        <!--<sync
            replTimeout="30000" /> -->
    </clustering>
</namedCache>

<!-- ***************************** -->
<!--  Cache to store Lucene locks  -->
<!-- ***************************** -->
<namedCache
    name="LuceneIndexesLocking">
    <clustering
        mode="invalidation">
        <stateTransfer
            fetchInMemoryState="false" />
        <!--<sync
            replTimeout="30000" /> -->
    </clustering>
</namedCache>

非常感谢任何正确配置此帮助的帮助!

1 个答案:

答案 0 :(得分:2)

Apache Lucene Hibernate Search 都不会创建这样的文件: Infinispan 使用数字桶ID,并根据这些桶的值散列一些可能处于负空间:这似乎是JClouds集成的一个问题。

请在此处提出问题:https://issues.jboss.org/browse/ISPN