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 1pp9YZ-0004da-TW for pgsql-hackers@arkaria.postgresql.org; Wed, 19 Apr 2023 15:17:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pp9YX-0000UY-Lk for pgsql-hackers@arkaria.postgresql.org; Wed, 19 Apr 2023 15:17:13 +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 1pp9YX-0000UJ-9t for pgsql-hackers@lists.postgresql.org; Wed, 19 Apr 2023 15:17:13 +0000 Received: from mail-qt1-x830.google.com ([2607:f8b0:4864:20::830]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1pp9YS-000hso-KQ for pgsql-hackers@postgresql.org; Wed, 19 Apr 2023 15:17:12 +0000 Received: by mail-qt1-x830.google.com with SMTP id ff18so10917913qtb.13 for ; Wed, 19 Apr 2023 08:17:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681917427; x=1684509427; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:from:to:cc:subject:date:message-id:reply-to; bh=HJm7oMwDlWN2jRxmHiIUH3ECYjwN53zf2WrD1lAIhvA=; b=XzlDhGEcvCGuOlUAIve+ndfxwxRuPrlH2OQOEpD/pRul5MM+gE3IPHmX7GPMKQeeoJ 0KoEp2DfHzmM/ovcxTPLvuddLqd60Z4UbWCcNwTFaUFklCLkuj7P8IQnA7/LW1NhT2jy skHWK6K5fqKhO+f0Ryn9/IanJ0QvioTUDi9vYlFLJbnTRmdSyBOq7ZeIsEwL2hefUqBI kbuECMfJ0EXTGjFoauBvoDr/TGVgltwEjik7bktYwylQbQuqN0/ZsadNvb330J0S0r61 q9W6AA6Tfnk291qDDSZn+MY1HVeOSnJPYqGruI014pBV1dRh4w5+E2tLxe5w96OgV5hz fG/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681917427; x=1684509427; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=HJm7oMwDlWN2jRxmHiIUH3ECYjwN53zf2WrD1lAIhvA=; b=J6KZ9HZIE0cV28C9VyQH9zpUkMjdHo/pbF0oD3eBtZ5rrrwYT0ikPaAFzUGG/RHuzh XDOCMk+ud8Dt9RribVStggpyIbtX07mfNzt5zlRxWO2OdtKDFe8pA1HxhksJ7RR4ei1g d0sWSFYNE3j391ruoSnPkWfa1EwvlEv+XFgCFnkq+WEdVvWKzCvI1aG6W32uqogojfG+ /yWuEPsRYEQd9CM2sD/N12pzOor+Gmw4A2jXIIA72P6LxnkFrUy7Hu08z5eXP11vm1X2 odlUfX+wvZ+YrD2TYjHCQq8pNrgKT27dy1sRVPhgplX+jd33Ga+8S9WMNUlzq5Sth0c3 dXvw== X-Gm-Message-State: AAQBX9dfT9Q/4Tnb8sJ8yoLDiJTAQNwF00PUH25B84hxKDYN/Noq6AVa LNGsw72inGMiZBj+Jw6I3Io= X-Google-Smtp-Source: AKy350Z6tnLjbcnktRJgZ0+2U8vrXQrkw8f+mBi9SyyVXXsGPZ9A0zbGSBI4RFUmHEgkyEvSYJDFag== X-Received: by 2002:ac8:590e:0:b0:3ef:414c:7e8 with SMTP id 14-20020ac8590e000000b003ef414c07e8mr6025234qty.30.1681917426979; Wed, 19 Apr 2023 08:17:06 -0700 (PDT) Received: from liskov ([2600:4040:7eef:cc01:f92:c8b0:7696:8007]) by smtp.gmail.com with ESMTPSA id i2-20020a05620a404200b007468765b411sm4742798qko.45.2023.04.19.08.17.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 08:17:06 -0700 (PDT) Date: Wed, 19 Apr 2023 11:17:04 -0400 From: Melanie Plageman To: Thomas Munro Cc: Andres Freund , Richard Guo , PostgreSQL-development Subject: Re: Wrong results from Parallel Hash Full Join Message-ID: <20230419151704.xkkobswffutslj34@liskov> Mail-Followup-To: Thomas Munro , Andres Freund , Richard Guo , PostgreSQL-development References: <20230412181452.cyfduw2ka2atqmii@awork3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Apr 12, 2023 at 08:31:26PM -0400, Melanie Plageman wrote: > On Wed, Apr 12, 2023 at 6:50 PM Thomas Munro wrote: > > And if we're going to > > exercise/test that case, should we do the non-parallel version too? > > I've added this. I thought if we were adding the serial case, we might > as well add the multi-batch case as well. However, that proved a bit > more challenging. We can get a HOT tuple in one of the existing tables > with no issues. Doing this and then deleting the reset match bit code > doesn't cause any of the tests to fail, however, because we use this > expression as the join condition when we want to emit NULL-extended > unmatched tuples. > > select count(*) from simple r full outer join simple s on (r.id = 0 - s.id); > > I don't think we want to add yet another time-consuming test to this > test file. So, I was trying to decide if it was worth changing these > existing tests so that they would fail when the match bit wasn't reset. > I'm not sure. I couldn't stop thinking about how my explanation for why this test didn't fail sounded wrong. After some further investigation, I found that the real reason that the HOT bit is already cleared in the tuples inserted into the hashtable for this query is that the tuple descriptor for the relation "simple" and the target list for the scan node are not identical (because we only need to retain a single column from simple in order to eventually do count(*)), so we make a new virtual tuple and build projection info for the scan node. The virtual tuple doesn't have the HOT bit set anymore (the buffer heap tuple would have). So we couldn't fail a test of the code clearing the match bit. Ultimately this is probably fine. If we wanted to modify one of the existing tests to cover the multi-batch case, changing the select count(*) to a select * would do the trick. I imagine we wouldn't want to do this because of the excessive output this would produce. I wondered if there was a pattern in the tests for getting around this. But, perhaps we don't care enough to cover this code. - Melanie