Return-Path: X-Original-To: apmail-jackrabbit-oak-dev-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-oak-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D0C5610217 for ; Tue, 3 Dec 2013 05:04:39 +0000 (UTC) Received: (qmail 62391 invoked by uid 500); 3 Dec 2013 05:04:39 -0000 Delivered-To: apmail-jackrabbit-oak-dev-archive@jackrabbit.apache.org Received: (qmail 62204 invoked by uid 500); 3 Dec 2013 05:04:36 -0000 Mailing-List: contact oak-dev-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-dev@jackrabbit.apache.org Received: (qmail 62188 invoked by uid 99); 3 Dec 2013 05:04:34 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Dec 2013 05:04:34 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of chetan.mehrotra@gmail.com designates 209.85.214.176 as permitted sender) Received: from [209.85.214.176] (HELO mail-ob0-f176.google.com) (209.85.214.176) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Dec 2013 05:04:29 +0000 Received: by mail-ob0-f176.google.com with SMTP id va2so13776003obc.21 for ; Mon, 02 Dec 2013 21:04:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=7mjoPYSFQRgqJIqlb8ooJ3fKK6RJWc14cEEmtTTwx3U=; b=vtzn5WkNNb9+TBXj/Aj4LmDd/gcRdzvjTZw1UxIOUqcSSgXj43gNRitoJWqQDvGWdQ o4axyw84YWHNPb/vtFutDsQELEDDvVndSWoHQVjRJIJgCn43MpWbzZbh7mBXw91b22JP xAn+xBL+4SW1CuBVg8p6W15bMo60S6mDJI8106A+pZwDFsF8XVszGO5uwgXko3IM1B7v QtNnkWrKDw/Qn7Dyl9UMq9ZewVoHftlgOp29y5g1u+n3RiSviBW0IJS7uVYEH88dFLOn tqXJPp51GMerqZh20bS2muBeFhzVuSoJyABoy6KiveLddZJXOuEMwYKJGmv8i9fpCU0h zGyw== MIME-Version: 1.0 X-Received: by 10.60.78.227 with SMTP id e3mr57613633oex.5.1386047047717; Mon, 02 Dec 2013 21:04:07 -0800 (PST) Received: by 10.60.148.228 with HTTP; Mon, 2 Dec 2013 21:04:07 -0800 (PST) In-Reply-To: <20131202134332.6C79023889CB@eris.apache.org> References: <20131202134332.6C79023889CB@eris.apache.org> Date: Tue, 3 Dec 2013 10:34:07 +0530 Message-ID: Subject: Re: svn commit: r1547017 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoNodeStore.java test/java/org/apache/jackrabbit/oak/plugins/mongomk/BackgroundWriteTest.java From: Chetan Mehrotra To: oak-dev@jackrabbit.apache.org Cc: oak-commits@jackrabbit.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Hi Marcel, Probably below code can be simplified using the Lists.partition(list,size) [1] > - // update if this is the last path or > - // revision is not equal to last revision > - if (i + 1 >= paths.size() || size == ids.size()) { > + // call update if any of the following is true: > + // - this is the last path > + // - revision is not equal to last revision (size of ids didn't change) > + // - the update limit is reached > + if (i + 1 >= paths.size() > + || size == ids.size() > + || ids.size() >= BACKGROUND_MULTI_UPDATE_LIMIT) { > store.update(Collection.NODES, ids, updateOp); > for (String id : ids) { > unsavedLastRevisions.remove(Utils.getPathFromId(id)); > Chetan Mehrotra [1] http://docs.guava-libraries.googlecode.com/git-history/release/javadoc/com/google/common/collect/Lists.html#partition(java.util.List, int)