You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Ancona Francesco <Fr...@siav.it> on 2016/02/25 10:46:41 UTC

info about oak and RDMBS

Hi,
i wrote yesterday that we are making a lots of performance test on oak and jackrabbit in order to select our target platform. We are going to try with several plane tests; one of them is using oak with RDBMS Postgres to store metadata.
We found an exception when save a new node  (root.addNode("hello").setProperty("count", 1);)

Our driver postgres is: datasource
                               <dependency>
                                               <groupId>org.postgresql</groupId>
                                               <artifactId>postgresql</artifactId>
                                               <version>9.4.1207.jre7</version>
                               </dependency>

Can you help us?

Thanks in advance.
Best regards

Class detail:
@Test
@ContextConfiguration(locations = { "classpath:spring-test-config.xml" })
public class OakPostgresTest extends AbstractTestCommons {
                @Autowired
                @Qualifier("oakDataSource")
                private DataSource ds;

                @Test
                public void test() {

                               final DocumentMK.Builder builder = new DocumentMK.Builder();
                               builder.setBlobStore(createFileSystemBlobStore());
                               final DocumentNodeStore ns = getPosgresDocumentNodeStore(builder);
                               Oak oak = new Oak(ns);
                               Jcr jcr = new Jcr(oak);
                               Repository repo = jcr.createRepository();
                               Session session = null;
                               try {
                                               InputStream is = new ByteArrayInputStream(document_small);
                                               session = repo.login(new SimpleCredentials("admin", "admin".toCharArray()));
                                               ValueFactory valueFactory = session.getValueFactory();
                                               Binary data = valueFactory.createBinary(is);
                                               Node root = session.getRootNode();
                                               if (root.hasNode("hello")) {
                                                               Node hello = root.getNode("hello");
                                                               long count = hello.getProperty("count").getLong();
                                                               if (count > 1) {
                                                                              hello.remove();
                                                                              System.out.println("delete the hello node");
                                                               } else {
                                                                              hello.setProperty("count", count + 1);
                                                                              hello.setProperty("data", data);
                                                                              System.out.println("found the hello node, count = " + count);
                                                               }
                                               } else {
                                                               System.out.println("creating the hello node");
                                                               root.addNode("hello").setProperty("count", 1);
                                               }
                                               session.save();
                                               // Logout
                               } catch (LoginException e) {
                                               // TODO Auto-generated catch block
                                               e.printStackTrace();
                               } catch (RepositoryException e) {
                                               // TODO Auto-generated catch block
                                               e.printStackTrace();
                               } finally {
                                               if (session != null) session.logout();
                                               ns.dispose();
                               }
                }

                private DocumentNodeStore getPosgresDocumentNodeStore(DocumentMK.Builder builder) {
                               DocumentNodeStore ns = null;
                               if (builder == null) {
                                               ns = new DocumentMK.Builder().setRDBConnection(ds).getNodeStore();
                               } else {
                                               ns = builder.setRDBConnection(ds).getNodeStore();
                               }
                               return ns;
                }

                private BlobStore createFileSystemBlobStore() {
                               try {
                                               FileUtils.deleteDirectory(new File("/home/test/oak"));
                               } catch (IOException e) {
                                               // TODO Auto-generated catch block
                                               e.printStackTrace();
                               }

                               FileBlobStore store = new FileBlobStore("/home/test/oak");
                               return store;
                }

}

