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 1v6F0o-001Ujk-Hi for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Oct 2025 21:14:22 +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 1v6F0m-003naj-7S for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Oct 2025 21:14:21 +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 1v6F0l-003nZd-TF for pgsql-hackers@lists.postgresql.org; Tue, 07 Oct 2025 21:14:20 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v6F0j-000Yaa-2g for pgsql-hackers@postgresql.org; Tue, 07 Oct 2025 21:14:19 +0000 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-2698d47e776so55087975ad.1 for ; Tue, 07 Oct 2025 14:14:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759871658; x=1760476458; darn=postgresql.org; h=in-reply-to:references:from:subject:cc:to:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=E9FfLMaQSdMGsBaRFIrAB5qeT5M4qjHJ384Hs6TZzTc=; b=gRB35GedYTzTcw9Rt/g4h9+nNyQ39Mespgr54M9qV8YL2O3e9vGYiTvrXvd1QyhPcq e9A/wZb7jd/w5itsy3Nmrt614/Z5qR2knH7ZB7f6796Wz3vjSFvFc8yDntX/Mvnd9B8S ohuESm7BEn8fVxu/rEVePbsPMd7JJSBFLDPcKeBB4MhLg1BVMCFLo/1HCpSDuSuDjsua 5SuxUKBfOIJC2NUaf1fJCBG9GvA+vTfLtuuzE8Q2RaMHhqdSbdMHyCYchHoiAbIIVz9U FapWeR5MZwq1Aw1m+LYZvCgpA4EJBnJ8WwYVMhzY1dWp1BDUV0onK+xCMAxEwubqLYxy OBVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759871658; x=1760476458; h=in-reply-to:references:from:subject:cc:to:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=E9FfLMaQSdMGsBaRFIrAB5qeT5M4qjHJ384Hs6TZzTc=; b=WxOzvMGGJTa8dtYYpOqUiTf2r/iNe0Jkv2zSUmSW8ZBubSKSeI3/HVCfDnIPDglxn4 zG1u5q+/+tAmeVl41J3/VgzmiloN/3jfr0exrjTmNyLiKjXYQh29IOS9lArfLaORsDO1 T3rB6Au3JGX6nEayiq51XnyWuGkca/DNfUq2zSKv1xJG2hmTyKXo6QYgGQJVebDlCeyJ g3kcQ7fDDNSTyZifqja9dTIsAXw6f9sbxFBhltoktpxFAv9FxR/4NPlg7y+y7n9myK7x kcW7S0v0lT/JnuqC/bkx8g46iCYcItnLHYVON8lBkU/qlEoOcWcQVn/Wl0TypkdnAE4J 7zQw== X-Forwarded-Encrypted: i=1; AJvYcCXiAfXDEjkVfQKuXM/StqdvNYjtivCMxGEHV2wmbqABLgGfDzgyp+sUFErUPQd8HSJ8tH2+n7sebJPv30Tp@postgresql.org X-Gm-Message-State: AOJu0Yzr5+g+lesRboDYrDJUhNbGc/htWaWOlOgXm+cbILJYPd4m6lSW O1bgVj2JmoNiKAUQoBGnnu3swbbaeRau2CBAhqjF3Ir+wIHKiaYrWB8F X-Gm-Gg: ASbGnctfuffyn5Se9IoWzsVRBz+hDV5EQJ6RejwvwxHnoNWyc6hL1//PI88mvDFDnco VH/BONGkIXcrsbzRvMVWiSBBcdSgU+xVuPo5KSrowqJqiaBueMdI1DMnSUArcvMz7GE7dLnMJvc wQ0gMKQRjcjUv7dT2+jWBXVSd/z31MzG48SK5Y4e0LGrEtK8Tl0KLl6lvRUgJzRGdDeAJgqukuC pdfoU+3qZovTWWYVv+UzNpi+SxmwNBWvYC7HZI45jSXYJaSYXseVwzFtnhuIgFk3QLr3CCTb0rq UyLdy9xUTiV0jZjNeQwJ49hoK08QPg6gUmUHkxdewQIKqGg8jG0KOXfclKFGaoZsRp1tPrySExG 1spn1flwIsV+nti41LUtPVpTYFbWj3crJFrAC0jCZVOpUPeQAe5gx7fYkxjjZGntKNvIAAw== X-Google-Smtp-Source: AGHT+IE22X5DAG3fom4mVyQZz5S/BPrF5Im+zg9G8hSlsw5CiAH1/ZGCyGUNY+l9w8V7ujivEuvgYQ== X-Received: by 2002:a17:903:285:b0:25c:e895:6a75 with SMTP id d9443c01a7336-290273473d5mr13009155ad.28.1759871657877; Tue, 07 Oct 2025 14:14:17 -0700 (PDT) Received: from localhost ([2804:14d:328a:a59c:cd72:c92f:e473:560d]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-28e8d110844sm174616355ad.23.2025.10.07.14.14.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Oct 2025 14:14:17 -0700 (PDT) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 07 Oct 2025 18:14:14 -0300 Message-Id: To: "Tom Lane" , "Matheus Alcantara" Cc: "Joel Jacobson" , "pgsql-hackers" Subject: Re: Optimize LISTEN/NOTIFY From: "Matheus Alcantara" X-Mailer: aerc 0.21.0 References: <6899c044-4a82-49be-8117-e6f669765f7e@app.fastmail.com> <165530.1752362320@sss.pgh.pa.us> <02a7cd37-e2fc-4212-8b19-f8c239c95fb8@app.fastmail.com> <96f00bf1-cc9d-4520-9d02-9e14e7767c88@app.fastmail.com> <30c2aa7d-dd6c-4b68-a2e4-f217a1a34acf@app.fastmail.com> <0b4d402a-9ac2-4aa8-acf8-8231dbe579ea@app.fastmail.com> <3095599.1758644879@sss.pgh.pa.us> <0dc6a2cc-5216-4dc1-9dd2-430cafc6095b@app.fastmail.com> <52CC167F-763B-4ECA-B0B4-DAB381816828@gmail.com> <9186C6D0-F7A9-482A-9183-89E530B57E36@gmail.com> <1073593.1759423179@sss.pgh.pa.us> <4bd5e6c4-6fa7-44bb-869d-59a32a331fa8@app.fastmail.com> <2451053.1759855880@sss.pgh.pa.us> In-Reply-To: <2451053.1759855880@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue Oct 7, 2025 at 1:51 PM -03, Tom Lane wrote: > Matheus Alcantara writes: >> 7. I'm wondering if we could add some TAP tests for this? > > async.c seems already moderately well covered by existing tests > src/test/regress/sql/async.sql > src/test/isolation/specs/async-notify.spec > > Do we need more? If there's something not covered, can we extend > those test cases instead of spinning up a whole new installation > for a TAP test? > I've executed the test coverage on v9 and it seems that we still have a good code coverage. I would imagine with the new branches that the code coverage could be effected but it's not true. There is just some small piece of new code added that is not being coveraged. > Also, I don't think it's the job of this patch to provide test > coverage for dshash. That should be quite well covered already. > When I was mentioning to test that we can grow the dshash correctly it's because the v9 patch has a logic to grow the array stored on dshash entry value that currently is not being cover by the tests. I'm not saying to test the dshash internal logic which I agree that it's not the job of this patch. Sorry for being confusing. + /* Need to add this listener */ + if (entry->num_listeners >=3D entry->allocated_listeners) + { + /* Grow the array (double the size) */ + int new_size =3D entry->allocated_listeners * 2; + dsa_pointer new_array =3D dsa_allocate(channel_dsa, + sizeof(ProcNumber) * new_size); + ProcNumber *new_listeners =3D (ProcNumber *) dsa_get_address(channel_dsa= , + new_array); + + /* Copy existing listeners */ + memcpy(new_listeners, listeners, + sizeof(ProcNumber) * entry->num_listeners); + + /* Free old array and update entry */ + dsa_free(channel_dsa, entry->listeners_array); + entry->listeners_array =3D new_array; + entry->allocated_listeners =3D new_size; + listeners =3D new_listeners; + } -- Matheus Alcantara