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 1u7XJA-0015zO-TD for pgsql-hackers@arkaria.postgresql.org; Wed, 23 Apr 2025 10:26:25 +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 1u7XJ4-005LAN-U7 for pgsql-hackers@arkaria.postgresql.org; Wed, 23 Apr 2025 10:26:19 +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.94.2) (envelope-from ) id 1u7XJ4-005LAF-J9 for pgsql-hackers@lists.postgresql.org; Wed, 23 Apr 2025 10:26:19 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u7XJ1-001WA7-1A for pgsql-hackers@postgresql.org; Wed, 23 Apr 2025 10:26:18 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-43cf05f0c3eso46305905e9.0 for ; Wed, 23 Apr 2025 03:26:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1745403974; x=1746008774; 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=bRZfmmlZN+H4GvCXSubXGLmP1hmN7abQfQflosgFyjQ=; b=RShGxL1r8RQh2y9sCZsmK+bRdjVOYJ6BcJhmgoIXRbUXtg7LBz3OahEZjbwsMq8Lux pItb3acBuBfPNG7D9yI6PW7qhOAVQLf6J8Xxf00SgNfUzRai8VFCqRO3vAV0JBbyeCeR nph7lrChehmxWuVbdbHXpF/wxXz9Rli3K4AtI8EFMs5YmpaMK5VElEfeBYjmPiqbW7Cm QlFq3Se8wPqBQl9SaoJUQtLviRPPJUkPwqrJPNKqAY6kMf59wImLgx07FZWaIbBHuKIQ 4/5MBbdEhhC9kr6cA2kygH31m8FF1fhzfPo4qPMA5EbyZVMBFHYdxnaG22S0u22Dbzce kTfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745403974; x=1746008774; 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=bRZfmmlZN+H4GvCXSubXGLmP1hmN7abQfQflosgFyjQ=; b=nznLXKsI/sB3Q5LNHIB6ZQbuZoQOnYz+xaVWCyadNnBf+xCS9mqkvGKy0fKSRaPea8 DmZ0j//L9L1rnYYS2rqqB8m2q4lP/NPmEuRqVGfiunT0HnDETaOz5PjFbwgDICepCltP QHXba1sEdYSwKsfcmvJnzSAT9JZ4xYQxXqADJnKDf7DeME/gOueZDiw6aGB8Z0Iclfkw 7rz9tfYZOcH9JCKE031jzmChwawXEd5+/o6UfC4Ie87mlP4R6ci+C+QGwVkH6YPmI1LY f7NEQfUZOjfqdG0a5cyEJOUoyrAFGbyw11oc8RbyC8QZUUzZpWunPwW40Yi8skjPIobT q7kw== X-Gm-Message-State: AOJu0YzZ7dxYLAGeSO95Y78UteO9vAism/5RoNzKwAX5OIElduDiIHAs 4s8VvVAROvgmi04QFoDnIxUCfNxsKzWxQOBXTuo/2kF2U5ghFDkmj5nqxVONvqs= X-Gm-Gg: ASbGnctIQ1tPGzM5FlahaOXZTUmWCMnhJcy5StCLYaYlCnfgKX0PNsWqHzs/hbtzRlM NRS9ZO0c7ykfea2W1eVmxWYrhnMsili7/FxkLTyBO35Jw8lH0RXGHBJJdxxoraZfDfM34m7nHqP 5kacrSQd3t3CqLiRyByuhMiANp5nSqiqLDeBvYxqQQvFZ5kDGnXGlsZ8Tjw20cLX253vqkjakwK 6Wk6m4cQehqujRWPMsRBDIPq20C+NYG6Tjzv8cOiScr1/6sU91cag/iudBZxmft4BMj7UJTzjiI MaSXMd5DNSirDFlGqysGgp7TatI2Q00d3r788Vn2MIUWYLteLUmm X-Google-Smtp-Source: AGHT+IE4Gx/XGRWahiPb0HwoUkgAZuUky9APzMFNUy/54/N/kunoE32dw5gX9KdnvQzvV+lrk4mx4g== X-Received: by 2002:a05:600c:1d02:b0:439:86fb:7340 with SMTP id 5b1f17b1804b1-4406ac412c4mr191390295e9.30.1745403973577; Wed, 23 Apr 2025 03:26:13 -0700 (PDT) Received: from localhost (109-81-174-36.rct.o2.cz. [109.81.174.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-44092dc229esm20896675e9.40.2025.04.23.03.26.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Apr 2025 03:26:13 -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> Comments: In-reply-to Sami Imseih message dated "Mon, 14 Apr 2025 12:13:00 -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: <17631.1745403972.1@localhost> Content-Transfer-Encoding: quoted-printable Date: Wed, 23 Apr 2025 12:26:12 +0200 Message-ID: <17632.1745403972@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Sami Imseih wrote: > > While working on [1] I realized that some field of pg_stat_progress_cl= uste has > > weird value. > = > Is there a repro that you can share that shows the weird values? It soun= ds like > the repro is on top of [1]. Is that right? Yes. > > AFAICS the current design does not consider that one progress-reportin= g > > command can be called by another one. > = > pgstat_progress_start_command should only be called once by the entry > point for the > command. In theory, we could end up in a situation where start_command > is called multiple times during the same top-level command; Not only in theory - it actually happens when CLUSTER is rebuilding indexe= s. > > Not sure what the correct fix is. We can > > either ignore update requests from the "nested" commands, or display t= he > = > There is a pattern where we do > = > ``` > if (progress) > pgstat_progress_update_param > ``` > = > cluster_rel can pass down a flag to index_build or others that update pr= ogress > to not report progress. Therefore, only the top level command is > updating progress. > what do you think? That's a possible approach. However, if the index build takes long time in= the CLUSTER case, the user will probably be interested in details about the in= dex build. The other approach is that we report only on the index build, but in that = case the interesting row of pg_stat_progress_cluster would disappear temporarily. That might also be confusing. Ideally we should report on all the commands in progress, but that is not trivial to implement. > [1] https://commitfest.postgresql.org/patch/5117/ -- = Antonin Houska Web: https://www.cybertec-postgresql.com