Re: [HACKERS] TODO item

Поиск
Список
Период
Сортировка
От Tatsuo Ishii
Тема Re: [HACKERS] TODO item
Дата
Msg-id 20000206154059U.t-ishii@sra.co.jp
обсуждение исходный текст
Ответ на Re: [HACKERS] TODO item  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: [HACKERS] TODO item  (Bruce Momjian <pgman@candle.pha.pa.us>)
RE: [HACKERS] TODO item  ("Hiroshi Inoue" <Inoue@tpf.co.jp>)
Список pgsql-hackers
> > In the TODO file:
> > 
> > * -Allow transaction commits with rollback with no-fsync performance [fsync](Vadim)
> > 
> > Has this been done in current? I see almost no performance
> > improvement on copying data into a table.
> 
> TODO updated.  That was part of MVCC which originally was supposed to be
> in 7.0.

Thanks.

BTW, I have worked a little bit on this item. The idea is pretty
simple. Instead of doing a real fsync() in pg_fsync(), just marking it
so that we remember to do fsync() at the commit time. Following
patches illustrate the idea. An experience shows that it dramatically
boosts the performance of copy. Unfortunately I see virtually no
difference for TPC-B like small many concurrent transactions. Maybe we
would need WAL for this. Comments?

Index: access/transam/xact.c
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/backend/access/transam/xact.c,v
retrieving revision 1.60
diff -c -r1.60 xact.c
*** access/transam/xact.c    2000/01/29 16:58:29    1.60
--- access/transam/xact.c    2000/02/06 06:12:58
***************
*** 639,644 ****
--- 639,646 ----     if (SharedBufferChanged)     {         FlushBufferPool();
+         pg_fsync_pending();
+          if (leak)             ResetBufferPool(); 
***************
*** 653,658 ****
--- 655,661 ----          */         leak = BufferPoolCheckLeak();         FlushBufferPool();
+         pg_fsync_pending();     }      if (leak)
Index: storage/file/fd.c
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/backend/storage/file/fd.c,v
retrieving revision 1.52
diff -c -r1.52 fd.c
*** storage/file/fd.c    2000/01/26 05:56:55    1.52
--- storage/file/fd.c    2000/02/06 06:13:01
***************
*** 189,202 **** static File fileNameOpenFile(FileName fileName, int fileFlags, int fileMode); static char
*filepath(char*filename); static long pg_nofile(void);  /*  * pg_fsync --- same as fsync except does nothing if -F
switchwas given  */ int pg_fsync(int fd) {
 
!     return disableFsync ? 0 : fsync(fd); }  /*
--- 189,238 ---- static File fileNameOpenFile(FileName fileName, int fileFlags, int fileMode); static char
*filepath(char*filename); static long pg_nofile(void);
 
+ static void alloc_fsync_info(void); 
+ static char *fsync_request;
+ static int nfds;
+  /*  * pg_fsync --- same as fsync except does nothing if -F switch was given  */ int pg_fsync(int fd)
+ {
+     if (fsync_request == NULL)
+       alloc_fsync_info();
+     fsync_request[fd] = 1;
+     return 0;
+ }
+ 
+ static void alloc_fsync_info(void)
+ {
+   nfds = pg_nofile();
+   fsync_request = malloc(nfds);
+   if (fsync_request == NULL) {
+     elog(ERROR, "alloc_fsync_info: cannot allocate memory");
+     return;
+   }
+ }
+ 
+ void
+ pg_fsync_pending(void) {
!   int i;
! 
!   if (disableFsync)
!     return;
! 
!   if (fsync_request == NULL)
!     alloc_fsync_info();
! 
!   for (i=0;i<nfds;i++) {
!     if (fsync_request[i]) {
!       fsync(i);
!       fsync_request[i] = 0;
!     }
!   } }  /*


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tatsuo Ishii
Дата:
Сообщение: Re: [HACKERS] pg_ctl man page
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] TODO item