java.text.ParseException: Query: SELECT * FROM [nt:base] WHERE(*)[jcr:uuid] = $id /* oak-internal */; expected: unknown node type
                at org.apache.jackrabbit.oak.query.SQL2Parser.getSyntaxError(SQL2Parser.java:1357)
                at org.apache.jackrabbit.oak.query.SQL2Parser.parseSelector(SQL2Parser.java:252)
                at org.apache.jackrabbit.oak.query.SQL2Parser.parseSource(SQL2Parser.java:278)
                at org.apache.jackrabbit.oak.query.SQL2Parser.parseSelect(SQL2Parser.java:203)
                at org.apache.jackrabbit.oak.query.SQL2Parser.parse(SQL2Parser.java:148)
                at org.apache.jackrabbit.oak.query.QueryEngineImpl.parseQuery(QueryEngineImpl.java:177)
                at org.apache.jackrabbit.oak.query.QueryEngineImpl.executeQuery(QueryEngineImpl.java:257)
                at org.apache.jackrabbit.oak.query.QueryEngineImpl.executeQuery(QueryEngineImpl.java:233)
                at org.apache.jackrabbit.oak.plugins.identifier.IdentifierManager.resolveUUID(IdentifierManager.java:314)
                at org.apache.jackrabbit.oak.plugins.identifier.IdentifierManager.resolveUUID(IdentifierManager.java:308)
                at org.apache.jackrabbit.oak.plugins.identifier.IdentifierManager.resolveUUID(IdentifierManager.java:304)
                at org.apache.jackrabbit.oak.plugins.identifier.IdentifierManager.getTree(IdentifierManager.java:133)
                at org.apache.jackrabbit.oak.security.user.AuthorizableBaseProvider.getByContentID(AuthorizableBaseProvider.java:56)
                at org.apache.jackrabbit.oak.security.user.AuthorizableBaseProvider.getByID(AuthorizableBaseProvider.java:51)
                at org.apache.jackrabbit.oak.security.user.UserProvider.getAuthorizable(UserProvider.java:211)
                at org.apache.jackrabbit.oak.security.user.UserManagerImpl.getAuthorizable(UserManagerImpl.java:106)
                at org.apache.jackrabbit.oak.security.user.UserInitializer.initialize(UserInitializer.java:130)
                at org.apache.jackrabbit.oak.spi.lifecycle.OakInitializer.initialize(OakInitializer.java:57)
                at org.apache.jackrabbit.oak.Oak.createNewContentRepository(Oak.java:672)
                at org.apache.jackrabbit.oak.Oak.createContentRepository(Oak.java:616)
                at org.apache.jackrabbit.oak.jcr.Jcr.createContentRepository(Jcr.java:367)
                at org.apache.jackrabbit.oak.jcr.Jcr.createRepository(Jcr.java:375)
                at it.zzzz.yyyy.testplatform.ecm.oak.OakPostgresTest.test(OakPostgresTest.java:53)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:497)
                at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
                at org.testng.internal.MethodInvocationHelper$1.runTestMethod(MethodInvocationHelper.java:197)
                at org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:175)
                at org.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:209)
                at org.testng.internal.Invoker.invokeMethod(Invoker.java:641)
                at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:822)
                at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1130)
                at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
                at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
                at org.testng.TestRunner.privateRun(TestRunner.java:782)
                at org.testng.TestRunner.run(TestRunner.java:632)
                at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
                at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
                at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
                at org.testng.SuiteRunner.run(SuiteRunner.java:268)
                at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
                at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
                at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
                at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
                at org.testng.TestNG.run(TestNG.java:1064)
                at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:113)
                at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:206)
                at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:177)
2016-02-25 10:06:43 [main] ERROR o.a.j.o.p.i.IdentifierManager -
                                                               query failed



[cid:image002.png@01D16FB9.CFA0A660]
Francesco Ancona | Software Dev. Dept. (SP) - Software Architect
tel. +39 049 8979797 | fax +39 049 8978800 | cel. +39 3299060325
e-mail: francesco.ancona@siav.it | www.siav.it

I contenuti di questa e-mail e dei suoi allegati sono confidenziali e riservati esclusivamente ai destinatari.
L'utilizzo per qualunque fine del presente messaggio e degli allegati così come la relativa divulgazione senza l'autorizzazione del mittente sono vietati.
Se avete ricevuto questa e-mail per errore, vi preghiamo di distruggerla e di comunicarcelo.
I dati personali sono trattati esclusivamente per le finalità della presente comunicazione in conformità con la legislazione vigente (D.lgs. 196/2003 "Codice Privacy").
Per informazioni: SIAV S.p.A. - siav@siav.it - 049 8979797

