[jira] [Commented] (SLING-6782) Sling Job implementation should avoid unnecessary writes to the repository

2017-04-19 Thread JIRA

[ 
https://issues.apache.org/jira/browse/SLING-6782?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15975467#comment-15975467
 ] 

Jörg Hoh commented on SLING-6782:
-

For this case I adapted the ResourceHelper.getOrCreateResourceInternal a update 
and made the commit for the creation of the parentPath mandatory (updated 
patch).
But then we cannot remove this local copy of this method and replace it by the 
ResourceUtil version, because there the commit of creation of the parentPath 
should still depend on autoCommit.

> Sling Job implementation should avoid unnecessary writes to the repository
> --
>
> Key: SLING-6782
> URL: https://issues.apache.org/jira/browse/SLING-6782
> Project: Sling
>  Issue Type: Improvement
>  Components: Event
>Affects Versions: Event 4.2.2
>Reporter: Jörg Hoh
> Attachments: SLING-6782-jobs-commit-to-often-2.patch, 
> SLING-6782-jobs-commit-to-often.patch
>
>
> I found in a number of occurences in the Sling Event code this pattern:
> {code}
> ResourceHelper.getOrCreateResource(resolver, newPath, 
> props);
> resolver.delete(jobResource);
> resolver.commit();
> {code}
> and the getOrCreateResource is internally doing a commit on the resolver 
> (autoCommit = true). So in the end there are 2 commits while only a single 
> commit would be sufficient.
> Removing these "double" commits could avoid a few write operations on the 
> repository.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (SLING-6782) Sling Job implementation should avoid unnecessary writes to the repository

2017-04-19 Thread Carsten Ziegeler (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-6782?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15975448#comment-15975448
 ] 

Carsten Ziegeler commented on SLING-6782:
-

Right - I thought that's exactly what I wrote :)

> Sling Job implementation should avoid unnecessary writes to the repository
> --
>
> Key: SLING-6782
> URL: https://issues.apache.org/jira/browse/SLING-6782
> Project: Sling
>  Issue Type: Improvement
>  Components: Event
>Affects Versions: Event 4.2.2
>Reporter: Jörg Hoh
> Attachments: SLING-6782-jobs-commit-to-often.patch
>
>
> I found in a number of occurences in the Sling Event code this pattern:
> {code}
> ResourceHelper.getOrCreateResource(resolver, newPath, 
> props);
> resolver.delete(jobResource);
> resolver.commit();
> {code}
> and the getOrCreateResource is internally doing a commit on the resolver 
> (autoCommit = true). So in the end there are 2 commits while only a single 
> commit would be sufficient.
> Removing these "double" commits could avoid a few write operations on the 
> repository.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (SLING-6782) Sling Job implementation should avoid unnecessary writes to the repository

2017-04-19 Thread JIRA

[ 
https://issues.apache.org/jira/browse/SLING-6782?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15975316#comment-15975316
 ] 

Jörg Hoh commented on SLING-6782:
-

Hi Carsten,

good point. But from my point of view in the context of Sling Jobs, 
autoCommit=false would never make sense for the creation of the parent path. So 
we should ignore this flag for that in any case and always do the commit. And 
only act on autoCommit when it's about saving the resoource.

> Sling Job implementation should avoid unnecessary writes to the repository
> --
>
> Key: SLING-6782
> URL: https://issues.apache.org/jira/browse/SLING-6782
> Project: Sling
>  Issue Type: Improvement
>  Components: Event
>Affects Versions: Event 4.2.2
>Reporter: Jörg Hoh
> Attachments: SLING-6782-jobs-commit-to-often.patch
>
>
> I found in a number of occurences in the Sling Event code this pattern:
> {code}
> ResourceHelper.getOrCreateResource(resolver, newPath, 
> props);
> resolver.delete(jobResource);
> resolver.commit();
> {code}
> and the getOrCreateResource is internally doing a commit on the resolver 
> (autoCommit = true). So in the end there are 2 commits while only a single 
> commit would be sufficient.
> Removing these "double" commits could avoid a few write operations on the 
> repository.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (SLING-6782) Sling Job implementation should avoid unnecessary writes to the repository

2017-04-18 Thread Carsten Ziegeler (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-6782?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15973673#comment-15973673
 ] 

Carsten Ziegeler commented on SLING-6782:
-

Good catch. However, I think the patch is removing too much: the 
getOrCreateResource is currently using auto commit to avoid problems in a 
cluster if the path to the resource needs to be created as well (too nodes 
concurrently adding the same path). So I think this needs some more changes to 
ResourceHelper: auto commit for the parent path part, no auto commit for the 
resource creation.
At the same time we can remove getOrCreateResourceInternal as this is a copy of 
Sling's API ResourceUtil method

> Sling Job implementation should avoid unnecessary writes to the repository
> --
>
> Key: SLING-6782
> URL: https://issues.apache.org/jira/browse/SLING-6782
> Project: Sling
>  Issue Type: Improvement
>  Components: Event
>Affects Versions: Event 4.2.2
>Reporter: Jörg Hoh
> Attachments: SLING-6782-jobs-commit-to-often.patch
>
>
> I found in a number of occurences in the Sling Event code this pattern:
> {code}
> ResourceHelper.getOrCreateResource(resolver, newPath, 
> props);
> resolver.delete(jobResource);
> resolver.commit();
> {code}
> and the getOrCreateResource is internally doing a commit on the resolver 
> (autoCommit = true). So in the end there are 2 commits while only a single 
> commit would be sufficient.
> Removing these "double" commits could avoid a few write operations on the 
> repository.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)