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 "Amit Jain (JIRA)" <ji...@apache.org> on 2018/04/05 06:52:00 UTC
[jira] [Updated] (OAK-7389) MongoBlobStore does not update
timestamp for already existing blobs
[ https://issues.apache.org/jira/browse/OAK-7389?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Amit Jain updated OAK-7389:
---------------------------
Fix Version/s: 1.2.30
> MongoBlobStore 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: documentmk
> Affects Versions: 1.2.14, 1.4.20, 1.8.2, 1.6.11
> Reporter: Amit Jain
> Priority: Critical
> Fix For: 1.2.30
>
>
> 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}
>
> 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)