You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Sergey Podatelev <br...@gmail.com> on 2009/11/16 11:56:24 UTC

FreeBSD indexing and lock file issues

Hello,

We're having problems with Jackrabbit repository running on FreeBSD.

First, there's a stale index issue. New elements added to the tree
aren't shown in the queries results.
That is, if there's a tree of five "book" elements, the result of a
"//store//book" query returns five elements.

Then, two "book" nodes are added, one as a kid of one of existing
books, and one as a kid of that first one added.
Now, the "//store//book" query still returns just five elements. This
issue occurs on BSD (prod server) and is not well reproducible, and
was never experienced on Linux (dev server).
It looks like the index files aren't getting updated for some reason,
because after the index files are removed and the webserver is
restarted, (and the index is rebuilt), the query returns correct
result.

Another problem is with the .lock file.
The repository is configured as a webapp bundle, and it's impossible
to redeploy the app because of the ".lock file is present" exception,
so each time the app needs to be redeployed, we have to stop the
webserver, remove the .lock file and then start the server again.

It seems that both problems might be somehow related to BSD's
filesystem peculiarities, since in first case  the index file isn't
being updated, and in the second case, the .lock file isn't being
deleted.

I'd really appreciate any pointers on these two, because Jackrabbit
repo is the key part of the application we're working on, and while
the second issue isn't that critical, the first one is really a
blocker because it results in data inconsistency.

Thanks a bunch.

-- 
sp

Re: FreeBSD indexing and lock file issues

Posted by Sergey Podatelev <br...@gmail.com>.
On Mon, Nov 16, 2009 at 4:06 PM, Thomas Müller <th...@day.com> wrote:
> Hi,
>
> Did you save the changes? For details when changes are available in
> the index, see http://wiki.apache.org/jackrabbit/Search
>

Yes, this is definitely an indexing issue because when I include a
property condition to the query, it does return the new nodes in
result. Thus,

//store//book

doesn't include the new nodes, and

//store//book[@section='art']

does include them, assuming both have section property set to "art".

-- 
sp

Re: FreeBSD indexing and lock file issues

Posted by Thomas Müller <th...@day.com>.
Hi,

> New elements added to the tree aren't shown in the queries results.

Did you save the changes? For details when changes are available in
the index, see http://wiki.apache.org/jackrabbit/Search

> Another problem is with the .lock file.
> The repository is configured as a webapp bundle, and it's impossible
> to redeploy the app because of the ".lock file is present" exception,

Are you sure Jackrabbit is stopped when the application is
un-deployed? If it really is a file system problem (for example when
using NFS), there is an alternative lock implementation, see also
http://wiki.apache.org/jackrabbit/RepositoryLock

Regards,
Thomas

Re: FreeBSD indexing and lock file issues

Posted by Sergey Podatelev <br...@gmail.com>.
Thank you, I'll try that for the shutdown issue.

