Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ebA2F-00013P-V4 for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Jan 2018 19:03:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ebA2D-0008Mh-VF for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Jan 2018 19:03:05 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ebA2D-0008MX-GF for pgsql-hackers@lists.postgresql.org; Mon, 15 Jan 2018 19:03:05 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ebA29-0002kB-3x for pgsql-hackers@postgresql.org; Mon, 15 Jan 2018 19:03:03 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 3F8CF21C1C46; Mon, 15 Jan 2018 22:02:59 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from arthur.localdomain (unknown [94.29.3.222]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 075B021C1C41; Mon, 15 Jan 2018 22:02:59 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1516042979; bh=LJC2rLtkU7REmKog4AuiOsW6nvIxShg61hTAGD+ck8g=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=M5eFwrZsDQWLpfAki64oWDHsyDV2R4zX77ByPkCr2Fhg7OrZdu/P/72G0vtywGxE6 HnOYP/k37X9UC0IDivg8IbnoyeIk/U+FSoExHtqKvljXj0Ln0LHorU6YC1AN5SsfaF 9Eq7ndKtze/7Z02jOWxqKr4xKNcp7J82x6tFzRfE= Date: Mon, 15 Jan 2018 22:02:57 +0300 From: Arthur Zakirov To: Tomas Vondra Cc: pgsql-hackers Subject: Re: [PROPOSAL] Shared Ispell dictionaries Message-ID: <20180115190104.GA2622@arthur.localdomain> References: <20171226164825.GA29922@zakirov.localdomain> <20171231152811.GA4233@arthur.localdomain> <20180107190526.GA27803@arthur.localdomain> <404f06c5-c7a3-3313-1a64-25f08ba089ad@2ndquadrant.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <404f06c5-c7a3-3313-1a64-25f08ba089ad@2ndquadrant.com> User-Agent: Mutt/1.9.2 (2017-12-15) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sat, Jan 13, 2018 at 10:33:14PM +0100, Tomas Vondra wrote: > Not sure if we really need to add the database/schema OIDs. I mentioned > the unexpected consequences (cross-db sharing) but maybe that's a > feature we should keep (it reduces memory usage). So perhaps this should > be another CREATE TEXT SEARCH DICTIONARY parameter, allowing sharing the > dictionary with other databases? > > Aren't we overengineering this? Another related problem I've noticed is memory leak. When a dictionary loaded and then dropped it won't be unloaded. I see several approaches: 1 - Use Oid of the dictionary itself as the key instead dictfile and afffile. When the dictionary is dropped it will be easily unloaded if it was loaded. Implementing should be easy, but the drawback is more memory consumption. 2 - Use reference counter with cross-db sharing. When the dictionary is loaded the counter increases. If all record of loaded dictionary is dropped it will be unloaded. 3 - Or reference counters without cross-db sharing to avoid possible confusing. Here dictfile, afffile and database Oid will be used as the key. -- Arthur Zakirov Postgres Professional: http://www.postgrespro.com Russian Postgres Company