Rename 'logdir' parameter to 'work_dir'.
authorTaiki Koshino <koshino@postgresql.org>
Tue, 14 Oct 2025 00:59:39 +0000 (09:59 +0900)
committerTaiki Koshino <koshino@postgresql.org>
Tue, 14 Oct 2025 02:08:53 +0000 (11:08 +0900)
Previously, the directory for storing pgpool_status and lock files was specified by the logdir parameter.
However, since the name logdir was confusing, the parameter has been renamed to work_dir for clarity.

16 files changed:
doc.ja/src/sgml/misc-config.sgml
doc.ja/src/sgml/release-3.6.sgml
doc.ja/src/sgml/release-3.7.sgml
doc.ja/src/sgml/release-4.0.sgml
doc/src/sgml/misc-config.sgml
doc/src/sgml/release-3.6.sgml
doc/src/sgml/release-3.7.sgml
doc/src/sgml/release-4.0.sgml
src/config/pool_config_variables.c
src/include/pool_config.h
src/main/health_check.c
src/main/pgpool_main.c
src/query_cache/pool_memqcache.c
src/sample/pgpool.conf.sample-stream
src/utils/pool_process_reporting.c
src/watchdog/watchdog.c

index 37dcf0b545792e8a0b6b20edf1cd29c709e50178..3a0e2d37caff6777e9e7866ab780c32ad993b5d7 100644 (file)
    </listitem>
   </varlistentry>
 
-  <varlistentry id="guc-logdir" xreflabel="logdir">
-   <term><varname>logdir</varname> (<type>string</type>)
+  <varlistentry id="guc-work-dir" xreflabel="work_dir">
+   <term><varname>work_dir</varname> (<type>string</type>)
     <indexterm>
      <!--
-     <primary><varname>logdir</varname> configuration parameter</primary>
+     <primary><varname>work_dir</varname> configuration parameter</primary>
      -->
-     <primary><varname>logdir</varname> 設定パラメータ</primary>
+     <primary><varname>work_dir</varname> 設定パラメータ</primary>
     </indexterm>
    </term>
    <listitem>
      enables the testing facility of health checking. In this case the
      health check process looks
      into <filename>backend_down_request</filename>
-     under <xref linkend="guc-logdir">.  The file may contain multiple
+     under <xref linkend="guc-work-dir">.  The file may contain multiple
      lines, and each line corresponds to each backend. A line in the
      file starts with backend id (must be a decimal number starting
      with zero), then a TAB, and ends with "down". The backend is
      repeating failovers.
 -->
      onにすると、ヘルスチェックのテスト機能が有効になります。
-     この場合、ヘルスチェックプロセスは<xref linkend="guc-logdir">の下にある<filename>backend_down_request</filename>を参照します。
+     この場合、ヘルスチェックプロセスは<xref linkend="guc-work-dir">の下にある<filename>backend_down_request</filename>を参照します。
      このファイルは、複数の行から構成され、各行は各々のバックエンドに対応します。
      各行はバックエンドID(ゼロから始まる十進数でなければなりません)で始まり、続いてタブ、最後に"down"で終わります。
      そのバックエンドはダウン状態と見なされ、<productname>Pgpool-II</productname>はフェイルオーバを開始します。
index f0c9e9560910c3296bc05653ee376a06ead0bef7..5412250e5bcb7b06c5a33c6b15830f700c85e03d 100644 (file)
      <!--
      Doc: fix typo in logdir description. (<ulink url="http://www.pgpool.net/mantisbt/view.php?id=453">bug 453</ulink>)(Tatsuo Ishii)
      -->
-     Doc: <xref linkend="GUC-LOGDIR">に関するドキュメントのタイポを修正しました。(<ulink url="http://www.pgpool.net/mantisbt/view.php?id=453">bug 453</ulink>)(Tatsuo Ishii)
+     Doc: <link linkend="GUC-WORK-DIR">logdir</link>に関するドキュメントのタイポを修正しました。(<ulink url="http://www.pgpool.net/mantisbt/view.php?id=453">bug 453</ulink>)(Tatsuo Ishii)
     </para>
    </listitem>
 
index 47cc2e0a69df6b6b05353b042d6c07299a47b4aa..b84b5188f8020fe52ffbd487ad9e41ca7c7b2ced 100644 (file)
      <!--
      Doc: fix typo in logdir description. (<ulink url="http://www.pgpool.net/mantisbt/view.php?id=453">bug 453</ulink>)(Tatsuo Ishii)
      -->