On Fri, Dec 11, 2009 at 1:33 PM, Ben Short <be...@benshort.co.uk> wrote:
> I agree thats a bit tricky :)
>
> You could try extending the JcrSessionFactory and overriding the
> destroy method as follows:
>
> public void destroy() throws Exception {
>                super.destroy();
>                if (repository instanceof JackrabbitRepository)
>                        ((JackrabbitRepository) repository).shutdown();
>        }
>
> The destroy will be called by spring when you undeploy or shutdown
> your webapp and there for the repository should be shut down.
>
> Ben
>
>
>
>
> 2009/12/11 Sergey Podatelev <br...@gmail.com>:
>> On Fri, Dec 11, 2009 at 1:11 PM, Ben Short <be...@benshort.co.uk> wrote:
>>> Sergey,
>>>
>>> Can I see your spring config that creates the repository?
>>>
>>
>> Sure, but it's a bit tricky cause I had to configure distributed
>> transactions for JCR and MySQL.
>> Going with Jencks was the only way I managed to achieve it.
>>
>> applicationContext.xml:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <beans ...>
>>
>>  <import resource="jdbc.xml" />
>>  <import resource="jcr.xml" />
>>
>>  <bean id="jtaTransactionManager"
>>      class="org.jencks.factory.TransactionManagerFactoryBean" />
>> ...
>> </beans>
>>
>> jcr.xml:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <beans ...>
>>
>> <bean id="connectionTracker"
>>    class="org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator"/>
>>
>>  <bean id="jrConnectionManager"
>>      class="org.jencks.factory.ConnectionManagerFactoryBean">
>>    <property name="transactionManager">
>>      <ref bean="jtaTransactionManager" />
>>    </property>
>>    <property name="transaction" value="xa"/>
>>    <property name="pooling" value="true" />
>>    <property name="poolMinSize" value="5" />
>>    <property name="poolMaxSize" value="100" />
>>    <property name="connectionTracker" ref="connectionTracker" />
>>  </bean>
>>
>>  <bean id="repository" class="org.jencks.factory.ConnectionFactoryFactoryBean">
>>    <property name="managedConnectionFactory">
>>      <ref local="repositoryManagedConnectionFactory"/>
>>    </property>
>>    <property name="connectionManager">
>>      <ref local="jrConnectionManager"/>
>>    </property>
>>  </bean>
>>
>>  <bean id="repositoryManagedConnectionFactory"
>>      class="org.apache.jackrabbit.jca.JCAManagedConnectionFactory">
>>    <property name="homeDir" value="@repo.home@" />
>>    <property name="configFile" value="@repo.config@" />
>>  </bean>
>>
>>
>>  <!-- SessionFactory -->
>>  <bean id="jcrSessionFactory" class="org.springmodules.jcr.JcrSessionFactory">
>>    <property name="repository">
>>      <ref local="repository"/>
>>    </property>
>>    <property name="credentials">
>>      <bean class="javax.jcr.SimpleCredentials">
>>        <constructor-arg index="0" value="@repo.login@" />
>>        <constructor-arg index="1" value="@repo.password@" />
>>      </bean>
>>    </property>
>>  </bean>
>>
>>  <bean id="jcrTemplate" class="org.springmodules.jcr.JcrTemplate">
>>    <property name="sessionFactory">
>>      <ref local="jcrSessionFactory"/>
>>    </property>
>>    <property name="allowCreate" value="true"/>
>>  </bean>
>>
>> </beans>
>>
>> jcbc.xml:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> <beans ...>
>>
>>  <bean id="jdbcConnectionManager"
>>      class="org.jencks.factory.ConnectionManagerFactoryBean">
>>    <property name="transactionManager">
>>      <ref bean="jtaTransactionManager"/>
>>    </property>
>>    <property name="transaction" value="xa"/>
>>  </bean>
>>
>>  <bean id="jdbcManagedConnectionFactory"
>> class="org.jencks.tranql.DataSourceMCF">
>>    <property name="driverName" value="com.mysql.jdbc.Driver" />
>>    <property name="url" value="@mysql.url@" />
>>    <property name="user" value="@mysql.login@" />
>>    <property name="password" value="@mysql.password@" />
>>  </bean>
>>
>>  <bean id="jdbcXaDataSource"
>> class="org.jencks.factory.ConnectionFactoryFactoryBean">
>>    <property name="managedConnectionFactory">
>>      <ref local="jdbcManagedConnectionFactory"/>
>>    </property>
>>    <property name="connectionManager">
>>      <ref local="jdbcConnectionManager" />
>>    </property>
>>  </bean>
>>
>> </beans>
>>
>> All the @...@ values are replaced at build time.
>>
>> --
>> sp
>>
>



-- 
sp

Re: FreeBSD indexing and lock file issues

Posted by Ben Short <be...@benshort.co.uk>.
I agree thats a bit tricky :)

You could try extending the JcrSessionFactory and overriding the
destroy method as follows:

