From oak-issues-return-29522-apmail-jackrabbit-oak-issues-archive=jackrabbit.apache.org@jackrabbit.apache.org Tue Feb 2 10:19:38 2016 Return-Path: X-Original-To: apmail-jackrabbit-oak-issues-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-oak-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B8B31186D8 for ; Tue, 2 Feb 2016 10:19:38 +0000 (UTC) Received: (qmail 11479 invoked by uid 500); 2 Feb 2016 10:18:40 -0000 Delivered-To: apmail-jackrabbit-oak-issues-archive@jackrabbit.apache.org Received: (qmail 11447 invoked by uid 500); 2 Feb 2016 10:18:40 -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 11436 invoked by uid 99); 2 Feb 2016 10:18:40 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Feb 2016 10:18:40 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id C58942C1F57 for ; Tue, 2 Feb 2016 10:18:39 +0000 (UTC) Date: Tue, 2 Feb 2016 10:18:39 +0000 (UTC) From: =?utf-8?Q?Tomek_R=C4=99kawek_=28JIRA=29?= To: oak-issues@jackrabbit.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (OAK-2761) Persistent cache: add data in a different thread 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-2761?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D151280= 19#comment-15128019 ]=20 Tomek R=C4=99kawek commented on OAK-2761: ------------------------------------ Patch: https://github.com/trekawek/jackrabbit-oak/pull/6.diff Changes: https://github.com/trekawek/jackrabbit-oak/pull/6/files The invalidate() is still synchronous. Otherwise we have following situatio= n: (1) invalidate(K) -> removes from memCache and starts the process of persis= tent cache invalidation, (2) getIfPresent(K) -> reads from the persistent cache and puts back to the= memCache, (3) the value is finally removed from the persistent cache The patch passes all the tests. > Persistent cache: add data in a different thread > ------------------------------------------------ > > Key: OAK-2761 > URL: https://issues.apache.org/jira/browse/OAK-2761 > Project: Jackrabbit Oak > Issue Type: Bug > Components: cache, core, mongomk > Reporter: Thomas Mueller > Assignee: Thomas Mueller > Labels: resilience > Fix For: 1.4, 1.3.15 > > > The persistent cache usually stores data in a background thread, but some= times (if a lot of data is added quickly) the foreground thread is blocked. > Even worse, switching the cache file can happen in a foreground thread, w= ith the following stack trace. > {noformat} > "127.0.0.1 [1428931262206] POST /bin/replicate.json HTTP/1.1" prio=3D5 ti= d=3D0x00007fe5df819800 nid=3D0x9907 runnable [0x0000000113fc4000] > java.lang.Thread.State: RUNNABLE > ... > =09at org.h2.mvstore.MVStoreTool.compact(MVStoreTool.java:404) > =09at org.apache.jackrabbit.oak.plugins.document.persistentCache.Persiste= ntCache$1.closeStore(PersistentCache.java:213) > =09- locked <0x0000000782483050> (a org.apache.jackrabbit.oak.plugins.doc= ument.persistentCache.PersistentCache$1) > =09at org.apache.jackrabbit.oak.plugins.document.persistentCache.Persiste= ntCache.switchGenerationIfNeeded(PersistentCache.java:350) > =09- locked <0x0000000782455710> (a org.apache.jackrabbit.oak.plugins.doc= ument.persistentCache.PersistentCache) > =09at org.apache.jackrabbit.oak.plugins.document.persistentCache.NodeCach= e.write(NodeCache.java:85) > =09at org.apache.jackrabbit.oak.plugins.document.persistentCache.NodeCach= e.put(NodeCache.java:130) > =09at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.applyC= hanges(DocumentNodeStore.java:1060) > =09at org.apache.jackrabbit.oak.plugins.document.Commit.applyToCache(Comm= it.java:599) > =09at org.apache.jackrabbit.oak.plugins.document.CommitQueue.afterTrunkCo= mmit(CommitQueue.java:127) > =09- locked <0x0000000781890788> (a org.apache.jackrabbit.oak.plugins.doc= ument.CommitQueue) > =09at org.apache.jackrabbit.oak.plugins.document.CommitQueue.done(CommitQ= ueue.java:83) > =09at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.done(D= ocumentNodeStore.java:637) > {noformat} > To avoid blocking the foreground thread, one solution is to store all dat= a in a separate thread. If there is too much data added, then some of the d= ata is not stored. If possible, the data that was not referenced a lot, and= / or old revisions of documents (if new revisions are available). -- This message was sent by Atlassian JIRA (v6.3.4#6332)