Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jEy7t-0000qs-GF for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Mar 2020 16:34:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jEy7s-0007K7-92 for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Mar 2020 16:34:32 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1jEy7r-0007Gn-U2 for pgsql-hackers@lists.postgresql.org; Thu, 19 Mar 2020 16:34:32 +0000 Received: from cyclops.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jEy7p-0000qB-3S for pgsql-hackers@lists.postgresql.org; Thu, 19 Mar 2020 16:34:31 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id BFFA121C4C2B; Thu, 19 Mar 2020 19:34:22 +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 [192.168.28.122] (unknown [192.168.28.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 87B9021C4C29; Thu, 19 Mar 2020 19:34:17 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1584635662; bh=pbKjeFQVh/RxS1KEdkPnJxO7E6bfmcOPrzZ1JHLG2SQ=; h=To:Cc:From:Subject:Date; b=p4VGBWu0Wpz6ggLmCOEuWF5xJd3E/Hb8+ccAL8Hlve57pTEuxz7HP7EMww3V/W3zQ 6Mj0GyZKytZMiI6mfTq1h+G2rB3+WGBLt0la7Q8JqMZiTFxssSH9CEsqsNMKKObKQd pVcxrKtNb/1dVhHS0t0h47a7JVt+BUCTqPGxqMyU= To: PostgreSQL Hackers Cc: Peter Geoghegan From: Anastasia Lubennikova Subject: nbtree: assertion failure in _bt_killitems() for posting tuple Message-ID: Date: Thu, 19 Mar 2020 19:34:17 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk During tests, we catched an assertion failure in _bt_killitems() for posting tuple in unique index: /* kitem must have matching offnum when heap TIDs match */ Assert(kitem->indexOffset == offnum); https://github.com/postgres/postgres/blob/master/src/backend/access/nbtree/nbtutils.c#L1809 I struggle to understand the meaning of this assertion. Don't we allow the chance that posting tuple moved right on the page as the comment says?  * We match items by heap TID before assuming they are the right ones to  * delete.  We cope with cases where items have moved right due to insertions. It seems that this is exactly the case for this failure. We expected to find tuple at offset 121, but instead it is at offset 125.  (see dump details below). Unfortunately I cannot attach test and core dump, since they rely on the enterprise multimaster extension code. Here are some details from the core dump, that I find essential: Stack is _bt_killitems _bt_release_current_position _bt_release_scan_state btrescan index_rescan RelationFindReplTupleByIndex (gdb) p offnum $3 = 125 (gdb) p *item $4 = {ip_blkid = {bi_hi = 0, bi_lo = 2}, ip_posid = 200} (gdb) p *kitem $5 = {heapTid = {ip_blkid = {bi_hi = 0, bi_lo = 2}, ip_posid = 200}, indexOffset = 121, tupleOffset = 32639} Unless I miss something, this assertion must be removed. -- Anastasia Lubennikova Postgres Professional: http://www.postgrespro.com The Russian Postgres Company