You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Marcel Reutegger (JIRA)" <ji...@apache.org> on 2016/05/11 07:30:13 UTC
[jira] [Comment Edited] (OAK-4321) Improve conflict exception
message to show if conflict is unexpected
[ https://issues.apache.org/jira/browse/OAK-4321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15277870#comment-15277870 ]
Marcel Reutegger edited comment on OAK-4321 at 5/11/16 7:29 AM:
----------------------------------------------------------------
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}
was (Author: mreutegg):
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: Marcel Reutegger
> Priority: Minor
> Fix For: 1.6, 1.5.2, 1.0.31, 1.2.15, 1.4.3
>
> Attachments: OAK-4321-1.0.diff
>
>
> Merge exception (aka OakMergeXXXX) 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)