public void destroy() throws Exception {
		super.destroy();
                if (repository instanceof JackrabbitRepository)
			((JackrabbitRepository) repository).shutdown();
	}

The destroy will be called by spring when you undeploy or shutdown
your webapp and there for the repository should be shut down.

Ben




2009/12/11 Sergey Podatelev <br...@gmail.com>:
> On Fri, Dec 11, 2009 at 1:11 PM, Ben Short <be...@benshort.co.uk> wrote:
>> Sergey,
>>
>> Can I see your spring config that creates the repository?
>>
>
> Sure, but it's a bit tricky cause I had to configure distributed
> transactions for JCR and MySQL.
> Going with Jencks was the only way I managed to achieve it.
>
> applicationContext.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans ...>
>
>  <import resource="jdbc.xml" />
>  <import resource="jcr.xml" />
>
>  <bean id="jtaTransactionManager"
>      class="org.jencks.factory.TransactionManagerFactoryBean" />
> ...
> </beans>
>
> jcr.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans ...>
>
> <bean id="connectionTracker"
>    class="org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator"/>
>
>  <bean id="jrConnectionManager"
>      class="org.jencks.factory.ConnectionManagerFactoryBean">
>    <property name="transactionManager">
>      <ref bean="jtaTransactionManager" />
>    </property>
>    <property name="transaction" value="xa"/>
>    <property name="pooling" value="true" />
>    <property name="poolMinSize" value="5" />
>    <property name="poolMaxSize" value="100" />
>    <property name="connectionTracker" ref="connectionTracker" />
>  </bean>
>
>  <bean id="repository" class="org.jencks.factory.ConnectionFactoryFactoryBean">
>    <property name="managedConnectionFactory">
>      <ref local="repositoryManagedConnectionFactory"/>
>    </property>
>    <property name="connectionManager">
>      <ref local="jrConnectionManager"/>
>    </property>
>  </bean>
>
>  <bean id="repositoryManagedConnectionFactory"
>      class="org.apache.jackrabbit.jca.JCAManagedConnectionFactory">
>    <property name="homeDir" value="@repo.home@" />
>    <property name="configFile" value="@repo.config@" />
>  </bean>
>
>
>  <!-- SessionFactory -->
>  <bean id="jcrSessionFactory" class="org.springmodules.jcr.JcrSessionFactory">
>    <property name="repository">
>      <ref local="repository"/>
>    </property>
>    <property name="credentials">
>      <bean class="javax.jcr.SimpleCredentials">
>        <constructor-arg index="0" value="@repo.login@" />
>        <constructor-arg index="1" value="@repo.password@" />
>      </bean>
>    </property>
>  </bean>
>
>  <bean id="jcrTemplate" class="org.springmodules.jcr.JcrTemplate">
>    <property name="sessionFactory">
>      <ref local="jcrSessionFactory"/>
>    </property>
>    <property name="allowCreate" value="true"/>
>  </bean>
>
> </beans>
>
> jcbc.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <beans ...>
>
>  <bean id="jdbcConnectionManager"
>      class="org.jencks.factory.ConnectionManagerFactoryBean">
>    <property name="transactionManager">
>      <ref bean="jtaTransactionManager"/>
>    </property>
>    <property name="transaction" value="xa"/>
>  </bean>
>
>  <bean id="jdbcManagedConnectionFactory"
> class="org.jencks.tranql.DataSourceMCF">
>    <property name="driverName" value="com.mysql.jdbc.Driver" />
>    <property name="url" value="@mysql.url@" />
>    <property name="user" value="@mysql.login@" />
>    <property name="password" value="@mysql.password@" />
>  </bean>
>
>  <bean id="jdbcXaDataSource"
> class="org.jencks.factory.ConnectionFactoryFactoryBean">
>    <property name="managedConnectionFactory">
>      <ref local="jdbcManagedConnectionFactory"/>
>    </property>
>    <property name="connectionManager">
>      <ref local="jdbcConnectionManager" />
>    </property>
>  </bean>
>
> </beans>
>
> All the @...@ values are replaced at build time.
>
> --
> sp
>