-     Doc: <xref linkend="GUC-LOGDIR">に関するドキュメントのタイポを修正しました。(<ulink url="http://www.pgpool.net/mantisbt/view.php?id=453">bug 453</ulink>)(Tatsuo Ishii)
+     Doc: <link linkend="GUC-WORK-DIR">logdir</link>に関するドキュメントのタイポを修正しました。(<ulink url="http://www.pgpool.net/mantisbt/view.php?id=453">bug 453</ulink>)(Tatsuo Ishii)
     </para>
    </listitem>
 
index 99785620b6928017e51b105e75e3268d1da3fea2..d75b3bbb6e0f68c47142033f30333dfd67f04e3d 100644 (file)
      <!--
      Doc: fix typo in logdir description. (<ulink url="http://www.pgpool.net/mantisbt/view.php?id=453">bug 453</ulink>)(Tatsuo Ishii)
      -->
-     Doc: <xref linkend="GUC-LOGDIR">に関するドキュメントのタイポを修正しました。(<ulink url="http://www.pgpool.net/mantisbt/view.php?id=453">bug 453</ulink>)(Tatsuo Ishii)
+     Doc: <link linkend="GUC-WORK-DIR">logdir</link>に関するドキュメントのタイポを修正しました。(<ulink url="http://www.pgpool.net/mantisbt/view.php?id=453">bug 453</ulink>)(Tatsuo Ishii)
     </para>
    </listitem>
 
index eb48b99f7684efa865f8b3072c27e998fe829e05..d4c20fd99d924bfb89c58488460ad198237ebb45 100644 (file)
    </listitem>
   </varlistentry>
 
-  <varlistentry id="guc-logdir" xreflabel="logdir">
-   <term><varname>logdir</varname> (<type>string</type>)
+  <varlistentry id="guc-work-dir" xreflabel="work_dir">
+   <term><varname>work_dir</varname> (<type>string</type>)
     <indexterm>
-     <primary><varname>logdir</varname> configuration parameter</primary>
+     <primary><varname>work_dir</varname> configuration parameter</primary>
     </indexterm>
    </term>
    <listitem>
      enables the testing facility of health checking. In this case the
      health check process looks
      into <filename>backend_down_request</filename>
-     under <xref linkend="guc-logdir">.  The file may contain multiple
+     under <xref linkend="guc-work-dir">.  The file may contain multiple
      lines, and each line corresponds to each backend. A line in the
      file starts with backend id (must be a decimal number starting
      with zero), then a TAB, and ends with "down". The backend is
index 1869c277427d846e34f0b4d93d278a69b514838a..b92c24634fcc0afa214dff618186ef6111b4d762 100644 (file)
     2019-01-03 [79ef2b0]
     -->
     <para>
-     Doc: fix typo in <xref linkend="GUC-LOGDIR"> description. (<ulink url="http://www.pgpool.net/mantisbt/view.php?id=453">bug 453</ulink>) (Tatsuo Ishii)
+     Doc: fix typo in <link linkend="GUC-WORK-DIR">logdir</link> description. (<ulink url="http://www.pgpool.net/mantisbt/view.php?id=453">bug 453</ulink>) (Tatsuo Ishii)
     </para>
    </listitem>
 
index fa26fec97efbebd88f774189884c1864abf4c537..87a13b25aec147411ba5f8bfa0153771b8ac93e3 100644 (file)
     2019-01-03 [520649b]
     -->
     <para>
-     Doc: fix typo in <xref linkend="GUC-LOGDIR"> description. (<ulink url="http://www.pgpool.net/mantisbt/view.php?id=453">bug 453</ulink>) (Tatsuo Ishii)
+     Doc: fix typo in <link linkend="GUC-WORK-DIR">logdir</link> description. (<ulink url="http://www.pgpool.net/mantisbt/view.php?id=453">bug 453</ulink>) (Tatsuo Ishii)
     </para>
    </listitem>
 
index 4160ab654f4b240676257703cb81a81fce03ba1c..62439b14397b206e04d8f5060380f26b7a2b47c7 100644 (file)
     2019-01-03 [de632ca]
     -->
     <para>
