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 1wQNCg-001VT4-02 for pgsql-hackers@arkaria.postgresql.org; Fri, 22 May 2026 10:34:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wQNCd-00CzAp-2b for pgsql-hackers@arkaria.postgresql.org; Fri, 22 May 2026 10:34:04 +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.96) (envelope-from ) id 1wQNCd-00CzAh-1U for pgsql-hackers@lists.postgresql.org; Fri, 22 May 2026 10:34:04 +0000 Received: from mail-qv1-xf33.google.com ([2607:f8b0:4864:20::f33]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wQNCc-00000000sIQ-0xhO for pgsql-hackers@postgresql.org; Fri, 22 May 2026 10:34:03 +0000 Received: by mail-qv1-xf33.google.com with SMTP id 6a1803df08f44-8ca12973e15so97776336d6.1 for ; Fri, 22 May 2026 03:34:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1779446040; cv=none; d=google.com; s=arc-20240605; b=b6/gxk2jsf18iWcrH5iY4gaPtL6sGNa2KaLhG2CBfKAFh9LJTtkML+QlizG0bR6Hra ZeKZEQh8PTZA7ob5XH/oYInDqOLquLSOy0tmQctWNHKjxTu1XKjSO8/RY0D4y5bBsX8j kJ7RCT+5Qqm8+xFyAwJOI5V/czS4vefI6PViak0Xyx86XL+ri7p2lX5C57RDf4jhsNWR dbUGsSyTWcRiOylr1i09UFbigflgtGiQkMKUtn07ChpB2gpt75KNX+Y3iFz9mkpWhCeI oN2MKoPTRYRilPZpLIkbEiK/+8cO+GN37uXiIej+Le094j2ZQ8Tl47K+D8qbV+19ckL/ ylfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=tLNjht8WXjLiIfeSvgaslbDNgB7NLxMtKZCAdJeiFL8=; fh=hmhzc1sq6z3fIQcGvCBCPwWin1PkBGRm51X1ryC1uVg=; b=XqlWJXROXYsr5h1r3xiW9RM4pGpOp4Jm7Wq5VmTWKV9vDOJzQmLnsNFtTgamBSyECE sy39TEYEr0XNZm69ifLhx73TdNrLP8YJh4QhNXfKIXFh3DQPrAF+58UFIDYXFDM+Obih OSCF6Oh2U2gw8ucJVE6edK3Hi5Wqy2MjqTfSux8rDlfrnxfpPbXtOtQqRVhHRGjSb+Hu BqdNza+MhsKWNXjyTu4vtbWKMXjlrCznOrtJE5ThDNIH6u819n412vDfyAxMYGD+B1xw Ezv+8gV8SbZCt3PYVzPkTlQy08ATHUb8NcmoPMKFd8gZmvsw+nTCWzt4dFo7icf1louQ Az0A==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779446040; x=1780050840; darn=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=tLNjht8WXjLiIfeSvgaslbDNgB7NLxMtKZCAdJeiFL8=; b=C40n83OHdQHd12Aqu57Cld6dSSBALjtwCpauVYKOGFiWOVfYlL6TcZ8N8vmcxa3n20 eOIQBlBbOdB7Acp12oEN0ION0yl7lCBgLalkwtAENmRRWcu+EzOtrpXdsvXL0AtsbfDx I9DEDiW3cjZCxWiNG7kngkfNfI6SLY8HXBc3wMTnFXYohdr+jVcvTEWfMbRTu+C/1Ne5 iDeQgHhw8WyY/Oq8ayW8acSwpRrpz6RfWP2r8NH5xNrRNJx+RMAWhCc6J6fxts4wxOew OYFGe4h5o9b8iiuVBHcAit7UDCHoY9hnl1iMvmtsVVVF6RTT6UlOy5xcjxr6Sq4vfFbH EtOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779446040; x=1780050840; h=content-transfer-encoding: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=tLNjht8WXjLiIfeSvgaslbDNgB7NLxMtKZCAdJeiFL8=; b=tLvbOGX9XRAmg3MqDVF2sT+nLHD95HW83fEpYrHHCGNDUPvBr9Ih2OwDkL9Hzqw/5p M4RmR4r2ZnYzjCSYizDyqCMZYXzBHILZHpBzNhUkoYX0cNa+3tfZC2de/yQ99keRXJwb Z9q3nc4rglwm0kOvzMfVeumOTldJdbLLMzXQQaw0mMq886s1YiMExAiRhkhqwj3f40r7 KWIA4IMIq9GfikqbRLVBVb/tHwT0RRgmaSWHcM6xGPsuPnw59/fAZIaEGZdBLoTYoF4X suotdjnB1B3MzF6Uo4rX0y7FjQE5PpX/S2HhkqyCE8J9K03TgW3R0ncn12QJStla+upK A6Xw== X-Forwarded-Encrypted: i=1; AFNElJ9tHz/LF72yIwfnccF04f6dVkhWsRTaaxpA56XTz+zRzvCpA67z9HuIBIDJzE71dnrwPc04gaYysvM66Miv@postgresql.org X-Gm-Message-State: AOJu0YwtQBgvvxHBQ0pRFfcu/ciZKUTRPsFXlrqDTKPwi93UDQvIr12G AqQR/t/c5OS6DObLfcM/Gzf/oK4nbA2xD37X2kC2gl9JyKrRJo4wfAkWexIkUIiAFqbGf10r2FN 5xCanJNPv4vqUHhIPQ9KrvcDBEVYVsrY= X-Gm-Gg: Acq92OEjOXXN7ZveHqLuZDCf7BUmj+AK+XEZV9ai+KRrkHHm+IKiDWS91zNzv+uWAXp bpIIbOMpBQ/NoZMvCOhRoQlRgZxke5RsoCfUBk+vrJaYHHrJSgY51JUKMlKFtTvwxoxLi/gubnM 5ZFYHEoWN5nYG6r/do43pn4882F1M6D9VtO0CAz/wUDw/qdza0sgiKmUE0ZZlRGzJB23bvjmYGS 5AXxf/T7F9gWjPpO07BMC5OE/z/sVozrCOV/Jv/X9JAOYzdw6snTxY9CSr8j/J+hDWIJDX31nX1 RuV6PRQ= X-Received: by 2002:a05:6214:398a:b0:89a:116b:e67d with SMTP id 6a1803df08f44-8cc7b68dcd3mr45383766d6.37.1779446040086; Fri, 22 May 2026 03:34:00 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: solai v Date: Fri, 22 May 2026 16:04:23 +0530 X-Gm-Features: AVHnY4KkYjCckVzRTJBvDLlAXDexURtmenQI9R5QB899quvW1kww6b4LQjcNs5k Message-ID: Subject: Re: Adding pg_dump flag for parallel export to pipes To: Nitin Motiani Cc: Hannu Krosing , Mahendra Singh Thalor , Dilip Kumar , Thomas Munro , pgsql-hackers@postgresql.org 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 Hi all, Thank you for the updated patch. On Fri, May 22, 2026 at 1:03=E2=80=AFPM Nitin Motiani wrote: > > Changed how pipe commands are quoted in the Windows test. The latest > versions are attached. I worked on reproducing the current limitation around parallel dumps and then tested the latest v16 patch adding --pipe support for pg_dump. To begin with, I verified the existing behavior. For example: pg_dump postgres | gzip > dump.sql.gz works, but does not support paralleli= sm, whereas: pg_dump -Fd -j 4 -f dumpdir postgres du -sh dumpdir 21M dumpdir requires intermediate disk storage. This demonstrates the current limitation where users must choose between parallelism and streaming pipelines. I then tested the patch introducing --pipe support. The feature is quite useful for modern workflows where users want to stream dump output directly to compression or upload pipelines without relying on intermediate storage. Basic functionality worked as expected. For example: pg_dump -p 55432 -Fd -j 4 --pipe=3D"cat > dump.out" postgres, produced a ~38MB output file, and: pg_dump -p 55432 -Fd -j 4 --pipe=3D"gzip > dump.gz" postgres produced, a compressed file (~11MB). The initial contents appeared valid: gunzip -c dump.gz | head 1 2 3 ... Also, no intermediate directory was created, confirming that the patch enables streaming without filesystem-backed staging. Error handling also behaved correctly. For example: --pipe=3D"invalid_cmd" resulted in: pg_dump: error: pipe command failed: command not found and: --pipe=3D"gzip | false" resulted in: pg_dump: error: pipe command failed: child process exited with exit code 1 However, I observed an important issue when using the feature with multiple parallel workers. Since the pipe command is executed per output file, using: --pipe=3D"gzip > dump.gz", it results in multiple workers invoking independent gzip processes that all write to the same output file. This leads to corrupted or truncated output. In my testing: gunzip -c dump.gz > dump.sql failed with: gzip: dump.gz: unexpected end of file This suggests that concurrent writes to a shared output target are not coordinated and can result in invalid dumps. It would be helpful to clarify expected usage patterns here. For example: whether users are expected to generate distinct outputs per worker, or whether safeguards should be implemented to prevent multiple workers from writing to the same destination. Additionally, during failure scenarios I observed backend logs such as: FATAL: connection to client lost Broken pipe While this is expected when the pipe terminates prematurely, it may be worth considering whether error messaging or cleanup behavior can be made clearer from the user perspective. Overall, the feature is valuable and aligns well with modern backup workflows. However, behavior in multi-worker scenarios with shared pipe targets may need further clarification or safeguards to avoid data corruption. Looking forward to more feedback. Regards. Solai