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/09/17 11:39:00 UTC

[jira] [Commented] (OAK-7389) Mongo/FileBlobStore does not update timestamp for already existing blobs

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

Julian Reschke commented on OAK-7389:
-------------------------------------

1.0 is failing now (removed the fixVersion for 1.0.43 for that reason):

{noformat}
deleteUpdatedBlob(org.apache.jackrabbit.oak.spi.blob.FileBlobStoreTest)  Time elapsed: 1.361 sec  <<< FAILURE!
java.lang.AssertionError: Deleted updated blobs
        at org.junit.Assert.fail(Assert.java:88)
        at org.junit.Assert.assertTrue(Assert.java:41)
        at org.junit.Assert.assertFalse(Assert.java:64)
        at org.apache.jackrabbit.oak.spi.blob.AbstractBlobStoreTest.deleteUpdatedBlob(AbstractBlobStoreTest.java:446)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        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.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

Running org.apache.jackrabbit.oak.spi.blob.MemoryBlobStoreTest
Tests run: 16, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.206 sec <<< FAILURE!
deleteUpdatedBlob(org.apache.jackrabbit.oak.spi.blob.MemoryBlobStoreTest)  Time elapsed: 1.102 sec  <<< FAILURE!
java.lang.AssertionError: Deleted updated blobs
        at org.junit.Assert.fail(Assert.java:88)
        at org.junit.Assert.assertTrue(Assert.java:41)
        at org.junit.Assert.assertFalse(Assert.java:64)
        at org.apache.jackrabbit.oak.spi.blob.AbstractBlobStoreTest.deleteUpdatedBlob(AbstractBlobStoreTest.java:446)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        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.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)


Results :

Failed tests:   deleteUpdatedBlob(org.apache.jackrabbit.oak.spi.blob.FileBlobStoreTest): Deleted updated blobs
  deleteUpdatedBlob(org.apache.jackrabbit.oak.spi.blob.MemoryBlobStoreTest): Deleted updated blobs

{noformat}

> Mongo/FileBlobStore does not update timestamp for already existing blobs
> ------------------------------------------------------------------------
>
>                 Key: OAK-7389
>                 URL: https://issues.apache.org/jira/browse/OAK-7389
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: blob
>    Affects Versions: 1.2.14, 1.4.20, 1.8.2, 1.6.11
>            Reporter: Amit Jain
>            Assignee: Amit Jain
>            Priority: Critical
>             Fix For: 1.9.0, 1.10, 1.2.30, 1.4.23, 1.6.14, 1.8.7
>
>         Attachments: OAK-7389-v1.patch, OAK-7389-v2.patch
>
>
> MongoBlobStore uses uses the {{insert}} call and ignores any exceptions which means any existing value won't be updated.
> {code:java}
>     @Override
>     protected void storeBlock(byte[] digest, int level, byte[] data) throws IOException {
>         String id = StringUtils.convertBytesToHex(digest);
>         cache.put(id, data);
>         // Check if it already exists?
>         MongoBlob mongoBlob = new MongoBlob();
>         mongoBlob.setId(id);
>         mongoBlob.setData(data);
>         mongoBlob.setLevel(level);
>         mongoBlob.setLastMod(System.currentTimeMillis());
>         // TODO check the return value
>         // TODO verify insert is fast if the entry already exists
>         try {
>             getBlobCollection().insertOne(mongoBlob);
>         } catch (DuplicateKeyException e) {
>             // the same block was already stored before: ignore
>         } catch (MongoException e) {
>             if (e.getCode() == DUPLICATE_KEY_ERROR_CODE) {
>                 // the same block was already stored before: ignore
>             } else {
>                 throw new IOException(e.getMessage(), e);
>             }
>         }
>     }
> {code}
>  FileBlobStore also returns if there's a file already existing without updating the timestamp
> {code:java}
>     @Override
>     protected synchronized void storeBlock(byte[] digest, int level, byte[] data) throws IOException {
>         File f = getFile(digest, false);
>         if (f.exists()) {
>             return;
>         }
>         .........
> {code}
> The above would cause data loss in DSGC if there are updates to the blob blocks which are re-surrected (stored again at the time of DSGC) because the timestamp would never have been modified.
>  
> cc/ [~tmueller], [~mreutegg], [~chetanm], [~catholicon]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)