-     Doc: fix typo in <xref linkend="GUC-LOGDIR"> description. (<ulink url="http://www.pgpool.net/mantisbt/view.php?id=453">bug 453</ulink>) (Tatsuo Ishii)
+     Doc: fix typo in <link linkend="GUC-WORK-DIR">logdir</link> description. (<ulink url="http://www.pgpool.net/mantisbt/view.php?id=453">bug 453</ulink>) (Tatsuo Ishii)
     </para>
    </listitem>
 
index 5bbe46d3aa49c1a0b531f8b092317a6ed79edfa7..326e3ab3f1411ddc2825754abd10ba5dcd813f64 100644 (file)
@@ -142,6 +142,7 @@ static bool BackendSlotEmptyCheckFunc(int index);
 /*variable custom assign functions */
 static bool FailOverOnBackendErrorAssignMessage(ConfigContext scontext, bool newval, int elevel);
 static bool DelegateIPAssignMessage(ConfigContext scontext, char *newval, int elevel);
+static bool LogDirAssignMessage(ConfigContext scontext, char *newval, int elevel);
 static bool BackendPortAssignFunc(ConfigContext context, int newval, int index, int elevel);
 static bool BackendHostAssignFunc(ConfigContext context, char *newval, int index, int elevel);
 static bool BackendDataDirAssignFunc(ConfigContext context, char *newval, int index, int elevel);
@@ -1353,13 +1354,24 @@ static struct config_string ConfigureNamesString[] =
 
        {
                {"logdir", CFGCXT_INIT, LOGGING_CONFIG,
-                       "PgPool status file logging directory.",
+                       "Old config parameter for work_dir.",
+                       CONFIG_VAR_TYPE_STRING, false, VAR_HIDDEN_IN_SHOW_ALL
+               },
+               NULL,
+               "",
+               LogDirAssignMessage, NULL, NULL, NULL
+       },
+
+       {
+               {"work_dir", CFGCXT_INIT, LOGGING_CONFIG,
+                       "directory to create pgpool_status and lock files.",
                        CONFIG_VAR_TYPE_STRING, false, 0
                },
-               &g_pool_config.logdir,
+               &g_pool_config.work_dir,
                DEFAULT_LOGDIR,
                NULL, NULL, NULL, NULL
        },
+
        {
                {"log_directory", CFGCXT_RELOAD, LOGGING_CONFIG,
                        "directory where log files are written.",
@@ -4830,6 +4842,26 @@ DelegateIPAssignMessage(ConfigContext scontext, char *newval, int elevel)
        return true;
 }
 
+/*
+ * Throws warning for if someone uses the removed logdir
+ * configuration parameter and set the value to work_dir
+ */
+static bool
+LogDirAssignMessage(ConfigContext scontext, char *newval, int elevel)
+{
+       if (scontext != CFGCXT_BOOT)
+               ereport(WARNING,
+                               (errmsg("logdir is changed to work_dir"),
+                                errdetail("if logdir is specified, the value will be set to work_dir")));
+       if (g_pool_config.work_dir)
+               pfree(g_pool_config.work_dir);
+       if (newval)
+               g_pool_config.work_dir = pstrdup(newval);
+       else
+               g_pool_config.work_dir = NULL;
+       return true;
+}
+
 /*
  * Check DB node spec. node spec should be either "primary", "standby" or
  * numeric DB node id.
index be82750e54ffab264b92e92d76b0d8e01ce87e39..7cf5460f322f1e0a8fa519ebf8108f6d5dccbc58 100644 (file)
@@ -261,7 +261,7 @@ typedef struct
        int                     authentication_timeout; /* maximum time in seconds to complete
                                                                                 * client authentication */
        int                     max_pool;               /* max # of connection pool per child */
-       char       *logdir;                     /* logging directory */
+       char       *work_dir;           /* directory to create pgpool_status and lock files */
        char       *log_destination_str;        /* log destination: stderr and/or
                                                                                 * syslog */
        int                     log_destination;        /* log destination */
index 68b3ced74a66bacaa72215a4dfa7c80c67c7d18b..0c72c0a7279bbe2c64df2d5fe15554ff2169a797 100644 (file)
@@ -620,7 +620,7 @@ check_backend_down_request(int node, bool done_requests)
        if (backend_down_request_file[0] == '\0')
        {
                snprintf(backend_down_request_file, sizeof(backend_down_request_file),
-                                "%s/%s", pool_config->logdir, BACKEND_DOWN_REQUEST_FILE);
+                                "%s/%s", pool_config->work_dir, BACKEND_DOWN_REQUEST_FILE);
        }
 
        fd = fopen(backend_down_request_file, "r");
