Re: [VOTE] Release Apache Jackrabbit Oak 1.7.8

2017-09-26 Thread Andrei Dulceanu
[X] +1 Release this package as Apache Jackrabbit Oak 1.7.8

Regards,
Andrei

2017-09-25 23:15 GMT+03:00 Davide Giannella :

> Please vote on releasing this package as Apache Jackrabbit Oak 1.7.8.
> The vote is open for the next 72 hours and passes if a majority of at
> least three +1 Jackrabbit PMC votes are cast.
>
> [ ] +1 Release this package as Apache Jackrabbit Oak 1.7.8
> [ ] -1 Do not release this package because...
>


Re: Access to NodeStore instance within benchmark

2017-09-26 Thread Michael Dürig


I tend to agree with Davide. Especially since the use case is for 
benchmarking only. Isn't there an alternative way where the node store 
could be exposed via the the benchmark's fixture?


Michael

On 25.09.17 11:00, Davide Giannella wrote:

On 25/09/2017 07:05, Chetan Mehrotra wrote:

One way can be to expose NodeStore instance from the Oak class. Would
that be ok to do?


I don't like it very much as it would make it too easy to access the
NodeStore from a consumer pov. `Oak` itself is already low level
therefore I'm not strongly objecting for adding such feature. However as
the Oak object accept the NodeStore already as part of the constructor I
would see if it is feasible to keep a reference to the NodeStore in the
AbstractTest itself and use it during repository construction.

HTH
Davide




Re: Access to NodeStore instance within benchmark

2017-09-26 Thread Chetan Mehrotra
Its bit buried in layers. I saw few other benchmark use reflection to
access the NodeStore. So for now using that to move forward


Chetan Mehrotra


On Tue, Sep 26, 2017 at 3:32 PM, Michael Dürig  wrote:
>
> I tend to agree with Davide. Especially since the use case is for
> benchmarking only. Isn't there an alternative way where the node store could
> be exposed via the the benchmark's fixture?
>
> Michael
>
>
> On 25.09.17 11:00, Davide Giannella wrote:
>>
>> On 25/09/2017 07:05, Chetan Mehrotra wrote:
>>>
>>> One way can be to expose NodeStore instance from the Oak class. Would
>>> that be ok to do?
>>
>>
>> I don't like it very much as it would make it too easy to access the
>> NodeStore from a consumer pov. `Oak` itself is already low level
>> therefore I'm not strongly objecting for adding such feature. However as
>> the Oak object accept the NodeStore already as part of the constructor I
>> would see if it is feasible to keep a reference to the NodeStore in the
>> AbstractTest itself and use it during repository construction.
>>
>> HTH
>> Davide
>>
>>
>


Oak Session save behavior

2017-09-26 Thread yogesh upadhyay
Hello,

We are working on a small CMS using Oak-Core (Version 1.6.0) with Play
framework and RDBMS as datastore.

"mysqlConnectorJava": "mysql:mysql-connector-java:5.1.38",
> "oak-jcr": "org.apache.jackrabbit:oak-jcr:1.6.0",
>
>
We use the following code for session handle,

public  CompletableFuture withSession(final FunctionWithCE operation) {
>   final CompletableFuture completableFuture = new CompletableFuture<>();
>   CompletableFuture.runAsync(() -> {
> Session session = null;
> try {
>   session = _repository.login(_credentials);
>   completableFuture.complete(operation. apply(session));
> } catch (Exception e) {
>   logger.error("Something went wrong while using session {}", e);
>   completableFuture.completeExceptionally(e);
> } finally {
>   if (session != null) {
> session.logout();
>   }
> }
>   }, (Runnable command) -> {
> ExecutionContexts.repositoryOperation().execute(command);
>   });
>
>   return completableFuture;
> }
>
>
 And this is how repository component is set up

@Inject
> public RepositoryComponentImpl(final ApplicationLifecycle 
> applicationLifecycle, Database database,
> Configuration configuration) {
>   final String jcrUsername = configuration.getString("jcrUsername");
>   final String jcrPassword = configuration.getString("jcrPassword");
>   if (jcrPassword != null || jcrUsername != null) {
> _credentials = new SimpleCredentials(jcrUsername, 
> jcrPassword.toCharArray());
> final DocumentMK.Builder documentMkBuilder = new DocumentMK.Builder();
> documentMkBuilder.setAsyncDelay(3000);
> documentMkBuilder.setPrefetchExternalChanges(true);
> final DocumentNodeStore documentNodeStore =
> 
> documentMkBuilder.setRDBConnection(database.getDataSource()).getNodeStore();
> _repository = new Jcr(new Oak(documentNodeStore)).createRepository();
> final CompletableFuture setupCompletable = withSession((Session 
> session) -> setupRepository(session));
> setupCompletable.exceptionally(e -> {
>   /*
>* If there is an exception, log the message and rethrow, otherwise it 
> would be
>* lost in the other thread and not surfaced
>*/
>   logger.error(e.getMessage(), e);
>   throw new CompletionException(e);
> });
> applicationLifecycle.addStopHook(() -> {
>   documentNodeStore.dispose();
>   return F.Promise.pure(null);
> });
>   } else {
> throw new IllegalStateException("Unable to get repository credentials.");
>   }
> }
>
>
And this is how session is being used in save operation,

public CompletableFuture deleteBlob(String blobId) {
  return _repositoryComponent.withSession((Session session) -> {
  session.getNode("/asset/").getNode(blobId).remove();
  session.save();
  return (null);
  });

}


For read operations, we use new session again.

Now the problem we are running into is, after save operation is performed,
there is no good way for us to know if save was done (Since save in oak is
async). So after save we refresh the page, the user sees old content.

We can provide some kind of delay on redirect to remedy this issue but it
won't be good user experience.

We are wondering, if there Is any good way to find if after
"session.save()" is called, data is saved in RDBMS and now all new session
will get updated data? Or we are doing anything wrong here.


Yogesh


Re: [VOTE] Release Apache Jackrabbit Oak 1.7.8

2017-09-26 Thread Vikas Saurabh
> [X] +1 Release this package as Apache Jackrabbit Oak 1.7.8

Thanks,
Vikas


Commit history missing for files moved to new modules in git-svn/github

2017-09-26 Thread Chetan Mehrotra
Looks like with svn move/copy the history in git is coming out to be
blank [2]. In svn it looks fine though [1].

Would it be possible to get git history back (via some other tooling
anyone aware of) as it greatly helps in understanding code evolution
while analyzing any issue quickly. Otherwise would need to work with
svn copy where checking history is slow.

For now following command shows history in git. But looks like
Intellij does not support this so its not possible to annotate [3]
file in IDE

git log -C --follow
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java


Chetan Mehrotra

[1] 
https://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java?view=log
[2] 
https://github.com/apache/jackrabbit-oak/commits/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
[3] 
https://stackoverflow.com/questions/27797965/showing-graphically-the-equivalent-of-git-log-follow-in-intellij


Re: Oak Session save behavior

2017-09-26 Thread Chetan Mehrotra
> Now the problem we are running into is, after save operation is performed,
> there is no good way for us to know if save was done (Since save in oak is
> async). So after save we refresh the page, the user sees old content.

Saves in Oak are not async. On a single cluster node if session S1
commits then any session S2 created after S1 (on same cluster node)
would see its change or any existing session can invoke refresh and
see latest repository state (per that cluster node)

For a cluster setup yes changes done by a session on one cluster node
would not be immediately seen on other cluster node. For such setups
you should setup sticky connections for your server