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 "Julian Reschke (JIRA)" <ji...@apache.org> on 2019/06/25 13:44:00 UTC
[jira] [Updated] (OAK-7286) DocumentNodeStoreBranch handling of
non-recoverable DocumentStoreExceptions
[ https://issues.apache.org/jira/browse/OAK-7286?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julian Reschke updated OAK-7286:
--------------------------------
Description:
In {{DocumentNodeStoreBranch.merge()}}, any {{DocumentStoreException}} is mapped to a {{DocumentStoreException}} to a {{CommitFailedException}} of type "MERGE", which leads to the operation being retried, and a non-helpful exception being generated.
The effect can be observed by enabling a test in {{ValidNamesTest}}:
{noformat}
--- oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ValidNamesTest.java (Revision 1825371)
+++ oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ValidNamesTest.java (Arbeitskopie)
@@ -300,7 +300,6 @@
public void testUnpairedHighSurrogateEnd() {
// see OAK-5506
org.junit.Assume.assumeFalse(super.fixture.toString().toLowerCase().contains("segment"));
- org.junit.Assume.assumeFalse(super.fixture.toString().toLowerCase().contains("rdb"));
nameTest("foo" + SURROGATE_PAIR[0]);
}
@@ -336,6 +335,7 @@
assertEquals("paths should be equal", p.getPath(), n.getPath());
return p;
} catch (RepositoryException ex) {
+ ex.printStackTrace();
fail(ex.getMessage());
return null;
}
{noformat}
The underlying issue is that {{RDBDocumentStore}} is throwing a {{DocumentStoreException}} due to the invalid ID, and repeating the call will not help.
We probably should have a way to distinguish between different types of problems.
I hacked {{DocumentNodeStoreBranch}} like that:
{noformat}
--- oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java (Revision 1825371)
+++ oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java (Arbeitskopie)
@@ -520,8 +520,12 @@
} catch (ConflictException e) {
throw e.asCommitFailedException();
} catch(DocumentStoreException e) {
- throw new CommitFailedException(MERGE, 1,
- "Failed to merge changes to the underlying store", e);
+ if (e.getMessage().contains("Invalid ID")) {
+ throw new CommitFailedException(OAK, 123,
+ "Failed to store changes in the underlying store: " + e.getMessage(), e);
+ } else {
+ throw new CommitFailedException(MERGE, 1, "Failed to merge changes to the underlying store", e);
+ }
} catch (Exception e) {
throw new CommitFailedException(OAK, 1,
"Failed to merge changes to the underlying store", e);
{noformat}
...which causes the exception to surface immediately (see https://issues.apache.org/jira/secure/attachment/12912117/OAK-7286.diff).
(cc [~mreutegg])
was:
In {{DocumentNodeStoreBranch.merge()}}, any {{DocumentStoreException}} is mapped to a {{DocumentStoreException}} to a {{CommitFailedException}} of type "MERGE", which leads to the operation being retried, and a non-helpful exception being generated.
The effect can be observed by enabling a test in {{ValidNamesTest}}:
{noformat}
--- oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ValidNamesTest.java (Revision 1825371)
+++ oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ValidNamesTest.java (Arbeitskopie)
@@ -300,7 +300,6 @@
public void testUnpairedHighSurrogateEnd() {
// see OAK-5506
org.junit.Assume.assumeFalse(super.fixture.toString().toLowerCase().contains("segment"));
- org.junit.Assume.assumeFalse(super.fixture.toString().toLowerCase().contains("rdb"));
nameTest("foo" + SURROGATE_PAIR[0]);
}
@@ -336,6 +335,7 @@
assertEquals("paths should be equal", p.getPath(), n.getPath());
return p;
} catch (RepositoryException ex) {
+ ex.printStackTrace();
fail(ex.getMessage());
return null;
}
{noformat}
The underlying issue is that {{RDBDocumentStore}} is throwing a {{DocumentStoreException}} due to the invalid ID, and repeating the call will not help.
We probably should have a way to dinstinguish between different types of problems.
I hacked {{DocumentNodeStoreBranch}} like that:
{noformat}
--- oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java (Revision 1825371)
+++ oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java (Arbeitskopie)
@@ -520,8 +520,12 @@
} catch (ConflictException e) {
throw e.asCommitFailedException();
} catch(DocumentStoreException e) {
- throw new CommitFailedException(MERGE, 1,
- "Failed to merge changes to the underlying store", e);
+ if (e.getMessage().contains("Invalid ID")) {
+ throw new CommitFailedException(OAK, 123,
+ "Failed to store changes in the underlying store: " + e.getMessage(), e);
+ } else {
+ throw new CommitFailedException(MERGE, 1, "Failed to merge changes to the underlying store", e);
+ }
} catch (Exception e) {
throw new CommitFailedException(OAK, 1,
"Failed to merge changes to the underlying store", e);
{noformat}
...which causes the exception to surface immediately (see https://issues.apache.org/jira/secure/attachment/12912117/OAK-7286.diff).
(cc [~mreutegg])
> DocumentNodeStoreBranch handling of non-recoverable DocumentStoreExceptions
> ---------------------------------------------------------------------------
>
> Key: OAK-7286
> URL: https://issues.apache.org/jira/browse/OAK-7286
> Project: Jackrabbit Oak
> Issue Type: Task
> Components: documentmk
> Reporter: Julian Reschke
> Assignee: Marcel Reutegger
> Priority: Major
> Fix For: 1.10.0
>
> Attachments: OAK-7286-DocumentStoreException.patch, OAK-7286-DocumentStoreException.patch, OAK-7286.diff, OAK-7286.diff
>
>
> In {{DocumentNodeStoreBranch.merge()}}, any {{DocumentStoreException}} is mapped to a {{DocumentStoreException}} to a {{CommitFailedException}} of type "MERGE", which leads to the operation being retried, and a non-helpful exception being generated.
> The effect can be observed by enabling a test in {{ValidNamesTest}}:
> {noformat}
> --- oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ValidNamesTest.java (Revision 1825371)
> +++ oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ValidNamesTest.java (Arbeitskopie)
> @@ -300,7 +300,6 @@
> public void testUnpairedHighSurrogateEnd() {
> // see OAK-5506
> org.junit.Assume.assumeFalse(super.fixture.toString().toLowerCase().contains("segment"));
> - org.junit.Assume.assumeFalse(super.fixture.toString().toLowerCase().contains("rdb"));
> nameTest("foo" + SURROGATE_PAIR[0]);
> }
> @@ -336,6 +335,7 @@
> assertEquals("paths should be equal", p.getPath(), n.getPath());
> return p;
> } catch (RepositoryException ex) {
> + ex.printStackTrace();
> fail(ex.getMessage());
> return null;
> }
> {noformat}
> The underlying issue is that {{RDBDocumentStore}} is throwing a {{DocumentStoreException}} due to the invalid ID, and repeating the call will not help.
> We probably should have a way to distinguish between different types of problems.
> I hacked {{DocumentNodeStoreBranch}} like that:
> {noformat}
> --- oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java (Revision 1825371)
> +++ oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java (Arbeitskopie)
> @@ -520,8 +520,12 @@
> } catch (ConflictException e) {
> throw e.asCommitFailedException();
> } catch(DocumentStoreException e) {
> - throw new CommitFailedException(MERGE, 1,
> - "Failed to merge changes to the underlying store", e);
> + if (e.getMessage().contains("Invalid ID")) {
> + throw new CommitFailedException(OAK, 123,
> + "Failed to store changes in the underlying store: " + e.getMessage(), e);
> + } else {
> + throw new CommitFailedException(MERGE, 1, "Failed to merge changes to the underlying store", e);
> + }
> } catch (Exception e) {
> throw new CommitFailedException(OAK, 1,
> "Failed to merge changes to the underlying store", e);
> {noformat}
> ...which causes the exception to surface immediately (see https://issues.apache.org/jira/secure/attachment/12912117/OAK-7286.diff).
> (cc [~mreutegg])
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)