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 1riHwn-00GCeE-LI for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Mar 2024 17:54:26 +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 1riHwm-007Zzm-51 for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Mar 2024 17:54:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1riHwl-007Zzd-Rn for pgsql-hackers@lists.postgresql.org; Thu, 07 Mar 2024 17:54:24 +0000 Received: from mail-yb1-xb2a.google.com ([2607:f8b0:4864:20::b2a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1riHwj-003Iis-7z for pgsql-hackers@lists.postgresql.org; Thu, 07 Mar 2024 17:54:23 +0000 Received: by mail-yb1-xb2a.google.com with SMTP id 3f1490d57ef6-dcc4de7d901so1114572276.0 for ; Thu, 07 Mar 2024 09:54:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709834060; x=1710438860; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=e7FgRAx+xdNIoQYdmB0XJftYWT5Oa2jvLO3FJV9I9+A=; b=ey0EqI4z7vSSOhDFnJRGdRqPWXMorQkCGZubP03We5CVhWkW/6na2g54HXJ5HRJloo gj4GGG5pIQPc+T27FsVCvZFxP8oWVZI7I/hzeIG/yfjQWlKy35WK8EZ0x4JMrUXnWCIU YLzwnbRH56IdssSqRwkdjai+M8i8VjOBCROP96yLjXXaDcj6w7TMEMyVEZXfKjZkcvxn f4eokEBXC3c62IvRCMhQUp5cXAKQ6Lw5VZYLkeX/Lk9V+7j+kWPLfrbHltpoHXpyaL1N uBf7JJ6PDsVPwBcKNreGjmJrsLiYmIs89f2Q6DDE3IVQfgirlUgla6d01+THNMZ8GoGH 6Elw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709834060; x=1710438860; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e7FgRAx+xdNIoQYdmB0XJftYWT5Oa2jvLO3FJV9I9+A=; b=Xpkim4+54C9RV510Gf4JYyGj7IaPnHXvklSdMvxzui5WmEiKzrc27cuTbSfxsoaxcf wz6jc9NDejyc6hp29S5ZGwAn2RugJt0KSgemqQTVNmRcH8/FQWZuQEtMMGp4tK1NBen/ vGDuVE/NL6t7m4ePaPtye8sa3A4KfBnMf+/lIhKF6xMG/gOELZ5zbpzhu5yFBlku9hSm M2wKItlMZAPPZKzh1xp9G7N+t3CBVUVrJy6Q7PzuFs40zW3ZSKzpazwKy0LTvI0dyiTi bSP5t0hCsRpGBEOEvwqo+BpW3Mv9f85+Z3uF2WByBzqEjpJFCcsaWRtfkgPyCr1glagi InIg== X-Forwarded-Encrypted: i=1; AJvYcCUtWzhpH3pQ1oYMnwp+FTfbRZCRzCISpV3xxWNUcc1gUwF2wy8o8xJPBHdEHhQI+Wikg5vYCmr7UTpqv8a5qXvFjqpeKfOhP4J5eT8ufJgAl9UE X-Gm-Message-State: AOJu0Yw34O/pLZJqnaaUAK1BpYJWDFfmQfnqDB526H5W3EH+p0j43cl0 Za14DI5iUd9b9j0H58bhOTWK7/t2eLJ66VOtOc6GOiRxrku7+OMRMjEsXMNkKvWBintNs0YcMIG +0kno0w+JK8zyjY4L41JJoKWdgCs= X-Google-Smtp-Source: AGHT+IFGtgUgbDch7t8F9x+0RLJs7rdAt/rt6iv5QHORFiEoFOZPXvHm8+zenstkXprU3qshLvpxUpptw6+ulf91GXk= X-Received: by 2002:a25:99c8:0:b0:dce:9c23:eafc with SMTP id q8-20020a2599c8000000b00dce9c23eafcmr15614789ybo.1.1709834059822; Thu, 07 Mar 2024 09:54:19 -0800 (PST) MIME-Version: 1.0 References: <202403061129.gnbmxwwn5lem@alvherre.pgsql> In-Reply-To: <202403061129.gnbmxwwn5lem@alvherre.pgsql> From: Robert Haas Date: Thu, 7 Mar 2024 12:54:07 -0500 Message-ID: Subject: Re: Potential stack overflow in incremental base backup To: Alvaro Herrera Cc: Thomas Munro , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Mar 6, 2024 at 6:29=E2=80=AFAM Alvaro Herrera wrote: > On 2024-Mar-06, Thomas Munro wrote: > > Even on the heap, 16GB is too much to assume we can allocate during a > > base backup. I don't claim that's a real-world problem for > > incremental backup right now in master, because I don't have any > > evidence that anyone ever really uses --with-segsize (do they?), but > > if we make it an initdb option it will be more popular and this will > > become a problem. Hmm. > > Would it work to use a radix tree from the patchset at > https://postgr.es/m/CANWCAZb43ZNRK03bzftnVRAfHzNGzH26sjc0Ep-sj8+w20VzSg@m= ail.gmail.com > ? Probably not that much, because we actually send the array to the client very soon after we construct it: push_to_sink(sink, &checksum_ctx, &header_bytes_done, incremental_blocks, sizeof(BlockNumber) * num_incremental_blocks); This is hard to do without materializing the array somewhere, so I don't think an alternate representation is the way to go in this instance. --=20 Robert Haas EDB: http://www.enterprisedb.com