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.96) (envelope-from ) id 1w2xpw-000lpo-0Q for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Mar 2026 20:49:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w2xpu-00EHck-2r for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Mar 2026 20:49:50 +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.96) (envelope-from ) id 1w2xpu-00EHcc-1t for pgsql-hackers@lists.postgresql.org; Wed, 18 Mar 2026 20:49:50 +0000 Received: from mail-yw1-x1136.google.com ([2607:f8b0:4864:20::1136]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w2xpq-00000000QOg-3udm for pgsql-hackers@lists.postgresql.org; Wed, 18 Mar 2026 20:49:49 +0000 Received: by mail-yw1-x1136.google.com with SMTP id 00721157ae682-79a4e5caad6so3758547b3.2 for ; Wed, 18 Mar 2026 13:49:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773866988; cv=none; d=google.com; s=arc-20240605; b=Z87Es4cYROp8cg1HiPIMfB+fxaE6JfCvBXhGGFOPuugauTPb3pyxd7VntVwmQI0ZGz 7RdWUB3gtGVt6fisjdbKw3IPENT2qmw1AUKtWIT6JQBusfzgyds0T5Srua3qgCAxZON+ 7zt6tZI1ze6oftfyRWg2cmcEXJ3jrPk+FyMYTVBrJSAnXsJT5Ug/PJPtmTZJr43EAzKi sHqeuTukvi73GwXEgqI0WU9njwkWPFdLD4JXByYnxpwp64s/RfhM8RNgchs1Bo2lLLCj lHnEY6DC/gV1q5FzkMNqn33CKw4g0+FtuiM5xqTwxUKEWrWFLV98ZNDLqZGiy1xgQM7A 2lDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=cWs7Q7ese7W1v98LchM+i0iMAo5AHgnQHumeeOJeKhI=; fh=AxvtAsmfFxlTbZANbpzV8TIetriCqytUANa9hWVqtG4=; b=HviCMWh8GG6Z4z8LA3TwClQiiFr6WB9IP6YTe9F+dt34GPaSjEFTX0iZMepgPvLRJL 6Ir8WapCdiSpGYhmc0+2YfhUY5+up5u7rejigTgUkRPMNWnL6SAr3/HZCPTYN59F+IRZ eAevWsBdxn1GBrnu4YNZGT4NRrPpimmV4X7xC/ITVgMIN/WOw7gIebFNNGbn7UV/vKK8 8Oz53ogiyNaqG3E6iAISawo+Jjym2KMZ1FjqHn/xpmqjPhPnvlzr8fd4UAKHvGIfePRa BI5EzDVXSGVYRkxKconOLo524O+JrBXpkNmvFX4wAPcNLXKQnu2CxP3fLZIquyMfPlLi B1Xg==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=percona.com; s=google; t=1773866988; x=1774471788; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=cWs7Q7ese7W1v98LchM+i0iMAo5AHgnQHumeeOJeKhI=; b=b6tjNQfEbqsiENMoVhd8fbauZxFXJBHBpcrw2sdCxaNkTyuviSu0uyfK2/yME48byv /reNwFVPZI3qC3/3w9h86g94BehPG+Bd8j0lhc/HI2iRybIkuy5v0Au/KhX4lUK2VBHq V/Y5Zf8m0V7SS73+/Tel7R8qbulF6aZvQKo28= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773866988; x=1774471788; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=cWs7Q7ese7W1v98LchM+i0iMAo5AHgnQHumeeOJeKhI=; b=mpy1jxmoyX8MC8twI+AHm/2Jtixz5VpHGWFyVxhaooUj+adB6I+lXkhzeCqEqeNOR1 ah8UnEOUbfFA262VQAlknwrszuBBmflRAv/757jCWeMvORvkCbFWM5tGIR2xT6o2RcGA mXu4s1oRAY8AdUND6+PzLQ9slccYvTpie7KxNlKsA0JCmshS9AxlMd1pc8Tr+RXOp97J 3mMlx/Z+tKOxf3r22YWWxXoClQsMlK2BTrKAKWchHWQ5aVdLNCxVm+TDhRbGKiwH1JK6 OsbocEVIRZtZ9JnG3dsTmAQmfpGv1rjT00V6tdII9h1eZd78N296HetPStKluxCdCcUj 0tzg== X-Forwarded-Encrypted: i=1; AJvYcCXkd8qja0u2kjpdywt2UETeXy37HaautJAcjmC/ALvJIN2uR/vRPcWYbC+aN9T1HX4X32NetYFCqKnTAM0I@lists.postgresql.org X-Gm-Message-State: AOJu0YxvuaZrX991Gdzk32VNutlhaa2hkN7D4skgrAfrBlOPgRE3okjD kq94oL/DNIzBa8ftxsiX9OmXDNSSENHVv0ccGFG8AzGqGPyT4vC2aetvtriM2VcjCT16mNF4ytF exW3G42/1qIy8oxP6ab5DouyPEH1fVZ7nLH39M2i7+a+Gm5VwTSyDXcd/3zi4zRbfLwvLv/5Pl7 Qzr+5BY4eteCMkiHzHTF2aGLUDMWwRlpBpLIgPVhTHmvBMnPfng8iKIjx2zm+6NbvxZWoOVpoBU nnNc/T8yx0xFRH4+Y6WnImJ6u8r1OvucyADV6T9nuPLVUxgZB7xf7TIaNR+Sjl+xzI= X-Gm-Gg: ATEYQzzMltECN64UJ3gHbcCRZXhZm6NBS1jibLkbDbsgHvuEkE01B7nBywyBIimWV4r JveHAKCZNoB/RwH7dmYLDDh/m1+qlmddyCsWe6ykC8nJL2Bm2wWYAddpSbHhN6qZc/5kka6j64s LeGDpru3tMLnE2mVvzmUXqQuiqOz1LIR3AGBEa+h1e6t3SGj9siFX1QQsjhDFCAnzq8m6zqWJ/i uBj4ZXQKAKj+IjjrWCLI8cOWSwC1LXmOgpCF8HIjKdPw6f9FVE974YO2pCo89jfMtQ8lgrihS3s JtWEgkIMdf0ydiMme9CUWv2JEMCx/tSG4ZARPgKNjLQvO9RZ0Ysgxi95T/z7sb7mpO88 X-Received: by 2002:a05:690c:60c4:b0:79a:3be7:81c4 with SMTP id 00721157ae682-79a718c912emr47371767b3.24.1773866987652; Wed, 18 Mar 2026 13:49:47 -0700 (PDT) MIME-Version: 1.0 References: <06086cb4-881b-4f5a-96af-f275220ff52d@vondra.me> In-Reply-To: From: Zsolt Parragi Date: Wed, 18 Mar 2026 20:49:37 +0000 X-Gm-Features: AaiRm52qb4yoP2e4mimjg401r9ivvfLuq9RmjZwv4Z_Q0jVBtr_zrXzQLqhX5bs Message-ID: Subject: Re: Stack-based tracking of per-node WAL/buffer usage To: Lukas Fittl Cc: Tomas Vondra , PostgreSQL Hackers , Andres Freund , Peter Smith Content-Type: text/plain; charset="UTF-8" X-CLOUD-SEC-AV-Sent: true X-CLOUD-SEC-AV-Info: percona,google_mail,monitor X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk + instr_stack.stack_space *= 2; + instr_stack.entries = repalloc_array(instr_stack.entries, Instrumentation *, instr_stack.stack_space); Can't this also cause issues with OOM? repalloc_array failing, but we already doubled stack_space. The initialization above uses the same order, but that should be safe as entries is initially NULL. + * 2) Accumulate all instrumentation to the currently active instrumentation, + * so that callers get a complete picture of activity, even after an abort ... + if (idx >= 0) + { + while (instr_stack.stack_size > idx + 1) + instr_stack.stack_size--; + + InstrPopStack(instr); + } There seems to be one more bug in this: 1. EXPLAIN ANALYZE fires a trigger 2. The trigger function throws ERROR, InstrStopTrigger never runs 3. ResOwnerReleaseInstrumentation runs but only checks unfinalized_children, not triggers 4. InstrStopFinalize discards the trigger entry 5. Trigger instrumentation information shows 0