Dinesh
Dinesh

Reputation: 123

Infinispan file-store creates binary folders with multiple .dat files

I am using the below infinispan configuration file and running into a weird issue. On startup the application creates multiple folders (one for each digit of the byte array 0 to 255) and each folder contains .dat file (in my case idempotent.dat). Also the content of the file are FCS1 for all the files created.

What I was expecting is that it will create a single file (/ap/efts/data/stage/cache/idempotent.dat) which has all the cached objects. Can someone please identify what is causing this issue? I am using a camel-infinispan component to create Infinispan based idempotent repository.

NOTE: This was working correctly in infinispan version 7.0. For reference, I am also providing infinispan 7.0 configuration file as well as the spring bean configuration for idempotent repository.

enter image description here

infinispan.xml (10.0)

<?xml version="1.0" encoding="UTF-8"?>
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="urn:infinispan:config:10.0 http://www.infinispan.org/schemas/infinispan-config-10.0.xsd" 
    xmlns="urn:infinispan:config:10.0">

    <cache-container default-cache="idempotent">
        <local-cache name="idempotent">
            <expiration lifespan="1800000" max-idle="1800000" interval="60000" />
            <persistence passivation="true">
                <file-store path="/ap/efts/data/stage/cache" purge="true">
                    <write-behind thread-pool-size="5" />
                </file-store>
            </persistence>
            <memory>
                <binary eviction="MEMORY" size="1000000" />
            </memory>
        </local-cache>
    </cache-container>
</infinispan>

infinispan.xml (7.0)

<?xml version="1.0" encoding="UTF-8"?>
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="urn:infinispan:config:7.0 http://www.infinispan.org/schemas/infinispan-config-7.0.xsd"
    xmlns="urn:infinispan:config:7.0">

    <cache-container default-cache="default">
        <local-cache name="idempotent">
            <eviction max-entries="10000" strategy="LIRS"/>
            <persistence passivation="false">
                <file-store path="/ap/efts/data/stage/cache" max-entries="10000" purge="false">
                </file-store>
            </persistence>
        </local-cache>
    </cache-container>
</infinispan>

spring bean configuration

    <bean id="cacheManager" class="org.infinispan.manager.DefaultCacheManager" init-method="start" destroy-method="stop">
        <constructor-arg type="java.lang.String" value="infinispan.xml"/>
    </bean>

    <bean id="infinispanRepo" class="org.apache.camel.component.infinispan.processor.idempotent.InfinispanIdempotentRepository"
        factory-method="infinispanIdempotentRepository">
        <constructor-arg ref="cacheManager" />
        <constructor-arg value="idempotent" />
    </bean>

Upvotes: 0

Views: 499

Answers (1)

Tristan Tarrant
Tristan Tarrant

Reputation: 1504

It is creating a file for each segment (caches internally are organized in segments). The default is 256. This makes operations such as iteration much faster. You can disable segmentation at the store level by adding a segmented="false" attribute to the file-store element

Upvotes: 4

Related Questions