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 1w5AxN-002yQv-0u for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2026 23:14:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w5AxK-009Zwc-1b for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2026 23:14:38 +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 1w5AxK-009ZwT-0V for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2026 23:14:38 +0000 Received: from mail-qt1-x835.google.com ([2607:f8b0:4864:20::835]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w5AxI-00000000xdm-0Ni4 for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2026 23:14:38 +0000 Received: by mail-qt1-x835.google.com with SMTP id d75a77b69052e-506aa68065eso15016281cf.1 for ; Tue, 24 Mar 2026 16:14:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774394075; cv=none; d=google.com; s=arc-20240605; b=EghudwUOXaMRWOhT1zm+SeZs+ZkLig4hX7Bw+oh3GPGyZgpqtx7qg7XWnCzIkdbjYn 86QV064bbhXeYKQNdGkdp8GmYy2amErb1OvwWqiKbVeVLscYAMwdBB4M0BslLjXpnK1C mekJ18Xwi81Il+VftJi2i+NHpIgLq/fr+U8T/qAexgKw7uAVnjJ6p4WgIsjYXYhbpwMu vYlGm8ij9e6PesNE0HMuIeiMBTOvclLw8/TSGohB4gpFGsNL8NHs4WZ1/djWJeYQpegb jXKUw8NiocaQXgYAag8d2wuvcR7wO2KYry4ysqKlFg9nAG3bVkIWTZI6QHD3TVS9G6cq 7x/w== 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=AHFJx/TpyscqcJKf6am+6MDO9alcTBe1lXHQM8JQROE=; fh=qboGw0czpob1LoV6eoyj19C4g8vgo3VGWFSi3MQC6/E=; b=Ohwdvl00x0TEK8anvUCcfe6n2o1fVz/n4jYURYuZqNnpeEMGi2NDtMffkLdy9GxxvE RZjXkMxtwNpvzCYWVNo7TR69xPOe4XrMTVp55lrdCHSfYhetknCEE1JsqjbJUcc/gr8m IXimHSQrbL8JaZ6vQboh3wBia/vmMPwVaU1+XAra6wd0uuCRXjfEzUTkCEpMzRzOk7HP R1tHCEQdm5MfTEpTxLlNAtItBwk/KmvgpvqnvhtYPoylY31VJQ1UUkwgHOrxw7Up1Pfy uyA6BWvEGJsPH7aiNYQIuAMpqhYG+/Vn94hqU9BHyxfSHoJT/1UJIaKDMT/7ViJEaUMf m4Dg==; 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=20251104; t=1774394075; x=1774998875; 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=AHFJx/TpyscqcJKf6am+6MDO9alcTBe1lXHQM8JQROE=; b=Gen0vhOJBlefCdszzFuZ033B+iCXBv3QO9IeZGTl3qywIZLL1AbH+Tu55W59/tZdTN jMpJOsEFApaRx/qRSMMKB3LlRnxLL/p4FuQ4eJk6soCSnr5IsNE67cgOsc3Zp77hB/Mw HxZQtPEr36XbIuKqVrQCQoJXUUPRAm/Mo50ExQBsWsKH2Bj+YOC1mCXOG/8vE5rZUQNn QoxK9rfLg0GEE+hsTDw1ePcEW9jvvtZVLd+7tOYH0m3rgyZ2+jveWIeu9bZyQvyjxSZX oQItRo9aGUym2lQN5jhcOTfvUuBnwlTySSVVBAZa9V4r9I3xgtmkMC2xGmSR5ot2QmUW Rjxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774394075; x=1774998875; 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=AHFJx/TpyscqcJKf6am+6MDO9alcTBe1lXHQM8JQROE=; b=GDAXYLYh9+tEJqRaL7G8FxwbVxIA3FbjNau4hjKWfQ3A6BcK5F+NBImUI1bCQTR09J DrMXf7j9m21XWc5KKsWvLxAPYEQKurJVtVCpVbk1MgPR1hOYpOhVSEH50MxNaY+CCu/u vxgywippojwXHebKh0sJ6jnEPCuthOYplk71r2nGSr/3sb93e1nnV6o5/d8RuHCPmuyI T1jClDftjmkThhjNfK6gGoqC+VMTPrHiRYOYomFUS2xQq91DtmehGQBOO2uqDEPCEW0+ 0iraVqZ2PQGVG1iixAngm0+ZyayqkP437W05mTuhDs5ZJURnkTmrgbEjsspgfvo+5N9j O2eQ== X-Forwarded-Encrypted: i=1; AJvYcCVhQJWVQ5PrN7E6FMABJDhM1V18K1gZON/dHoDIH0X9Vvb3Ad2RE+F9nXwocZj59mpNcC+lu4XUnMiNFl2d@lists.postgresql.org X-Gm-Message-State: AOJu0Yzs+sk6M46Ie3Jxth/RlZHqYU3x5iw1iTW9KfJYBVbEKMxTEvFt 1+dovvsmGMvL3yTFPjfg1i3ZjylBpnD1pDxbJ8T/+z4sI91po/8/6Uqf91+QBJTlO57fDDOHBpP ajKYxZC3QvnZSvIxaw8mz2nL0UaCRtyo= X-Gm-Gg: ATEYQzyqKpW1/BWKMTgn+pNQ9kP+pErBi0OeGbEaHH3bPFq61NqfKs5hSqloz3TB8V/ s3owF1+VnV/3/A/xEpYX1muWP7JauGokTohvRkSKwo/eFVTnyCQs2PSEQmH5ggLgcPcz9tLhMUO dUDKoz+OSEt3JHNLxwIzgHmy4FEGHqR3bacnVkFnRjv8WSbdOPF3jQ/RMzYKt7UMLGvOK8OOVp0 DE45szvT3C/VZ+a63m0XayvO5xcSM3JsDB9KZxw8q/8s/A2x5kfhcY/JM8qzqkdlbvMiFm0vehk a0GCtSc= X-Received: by 2002:a05:622a:2c5:b0:50b:4946:2776 with SMTP id d75a77b69052e-50b80d4146emr23880751cf.22.1774394074954; Tue, 24 Mar 2026 16:14:34 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Peter Smith Date: Wed, 25 Mar 2026 10:14:08 +1100 X-Gm-Features: AaiRm51e_ExcRDQ9A7CiWXV7Xcob7ExPTQ-Pw_DBnvACksmMjm3UpLCUpg-QHjg Message-ID: Subject: Re: [Proposal] Adding Log File Capability to pg_createsubscriber To: "Hayato Kuroda (Fujitsu)" Cc: Gyan Sreejith , Amit Kapila , shveta malik , Shlok Kyal , vignesh C , Euler Taveira , "pgsql-hackers@lists.postgresql.org" Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi. Here are some review comments for v18-0001. ====== 1. +#define SERVER_LOG_FILE_NAME "pg_createsubscriber_server" +#define INTERNAL_LOG_FILE_NAME "pg_createsubscriber_internal" Those are not the names of logfiles; they are just the first part of the names. Why not also put the ".log" part here, instead of burying it in format strings scattered in the code? SUGGESTION (e.g., more similar to pg_upgrade.h) #define SERVER_LOG_FILE_NAME "pg_createsubscriber_server.log" #define INTERNAL_LOG_FILE_NAME "pg_createsubscriber_internal.log" ~~~ 2. +static char logdir[MAXPGPATH]; /* Directory log files are put (if specified) */ Missing words in that comment? e.g. Directory where log files are written ... Directory for log files ... It might also be useful to mention that this is more than just the original user-specified --logdir directory; it also includes the timestamp sub-dir. ~~~ 3. /* - * Report a message with a given log level + * Report a message with a given log level to stderr and log file + * (if specified). */ +static void +report_createsub_log_v(enum pg_log_level level, enum pg_log_part part, + const char *pg_restrict fmt, va_list args) This is a function comment, but there is no way to specify the log file by using this function, so maybe reword that "if specified" part for clarity. SUGGESTION: * Report a message with a given log level. * Writes to stderr, and also to the log file (if pg_createsubscriber --logdir option was specified). ~~~ 4. + /* Build timestamp directory path */ + len = snprintf(logdir, MAXPGPATH, "%s/%s", log_basedir, timestamp); + + if (len >= MAXPGPATH) + report_createsub_fatal("directory path for log files, %s/%s, is too long", + logdir, timestamp); IIUC, when the snprintf exceeds MAXPGPATH, then 'logdir' is going to contain a truncated string. And, maybe that already includes a partial truncated timestamp part: "myreallylongname/20260" AFAICT, the subsequent fatal message is going to report that incorrectly when it appends the timestamp a second time, like: "... myreallylongname/20260/20260119T204317.204 is too long" Notice that pg_upgrade doesn't try to report the names of files that are too long. It just says things like "directory path for new cluster is too long". ====== Kind Regards, Peter Smith. Fujitsu Australia