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.96) (envelope-from ) id 1vQT1t-008DZ9-0d for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Dec 2025 16:15:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vQT1q-008nBr-0h for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Dec 2025 16:15:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vQT1p-008nBd-2q for pgsql-hackers@lists.postgresql.org; Tue, 02 Dec 2025 16:15:02 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vQT1n-002m6a-1l for pgsql-hackers@lists.postgresql.org; Tue, 02 Dec 2025 16:15:01 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4779ce2a624so58213575e9.2 for ; Tue, 02 Dec 2025 08:14:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1764692098; x=1765296898; darn=lists.postgresql.org; h=message-id:date:content-transfer-encoding:mime-version:comments :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yc9FIkEDwPxwphRi9bXCqk6AOiSF0CwyG8eg8l/FUSA=; b=gxqAeEMmsBP+pWoEtxs68tw5Dm814I9E7g4sBmNvvcdNSCQef343b7RQkLj7VI/Jhl tyltY1INUYnUfKA7PNbwIRjncJmSHwJ20CusrNYuk0KZDU35SGh9LhWQN3hD6L2c+lc/ 1Q3GvUkvqYfTcjf9KEDdc/v+Qys/cvSwo2nZcoKTy0feW4lQ+r1AFPhOy46jLWDqyKHr shD7OFJxRPCyySyxLOpWCQHrDlUlNBQA+rcGhBzjiYG0WuNOkMkmrI0bTGJdkYcOgDKO Y/QxKjGh3+PBiyatr1W4SlLdMKEtZZK806WPDI7dfig57OGn2Rs9quIZR4wGqeYPBp1F U8yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764692098; x=1765296898; h=message-id:date:content-transfer-encoding:mime-version:comments :references:in-reply-to:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yc9FIkEDwPxwphRi9bXCqk6AOiSF0CwyG8eg8l/FUSA=; b=koEv6LfuIW/rqN8HxEyK8h3P3xLLNC4NXZxkwhbARjBDQ/p58NL9KMcIOHkbleLUJ0 YPvG8mmLlftTpU5GXfoBfcSYOprj6fNnzNUhJR2AC4ZfIgEq/TMiHz9QEub33gJkhy9y QdKajvY94LhK5DAMk9tMfXw0PFEw48Ap3v6yStbVnHQ3BUnTUjxQVYgP+5Ry/mJ40EaO Rtyu4r4i7qFSKfQbFefbftdsMN/rqZYzASUy4udEtVESMW2ouyQ8fU3dwcgy5Pxfho7D nWxCeDsWYL8kn7D3iai8c06Xj/R/gOUDiZqcFFDLawgyVH7xPwoS/OIhzCy3RbZHwgTZ XpQg== X-Forwarded-Encrypted: i=1; AJvYcCWVZ+2/TNh9ybj7ROAtofKziBBgarSWexkZprlQEA0AEdMlhMxGeu00/VR79PZ5BU3S9UlpsKByGUWQxljG@lists.postgresql.org X-Gm-Message-State: AOJu0YzaoHRZH68NSkfEtyUvFvU+Jtu2rCGAqo1NqaGofQy15C85yhjG kicJWcAKXCZCr+DL27aKS/AH+CdWaIlthHy8WYHjeBn40Qbg5M3Hjy9orXMqbysgEFc= X-Gm-Gg: ASbGncuCOAcUOiUXLpMRqLbEgM2wbGjBTRdF/RzYzuyDQU7aD+OCdWJsLSWPvzFfuNm 1qz92g396KqCH8HzBD/N6Xu5d40IVvMuJlSUWzq12jB8kLlIHjw2WjncsN6rhaNhasBC/1eaoDQ 3j8m3yDQ+Ti4V5KAMv2Kq/P8mqbezm5Y8/0jpiIpuOJPnDjrzUUF/1M705R6/1WAxkecszzPLpn 0bnGxOqiBn688fVqCHRhP5XtOFEU89rg+Ncx2VmzAUTWccvtDekVHaJIyxzEgIIubvy6fsoBguw 4qNOzfgr2KysKpviQqj3eqQIgp3Ym3Nm3k2gUu0kfKOmyP7hX8YMVw05FTwwqx/NOlhkSXnHED1 R9X/Tys5iVERTYpqbmkRm29zFbP7fQb8lfv3r/+L5b2ta+DmxchW/38LXbp1YDuRMzK6e9uIDr4 9iiFUAJ78EUmvMnj6mbLKA+8eOH9ZGEKlu/dg= X-Google-Smtp-Source: AGHT+IFFM/kvE+32X+3dfNx9VNF8/C/ZzRtXdPukmy5eQfjqlUr8GTB+/Hy3mbIiOjJc4CJUSNCuTQ== X-Received: by 2002:a05:600c:3b1a:b0:45d:d1a3:ba6a with SMTP id 5b1f17b1804b1-47904b29e28mr299511745e9.33.1764692098591; Tue, 02 Dec 2025 08:14:58 -0800 (PST) Received: from localhost (109-81-168-246.rct.o2.cz. [109.81.168.246]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4791163e3cbsm312681695e9.10.2025.12.02.08.14.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 08:14:58 -0800 (PST) From: Antonin Houska To: Mihail Nikalayeu cc: Alvaro Herrera , Pg Hackers , Robert Treat Subject: Re: Adding REPACK [concurrently] In-reply-to: References: <202507262156.sb455angijk6@alvherre.pgsql> <202510301734.pj4uds3mqxx4@alvherre.pgsql> <11472.1762156600@localhost> Comments: In-reply-to Mihail Nikalayeu message dated "Tue, 02 Dec 2025 01:50:00 +0100." X-Mailer: MH-E 8.6+git; nmh 1.8; GNU Emacs 28.3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 02 Dec 2025 17:14:57 +0100 Message-ID: <21728.1764692097@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Mihail Nikalayeu wrote: > Hello, Antonin! >=20 > On Mon, Nov 3, 2025 at 8:56=E2=80=AFAM Antonin Houska wr= ote: > > I'll fix all the problems in the next version. Thanks! >=20 > A few more moments I mentioned: >=20 > > switch ((vis =3D HeapTupleSatisfiesVacuum(tuple, OldestXmin, buf))) > vis is unused, also to double braces. >=20 > > LockBuffer(buf, BUFFER_LOCK_UNLOCK); > > continue; > > } >=20 > > /* > > * In the concurrent case, we have a copy of the tuple, so we > > * don't worry whether the source tuple will be deleted / updated > > * after we release the lock. > > */ > > LockBuffer(buf, BUFFER_LOCK_UNLOCK); > >} >=20 > I think locking and comments are a little bit confusing here. > I think we may use single LockBuffer(buf, BUFFER_LOCK_UNLOCK); before > `if (isdead)` as it was before. > Also, I am not sure "we have a copy" is the correct point here, I > think motivation is mostly the same as in > heapam_index_build_range_scan. All these problems are due to incorrect separation of the "preserve visibility" part of the patch series. Will be fixed in the next version. > Also, I think it is a good idea to add tests for index-based and > sort-based repack. Not sure, cluster.sql already seems to do the same. > Also, for sort-based I think we need to also call > repack_decode_concurrent_changes during insertion phase I miss the point. The current coding is such that this part if (concurrent) { XLogRecPtr end_of_wal; end_of_wal =3D GetFlushRecPtr(NULL); if ((end_of_wal - end_of_wal_prev) > wal_segment_size) { repack_decode_concurrent_changes(decoding_ctx, end_of_wal); end_of_wal_prev =3D end_of_wal; } } gets called regardless the value of 'tuplesort' above. > > is_system_catalog && !concurrent > 2 places, always true, feels strange. ok --=20 Antonin Houska Web: https://www.cybertec-postgresql.com