[jira] [Commented] (OAK-4321) Improve conflict exception message to show if conflict is unexpected

2016-05-10 Thread Marcel Reutegger (JIRA)

[ 
https://issues.apache.org/jira/browse/OAK-4321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15277870#comment-15277870
 ] 

Marcel Reutegger commented on OAK-4321:
---

The check is not quite correct, it will report that a revision is older than 
the base revision vector when it is actually equal. I think the patch should 
look like this:

{noformat}
--- 
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/Commit.java
+++ 
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/Commit.java
@@ -42,6 +42,7 @@ import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static com.google.common.base.Objects.equal;
 import static com.google.common.base.Preconditions.checkNotNull;
 import static com.google.common.collect.Iterables.filter;
 import static com.google.common.collect.Iterables.transform;
@@ -565,6 +566,10 @@ public class Commit {
 private String formatConflictRevision(Revision r) {
 if (nodeStore.getHeadRevision().isRevisionNewer(r)) {
 return r + " (not yet visible)";
+} else if (baseRevision != null
+&& !baseRevision.isRevisionNewer(r)
+&& !equal(baseRevision.getRevision(r.getClusterId()), r)) {
+return r + " (older than base - " + baseRevision + ")";
 } else {
 return r.toString();
 }
{noformat}

> Improve conflict exception message to show if conflict is unexpected
> 
>
> Key: OAK-4321
> URL: https://issues.apache.org/jira/browse/OAK-4321
> Project: Jackrabbit Oak
>  Issue Type: Improvement
>  Components: core, documentmk
>Reporter: Vikas Saurabh
>Assignee: Vikas Saurabh
>Priority: Minor
>  Labels: candidate_oak_1_0, candidate_oak_1_2, candidate_oak_1_4
> Fix For: 1.6
>
> Attachments: OAK-4321-1.0.diff
>
>
> Merge exception (aka OakMerge) are often expected when concurrent 
> sessions do conflicting writes. But in some occasions, we've seen bugs in oak 
> which also lead to merge exception.
> This creates confusion during investigation to isolate if it's an issue in 
> oak or a genuine concurrent conflict.
> It'd be useful if the exception message has information to distinguish that.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (OAK-4321) Improve conflict exception message to show if conflict is unexpected

2016-05-03 Thread Marcel Reutegger (JIRA)

[ 
https://issues.apache.org/jira/browse/OAK-4321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15268181#comment-15268181
 ] 

Marcel Reutegger commented on OAK-4321:
---

You can probably get the system into this state when you modify data directly 
on the DocumentStore API level. E.g. shoot a hole into the hierarchy by 
removing a document with children than still exist.

> Improve conflict exception message to show if conflict is unexpected
> 
>
> Key: OAK-4321
> URL: https://issues.apache.org/jira/browse/OAK-4321
> Project: Jackrabbit Oak
>  Issue Type: Improvement
>  Components: core, documentmk
>Reporter: Vikas Saurabh
>Assignee: Vikas Saurabh
>Priority: Minor
>  Labels: candidate_oak_1_0, candidate_oak_1_2, candidate_oak_1_4
> Fix For: 1.6
>
> Attachments: OAK-4321-1.0.diff
>
>
> Merge exception (aka OakMerge) are often expected when concurrent 
> sessions do conflicting writes. But in some occasions, we've seen bugs in oak 
> which also lead to merge exception.
> This creates confusion during investigation to isolate if it's an issue in 
> oak or a genuine concurrent conflict.
> It'd be useful if the exception message has information to distinguish that.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (OAK-4321) Improve conflict exception message to show if conflict is unexpected

2016-04-29 Thread Vikas Saurabh (JIRA)

[ 
https://issues.apache.org/jira/browse/OAK-4321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15263839#comment-15263839
 ] 

Vikas Saurabh commented on OAK-4321:


Thanks Julian for spotting that 'else' and for 1.0 version of the patch.

> Improve conflict exception message to show if conflict is unexpected
> 
>
> Key: OAK-4321
> URL: https://issues.apache.org/jira/browse/OAK-4321
> Project: Jackrabbit Oak
>  Issue Type: Improvement
>  Components: core, documentmk
>Reporter: Vikas Saurabh
>Assignee: Vikas Saurabh
>Priority: Minor
>  Labels: candidate_oak_1_0, candidate_oak_1_2, candidate_oak_1_4
> Fix For: 1.6
>
> Attachments: OAK-4321-1.0.diff
>
>
> Merge exception (aka OakMerge) are often expected when concurrent 
> sessions do conflicting writes. But in some occasions, we've seen bugs in oak 
> which also lead to merge exception.
> This creates confusion during investigation to isolate if it's an issue in 
> oak or a genuine concurrent conflict.
> It'd be useful if the exception message has information to distinguish that.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (OAK-4321) Improve conflict exception message to show if conflict is unexpected

2016-04-28 Thread Vikas Saurabh (JIRA)

[ 
https://issues.apache.org/jira/browse/OAK-4321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15263232#comment-15263232
 ] 

Vikas Saurabh commented on OAK-4321:


[~mreutegg], probably the minimalist of fixes can be like:
{noformat}
--- 
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/Commit.java
+++ 
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/Commit.java
@@ -557,6 +557,8 @@ public class Commit {
 private String formatConflictRevision(Revision r) {
 if (nodeStore.getHeadRevision().isRevisionNewer(r)) {
 return r + " (not yet visible)";
+} if (baseRevision != null && !baseRevision.isRevisionNewer(r)) {
+return r + " (older than base - " + baseRevision + ")";
 } else {
 return r.toString();
 }
{noformat}

What I'm finding harder is to write test cases to create invalid conflicts - 
any pointers?

In the mean time I'm also looking at some code paths in {{checkConflicts}} to 
see if we are covering all cases.

> Improve conflict exception message to show if conflict is unexpected
> 
>
> Key: OAK-4321
> URL: https://issues.apache.org/jira/browse/OAK-4321
> Project: Jackrabbit Oak
>  Issue Type: Improvement
>  Components: core, documentmk
>Reporter: Vikas Saurabh
>Assignee: Vikas Saurabh
>Priority: Minor
>  Labels: candidate_oak_1_0, candidate_oak_1_2, candidate_oak_1_4
> Fix For: 1.6
>
>
> Merge exception (aka OakMerge) are often expected when concurrent 
> sessions do conflicting writes. But in some occasions, we've seen bugs in oak 
> which also lead to merge exception.
> This creates confusion during investigation to isolate if it's an issue in 
> oak or a genuine concurrent conflict.
> It'd be useful if the exception message has information to distinguish that.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)