View Issue Details

IDProjectCategoryView StatusLast Update
0000493Pgpool-IIBugpublic2019-04-10 16:15
ReporterhoshiaiAssigned Tohoshiai 
PrioritylowSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version3.4.23 
Target Version3.4.24Fixed in Version3.4.24 
Summary0000493: when read old pgpool_status file, wrong variable was referenced by Pgpool-II.
DescriptionPgpool-II 3.4 or later, a pgpool_status format is changed from binary data to ASCII text.
And their version support old format.

But read_status_file() function reference wrong variable, when old format file read.

'backend_rec ' variable is read by pgpool_status file.
If status is CON_DOWN, it is correct. But if status is CON_CONNECT_WAIT or CON_UP,
Pgpool-II read not backend_rec but BACKEND_INFO(i). It isincorrect.

read_status_file() #src/main/pgpool_main.c
=====================================
                         if (backend_rec.status[i] == CON_DOWN)
                         {
                                 BACKEND_INFO(i).backend_status = CON_DOWN;
                                 (void)write_status_file();
                                 ereport(LOG,
                                                 (errmsg("read_status_file: %d th backend is set to down status", i)));
                         }
                         else if (BACKEND_INFO(i).backend_status == CON_CONNECT_WAIT ||
                                          BACKEND_INFO(i).backend_status == CON_UP)
=====================================
TagsNo tags attached.

Activities

hoshiai

2019-04-09 14:44

developer   ~0002539

I attached patch fixed this problem.

pgpool_stats_fix.patch (713 bytes)
 src/main/pgpool_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/pgpool_main.c b/src/main/pgpool_main.c
index 0a03f77..a3f2a98 100644
--- a/src/main/pgpool_main.c
+++ b/src/main/pgpool_main.c
@@ -2943,8 +2943,8 @@ static int read_status_file(bool discard_status)
 				ereport(LOG,
 						(errmsg("read_status_file: %d th backend is set to down status", i)));
 			}
-			else if (BACKEND_INFO(i).backend_status == CON_CONNECT_WAIT ||
-					 BACKEND_INFO(i).backend_status == CON_UP)
+			else if (backend_rec.status[i] == CON_CONNECT_WAIT ||
+					 backend_rec.status[i] == CON_UP)
 			{
 				BACKEND_INFO(i).backend_status = CON_CONNECT_WAIT;
 				(void)write_status_file();

hoshiai

2019-04-10 16:15

developer   ~0002543

Above patch commited.
https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=e5f26774ec007313b2f7f0672e5f521d9a2c0fe8

Issue History

Date Modified Username Field Change
2019-04-08 17:07 hoshiai New Issue
2019-04-08 17:07 hoshiai Status new => assigned
2019-04-08 17:07 hoshiai Assigned To => hoshiai
2019-04-08 17:09 hoshiai Summary when read old pool_status file, wrong variable was referenced by Pgpool-II. => when read old pgpool_status file, wrong variable was referenced by Pgpool-II.
2019-04-08 17:09 hoshiai Description Updated View Revisions
2019-04-09 14:44 hoshiai File Added: pgpool_stats_fix.patch
2019-04-09 14:44 hoshiai Note Added: 0002539
2019-04-10 16:15 hoshiai Status assigned => closed
2019-04-10 16:15 hoshiai Resolution open => fixed
2019-04-10 16:15 hoshiai Fixed in Version => 3.4.24
2019-04-10 16:15 hoshiai Note Added: 0002543