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 2018/02/26 20:57:00 UTC
[jira] [Created] (OAK-7286) DocumentNodeStoreBranch handling of
non-recoverable DocumentStoreExceptions
Julian Reschke created OAK-7286:
-----------------------------------
Summary: 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
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.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)