index bf7e49ef69a718c360388730b617019fc33131b2..4d88c5815ea253471167dfe7e5bf39f0270323ec 100644 (file)
@@ -523,7 +523,7 @@ PgpoolMain(bool discard_status, bool clear_memcache_oidmaps)
                int                     lfd;
 
                snprintf(query_cache_lock_path, sizeof(query_cache_lock_path),
-                                "%s/%s", pool_config->logdir, QUERY_CACHE_LOCK_FILE);
+                                "%s/%s", pool_config->work_dir, QUERY_CACHE_LOCK_FILE);
                lfd = open(query_cache_lock_path, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR);
                if (lfd == -1)
                {
@@ -3204,7 +3204,7 @@ read_status_file(bool discard_status)
                pool_set_backend_status_changed_time(i);
        }
 
-       snprintf(fnamebuf, sizeof(fnamebuf), "%s/%s", pool_config->logdir, STATUS_FILE_NAME);
+       snprintf(fnamebuf, sizeof(fnamebuf), "%s/%s", pool_config->work_dir, STATUS_FILE_NAME);
        fd = fopen(fnamebuf, "r");
        if (!fd)
        {
@@ -3391,7 +3391,7 @@ write_status_file(void)
                return 0;
        }
 
-       snprintf(fnamebuf, sizeof(fnamebuf), "%s/%s", pool_config->logdir, STATUS_FILE_NAME);
+       snprintf(fnamebuf, sizeof(fnamebuf), "%s/%s", pool_config->work_dir, STATUS_FILE_NAME);
        fd = fopen(fnamebuf, "w");
        if (!fd)
        {
index dc2ce911e0afb36ab5b25533a98aa743b2e58445..c8a94cc99c0f699a4ddbea7d617cf96b0edd7d92 100644 (file)
@@ -3137,7 +3137,7 @@ pool_shmem_lock(POOL_MEMQ_LOCK_TYPE type)
        {
                char       *path;
 
-               path = psprintf("%s/%s", pool_config->logdir, QUERY_CACHE_LOCK_FILE);
+               path = psprintf("%s/%s", pool_config->work_dir, QUERY_CACHE_LOCK_FILE);
                memq_lock_fd = open(path, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR);
                if (memq_lock_fd == -1)
                {
index a7eb594c90fa3b027fe93855cc8f6055c87ccf3b..dcccb57a689412fe6e7581e2556bd3155565cbf2 100644 (file)
@@ -351,8 +351,8 @@ backend_clustering_mode = streaming_replication
                                    # location of pgpool.conf file or
                                    # as an absolute path
                                    # (change requires restart)
-#logdir = '/tmp'
-                                   # Directory of pgPool status file
+#work_dir = '/tmp'
+                                   # Directory for pgpool_status and lock files.
                                    # (change requires restart)
 
 
index 99c0cc006e6ba9f33423fe21fdb2f05be2c2aab7..e4fcf4457e20bc0a6c09f55e8b9c5105e83ae93e 100644 (file)
@@ -507,9 +507,9 @@ get_config(int *nrows)
        StrNCpy(status[i].desc, "path to pid file", POOLCONFIG_MAXDESCLEN);
        i++;
 
-       StrNCpy(status[i].name, "logdir", POOLCONFIG_MAXNAMELEN);
-       snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%s", pool_config->logdir);
-       StrNCpy(status[i].desc, "PgPool status file logging directory", POOLCONFIG_MAXDESCLEN);
+       StrNCpy(status[i].name, "work_dir", POOLCONFIG_MAXNAMELEN);
+       snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%s", pool_config->work_dir);
+       StrNCpy(status[i].desc, "directory to create pgpool_status and lock files ", POOLCONFIG_MAXDESCLEN);
        i++;
 
        /* CONNECTION POOLING */
index 48d05b1f8bcec772a46a52ecb0628e29b3b98bff..663e77240bc41b1e9f946f57d48e794e0048f722 100644 (file)
@@ -8577,7 +8577,7 @@ load_watchdog_debug_test_option(void)
        if (wd_debug_request_file[0] == '\0')
        {
                snprintf(wd_debug_request_file, sizeof(wd_debug_request_file),
-                                "%s/%s", pool_config->logdir, WATCHDOG_DEBUG_FILE);
+                                "%s/%s", pool_config->work_dir, WATCHDOG_DEBUG_FILE);
        }
 
        fd = fopen(wd_debug_request_file, "r");