The contents of this e-mail and its attachments are confidential and reserved exclusively to the recipients.
The use for any purpose of this message and attachments as well as its disclosure without the consent of the sender is prohibited.
If you have received this email in error, please destroy it and notify us.
Personal data shall be processed solely for the purposes of this notice in accordance with current legislation (Legislative Decree no. 196/2003 "Code").
For more information: SIAV S.p.A. - siav@siav.it - 049 8979797


Re: R: R: info about oak and RDMBS

Posted by Julian Reschke <ju...@gmx.de>.
On 2016-02-25 12:42, Ancona Francesco wrote:
> Hi,
> I had run the same test changing only the  DocumentNodeStore type as in the following code:
>
> final DocumentMK.Builder builder = new DocumentMK.Builder(); builder.setBlobStore(createFileSystemBlobStore());
> final DocumentNodeStore ns = getMongoDocumentNodeStore(builder);
>
> private DB db = new MongoClient("127.0.0.1", 27017).getDB("test2");
> private DocumentNodeStore getMongoDocumentNodeStore(DocumentMK.Builder builder) {
>                  DocumentNodeStore ns = null;
>                  if (builder == null) {
>                                 ns = new DocumentMK.Builder().
>                              setMongoDB(db).getNodeStore();
>                  } else {
>                      ns = builder.
>                              setMongoDB(db).getNodeStore();
>                  }
>                  return ns;
> }
>
> With mongo i had run the test without errors.
>
> Best regards

OK.

Questions:

1) Where do you get the datasource from?

2) Did you have a look at the OAK logs?

Other than that...:

In Oak, we have tons of JCR tests that pass on RDB with Postgres, so 
something that you do apparently is different from how it's done in our 
test setup.

You could either look at how the repo is constructed in the tests, or 
alternatively, try to change your code so that it can be run as unit 
test in Oak.

Best regards, Julian



R: R: info about oak and RDMBS

Posted by Ancona Francesco <Fr...@siav.it>.
Hi,
I had run the same test changing only the  DocumentNodeStore type as in the following code:

final DocumentMK.Builder builder = new DocumentMK.Builder(); builder.setBlobStore(createFileSystemBlobStore());
final DocumentNodeStore ns = getMongoDocumentNodeStore(builder);

private DB db = new MongoClient("127.0.0.1", 27017).getDB("test2");
private DocumentNodeStore getMongoDocumentNodeStore(DocumentMK.Builder builder) {                                                            
                DocumentNodeStore ns = null;
                if (builder == null) {
                               ns = new DocumentMK.Builder().
                            setMongoDB(db).getNodeStore();
                } else {
                    ns = builder.
                            setMongoDB(db).getNodeStore();
                }
                return ns;
}

With mongo i had run the test without errors.

Best regards

-----Messaggio originale-----
Da: Julian Reschke [mailto:julian.reschke@gmx.de] 
Inviato: giovedì 25 febbraio 2016 11:44
A: oak-dev@jackrabbit.apache.org
Cc: Diquigiovanni Simone <Si...@siav.it>
Oggetto: Re: R: info about oak and RDMBS

On 2016-02-25 11:30, Ancona Francesco wrote:
> Yes.
>
> We tried the following combination:
> 1) metadata on mongo and binary mongo
> 2) metadata on mongo and binary using filesystem
>
> Best regards

It looks like the repository construction doesn't work (nodetype index missing).

Can you double-check that your code for Mongo really has the same steps?

Best regards, Julian







 
 
************************************************************************************
This footnote confirms that this email message has been scanned by PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses.
************************************************************************************




R: R: info about oak and RDMBS

Posted by Ancona Francesco <Fr...@siav.it>.
Hi,
to answer your question, I’d manually delete all the tables in the posgresql db before running the test,
so the stacktrace is relative to a fresh start.
On a second run, without deleting the tables, I had a different type of exception.

Best regards

