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 1pD0RA-00038h-8I for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Jan 2023 09:51:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pD0R8-0002Ss-O9 for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Jan 2023 09:51:54 +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 1pD0R8-0002Si-ED for pgsql-hackers@lists.postgresql.org; Wed, 04 Jan 2023 09:51:54 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pD0R4-0006p4-4x for pgsql-hackers@postgresql.org; Wed, 04 Jan 2023 09:51:54 +0000 Received: by mail-wm1-x32e.google.com with SMTP id c65-20020a1c3544000000b003cfffd00fc0so29090165wma.1 for ; Wed, 04 Jan 2023 01:51:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=t2CMinCMSb9sPJS6VHfhEs2kjbg00ySuw+AdQPktM1E=; b=eFJcs/JiF6OeB3v6qIYs+kOU9Cm3v8Kju0tmjCJnGlwG6ysA8ktWiR2Cuj9uke8WZ7 HplDOXXPPPm5oZk7WLFruqHPn2w6qRVBP8hmfs+Bwek4H4ePJ52ZDWdmZh/WBCUn7tcz qPhALScqpsAjBnLxzmM81rhM4XcuQfZIuw0Hqnqcqrm4r8B6jv9ZsvSjR/vBGisX3qqK DDzPGeS0n8TEKSQ0jG3rzbHJNoBUGr11EKoEKbHBGEFv6mWDGtdPHawiPD7yjp9h9nJo 2O5bGWgk7l/Mr97qUfnic0Nqk3CzeVRh0UiTaLUXNclWhk02wF/dPgTnPHzKgM0iAJ/B 91EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=t2CMinCMSb9sPJS6VHfhEs2kjbg00ySuw+AdQPktM1E=; b=nsCjDCtTWu2Xz148/6B7/58MCSRSPBGtyjmoHf5B95cjiZFZq8NLecW748jEF8q2U1 LcwGbbqpZi0Vj3Z/+onkqYWjv0jO0nKQqbN9ilperH+CaqFm6eIhZ3v+Atb6/dDgIBDC WIsl/zLuGlzyDQS8ih6nugTrG6cQ63+WjAb6VWbK5JmmJM7IFpZNrnMiQWgAsOsoUZsu vuQDs2eTLB5Fzp1HkKISUfbZ4UGXAB41ZCNhTc48Y6aa9fwX7Cd2th9MS6EB7hIikmGS Lfe4hkZsX7D+/L0MRIYccxp1aN+8rTFEuWZ57eg6hfNCNGWRuktlw85pS15tjUA2Pm7M 8AGA== X-Gm-Message-State: AFqh2koXu7ZZLVPbsZq4EQe/QMFkiV0gSaKiLo+iQot0O60f3h1ef2Hj 5UukvEisxn23hsgAz27hK+E= X-Google-Smtp-Source: AMrXdXvQC2lLTlscx7MRKBMVdzQwVpAqM81S5GROqqUdVRmijdDMI854a21jKK7z0AT4zEu9QYZz7w== X-Received: by 2002:a05:600c:3d05:b0:3d3:5c21:dd94 with SMTP id bh5-20020a05600c3d0500b003d35c21dd94mr34654768wmb.9.1672825908221; Wed, 04 Jan 2023 01:51:48 -0800 (PST) Received: from [192.168.5.162] ([54.239.6.189]) by smtp.gmail.com with ESMTPSA id d10-20020a05600c3aca00b003d34faca949sm44222599wms.39.2023.01.04.01.51.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Jan 2023 01:51:47 -0800 (PST) Message-ID: <977c555e-5d10-526f-ada0-b58d12267075@gmail.com> Date: Wed, 4 Jan 2023 10:50:31 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: Add index scan progress to pg_stat_progress_vacuum To: "Imseih (AWS), Sami" , vignesh C Cc: Nathan Bossart , Masahiko Sawada , Andres Freund , Robert Haas , "Bossart, Nathan" , Peter Geoghegan , Justin Pryzby , "pgsql-hackers@postgresql.org" References: <20221109030030.5wmvr76xj256cccw@awork3.anarazel.de> <7C22F915-5BB8-4729-8FF1-98B774CD6C85@amazon.com> <3FC1BD50-1640-45DC-A354-B6183B0966F9@amazon.com> <7CCF18B6-9CB6-4DC6-AE9B-756F388C541F@amazon.com> <20F7ED07-4D32-4231-A81C-432EB111F0B2@amazon.com> <20221230183955.GB437226@nathanxps13> <3D992C93-AA5D-4719-8712-6ECD3D864966@amazon.com> <7A191516-3D65-4819-BF19-E116B53E783C@amazon.com> Content-Language: en-US From: "Drouvot, Bertrand" In-Reply-To: <7A191516-3D65-4819-BF19-E116B53E783C@amazon.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 1/3/23 5:46 PM, Imseih (AWS), Sami wrote: >> cirrus-ci.com/task/4557389261701120 > > I earlier compiled without building with --enable-cassert, > which is why the compilation errors did not produce on my > buid. > > Fixed in v19. > > Thanks > Thanks for the updated patch! Some comments about it: + + + + indexes_total bigint + + + Number of indexes that wil be vacuumed. This value will be Typo: wil + /* report number of indexes to vacuum, if we are told to cleanup indexes */ + if (vacrel->do_index_cleanup) + pgstat_progress_update_param(PROGRESS_VACUUM_INDEX_TOTAL, vacrel->nindexes); "Report" instead? (to looks like the surrounding code) + /* + * Done vacuuming an index. Increment the indexes completed + */ + pgstat_progress_update_param(PROGRESS_VACUUM_INDEX_COMPLETED, + idx + 1); "Increment the indexes completed." (dot at the end) instead? - * Increase and report the number of index scans. + * Reset and report the number of indexes scanned. + * Also, increase and report the number of index + * scans. What about "Reset and report zero as the number of indexes scanned."? (just to make clear we don't want to report the value as it was prior to the reset) - /* Disable index vacuuming, index cleanup, and heap rel truncation */ + /* + * Disable index vacuuming, index cleanup, and heap rel truncation + * The new "Disable index vacuuming, index cleanup, and heap rel truncation" needs a dot at the end. + * Also, report to progress.h that we are no longer tracking + * index vacuum/cleanup. + */ "Also, report that we are" instead? + /* + * Done cleaning an index. Increment the indexes completed + */ Needs a dot at the end. - /* Reset the parallel index processing counter */ + /* Reset the parallel index processing counter ( index progress counter also ) */ "Reset the parallel index processing and progress counters" instead? + /* Update the number of indexes completed. */ + pg_atomic_add_fetch_u32(&(pvs->shared->nindexes_completed), 1); Remove the dot at the end? (to looks like the surrounding code) + +/* + * Read pvs->shared->nindexes_completed and update progress.h + * with indexes vacuumed so far. This function is called periodically "Read pvs->shared->nindexes_completed and report the number of indexes vacuumed so far" instead? + * Note: This function should be used by the leader process only, "called" instead of "used"? case WAIT_EVENT_XACT_GROUP_UPDATE: event_name = "XactGroupUpdate"; break; + case WAIT_EVENT_PARALLEL_VACUUM_FINISH: + event_name = "ParallelVacuumFinish"; + break; /* no default case, so that compiler will warn */ It seems to me that the case ordering should follow the alphabetical order (that's how it is done currently without the patch). +#define REPORT_PARALLEL_VACUUM_EVERY_PAGES ((BlockNumber) (((uint64) 1024 * 1024 * 1024) / BLCKSZ)) It seems to me that "#define REPORT_PARALLEL_VACUUM_EVERY_PAGES ((BlockNumber) (1024 * 1024 * 1024 / BLCKSZ))" would be fine too. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com