Re: FreeBSD indexing and lock file issues

Posted by Sergey Podatelev <br...@gmail.com>.
On Fri, Dec 11, 2009 at 1:11 PM, Ben Short <be...@benshort.co.uk> wrote:
> Sergey,
>
> Can I see your spring config that creates the repository?
>

Sure, but it's a bit tricky cause I had to configure distributed
transactions for JCR and MySQL.
Going with Jencks was the only way I managed to achieve it.

applicationContext.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans ...>

  <import resource="jdbc.xml" />
  <import resource="jcr.xml" />

  <bean id="jtaTransactionManager"
      class="org.jencks.factory.TransactionManagerFactoryBean" />
...
</beans>

jcr.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans ...>

<bean id="connectionTracker"
    class="org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator"/>

  <bean id="jrConnectionManager"
      class="org.jencks.factory.ConnectionManagerFactoryBean">
    <property name="transactionManager">
      <ref bean="jtaTransactionManager" />
    </property>
    <property name="transaction" value="xa"/>
    <property name="pooling" value="true" />
    <property name="poolMinSize" value="5" />
    <property name="poolMaxSize" value="100" />
    <property name="connectionTracker" ref="connectionTracker" />
  </bean>

  <bean id="repository" class="org.jencks.factory.ConnectionFactoryFactoryBean">
    <property name="managedConnectionFactory">
      <ref local="repositoryManagedConnectionFactory"/>
    </property>
    <property name="connectionManager">
      <ref local="jrConnectionManager"/>
    </property>
  </bean>

  <bean id="repositoryManagedConnectionFactory"
      class="org.apache.jackrabbit.jca.JCAManagedConnectionFactory">
    <property name="homeDir" value="@repo.home@" />
    <property name="configFile" value="@repo.config@" />
  </bean>


  <!-- SessionFactory -->
  <bean id="jcrSessionFactory" class="org.springmodules.jcr.JcrSessionFactory">
    <property name="repository">
      <ref local="repository"/>
    </property>
    <property name="credentials">
      <bean class="javax.jcr.SimpleCredentials">
        <constructor-arg index="0" value="@repo.login@" />
        <constructor-arg index="1" value="@repo.password@" />
      </bean>
    </property>
  </bean>

 <bean id="jcrTemplate" class="org.springmodules.jcr.JcrTemplate">
    <property name="sessionFactory">
      <ref local="jcrSessionFactory"/>
    </property>
    <property name="allowCreate" value="true"/>
  </bean>

</beans>

jcbc.xml:

<?xml version="1.0" encoding="UTF-8"?>

<beans ...>

  <bean id="jdbcConnectionManager"
      class="org.jencks.factory.ConnectionManagerFactoryBean">
    <property name="transactionManager">
      <ref bean="jtaTransactionManager"/>
    </property>
    <property name="transaction" value="xa"/>
  </bean>

  <bean id="jdbcManagedConnectionFactory"
class="org.jencks.tranql.DataSourceMCF">
    <property name="driverName" value="com.mysql.jdbc.Driver" />
    <property name="url" value="@mysql.url@" />
    <property name="user" value="@mysql.login@" />
    <property name="password" value="@mysql.password@" />
  </bean>

  <bean id="jdbcXaDataSource"
class="org.jencks.factory.ConnectionFactoryFactoryBean">
    <property name="managedConnectionFactory">
      <ref local="jdbcManagedConnectionFactory"/>
    </property>
    <property name="connectionManager">
      <ref local="jdbcConnectionManager" />
    </property>
  </bean>

</beans>

All the @...@ values are replaced at build time.

-- 
sp

Re: FreeBSD indexing and lock file issues

Posted by Ben Short <be...@benshort.co.uk>.
Sergey,