-----Messaggio originale-----
Da: Alex Parvulescu [mailto:alex.parvulescu@gmail.com] 
Inviato: giovedì 25 febbraio 2016 12:16
A: Oak devs <oa...@jackrabbit.apache.org>
Cc: Diquigiovanni Simone <Si...@siav.it>
Oggetto: Re: R: info about oak and RDMBS

Hi,

I would add making sure the test uses a clean slate each time, meaning you drop the db at the end and/or create fresh unique ones each time the test runs (I don't see this happening in the current snippet).
this would protect you against weird artifacts.

alex


On Thu, Feb 25, 2016 at 11:43 AM, Julian Reschke <ju...@gmx.de>
wrote:

> On 2016-02-25 11:30, Ancona Francesco wrote:
>
>> Yes.
>>
>> We tried the following combination:
>> 1) metadata on mongo and binary mongo
>> 2) metadata on mongo and binary using filesystem
>>
>> Best regards
>>
>
> It looks like the repository construction doesn't work (nodetype index 
> missing).
>
> Can you double-check that your code for Mongo really has the same steps?
>
> Best regards, Julian
>
>
>
>
>
>
>

 
 
************************************************************************************
This footnote confirms that this email message has been scanned by PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses.
************************************************************************************




Re: R: info about oak and RDMBS

Posted by Alex Parvulescu <al...@gmail.com>.
Hi,

I would add making sure the test uses a clean slate each time, meaning you
drop the db at the end and/or create fresh unique ones each time the test
runs (I don't see this happening in the current snippet).
this would protect you against weird artifacts.

alex


On Thu, Feb 25, 2016 at 11:43 AM, Julian Reschke <ju...@gmx.de>
wrote:

> On 2016-02-25 11:30, Ancona Francesco wrote:
>
>> Yes.
>>
>> We tried the following combination:
>> 1) metadata on mongo and binary mongo
>> 2) metadata on mongo and binary using filesystem
>>
>> Best regards
>>
>
> It looks like the repository construction doesn't work (nodetype index
> missing).
>
> Can you double-check that your code for Mongo really has the same steps?
>
> Best regards, Julian
>
>
>
>
>
>
>

Re: R: info about oak and RDMBS

Posted by Julian Reschke <ju...@gmx.de>.
On 2016-02-25 11:30, Ancona Francesco wrote:
> Yes.
>
> We tried the following combination:
> 1) metadata on mongo and binary mongo
> 2) metadata on mongo and binary using filesystem
>
> Best regards

It looks like the repository construction doesn't work (nodetype index 
missing).

Can you double-check that your code for Mongo really has the same steps?

Best regards, Julian







R: info about oak and RDMBS

Posted by Ancona Francesco <Fr...@siav.it>.
Yes.

We tried the following combination:
1) metadata on mongo and binary mongo
2) metadata on mongo and binary using filesystem 

Best regards

-----Messaggio originale-----
Da: Julian Reschke [mailto:julian.reschke@gmx.de] 
Inviato: giovedì 25 febbraio 2016 10:56
A: oak-dev@jackrabbit.apache.org
Oggetto: Re: info about oak and RDMBS

On 2016-02-25 10:46, Ancona Francesco wrote:
> Hi,
>
> i wrote yesterday that we are making a lots of performance test on oak 
> and jackrabbit in order to select our target platform. We are going to 
> try with several plane tests; one of them is using oak with RDBMS 
> Postgres to store metadata.
> ...


Does this happen with RDB persistence only?

Best regards, Julian

 
 
************************************************************************************
This footnote confirms that this email message has been scanned by PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses.
************************************************************************************




Re: info about oak and RDMBS

Posted by Julian Reschke <ju...@gmx.de>.
On 2016-02-25 10:46, Ancona Francesco wrote:
> Hi,
>
> i wrote yesterday that we are making a lots of performance test on oak
> and jackrabbit in order to select our target platform. We are going to
> try with several plane tests; one of them is using oak with RDBMS
> Postgres to store metadata.
> ...


Does this happen with RDB persistence only?

Best regards, Julian