Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lMyBy-0008KB-DY for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Mar 2021 19:20:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lMyBw-0005NN-PJ for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Mar 2021 19:20:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lMyBw-0005NG-Dj for pgsql-hackers@lists.postgresql.org; Thu, 18 Mar 2021 19:20:20 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lMyBp-0002DK-3u for pgsql-hackers@lists.postgresql.org; Thu, 18 Mar 2021 19:20:18 +0000 Received: by mail-ed1-x535.google.com with SMTP id h10so8029681edt.13 for ; Thu, 18 Mar 2021 12:20:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-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=f0iKAjxQHxxYJNUaep09pySIpTVQU3VNg4cE/kNiXsU=; b=MCuagEl+6fkxKjhGDlGGGv+YwX6PUKfiFW4VApqdzM1K6TuSuYDJAgSr7O0ih8DfdI pu6f7OjUgUtCkqcvJaniv/PUoITzhQ5iKhecmtmZYGnK8GZLR/FDGC89GlNPbSE6X1Pc kqzdQ4SaI+dheM5SAzff/ysGrh7HGvtqB9hp40UIrCBNy5H9xUiRK+RVJO3uM7jn9Jfc CiT33Jzdj0hkcvBDZWFavL+GBf88XK+omTsrXLZnJYglYN74QkJUt5uoJogXi6n/2c/g dcN1IMMKlsF/iy91cHVVw/x1ritCkUUiT5yEU4H+lmOSDmEMOrAZt7UpMv64U7fd2fNY gKPA== 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=f0iKAjxQHxxYJNUaep09pySIpTVQU3VNg4cE/kNiXsU=; b=Ez+lfWxCdlcV/bn5nYNILKq52vd38uao7kFI9pupcpSCmjW5ooFCPunwwrLsO5kuOK 1KmI+gdZzdVQTjvr4VnlMxMPHJEZIs3Zx9PI6GzV5q5xbooltoyy3unnh+3AXjaaC+/4 W9X10FlqvMoG/QxwJSuImRvRGXsQZOA8rY6uFJG0oBvh8MJvG5M6xglHMK/DRkPH1eO5 n+M+dACTFoelBhmTy2sVFUkJblEX5omRdxDe3VbyuyAt95p6+tFVrGDRZ5lvd282GRaV 2M9WN/+qTh2kK8zeLkT8O4eIXg5Jb23OJZzUnXNQPFcXa4NWAtHMVb3dFvHUP2IoeeV6 Fv+g== X-Gm-Message-State: AOAM533UG4bcE5URlLZsmPDjKyc9+aSaCl6Q97nZk7M/xzYCHx4Dj4fk meYP+krj2pEzmK0lZzWZq+HJRpDV6Ebd60lenxGsXYJebah4g9Pq8TU8sbQZOP+lbH8CXf8o2iS bkGjqDGPwihWA5Kq7T/9aVX6d2+BpvOzyYiIp6Sag46WFfD+UN1C7Vkc3ljnONY2NzrbnyTP5NB QjJC9NFZbVQ3WSo+5pbov9AJscp5gGDpC4nmybP0a06GsLHpZPUoGn X-Google-Smtp-Source: ABdhPJy1RCMZGAhMyydapTsvqj7Q19bqdhqKcJpHBZMnUiMVzQf2tFhG1wxJkHKsvjkjZD4+wOS8aA== X-Received: by 2002:aa7:d94c:: with SMTP id l12mr5357513eds.311.1616095211618; Thu, 18 Mar 2021 12:20:11 -0700 (PDT) Received: from [10.137.0.20] (ip-86-49-253-127.net.upcbroadband.cz. [86.49.253.127]) by smtp.gmail.com with ESMTPSA id r25sm2216706edv.78.2021.03.18.12.20.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Mar 2021 12:20:10 -0700 (PDT) Subject: Re: cleanup temporary files after crash To: Euler Taveira , Thomas Munro , Michael Paquier Cc: Euler Taveira , Anastasia Lubennikova , Tomas Vondra , PostgreSQL Hackers , Tom Lane References: <20201028184252.5vpoe65kcfebbmmf@development> <20201101012555.GC3000@paquier.xyz> <1982ee3c-54c3-280a-806a-fd28ad8f19e6@postgrespro.ru> <363cb85c-3a03-9a49-b830-8b645c1241d9@enterprisedb.com> <4245d284-97b2-4056-96c2-455792d9b564@www.fastmail.com> <8740f056-a7c0-ff12-0a50-de5324a928ee@enterprisedb.com> <822e3a60-56a1-219d-c473-365751c3e108@enterprisedb.com> From: Tomas Vondra Message-ID: Date: Thu, 18 Mar 2021 20:20:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <822e3a60-56a1-219d-c473-365751c3e108@enterprisedb.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/18/21 6:51 PM, Tomas Vondra wrote: > Hmm, > > crake and florican seem to have failed because of this commit, with this > error in the new TAP test: > > error running SQL: 'psql::1: ERROR: could not open directory > "base/pgsql_tmp": No such file or directory' > while running 'psql -XAtq -d port=64336 host=/tmp/sv1WjSvj3P > dbname='postgres' -f - -v ON_ERROR_STOP=1' with sql 'SELECT COUNT(1) > FROM pg_ls_dir($$base/pgsql_tmp$$)' at > /home/andrew/bf/root/HEAD/pgsql.build/../pgsql/src/test/perl/PostgresNode.pm > line 1572. > > So it seems the pgsql_tmp directory does not exist, for some reason. > Considering the directory should be created for the first temp file, > that either means the query in the TAP test does not actually create a > temp file on those machines, or it gets killed too early. > > The 500 rows used by the test seems fairly low, so maybe those machines > can do the sort entirely in memory? > > The other option is that the sleep in the TAP test is a bit too short, > but those machines don't seem to be that slow. > > Anyway, TAP test relying on timing like this may not be the best idea, > so I wonder how else to test this ... > I think a better way to test this would be to use a tuple lock: setup: create table t (a int unique); session 1: begin; insert into t values (1); ... keep open ... session 2: begin; set work_mem = '64kB'; insert into t select i from generate_series(1,10000) s(i); ... should block ... Then, once the second session gets waiting on the tuple, kill the backend. We might as well test that there actually is a temp file first, and then test that it disappeared. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company