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/03/05 14:27:00 UTC
[jira] [Comment Edited] (OAK-7286) DocumentNodeStoreBranch handling
of non-recoverable DocumentStoreExceptions
[ https://issues.apache.org/jira/browse/OAK-7286?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16386128#comment-16386128 ]
Julian Reschke edited comment on OAK-7286 at 3/5/18 2:26 PM:
-------------------------------------------------------------
It seems that now the {{DocumentStoreException}} thrown by RDB on invalid IDs surfaces on the JCR level as it. Is that intended?
{noformat}
java.lang.AssertionError: OakOak0001: org.apache.jackrabbit.oak.plugins.document.DocumentStoreException: Invalid ID: 2:/test_node/foo?
at org.junit.Assert.fail(Assert.java:88)
at org.apache.jackrabbit.oak.jcr.ValidNamesTest.nameTest(ValidNamesTest.java:335)
at org.apache.jackrabbit.oak.jcr.ValidNamesTest.testUnpairedHighSurrogateEnd(ValidNamesTest.java:303)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
{noformat}
was (Author: reschke):
It seems that now the {{DocumentStoreException}} thrown by RDB on invalid IDs surfaces on the JCR level as it. Is that intended?
> 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.9.0, 1.10
>
> Attachments: 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 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])
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)