[pgsql-jp: 32910] Re: pgpool +長いデータの INSERT

Tatsuo Ishii t-ishii @ sra.co.jp
2004年 5月 7日 (金) 23:03:40 JST


石井です.

> 川村と申します。
> 
> FreeBSD 5.2.1-RELEASE-p4 上で、pgpool-1.0 と PostgreSQL-7.3.5 を
> 動作させています。
> 
> pgpool 経由で postmaster へ、例えば 40000 byte 位の文字列データを
> INSERT するクエリを送ると、pgpool が core dump する現象が起きてい
> ます。pgpool を通さずに、postmaster 直だと問題ありません。

バグを見つけたので修正してみました.とりあえずこちらでは44000バイトく
らいのinsertでも動いています.良かったら試してみてください.
--
Tatsuo Ishii

Index: pool_stream.c
===================================================================
RCS file: /home/t-ishii/repository/pgpool/pool_stream.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -c -r1.16 -r1.17
*** pool_stream.c	28 Apr 2004 13:52:38 -0000	1.16
--- pool_stream.c	7 May 2004 13:59:23 -0000	1.17
***************
*** 388,394 ****
  		pool_debug("pool_read_string: string: :%s:", cp->sbuf+readp);
  		pool_debug("pool_read_string: next string: :%s:", cp->sbuf+readp+strlen(cp->sbuf+readp)+1);
  		
! 		/* enountered null or newline? */
  		if (flag)
  		{
  			/* ok we have read all data */
--- 388,394 ----
  		pool_debug("pool_read_string: string: :%s:", cp->sbuf+readp);
  		pool_debug("pool_read_string: next string: :%s:", cp->sbuf+readp+strlen(cp->sbuf+readp)+1);
  		
! 		/* encountered null or newline? */
  		if (flag)
  		{
  			/* ok we have read all data */
***************
*** 399,413 ****
  
  		pool_debug("pool_read_string: read more data %d string: :%s:", *len, cp->sbuf+readp);
  
! 		readp = cp->sbufsz;
! 		cp->sbufsz += READBUFSZ;
  		readsize = READBUFSZ;
  
! 		cp->sbuf = realloc(cp->sbuf, cp->sbufsz);
! 		if (cp->sbuf == NULL)
  		{
! 			pool_error("pool_read_string: realloc failed");
! 			return NULL;
  		}
  	}
  	return cp->sbuf;
--- 399,417 ----
  
  		pool_debug("pool_read_string: read more data %d string: :%s:", *len, cp->sbuf+readp);
  
! 		readp += readlen;
  		readsize = READBUFSZ;
  
! 		if ((*len+readsize) > cp->sbufsz)
  		{
! 			cp->sbufsz += READBUFSZ;
! 
! 			cp->sbuf = realloc(cp->sbuf, cp->sbufsz);
! 			if (cp->sbuf == NULL)
! 			{
! 				pool_error("pool_read_string: realloc failed");
! 				return NULL;
! 			}
  		}
  	}
  	return cp->sbuf;




pgsql-jp メーリングリストの案内