You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Francesco Chicchiriccò <il...@apache.org> on 2015/07/16 13:45:12 UTC
Troubles with slices
Hi all,
at Syncope we are implementing the multi-tenancy feature [1], which
requires - at least for the way how we thought at it - to extend the
current OpenJPA-based persistence layer with slices.
I am unfortunately experiencing some troubles, so I've assembled a
quickstart project to show my problems [2], which replicates most of
Syncope settings.
You can verify that, after issuing
mvn clean test
all tests (but one, which is rather irrelevant since it does not perform
any database operation) are failing; if, instead, a single test method
is invoked as
Konsole output mvn clean test -Dtest=RealmTest#save
everything is working as expected (this is true for every single test
method).
The relevant part of the stacktrace is at [3]: as you can see, it seems
that there are problems related to transaction completion.
You can find the OpenJPA setup in [3] - as you can see the application
is Spring-managed; please note that I had to explicitly set
"openjpa.BrokerImpl" to
"org.apache.openjpa.slice.DistributedBrokerImpl", otherwise nothing was
working at all.
Is there anything obvious that I am currently overlooking?
TIA
Regards.
[1]
https://cwiki.apache.org/confluence/display/SYNCOPE/%5BDISCUSS%5D+Domains
[2] https://github.com/ilgrosso/OpenJPASlice/
[3] https://paste.apache.org/b5ot
[4]
https://github.com/ilgrosso/OpenJPASlice/blob/master/src/main/resources/persistenceContextEMFactory.xml
--
Francesco Chicchiriccò
Tirasa - Open Source Excellence
http://www.tirasa.net/
Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC
http://people.apache.org/~ilgrosso/
Re: Troubles with slices
Posted by Francesco Chicchiriccò <il...@apache.org>.
Hi all,
I am continuing from [1].
I have now problems with a range-enabled JPQL query.
The problematic code is in DistributedStoreQuery, around lines 149:167,
triggered by Syncope's JPATaskDAO [2].
From there an instance of RangeResultObjectProvider wrapping
OrderingMergedResultObjectProvider, wrapping in turn
InstanceResultObjectProvider is returned.
Then, RangeResultObjectProvider#next() is invoked, and this works fine
when the required range is (0, 2): when, instead the range is (2, 4), I
see that _delegate.next() is called (line 91 from
RangeResultObjectProvider) and this "consumes" the underlying result
set, thus resulting in an empty query result.
Does anyone see any obvious problem here?
TIA
Regards.
[1] http://markmail.org/message/6bz2uqmuzth4q3t6
[2]
https://github.com/apache/syncope/blob/SYNCOPE-652/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPATaskDAO.java#L123
--
Francesco Chicchiriccò
Tirasa - Open Source Excellence
http://www.tirasa.net/
Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC
http://people.apache.org/~ilgrosso/
Re: Troubles with slices
Posted by Francesco Chicchiriccò <il...@apache.org>.
Hi all,
since yesterday I've made some progresses, but I've got even more questions.
First of all, a bit of background information.
As part of SYNCOPE-652 [1], we are implementing multi-tenancy in Apache
Syncope. The purpose is to allow situations were a single deployment can
serve several different customers, with each customer's data physically
separated from each other.
Having the internal persistence already based on OpenJPA, slices are the
most logical choice.
The work related to SYNCOPE-652 is in a feature branch [2].
I have started with OpenJPA 2.4.0, but since I had to change a couple of
things, I've forked (from trunk) and made such changes there [3][4].
In [2] I have changed the OpenJPA configuration from non-slice to a
single master slice; with such a configuration [5] (and fixes in OpenJPA
mentioned above) I am now able to successfully run unit tests but I
still have some troubles with integration tests.
I was also able to run unit tests with a second slice attached.
Questions I've got so far:
1. besides "openjpa.BrokerFactory" to "slice", I also had to set
"openjpa.BrokerImpl" to
"org.apache.openjpa.slice.DistributedBrokerImpl", but I could not find
any reference to this in the slice documentation: is this correct /
expected?
2. I had to disable both "openjpa.QueryCache" and
"openjpa.QueryCompilationCache": is this correct / expected? what is the
impact in terms of performances?
3. Could someone take a look at [3] and [4] and see if such changes
make sense for the general case? If so I would be glad to open issue(s)
and provide patch(es).
Thanks for your support.
Regards.
[1]
https://cwiki.apache.org/confluence/display/SYNCOPE/%5BDISCUSS%5D+Domains
[2] https://github.com/apache/syncope/tree/SYNCOPE-652
[3]
https://github.com/ilgrosso/openjpa/commit/4128bcdc06945b07a35d0018cc8fd54a3b472942
[4]
https://github.com/ilgrosso/openjpa/commit/58444983be149a2f04008a5a6cc4bb9ded291da5
[5]
https://github.com/apache/syncope/blob/SYNCOPE-652/core/persistence-jpa/src/main/resources/persistenceContextEMFactory.xml
--
Francesco Chicchiriccò
Tirasa - Open Source Excellence
http://www.tirasa.net/
Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC
http://people.apache.org/~ilgrosso/
Re: Troubles with slices
Posted by Francesco Chicchiriccò <il...@apache.org>.
On 16/07/2015 13:47, Francesco Chicchiriccò wrote:
> On 16/07/2015 13:45, Francesco Chicchiriccò wrote:
>> Hi all,
>> at Syncope we are implementing the multi-tenancy feature [1], which
>> requires - at least for the way how we thought at it - to extend the
>> current OpenJPA-based persistence layer with slices.
>>
>> I am unfortunately experiencing some troubles, so I've assembled a
>> quickstart project to show my problems [2], which replicates most of
>> Syncope settings.
>>
>> You can verify that, after issuing
>>
>> mvn clean test
>>
>> all tests (but one, which is rather irrelevant since it does not
>> perform any database operation) are failing; if, instead, a single
>> test method is invoked as
>>
>> mvn clean test -Dtest=RealmTest#save
>>
>> everything is working as expected (this is true for every single test
>> method).
>>
>> The relevant part of the stacktrace is at [3]: as you can see, it
>> seems that there are problems related to transaction completion.
>>
>> You can find the OpenJPA setup in [3]
>
> at [4], sorry
>
>> - as you can see the application is Spring-managed; please note that
>> I had to explicitly set "openjpa.BrokerImpl" to
>> "org.apache.openjpa.slice.DistributedBrokerImpl", otherwise nothing
>> was working at all.
>>
>> Is there anything obvious that I am currently overlooking?
Update: when disabling QueryCompilationCache
https://github.com/ilgrosso/OpenJPASlice/blob/master/src/main/resources/persistenceContextEMFactory.xml#L59
all tests are now working altogether.
Can you confirm that my configuration is correct / expected?
>> [1]
>> https://cwiki.apache.org/confluence/display/SYNCOPE/%5BDISCUSS%5D+Domains
>> [2] https://github.com/ilgrosso/OpenJPASlice/
>> [3] https://paste.apache.org/b5ot
>> [4]
>> https://github.com/ilgrosso/OpenJPASlice/blob/master/src/main/resources/persistenceContextEMFactory.xml
--
Francesco Chicchiriccò
Tirasa - Open Source Excellence
http://www.tirasa.net/
Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC
http://people.apache.org/~ilgrosso/
Re: Troubles with slices
Posted by Francesco Chicchiriccò <il...@apache.org>.
On 16/07/2015 13:45, Francesco Chicchiriccò wrote:
> Hi all,
> at Syncope we are implementing the multi-tenancy feature [1], which
> requires - at least for the way how we thought at it - to extend the
> current OpenJPA-based persistence layer with slices.
>
> I am unfortunately experiencing some troubles, so I've assembled a
> quickstart project to show my problems [2], which replicates most of
> Syncope settings.
>
> You can verify that, after issuing
>
> mvn clean test
>
> all tests (but one, which is rather irrelevant since it does not
> perform any database operation) are failing; if, instead, a single
> test method is invoked as
>
> mvn clean test -Dtest=RealmTest#save
>
> everything is working as expected (this is true for every single test
> method).
>
> The relevant part of the stacktrace is at [3]: as you can see, it
> seems that there are problems related to transaction completion.
>
> You can find the OpenJPA setup in [3]
at [4], sorry
> - as you can see the application is Spring-managed; please note that I
> had to explicitly set "openjpa.BrokerImpl" to
> "org.apache.openjpa.slice.DistributedBrokerImpl", otherwise nothing
> was working at all.
>
> Is there anything obvious that I am currently overlooking?
>
> TIA
> Regards.
>
> [1]
> https://cwiki.apache.org/confluence/display/SYNCOPE/%5BDISCUSS%5D+Domains
> [2] https://github.com/ilgrosso/OpenJPASlice/
> [3] https://paste.apache.org/b5ot
> [4]
> https://github.com/ilgrosso/OpenJPASlice/blob/master/src/main/resources/persistenceContextEMFactory.xml
--
Francesco Chicchiriccò
Tirasa - Open Source Excellence
http://www.tirasa.net/
Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC
http://people.apache.org/~ilgrosso/