Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uRDN7-008dPw-Qs for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Jun 2025 17:11:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uRDN5-001lsT-Mg for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Jun 2025 17:11:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uRDN5-001lsL-8Z for pgsql-hackers@lists.postgresql.org; Mon, 16 Jun 2025 17:11:48 +0000 Received: from forwardcorp1d.mail.yandex.net ([178.154.239.200]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uRDN3-002OpI-0c for pgsql-hackers@lists.postgresql.org; Mon, 16 Jun 2025 17:11:47 +0000 Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:160f:0:640:ffb2:0]) by forwardcorp1d.mail.yandex.net (Yandex) with ESMTPS id 8AB8060B6B; Mon, 16 Jun 2025 20:11:43 +0300 (MSK) Received: from smtpclient.apple (unknown [2a02:6bf:8080:971::1:12]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id gBP1R60Fia60-WDuMcmQL; Mon, 16 Jun 2025 20:11:43 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1750093903; bh=5aORZCQ6FySOrkzfEDmXh+q0zUI0viwhJk3KajX9JDs=; h=Message-Id:To:Date:References:Cc:In-Reply-To:From:Subject; b=KpboqY9ECNgRMmAc7qmbpsWIImodgljXCWKOAsU9ea03A5Ql0768JPtgPp2CtZlJW vaRQf+wBaehWldvxj9Lecpa6fmiwFhguOmQPJ/nWh7qTwk5un7v+6C5OzU+1z3lYAW L7liK7pb0fVeManHFYuL51XP3OEgvrRHbgzdicVw= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.600.51.1.1\)) Subject: Re: amcheck support for BRIN indexes From: Andrey Borodin In-Reply-To: Date: Mon, 16 Jun 2025 22:11:31 +0500 Cc: PostgreSQL Hackers Content-Transfer-Encoding: quoted-printable Message-Id: <0C842FA2-8ACF-4C81-9F0E-F0BDB479AC28@yandex-team.ru> References: To: Arseniy Mukhin X-Mailer: Apple Mail (2.3826.600.51.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi! Nice feature! > On 8 Jun 2025, at 17:39, Arseniy Mukhin = wrote: >=20 > +#define BRIN_MAX_PAGES_PER_RANGE 131072 I'd personally prefer some words on where does this limit come from. I'm = not a BRIN pro, just curious. Or, at least, maybe we can use a form 128 * 1024, if it's just a sane = limit. > On 8 Jun 2025, at 17:39, Arseniy Mukhin = wrote: > A bit more detailed commit message would be very useful. The test coverage is very decent. The number of possible corruptions in = tests is impressive. I don't really have an experience with BRIN to say = how different they are, but I want to ask if you are sure that these = types of corruption will be portable across big-endian machines and such = stuff. Copyright year in all new files should be 2025. Some documentation about brin_index_check() would be handy, especially = about its parameters. Perhaps, somewhere near gin_index_check() in = amcheck.sgml. brin_check_ereport() reports ERRCODE_DATA_CORRUPTED. We should = distinguish between ERRCODE_INDEX_CORRUPTED which is a stormbringer and = ERRCODE_DATA_CORRUPTED which is an actual disaster. If it's not very difficult - it would be great to use read_stream = infrastructure. See btvacuumscan() in nbtree.c calling = read_stream_begin_relation() for example. We cannot use it in logical = scans in B-tree\GiST\GIN, but maybe BRIN can take some advantage of this = new shiny technology. + state->revmapbuf =3D ReadBufferExtended(idxrel, = MAIN_FORKNUM, state->revmapBlk, RBM_NORMAL, + = state->checkstrategy); + LockBuffer(state->revmapbuf, BUFFER_LOCK_SHARE); // usage of state->revmapbuf + LockBuffer(state->revmapbuf, BUFFER_LOCK_UNLOCK); // more usage of state->revmapbuf + ReleaseBuffer(state->revmapbuf); I hope you know what you are doing. BRIN concurrency is not known to me = at all. That's all for first pass through patches. Thanks for working on it! Best regards, Andrey Borodin.=