Can I see your spring config that creates the repository?

Ben


2009/12/11 Sergey Podatelev <br...@gmail.com>:
> On Mon, Nov 16, 2009 at 4:07 PM, Alexander Klimetschek <ak...@day.com> wrote:
>> On Mon, Nov 16, 2009 at 11:56, Sergey Podatelev
>> <br...@gmail.com> wrote:
>>> Another problem is with the .lock file.
>>
>> In this case you must make sure the shutdown() method is called.
>
> Sorry for the late response, but can you please tell me if you know a
> way to do this using Spring? I'm working with JackRabbit via
> spring-modules-jcr and not sure how can I force the shutdown in this
> case.
>
>
> And again, I'm having index corruption issues. Don't know if this
> helps, but I've noticed that the problem usually occures after a
> scheduled procedure performs some processing of the data stored in
> repository. After that I can see that the processing was successful,
> and all the nodes had changed their state properly, but when I'm
> trying to access Iterator-s I receive from queries, they're broken.
> Like this:
>
>            final Query q = session.getWorkspace().getQueryManager()
>                    .createQuery("//some-node[@node-id='1']", Query.XPATH);
>            final NodeIterator i = q.execute().getNodes();
>            int size = i.getSize(); // returns 0
>
> So I'm having size=0 despite the fact that <some-node> with node-id=1
> property exists in the repository, I can see it among the results of
> queries like "//some-node".
>
> After I delete all the indexes, everything is back to normal.
>
> Please, give me at least some pointers.
>
> Maybe this is somehow related to Derby or any other JackRabbit
> component issues on FreeBSD?
>
>
> --
> sp
>

Re: FreeBSD indexing and lock file issues

Posted by Sergey Podatelev <br...@gmail.com>.
On Mon, Nov 16, 2009 at 4:07 PM, Alexander Klimetschek <ak...@day.com> wrote:
> On Mon, Nov 16, 2009 at 11:56, Sergey Podatelev
> <br...@gmail.com> wrote:
>> Another problem is with the .lock file.
>
> In this case you must make sure the shutdown() method is called.

Sorry for the late response, but can you please tell me if you know a
way to do this using Spring? I'm working with JackRabbit via
spring-modules-jcr and not sure how can I force the shutdown in this
case.


And again, I'm having index corruption issues. Don't know if this
helps, but I've noticed that the problem usually occures after a
scheduled procedure performs some processing of the data stored in
repository. After that I can see that the processing was successful,
and all the nodes had changed their state properly, but when I'm
trying to access Iterator-s I receive from queries, they're broken.
Like this:

            final Query q = session.getWorkspace().getQueryManager()
                    .createQuery("//some-node[@node-id='1']", Query.XPATH);
            final NodeIterator i = q.execute().getNodes();
            int size = i.getSize(); // returns 0

So I'm having size=0 despite the fact that <some-node> with node-id=1
property exists in the repository, I can see it among the results of
queries like "//some-node".

After I delete all the indexes, everything is back to normal.

Please, give me at least some pointers.

Maybe this is somehow related to Derby or any other JackRabbit
component issues on FreeBSD?


-- 
sp

Re: FreeBSD indexing and lock file issues

Posted by Alexander Klimetschek <ak...@day.com>.
On Mon, Nov 16, 2009 at 11:56, Sergey Podatelev
<br...@gmail.com> wrote:
> Another problem is with the .lock file.
> The repository is configured as a webapp bundle, and it's impossible
> to redeploy the app because of the ".lock file is present" exception,
> so each time the app needs to be redeployed, we have to stop the
> webserver, remove the .lock file and then start the server again.

In this case you must make sure the shutdown() method is called.

http://wiki.apache.org/jackrabbit/ExamplesPage#Shutting_Down_the_Repository
http://jackrabbit.apache.org/api-1/org/apache/jackrabbit/api/JackrabbitRepository.html#shutdown()

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com