Re: Inefficient handling of LO-restore + Patch

Поиск
Список
Период
Сортировка
Искать
От
Bruce Momjian
Тема
Re: Inefficient handling of LO-restore + Patch
Дата
Msg-id
200204241403.g3OE37O10125@candle.pha.pa.us
Ответ на
Список
Дерево обсуждения
Re: Inefficient handling of LO-restore + Patch "Mario Weilguni" <mario.weilguni@icomedias.com>

OK, I have applied the following patch to fix these warnings.  However,
I need Mario to confirm these are the right changes.  Thanks.

---------------------------------------------------------------------------

Peter Eisentraut wrote:
> This patch does not compile correctly:
> 
> pg_backup_archiver.c: In function `ahwrite':
> pg_backup_archiver.c:1252: warning: pointer of type `void *' used in arithmetic
> pg_backup_archiver.c:1259: warning: pointer of type `void *' used in arithmetic
> pg_backup_archiver.c:1263: warning: pointer of type `void *' used in arithmetic
> make: *** [pg_backup_archiver.o] Error 1
> 
> 
> Bruce Momjian writes:
> 
> >
> > Patch applied.  Thanks.
> >
> > ---------------------------------------------------------------------------
> >
> >
> > Mario Weilguni wrote:
> > > Am Donnerstag, 11. April 2002 17:44 schrieb Tom Lane:
> > > > "Mario Weilguni"  writes:
> > > > > And I did not find out how I can detect the large object
> > > > > chunksize, either from getting it from the headers (include
> > > > > "storage/large_object.h" did not work)
> > > >
> > >
> > > You did not answer if it's ok to post the patch, hope it's ok:
> >
> >
> 
> -- 
> Peter Eisentraut   peter_e@gmx.net
> 
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
Index: src/bin/pg_dump/pg_backup_archiver.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v
retrieving revision 1.43
diff -c -r1.43 pg_backup_archiver.c
*** src/bin/pg_dump/pg_backup_archiver.c	24 Apr 2002 02:21:04 -0000	1.43
--- src/bin/pg_dump/pg_backup_archiver.c	24 Apr 2002 14:01:15 -0000
***************
*** 1249,1266 ****
  		  int remaining = AH->lo_buf_size - AH->lo_buf_used;
  		  int slack = nmemb * size - remaining;
  
! 		  memcpy(AH->lo_buf + AH->lo_buf_used, ptr, remaining);
  		  res = lo_write(AH->connection, AH->loFd, AH->lo_buf, AH->lo_buf_size);
  		  ahlog(AH, 5, "wrote %d bytes of large object data (result = %d)\n",
  		  	        AH->lo_buf_size, res);
  		  if (res != AH->lo_buf_size)
  			die_horribly(AH, modulename, "could not write to large object (result: %d, expected: %d)\n",
  						 res, AH->lo_buf_size);
! 	          memcpy(AH->lo_buf, ptr + remaining, slack);
  		  AH->lo_buf_used = slack;
  	       } else {
  	         /* LO Buffer is still large enough, buffer it */
! 		 memcpy(AH->lo_buf + AH->lo_buf_used, ptr, size * nmemb);
  		 AH->lo_buf_used += size * nmemb;
  	       }
  
--- 1249,1266 ----
  		  int remaining = AH->lo_buf_size - AH->lo_buf_used;
  		  int slack = nmemb * size - remaining;
  
! 		  memcpy((char *)AH->lo_buf + AH->lo_buf_used, ptr, remaining);
  		  res = lo_write(AH->connection, AH->loFd, AH->lo_buf, AH->lo_buf_size);
  		  ahlog(AH, 5, "wrote %d bytes of large object data (result = %d)\n",
  		  	        AH->lo_buf_size, res);
  		  if (res != AH->lo_buf_size)
  			die_horribly(AH, modulename, "could not write to large object (result: %d, expected: %d)\n",
  						 res, AH->lo_buf_size);
! 	          memcpy(AH->lo_buf, (char *)ptr + remaining, slack);
  		  AH->lo_buf_used = slack;
  	       } else {
  	         /* LO Buffer is still large enough, buffer it */
! 		 memcpy((char *)AH->lo_buf + AH->lo_buf_used, ptr, size * nmemb);
  		 AH->lo_buf_used += size * nmemb;
  	       }
  
В списке pgsql-hackers по дате отправления
От: Bruce Momjian
Дата:
От: Bruce Momjian
Дата:
Сообщение: Re: Sequential Scan Read-Ahead
FAQ