Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fiS0D-0004K6-EO for pgsql-bugs@arkaria.postgresql.org; Wed, 25 Jul 2018 22:11:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fiS0A-0001R0-T9 for pgsql-bugs@arkaria.postgresql.org; Wed, 25 Jul 2018 22:11:22 +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 1fiS0A-0001Qs-Iv for pgsql-bugs@lists.postgresql.org; Wed, 25 Jul 2018 22:11:22 +0000 Received: from mail-qt0-x22b.google.com ([2607:f8b0:400d:c0d::22b]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fiS07-0006xE-0S for pgsql-bugs@postgresql.org; Wed, 25 Jul 2018 22:11:22 +0000 Received: by mail-qt0-x22b.google.com with SMTP id h4-v6so9275534qtj.7 for ; Wed, 25 Jul 2018 15:11:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=xwZA4coEKLhz4Su+RtJ88V33SB27/tWNBtV9BCBHNxI=; b=OXm1otaA5+e3tIC91TZ/VvZ6/m1086znRz5iJeBCra44spvwWIbC8+aueRSi+lzsuO iUAuDu5CRyAIN/U9dXJQjuuzppaEDvIfE/flH6zln4ARR2Zgv8V4H8OTSqoiJlFr8sVE Wor0xJjlgOg0s36PEngoASRNIcxs0UDZ8aOfQXF3Ctp1lRIqcTHJhh25Hy/VN0vMCDNO gFPEK9FBEAAWyGmKwaRqjjoq5ERwqNRMU4kiNr4CX32sbZvf45QKgRxVQhzq6Z7TN1ik I7NcrJ/GafFt4P0INDdoEojU/es4pHfXP++QOe9p7jCJahq2ZlNTlbU8F335qOQH5jr7 KwYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=xwZA4coEKLhz4Su+RtJ88V33SB27/tWNBtV9BCBHNxI=; b=hj/A2dLxHQY4SRINqIJUosfFwjYxFZh5aTeMtE6Sz/m9Q6mARBvn3eB3pL+j3JTb5K w6Z/i1SZQUbwV746qFNNhnFnFk4uK1OnBbS9u4XSee1fq8kAp2xGIOkm1lkgssSJaBU3 7C+jRv4F5xXc5RZVbYShXd3+nQzfpJuPSy9qXWexVaNehcI7/KyUI7qzNwgchV76pS5R skjYYWYNuZaVG6sjQIqR88i/kIGHMBYT5H2v2d8M46LZCVdfBzhH8JRRZOcNeFfFNxT4 lJpJeZQhfYdqlVkIOkCRJ4lNwfq3/S4jxyHj++GqXCZ05Xu4SX3hwvCaNxXre1XPKNzc odeg== X-Gm-Message-State: AOUpUlF/vx8g9sCPiCieLbdZG6y5z2dHv8jMlynnakdvjXGJWHGltZgx 7eP0u/gNSFpwlg6WnMN2XqFqvA== X-Google-Smtp-Source: AAOMgpf08uFF7IjPN0Pz6uoNnJiHf4fsJ+IUI8GKgHx9hxOmUcqGEOC8+Ne92blR71mOe2vPJvSZFQ== X-Received: by 2002:a0c:e2c4:: with SMTP id t4-v6mr20881553qvl.167.1532556675973; Wed, 25 Jul 2018 15:11:15 -0700 (PDT) Received: from alvin.alvh.no-ip.org ([179.56.48.71]) by smtp.gmail.com with ESMTPSA id a6-v6sm6530414qth.8.2018.07.25.15.11.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Jul 2018 15:11:15 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 165144ED; Wed, 25 Jul 2018 18:11:13 -0400 (-04) Date: Wed, 25 Jul 2018 18:11:13 -0400 From: Alvaro Herrera To: Andres Freund Cc: Dmitry Dolgov <9erthalion6@gmail.com>, Michael Paquier , PostgreSQL-development , PostgreSQL mailing lists Subject: Re: LLVM jit and matview Message-ID: <20180725221113.q5bsc2qqnhbghxtt@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180725214702.6v7jxi2zkcv3exar@alap3.anarazel.de> User-Agent: NeoMutt/20170306-137-4415bd-dirty (1.8.0) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2018-Jul-25, Andres Freund wrote: > The fix is easy, releasing the JIT context should just happen in > FreeExecutorState(). Only thing is that that function has the following > comment in the header: > * Note: this is not responsible for releasing non-memory resources, > * such as open relations or buffer pins. But it will shut down any > * still-active ExprContexts within the EState. That is sufficient > * cleanup for situations where the EState has only been used for expression > * evaluation, and not to run a complete Plan. > > I don't really think throwing away functions is a violation of that, but > I think it's possible to argue the other way? I suppose the other possible way about it is to say estate->es_jit in a local variable so that you can call it after FreeExecutorState. But what would be the advantage of avoiding the context release inside FreeExecutorState? It seems pretty appropriate to me to do it there. You could argue that the JIT context is definitely part of the estate being freed. Just amend the comment, no? -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services