Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nSRS9-0003Eh-1m for pgsql-hackers@arkaria.postgresql.org; Thu, 10 Mar 2022 22:40:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nSRS7-0006od-Vq for pgsql-hackers@arkaria.postgresql.org; Thu, 10 Mar 2022 22:40:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nSRP5-0001Fx-CF for pgsql-hackers@lists.postgresql.org; Thu, 10 Mar 2022 22:37:03 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nSRP2-0006ah-PO for pgsql-hackers@postgresql.org; Thu, 10 Mar 2022 22:37:03 +0000 Received: by mail-pl1-x62f.google.com with SMTP id r12so6149170pla.1 for ; Thu, 10 Mar 2022 14:37:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=JlHgn/vhkxFASqEov8kEXhS4jXdrWVGWN/8DjiikHf8=; b=CJOxb896RWm9ohATmG7csqDfSjW8dzdjhWzo6z+TC3DDMBg/209HJzXYvHPYDmWf0O vfj1EDu4C5ir2aYGP82P6JfAzCwACGulmg8cHgmwV0+NnHeduYpxOSevnlYwK504mbX7 qviPrKf3ncO9I+O8UonnMPzfCx/F8X3vpA3VkFb1RKRMI+ELbwm9yJLOjdLEULjU/bAN Bv0mvkgR5GVG2u8fCOET8/Gd+3Ol4Zutcc03sthXoNVIGPJtMM7KEtQo4oHV6vGiRy8A 78n/97FSH7bX4qDb6jUMQDwyTrA5NxpYUBAiR9cGdIZKfksXr1XIz6aJA3mk0B3EWY8Y SUqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=JlHgn/vhkxFASqEov8kEXhS4jXdrWVGWN/8DjiikHf8=; b=0BWXMyKAGe7Z64Qd+z9Aal6GxN5UuwHimdmPb8nv449JW6FG+PdShRgjvdNAXDnefW NAIYmBZCkthZcD5JLLU7Fvxe6RMf1cN6FffwP7OfB9pnMqGzwp9RbR2NpdQMeK58+w38 FLskMki86OM9g5FrabSUDqXrocijZVovxkOH3xT3kYKUJ+9qpKsZHs+BcnPWCpXsvG6U cV/TiOnVBJV0VewIrJfnfd6215JacYkg2Lf8e3FKDwoldKS4iDfykcofh+oP+sJtAOUi cHyOkgELw35U+G5RkL9CN1tQ7ZgYfmjuQSte5DYEpb1MSs6Aay1XRBXNds0smwN0fAHP im0Q== X-Gm-Message-State: AOAM530X6pvmrIV+vIauuvlYbU1guJaXQQmaOnPybFKNm4xu22U9yQ5t 2JLg58iax4zuLg9LGdmHoZw= X-Google-Smtp-Source: ABdhPJyrhLWYlCO6yV2InSz4TE3zg5ncv3BY+SyxL5JcxX29HEr44VLf8/DT5z4yncjSKRhEfnKpVA== X-Received: by 2002:a17:902:da8d:b0:151:dcb7:46a6 with SMTP id j13-20020a170902da8d00b00151dcb746a6mr7174396plx.133.1646951818449; Thu, 10 Mar 2022 14:36:58 -0800 (PST) Received: from nathanxps13 ([50.54.155.70]) by smtp.gmail.com with ESMTPSA id g18-20020a62e312000000b004f6fe0f4cf2sm7755606pfh.102.2022.03.10.14.36.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Mar 2022 14:36:58 -0800 (PST) Date: Thu, 10 Mar 2022 14:36:55 -0800 From: Nathan Bossart To: "Imseih (AWS), Sami" Cc: Masahiko Sawada , Peter Geoghegan , "Bossart, Nathan" , Justin Pryzby , "pgsql-hackers@postgresql.org" Subject: Re: Add index scan progress to pg_stat_progress_vacuum Message-ID: <20220310223655.GA470606@nathanxps13> References: <99A5CBE8-EC10-42AA-ABB4-4C812EEFD294@amazon.com> <20220310005237.GA307769@nathanxps13> <333D1326-1EED-416F-A9AF-21C90C1C098C@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Mar 10, 2022 at 09:30:57PM +0000, Imseih (AWS), Sami wrote: > Attached v4 which includes accounting for the hash size on startup, removal of the no longer needed comment in pgstatfuncs.c and a change in both code/docs to only reset the indexes_total to 0 when failsafe is triggered. Thanks for the new patch set. +/* + * Structs for tracking shared Progress information + * amongst worker ( and leader ) processes of a vacuum. + */ nitpick: Can we remove the extra spaces in the parentheses? + if (entry != NULL) + values[PGSTAT_NUM_PROGRESS_COMMON + PROGRESS_VACUUM_INDEXES_COMPLETED] = entry->indexes_processed; What does it mean if there isn't an entry in the map? Is this actually expected, or should we ERROR instead? + /* vacuum worker progress hash table */ + max_table_size = GetMaxBackends(); + size = add_size(size, hash_estimate_size(max_table_size, + sizeof(VacProgressEntry))); I think the number of entries should be shared between VacuumWorkerProgressShmemInit() and VacuumWorkerProgressShmemSize(). Otherwise, we might update one and not the other. + /* Call the command specific function to override datum values */ + if (pg_strcasecmp(cmd, "VACUUM") == 0) + set_vaccum_worker_progress(values); I think we should elaborate a bit more in this comment. It's difficult to follow what this is doing without referencing the comment above set_vacuum_worker_progress(). IMO the patches are in decent shape, and this should likely be marked as ready-for-committer in the near future. Before doing so, I think we should check that Sawada-san is okay with moving the deeper infrastructure changes to a separate threaḋ. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com