From oak-issues-return-60981-archive-asf-public=cust-asf.ponee.io@jackrabbit.apache.org Thu Apr 5 14:56:05 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id A939118064F for ; Thu, 5 Apr 2018 14:56:04 +0200 (CEST) Received: (qmail 23012 invoked by uid 500); 5 Apr 2018 12:56:02 -0000 Mailing-List: contact oak-issues-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: oak-dev@jackrabbit.apache.org Delivered-To: mailing list oak-issues@jackrabbit.apache.org Received: (qmail 22999 invoked by uid 99); 5 Apr 2018 12:56:02 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Apr 2018 12:56:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id E4858181434 for ; Thu, 5 Apr 2018 12:56:01 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.511 X-Spam-Level: X-Spam-Status: No, score=-109.511 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id ll87j6mEvTqH for ; Thu, 5 Apr 2018 12:56:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id D3D2A5F4E7 for ; Thu, 5 Apr 2018 12:56:00 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 692C3E024A for ; Thu, 5 Apr 2018 12:56:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 28D502561D for ; Thu, 5 Apr 2018 12:56:00 +0000 (UTC) Date: Thu, 5 Apr 2018 12:56:00 +0000 (UTC) From: "Thomas Mueller (JIRA)" To: oak-issues@jackrabbit.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (OAK-7389) Mongo/FileBlobStore does not update timestamp for already existing blobs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/OAK-7389?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D164268= 69#comment-16426869 ]=20 Thomas Mueller commented on OAK-7389: ------------------------------------- I'm not sure, but I would probably try this: the query part just contain KE= Y_ID =3D id; the "$set" part just contain KEY_LAST_MOD =3D System.currentTi= meMillis(), and "$setOnInsert" part contain all other fields (except for KE= Y_LAST_MOD and not KEY_ID). > 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.2.30 > > Attachments: OAK-7389-v1.patch > > > MongoBlobStore uses uses the {{insert}} call and ignores any exceptions w= hich means any existing value won't be updated. > {code:java} > @Override > protected void storeBlock(byte[] digest, int level, byte[] data) thro= ws IOException { > String id =3D StringUtils.convertBytesToHex(digest); > cache.put(id, data); > // Check if it already exists? > MongoBlob mongoBlob =3D 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() =3D=3D DUPLICATE_KEY_ERROR_CODE) { > // the same block was already stored before: ignore > } else { > throw new IOException(e.getMessage(), e); > } > } > } > {code} > =C2=A0FileBlobStore also returns if there's a file already existing witho= ut updating the timestamp > {code:java} > @Override > protected synchronized void storeBlock(byte[] digest, int level, byte= [] data) throws IOException { > File f =3D 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 th= e timestamp would never have been modified. > =C2=A0 > cc/ [~tmueller], [~mreutegg], [~chetanm], [~catholicon] -- This message was sent by Atlassian JIRA (v7.6.3#76005)