Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f2Ip1-0007FZ-JB for pgsql-hackers@arkaria.postgresql.org; Sat, 31 Mar 2018 15:53:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f2Ioz-0001VW-Rv for pgsql-hackers@arkaria.postgresql.org; Sat, 31 Mar 2018 15:53:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f2Ioz-0001VM-Ko for pgsql-hackers@lists.postgresql.org; Sat, 31 Mar 2018 15:53:37 +0000 Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1f2Iov-0008Ho-Qk for pgsql-hackers@postgresql.org; Sat, 31 Mar 2018 15:53:36 +0000 Received: by mail-wm0-x22e.google.com with SMTP id r131so20743738wmb.2 for ; Sat, 31 Mar 2018 08:53:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=hf6N6ph7SK5yEuVQD6O26VEIxvgvM/7q6VLkQ2/Bhc8=; b=CjmhDurk1kNPy9E4YIoZxx42Z/pvK4HR0Wngit7TmxJ1aJTJiRyewVp+YIcgWfI13H XEelkeOd8k+EQzr0hGElq98P7u/+Nvi53+7ctaHL7pRCY2rTxfRu13grnaBTTEW1znM9 Ne/wZMIEhxsI3/sKbEr3marzV7/caWgGsU4+omTeqEzk6EVjCw6+prLWdiDPXRsHwS++ rElLb4mfVbc7SYmgma/EatTNdvayLw8TKcibdAKpVLtMRLY9iMXCjF4BNkk0c9pOJ2Er mzBtSYmECBcQelxG/e84W3nDBGK353kK0aPXBb4itF6fadcoRYMB9Vak5E9XN7N9vi/1 r0Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=hf6N6ph7SK5yEuVQD6O26VEIxvgvM/7q6VLkQ2/Bhc8=; b=sF7K/Z3OCkccfuH/cskIYes2M/5aS+/E+Wgm215IA8EVlJe4PcWQXfEJjPhG8VoASi da1f2N7UUu24+k91lmRusg8FL4BDMf9E2eQs4nI/ObTEerzxfZ06T9lYgNZN07gkgxU5 cJt6515bogxpdCT8tD33La4x4r0R1Mqtku10QaboWl16lSEsFUTt4lXpSOFqZRFXJwpz cI8GHrsPa0ai9UJM5qMeBnlZaWPtm9lBGo3kwTqylHDf7j+Rv0WRV+w34h9f3SsBmqmh Uhgrf2en/RXd1sqIabcau1RFtnY2Z2YLQ6M7jxkUKVFeoEJWm1QEwcOgJuq0qSr1Ymec w9wA== X-Gm-Message-State: AElRT7FnWk5+L0Z17ci1+H9xILesJBFDLxQW1BnDCq6hVmgSzTGcBI23 89EJ/2dfTJssTd8PjE83pm5FlZxSdrKMg9/ifdcOkXqzviToShrJPT2ea6kzwaWK1vb+lwu6ZsB RIaY0wBnxTgxA5P19jV0/oiW2LYJcZLjkm5Ziot1sCh7BuWWk51hUgkXbN4kMQ+Zu1NR4wQRH8S AHhxVI1GIP X-Google-Smtp-Source: AIpwx4/DE9ECHm2F+zrV6iEnPrIdiqPmzHt1IWIeDu/p90yzZcf+JFTPYSEKOt4+K2SrT5Nv+Au3oA== X-Received: by 10.28.108.5 with SMTP id h5mr5290421wmc.100.1522511610907; Sat, 31 Mar 2018 08:53:30 -0700 (PDT) Received: from [10.137.2.19] (ip-78-102-97-226.net.upcbroadband.cz. [78.102.97.226]) by smtp.gmail.com with ESMTPSA id n11sm1472265wre.50.2018.03.31.08.53.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 31 Mar 2018 08:53:25 -0700 (PDT) Subject: Re: [PROPOSAL] Shared Ispell dictionaries To: Arthur Zakirov , Tom Lane Cc: Pavel Stehule , Andres Freund , Ildus Kurbangaliev , pgsql-hackers References: <20180319110648.GA32319@zakirov.localdomain> <2ae9588a-f3cb-777d-1958-c76c22225823@2ndquadrant.com> <20180320131149.GA12884@zakirov.localdomain> <20180321090050.GA21751@zakirov.localdomain> <20180322105603.GA23544@zakirov.localdomain> <28250.1521924996@sss.pgh.pa.us> <20180328135143.GA13322@zakirov.localdomain> <20180328230305.GA29598@arthur.localdomain> From: Tomas Vondra Message-ID: <5b6ab077-8566-4e04-9d1d-00ab811f0338@2ndquadrant.com> Date: Sat, 31 Mar 2018 17:53:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 03/31/2018 12:42 PM, Arthur Zakirov wrote: > Hello all, > > I'd like to add new optional function to text search template named fini > in addition to init() and lexize(). It will be called by > RemoveTSDictionaryById() and AlterTSDictionary(). dispell_fini() will > call ts_dict_shmem_release(). > > It doesn't change segments leaking situation. I think it makes text > search API more transparent. > If it doesn't actually solve the problem, why add it? I don't see a point in adding functions for the sake of transparency, when it does not in fact serve any use cases. Can't we handle the segment-leaking by adding some sort of tombstone? For example, imagine that instead of removing the hash table entry we mark it as 'dropped'. And after that, after the lookup we would know the dictionary was removed, and the backends would load the dictionary into their private memory. Of course, this could mean we end up having many tombstones in the hash table. But those tombstones would be tiny, making it less painful than potentially leaking much more memory for the dictionaries. Also, I wonder if we might actually remove the dictionaries after a while, e.g. based on XID. Imagine that we note the XID of the transaction removing the dictionary, or perhaps XID of the most recent running transaction. Then we could use this to decide if all running transactions actually see the DROP, and we could remove the tombstone. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services