jackrabbit-oak-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Mueller (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OAK-3872) [RDB] Updated blob still deleted even if deletion interval lower
Date Wed, 13 Jan 2016 07:51:39 GMT

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

Thomas Mueller commented on OAK-3872:
-------------------------------------

The patch looks good to me. I think the bug in the original code was that the comparison was
wrong:

{noformat}
// correct:
// delete only if the last modified is older than x
metaStatement.append(" and LASTMOD <= ?");

// wrong:
// delete only if there is NO entry where the last modified of the meta is older than x
dataStatement.append(" and not exists(select * from " + this.tnMeta + " m where ID = m.ID
and m.LASTMOD <= ?)");

// correct would also be:
// delete if there is NO entry where the last modified of the meta is YOUNGER than x
dataStatement.append(" and not exists(select * from " + this.tnMeta + " m where ID = m.ID
and m.LASTMOD > ?)");
{noformat}

But the patch is also fine. The logic is a bit different: delete if there is no meta record.
This is correct if the meta record is removed before the data record. Please note it would
not be correct if the data record is removed before the meta record, which is the case:

{noformat}
count += prepMeta.executeUpdate();
prepData.execute();
{noformat}

I guess it would be good to add comments in the code, to avoid adding bugs later on.

> [RDB] Updated blob still deleted even if deletion interval lower
> ----------------------------------------------------------------
>
>                 Key: OAK-3872
>                 URL: https://issues.apache.org/jira/browse/OAK-3872
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: blob, rdbmk
>            Reporter: Amit Jain
>            Assignee: Julian Reschke
>         Attachments: OAK_3872.patch
>
>
> If an existing blob is uploaded again, the timestamp of the existing entry is updated
in the meta table. Subsequently if a call to delete (RDBBlobStore#countDeleteBlobs) is made
with {{maxLastModifiedTime}} parameter of less than the updated time above, the entry in the
meta table is not touched but the data table entry is wiped out. 
> Refer https://github.com/apache/jackrabbit-oak/blob/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStore.java#L510



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message