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 1u8Mww-002IdK-Po for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Apr 2025 17:34:55 +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 1u8Mwu-00Dh0d-KD for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Apr 2025 17:34:53 +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 1u8Mwu-00Dh0V-8k for pgsql-hackers@lists.postgresql.org; Fri, 25 Apr 2025 17:34:53 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u8Mwr-0022gn-2G for pgsql-hackers@postgresql.org; Fri, 25 Apr 2025 17:34:52 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-43edb40f357so17791655e9.0 for ; Fri, 25 Apr 2025 10:34:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1745602489; x=1746207289; darn=postgresql.org; h=message-id:date:content-transfer-encoding:content-id:mime-version :comments:references:in-reply-to:subject:cc:to:from:from:to:cc :subject:date:message-id:reply-to; bh=kJEqR2haCtxa5vxd+FQV79UjsiGoY8x8Q+Xxn3eCaws=; b=TEKsj3cmDHOe9fZu6nALjjVlxlMe5nfNK7o27ViWBfHJcXYyO8BA8AhBFDxzVuI4vY zOdZP/WcC7RTHtoV4Uz07HHzSG8HpMhLc+x8gH9pfwmdsEm1iwVECTOolTMJltmG3FLB m5uRJ+S6yQNskPJzC3a08E1ZX0wySz9LzkGknkZ0mUv6swYB+PK3YOkkMjjX1Q62r7ww pLZLjetPDYH/lY+/UUCU6l4VIIEXPPEskn8wIhYHoHEsKBETwvuvks1nSIR+3ILwiiNC zyDFZAFB9F8jQ3dj6pDeGsx8y+on9jF5QaKBIMcKkBxYaF95d0gwHaWN1qu1BmjHLAB9 T4iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745602489; x=1746207289; h=message-id:date:content-transfer-encoding:content-id:mime-version :comments:references:in-reply-to:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kJEqR2haCtxa5vxd+FQV79UjsiGoY8x8Q+Xxn3eCaws=; b=tJVhLGeIv8rV57nxuoRbYyXNMPUtg6Ux9BPIX1aOtR/oDHqVTAaheAfU4vFEBLCAEb rksuUXuU+VMejvi1Agb8ZGZWUvVl0flhvjw+u90j1rf7fnKWDOH4YuKoN2Hw+yVaALC6 hhcO3FzYnpGF4IIRoXjipPwpOQFxMnl38as7YSAABCPQHvFFX3TPnGTBRz7dqRGs7MHK X7b9ZXLCXUsEO1g5yeZgvB8TTnSph7mZeHlXUkUT3rCFrGAQ859j/fq84NY9uGzag231 EAifjRLe1cDAHPgctBewBe7hW8Am6SJSSYyAV89iwGFI1p4pXnNyd5eS4QOnYx6YfVc3 pWqg== X-Gm-Message-State: AOJu0YxN6Vbk+EBoc2OlusneXe9IGICIMJ0Q3wxTDX+k02ocEAl36CM1 8YqvphcrUZo5EvKLLhdHAm0z2Ts25rnUpV2LihVLVqZI5ZX6FY/I1Ko2wexSCRg= X-Gm-Gg: ASbGncsCUucF3f++njZlpRGLRof0CBkkcl+evbanVPDE/l3Dy7TT+jKJJvyTV5UuxBp 9HO5gY9a58tjiGkq2LRwVaBsI3QPiE1YplKezgSoXzys0gVffrw1KZfbPLemiuQPvwjWMUrLlET Xa0BonM4JjnpD+lCJrBQXROB+uOAtzLjHB8s8F1rpOvwmmGRQUnBSuV+bv7HpAi4063B/ydF93a yVamWskl9YrrBjsRwtEIap15+iBzQclZN6M1p5CbEMjQvP7zg46gE1V4296Y809HjQq2qkqO4Yi t/q+LJDQqw53MNRWnteu8puYY+FNv5RIMl56zC1vea4D7+aab15E X-Google-Smtp-Source: AGHT+IErChy/0AZluSGDhlQXOGgpTRP8EBWKOYjC9NkYhMATH/npshfIozhzz+uDN9/aamG1OQyJCQ== X-Received: by 2002:a05:600c:3c92:b0:43c:e7ae:4bcf with SMTP id 5b1f17b1804b1-440a63492d8mr22980125e9.0.1745602489036; Fri, 25 Apr 2025 10:34:49 -0700 (PDT) Received: from localhost (109-81-174-36.rct.o2.cz. [109.81.174.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-440a538f4e3sm31061385e9.36.2025.04.25.10.34.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Apr 2025 10:34:48 -0700 (PDT) From: Antonin Houska To: Sami Imseih cc: pgsql-hackers@postgresql.org Subject: Re: Conflicting updates of command progress In-reply-to: References: <117147.1744380740@localhost> <17632.1745403972@localhost> <4746.1745487225@localhost> Comments: In-reply-to Sami Imseih message dated "Thu, 24 Apr 2025 13:15:06 -0500." X-Mailer: MH-E 8.6+git; nmh 1.8; GNU Emacs 28.3 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <25939.1745602488.1@localhost> Content-Transfer-Encoding: quoted-printable Date: Fri, 25 Apr 2025 19:34:48 +0200 Message-ID: <25940.1745602488@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Sami Imseih wrote: > > pgstat_progress_start_command() is called twice: First with > > cmdtype=3DPROGRESS_COMMAND_CLUSTER, second with > > PROGRESS_COMMAND_CREATE_INDEX. The first happens in cluster_rel() the = second > > in cluster_rel() -> rebuild_relation() -> finish_heap_swap() -> > > reindex_relation() -> reindex_index(). > > > > It does not matter though, the current design only expects one command= . > = > When I set a breakpoint on pgstat_progress_start_command and ran a > CLUSTER on a table with a few indexes, I only saw start_command being > called once for PROGRESS_COMMAND_CLUSTER. Then I went back in the > code and realized that reindex_index when called via the CLUSTER command > has progress set to false. So as it stands now, only PROGRESS_COMMAND_CL= USTER > is effectively started when CLUSTER is called. > = > ``` > if (progress) > { > const int progress_cols[] =3D { > PROGRESS_CREATEIDX_COMMAND, > PROGRESS_CREATEIDX_INDEX_OID > }; > const int64 progress_vals[] =3D { > PROGRESS_CREATEIDX_COMMAND_REINDEX, > indexId > }; > = > pgstat_progress_start_command(PROGRESS_COMMAND_CREATE_INDEX, > heapId); > pgstat_progress_update_multi_param(2, progress_cols, progress_vals); > } Ah, got it. So for now the REPACK CONCURRENTLY patch only needs to turn of= f the progress reporting for PROGRESS_COMMAND_CREATE_INDEX properly. Thanks = for checking! -- = Antonin Houska Web: https://www.cybertec-postgresql.com