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 1w3X7V-001Jrx-1e for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Mar 2026 10:30:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w3X7T-005Mf1-2N for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Mar 2026 10:30:20 +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 1w3X7T-005Met-1L for pgsql-hackers@lists.postgresql.org; Fri, 20 Mar 2026 10:30:19 +0000 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w3X7R-00000000A0V-07El for pgsql-hackers@lists.postgresql.org; Fri, 20 Mar 2026 10:30:19 +0000 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-5a27eb8311bso566385e87.1 for ; Fri, 20 Mar 2026 03:30:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774002616; cv=none; d=google.com; s=arc-20240605; b=g605Y8/ihZaI6bpPQ5SE4kQC+8mxbhdzE+uHiU8m9VwKHLGaKlAam+3mT5VODuGQc4 rsLpv6+4wpM1Jm2npD7vgflraDLrOl495k8zLDwiMx9h3LQC5IOUXqqAU2mnQ3vNVzKv ss0r5/49+twBc5MIIuXUpSjsdpFugdPP0VHyAvB6Eram2eKiByvyILelWGFSIwV/twUx fv8rlnp/7Qk2Vj+JjqxWhoyRoXgqVI3NePOHAx1SHyANYIIeMCmQ7zecEcKM/9QIAXoo OMMGIYM9qW0muVZBUUPUad2rranptwieAcicfIRAQ5dwD8uUMrRDlnOgGOBBbMtPfjAy ItvA== 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=uYEj9ddvGa78YXbllmFr+yAFSCrjE6e/oErRXuAgxEg=; fh=vq650bLrZ1z9mO9HYnQSE3dgNPdp9CDzyaiv6WQp5Qs=; b=f0GRWS1bR/rI2zpMW9JNwp+ZQneFvNeW86pK91t91K1KobeNwZ51dBvVuwhwcqOEXT O9lKWB9KTqKbk+kf+FPuF+GB8kCrhNdVAQIP7AYP7Xlo2i3l8CaX5LJU/zyKfcQxT/5M 6ECXZsOceIiyBsXLLkbXqzSWnJXQHoAWhZNETqRworrQz0t5nZP7MXpzyli5359xB7pw LagMwYL1tpSLQGYu/OHx5aHGZse9kuo6dx0ygpwUmU4TWFhCCgQNmXZsDxQ8Y7LPGffN 3lvaX8Sel06BVPPPRl4Jen556p1uHLezgJvNoFomdGZzpLnk2LQGfA1TNvTJN3UEYj6X umRw==; 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=gmail.com; s=20230601; t=1774002616; x=1774607416; 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=uYEj9ddvGa78YXbllmFr+yAFSCrjE6e/oErRXuAgxEg=; b=EWUC4tdHEWbQ452h1frA+qCe+A3v4OkLyM09hJnLYseXn0dBH3Y/YGgcBoDtMlPZ0B 4qanDt3uU/fKW3Ki8OaUvp9tH7wdY+vjlIoTwgVDt+WdCPOmaUWoo48st7qY82EZrZP6 UAADRFvMw2ZIYgLXEu75IqXrexCuf9cns97X1M7mkeIkbvMgPSmU4SQIM7Nl+gBXZNf6 R0sc7Wz09+gIPeoGMkbbMwtTvCTXCvhqdW3ciY08iMlqhmrmyvhd4obeqGphNS1/CFPZ TUhghTuWqgLNJofbPugzjUx3HoHxN1nJyu3zAlbLgdnDEqLOfotZ+jGMr7TmCCRRtHqF SfXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774002616; x=1774607416; 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=uYEj9ddvGa78YXbllmFr+yAFSCrjE6e/oErRXuAgxEg=; b=UvoJTm9op4xz/bg0OWYF5PFO/JivyVuRo9wqLX/HGrs8SBZnd7biwXVknE3HPAvCyY jVjEdoj34LcXm7WQjj8/l8lDru+XAvsK1TFociAgc4qDoe7xedAF1KDn05qxc8nO1FC3 MG5u20UykOnCTSKK4dU/WCUr3RQt3fJsz+vZWG8HbdqhXKnN6+2tfIb6qk3sPWGdoRsY DeXJbo+oV+hmU5xyQtQPiXQdajahM/izg1edLi2wn3nrMHpWvmw8BBczTiG5f2HxtJS2 A2L99R9682bW7LBBdheglIy26HFrHKZpBkJ02ht8TRyf5RZOYOYLXwglw9QAKTEqLRe2 rElA== X-Forwarded-Encrypted: i=1; AJvYcCWrRc0JlzxDbiPz/PRMYG9Sc2up0LU/R9i6HDI03EjUhc78Lj60SxlIsFk0TvBf2NyCTW025VwY5/zbz0lr@lists.postgresql.org X-Gm-Message-State: AOJu0YxVA7KxayjDC4l2877MC/qd+/RZcM+Tev1Dk+Q0dgDPyOwKNvLB T7TX5itGOZgVX8L74haJHvlot/7R4Wu0EBnkHR6XptiMs64H5ahr5Jzi7CU/xznPQAwgNQTb+aa li6aDj7jYn3tEJS8Sb/Fh5bcmUC0ulw== X-Gm-Gg: ATEYQzwaN2EskYO9EZW64HBGyBFnsGO0PDQQpNWyLdik+xb8Cy9PVp6qlqpYHak8KLS 0acHKDcroNtqIJJcayTSreDqpU8aTmZ9bWCcO01QMwE/5/4bCWmE2Y/8TUFQPZVf0hPhh9rX1Cg mSqSNwzJFGJXV9DhobqkHWyf/7W0SNZ2DBMcTvYDE8ykDtsDQLhsUCoO9OLI3P+lMhuVyn1UBnJ qJhnk30PH4tuwYTNt4WhzH89AENP7vUNQuOMtQyHakY/febBKYio26fz5LaF29d06yLODNj3rlo SzWkgyFZ4Fzazg== X-Received: by 2002:a05:6512:3091:b0:5a2:820a:382c with SMTP id 2adb3069b0e04-5a285b61253mr862870e87.26.1774002615539; Fri, 20 Mar 2026 03:30:15 -0700 (PDT) MIME-Version: 1.0 References: <48261e54-c4f1-4bde-a4a9-4f3698a6b380@app.fastmail.com> In-Reply-To: From: Nisha Moond Date: Fri, 20 Mar 2026 16:00:03 +0530 X-Gm-Features: AaiRm50bpGU8WuF8NqB4hUhCetfz8o1jHAGI_EWyp2YMPdZTEStxte2kAJO8nck Message-ID: Subject: Re: [Proposal] Adding Log File Capability to pg_createsubscriber To: Gyan Sreejith Cc: =?UTF-8?B?S3Vyb2RhLCBIYXlhdG8v6buS55SwIOmavOS6ug==?= , Amit Kapila , Shlok Kyal , vignesh C , Euler Taveira , "pgsql-hackers@lists.postgresql.org" , Peter Smith 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 Thu, Mar 19, 2026 at 11:59=E2=80=AFPM Gyan Sreejith wrote: > > Thank you, Kuroda-san, for all the work. > I have made a small change - I added a pg_free() to free internal_log_fil= e. >> >> Hi Gyan, I reviewed/tested the patches, please find below comments for v13-002 patch= - File: pg_createsubscriber.c 1) + + if ((internal_log_file_fp =3D logfile_open(internal_log_file, "a")) =3D= =3D NULL) + pg_fatal("could not open log file \"%s\": %m", internal_log_file); + IIUC, the pg_fatal() call here seems unreachable as the function logfile_open() itself calls pg_fatal() and exits if it fails to open the file. I think it should just be - internal_log_file_fp =3D logfile_open(internal_log_file, "a"); Please correct me if I'm missing something. ~~~ 2) + if (opt->log_dir !=3D NULL) + out_file =3D psprintf("%s/%s/%s.log", opt->log_dir, log_timestamp, SERVER_LOG_FILE_NAME); + else + out_file =3D DEVNULL; + + cmd_str =3D psprintf("\"%s\" -D \"%s\" >> \"%s\"", pg_resetwal_path, + subscriber_dir, out_file); Similar to internal_log_file, why are 'out_file' and 'cmd_str' above not fr= eed? ~~~ 3) Typo - extra blank line after va_end(args); @@ -205,10 +243,11 @@ pg_fatal(const char *pg_restrict fmt,...) va_start(args, fmt); - pg_log_generic_v(PG_LOG_ERROR, PG_LOG_PRIMARY, fmt, args); + pg_createsub_log_v(PG_LOG_ERROR, PG_LOG_PRIMARY, fmt, args); va_end(args); + exit(1); ~~~ 4) File: t/040_pg_createsubscriber.pl +is( scalar(@server_log_files), 1, " + pg_createsubscriber_server.log file was created"); ... ... +is( scalar(@internal_log_files), 1, " + pg_createsubscriber_internal.log file was created"); Above introduces newlines in result log, test 29 and 32 looks like - [14:46:59.071](0.639s) ok 28 - run pg_createsubscriber --dry-run on node S [14:46:59.071](0.000s) ok 29 - [14:46:59.071](0.000s) # pg_createsubscriber_server.log file was create= d [14:46:59.071](0.000s) ok 30 - pg_createsubscriber_server.log file not empt= y [14:46:59.071](0.000s) ok 31 - server reached consistent recovery state [14:46:59.072](0.000s) ok 32 - [14:46:59.072](0.000s) # pg_createsubscriber_internal.log file was crea= ted [14:46:59.072](0.000s) ok 33 - pg_createsubscriber_internal.log file not em= pty These should be single-line results similar to others. -- Thanks, Nisha