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 1wdZ8Z-004BnW-1B for pgsql-hackers@arkaria.postgresql.org; Sat, 27 Jun 2026 19:56:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wdZ8X-00FlaD-0d for pgsql-hackers@arkaria.postgresql.org; Sat, 27 Jun 2026 19:56:21 +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.96) (envelope-from ) id 1wdZ8W-00Fla3-2x for pgsql-hackers@lists.postgresql.org; Sat, 27 Jun 2026 19:56:20 +0000 Received: from mail-oi1-x236.google.com ([2607:f8b0:4864:20::236]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wdZ8U-00000000XKX-0QGU for pgsql-hackers@lists.postgresql.org; Sat, 27 Jun 2026 19:56:20 +0000 Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-494ed476db2so316049b6e.2 for ; Sat, 27 Jun 2026 12:56:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1782590176; cv=none; d=google.com; s=arc-20260327; b=DVG7yojXfggGebbK7oLWlXlzMb63TUK7IOWbfWo0ttgSO8p7GFPpNmXQ95a29ucukb QhYxkbGJhsf6OVogfoupyW7D/DUu5SJ/Vkzg9PSNhc+h/fBhcAYJBXy32ZxE93bYmnZy g5TnJU7aH2pIxSfcfGgeBMTzzuAAjV23GFsqmWU+kI09NmV/7HFfJ4+KQSWzW27c5zgZ BjK/TYd1pTXm6shSauMTP407tBlE1k0jMDDQliVgxkiIXQomfBRzeX6obEYEGj2tshbt J9WYYLOg5PbsciHryIn/Z/MZcIQO2ASyqbeqyGToxuCnc5GTpVFoiRAt7MZyKdX3/1S+ tOAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=29e3LX/YK/WZz2tocHsHx4EXQ6928LDpOLBMNxpcHsc=; fh=qbMXCdxi67zwwBmvQQ3BldzXy8b5S5V958kh6qXB69A=; b=d6JrriZSyY6p8v/E6/cDOUPwoBKZsutwIUVEWLaiGRCTgnP9TBJ0qHA7UGlPB72r/f F4PpCuOP+InEmhZXKTmfCJfjrW2QnBJsOjmuUHk3J5/JJMAN1cNigOdb8okDClfmWHpy kAc0FxDVpzOD4n2dKeK6L99xD7jfdvL3I+goFdyfgEwskWy3HTLFQLInmwDQrmpbIcR6 j0u8TvsyFNtkQ/yEzicy6L0dlIZf/ZIFEOznvW0Lq/w+kIRsFKObL/vU4Vh/+SrxKxd9 yDqngIJSMU8IWe226sntzSat2D9XXGrMXKe01d/oNZ9OuZNYBGZE0OZjsFXkMtYcoqau +Sag==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782590176; x=1783194976; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=29e3LX/YK/WZz2tocHsHx4EXQ6928LDpOLBMNxpcHsc=; b=KoOqqlxeht5Zn55FaMDVa9RZ+kdNrYfi/2seX/Xweo1TXU1pemWhTM/pUAPSYaI6N+ Wnws7aD+kdoVMlzBcbZsfSqA1stRH1G3dl+7D8079aLTJeKAAQXc5Q+lcALUuuPsNPm0 lEZBkp1Pi9neGGN0n7OLEGHZn41h71f1ydo3is15s3iljxtszPJfQi7FL097TPE9jnLI HdqFrsCGihNDD8s+DCO7xlKEJyLdL1sQ3cbOMvvQ7LXtWvG9ZofbZakdRHCZEax27gtb Hwu4+l6w5rLbJKGvRBIDFJyhho7xtQNhB+1qLhafQI7LU5PQWSzUAk0E+oGj3anAv3Df U7fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782590176; x=1783194976; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=29e3LX/YK/WZz2tocHsHx4EXQ6928LDpOLBMNxpcHsc=; b=NgrDqDjVSlIKXIh5pk2LxG/P6TlS+rLKDFhcfFswPJzBI6YyUza2wQskhN4JnzvuiI V7tvgSNmjs/r1UnOUZQVY1v/cf8w2cIjmZ6neagkTqyIK5k4UYLah7FPVtvcsU2zkWix gSsQOoSD09z502iTe2lRoQPpeGYb02p00O/9eD/CTtNTCkiTxXqA5/b8KJYnM37lJTcA 3KhzGsF12FMs2njtWkUt5lwlw1Za77f08ulIzjClAM/UZ2CRkLnHClaWMlmvHijoED7u 1i89YgDHYEjZUMUc5P2LbDUDir2MSlxWV0DYTDWzLfe096Q+8vxykbzo/BWsXyE7Iz5O EGTg== X-Gm-Message-State: AOJu0YynkZJ0wW5xURdRPGowk+ntOborxk765qEyXBBj3AVW9d20Opuq h8Ibr2GrKxOq8/SVx8cj+JGtMiOEFAyt1XleZ39ygpDuBL0QT9vi9yl/R2WRgiQPQQrrBrCJAGo R68H67NIoj/Ke0++WqD+8raWLWtBOWZk= X-Gm-Gg: AfdE7cm1W+WEy8ErT3bNfOa2A7ZiQtBBuuZZp/tRHUUlTnZFNBHgPvLdzEJ99k4AfWS nU+lAOJlDPRM+m1VTSFmVBW5P7llLjbQ6FqjHcjbYFF+UBJ8cQ93UoZJ0HK8YSdDk4ERuOVg2nh CG/z4mK4D4nDu7C6/ltE/Rxm8C+lH7Ow5IjfcefSurW3lr1ovmTJv/Wp1xywduPdRP3RnXws9Q5 96DjzgYqPdKMjwkxaMeSmqWFCQY0BnVy14BI/CAsn7GKFRSjv+YzbBVICSFwktY8JQe2ZO056JV lwoRebfS18N/CFyqIFjUBPnmRJ0W X-Received: by 2002:a05:6808:f8e:b0:485:467f:a307 with SMTP id 5614622812f47-49218a120f1mr8183610b6e.42.1782590176507; Sat, 27 Jun 2026 12:56:16 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bharath Rupireddy Date: Sat, 27 Jun 2026 12:56:04 -0700 X-Gm-Features: AVVi8CcO_LdXJrnU1H1Ku0UdRsfXrKEYhvBrSz_BZqfLCXT1-8KWA8j9yXQuKz8 Message-ID: Subject: Re: Do not lock tables in get_tables_to_repack To: cca5507 Cc: pgsql-hackers , Antonin Houska , Alvaro Herrera Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Tue, Jun 16, 2026 at 12:35=E2=80=AFAM cca5507 wrote: > > Hi hackers, > > When doing a whole database repack, we build a list of repackable > tables and take a lock on them to prevent concurrent drops. But > concurrent drops can always happen after we build the list because > we process each table in a separate transaction. The > ConditionalLockRelationOid() also makes the default behavior like > SKIP_LOCKED, which is unexpected. > > To remove the locks, we need to make repack_is_permitted_for_relation() > handles concurrent drops correctly: it should not report an error > when failing to search the syscache in pg_class_aclcheck(). Use > pg_class_aclcheck_ext() instead to detect a concurrent drop. Also > check the return value of get_rel_name(). > > Thoughts? I don't have a strong opinion on fixing this for REPACK. For vacuum, we wanted to get consistent behavior across all modes of invoking it [1]. Whether to handle concurrent drops for REPACK depends on how long it spends scanning pg_index/pg_class in get_tables_to_repack. Also, vacuum is more commonly run database-wide (against all tables), and without field experience showing this is a real problem for REPACK, I'm not sure the fix is needed. That said, others may have a different take - adding the REPACK authors here for their input. [1] https://www.postgresql.org/message-id/CALj2ACUbhDFJWSwiyoUxXED2S2fr9Xis= %3D08Rnjq53UzBE4FvzA%40mail.gmail.com -- Bharath Rupireddy Amazon Web Services: https://aws.amazon.com