From acad203c31cc7d2c80937ff5b65ff8295f71c46c Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Fri, 2 Jun 2000 02:27:59 +0000 Subject: Update faq's. --- doc/FAQ_NT | 367 ++++++++++++++++++++++++++++++++++++++++++++ doc/README.BSDI | 31 ---- doc/README.NT | 367 -------------------------------------------- doc/TODO.detail/replication | 105 ++++++++++++- 4 files changed, 468 insertions(+), 402 deletions(-) create mode 100644 doc/FAQ_NT delete mode 100644 doc/README.BSDI delete mode 100644 doc/README.NT diff --git a/doc/FAQ_NT b/doc/FAQ_NT new file mode 100644 index 00000000000..e4542895063 --- /dev/null +++ b/doc/FAQ_NT @@ -0,0 +1,367 @@ +Installing PostgreSQL on NT: + +--------------------------------------------------------------------------- + +It can be done by done by typing configure, make and make install. + +1. Install the Cygwin package +2. Update to EGCS 1.1.2 + (This may be optional.) + +--------------------------------------------------------------------------- + + OPTIONAL + +1. Install the Andy Piper Tools (http://www.xemacs.freeserve.co.uk/) + (This may be optional.) + You need at least the crypt library (also available as + ftp://sourceware.cygnus.com/pub/cygwin/xfree/libcrypt-cygwin-b20.1.tar.bz2) + +--------------------------------------------------------------------------- + + CYGWIN32 INSTALLATION + +1. Download the Cygwin32 IPC Package by Ludovic LANGE + http://penguin.cz/~horak/cygwin32_ipc-1.03.tar.gz +2. Untar the package and follow the readme instructions. +3. Apply the patch at the end of this file to the cygipc sources + before compiling the library. +4. I tested 1.03. +5. I used the \cygwin-b20\h-i568-cygwin32\i586-cygwin32\lib and +\cygwin-b20\h-i568-cygwin32\i586-cygwin32\include\sys instead of the +/usr/local/lib and usr/local/include/sys. + +NOTE: +Also, the cygnus-bindir has to be placed in the path before the +NT-directories, because the sort.exe has to be taken for cygnus, not +NT. + +--------------------------------------------------------------------------- + + POSTGRESQL INSTALL WITH NT SPECIFICS + +1. Download the current version of PostgreSQL. +2. Untar the package. +3. Copy the files from \pgsql\src\win32 according to the readme file. +4. Edit \pgsql\src\template\cygwin32 if needed (I had to adjust the YFLAGS +path). +5. ./configure +6. make +7. create the directory /usr/local/pgsql manually: the mkdir cannot create a +directory 2 levels deep in one step. +8. make install +9. cd /usr/lical/pgsql/doc +10. make install +11. Set the environmental data +12. Initdb --username=jkr (do not run this command as administrator) + +13. Open a new Cygwin command prompt +14. Start "ipc-deamon&" (background proces) +15. Start "postmaster -i 2>&1 > /tmp/postgres.log &" (background proces) +16. Start "tail -f /tmp/postgres.log" to see the messages + +17. cd /usr/src/pgsql/src/test/regress +18. make all runtest + +All test should be run. + +NOTE: +By default, PostgreSQL clients like psql communicate using unix domain +sockets, which don't work on NT. Start the postmaster with -i, and +when connecting to the database from a client, set the PGHOST +environment variable to 'localhost' or supply the hostname on the +command line. + +Joost + +PS: If you still have problems you can mail to Dan Horak + who is the maintainer for the win32 port + +--------------------------------------------------------------------------- + +*** ./ipc-daemon.c.orig Tue Dec 01 00:04:24 1998 +--- ./ipc-daemon.c Fri Sep 24 13:34:16 1999 +*************** +*** 270,285 **** + { + itoa(100*id+Index, LBuff) ; + LHandle = OpenSemaphore(SEMAPHORE_ALL_ACCESS, FALSE, LBuff) ; +! while (LAdrSem->current_nb[id].current_nb[Index] > 0 ) +! { +! WaitForSingleObject(LHandle, 0) ; +! LAdrSem->current_nb[id].current_nb[Index]-- ; +! } +! CloseHandle(LHandle) ; + } + LAdrSem->semary[id] = IPC_UNUSED ; + LAdrSem->state[id] = 0 ; + } + else + { + for (Index = 0; Index < sma->sem_nsems; Index++) +--- 270,284 ---- + { + itoa(100*id+Index, LBuff) ; + LHandle = OpenSemaphore(SEMAPHORE_ALL_ACCESS, FALSE, LBuff) ; +! while (WaitForSingleObject(LHandle, 0) == WAIT_OBJECT_0) +! ; +! LAdrSem->current_nb[id].current_nb[Index] = 0; +! CloseHandle(LHandle) ; + } + LAdrSem->semary[id] = IPC_UNUSED ; + LAdrSem->state[id] = 0 ; + } ++ /* + else + { + for (Index = 0; Index < sma->sem_nsems; Index++) +*************** +*** 288,293 **** +--- 287,293 ---- + LHandle = OpenSemaphore(SEMAPHORE_ALL_ACCESS, FALSE, LBuff) ; + } + } ++ */ + } + } + +*** ./msg.c.orig Tue Dec 01 00:16:09 1998 +--- ./msg.c Fri Sep 17 12:50:50 1999 +*************** +*** 57,62 **** +--- 57,77 ---- + static int GFirstMsg = 0; /*PCPC*/ + static int GFdMsg ; /*PCPC*/ + ++ /*****************************************/ ++ /* Initialization of static variables */ ++ /*****************************************/ ++ static pid_t GProcessId = 0; ++ static void init_globals(void) ++ { ++ pid_t pid; ++ ++ if (pid=getpid(), pid != GProcessId) ++ { ++ GFirstMsg = 0; ++ msgbytes = msghdrs = msg_seq = used_queues = max_msqid = 0; ++ GProcessId = pid; ++ } ++ } + /************************************************************************/ + /* Demande d'acces a la zone partagee de gestion des semaphores */ + /************************************************************************/ +*************** +*** 79,84 **** +--- 94,100 ---- + { + int LRet ; + ++ init_globals(); + if( GFirstMsg == 0 ) + { + if( IsGSemMsgExist() ) +*** ./sem.c.orig Tue Dec 01 00:16:25 1998 +--- ./sem.c Fri Sep 17 12:47:11 1999 +*************** +*** 58,63 **** +--- 58,78 ---- + static int GFirstSem = 0; /*PCPC*/ + static int GFdSem ; /*PCPC*/ + ++ static pid_t GProcessId = 0; ++ ++ static void init_globals(void) ++ { ++ pid_t pid; ++ ++ if (pid=getpid(), pid != GProcessId) ++ { ++ GFirstSem = 0; ++ used_sems = used_semids = max_semid = 0; ++ sem_seq = 0; ++ GProcessId = pid; ++ } ++ } ++ + /************************************************************************/ + /* Demande d'acces a la zone partagee de gestion des semaphores */ + /************************************************************************/ +*************** +*** 77,82 **** +--- 92,98 ---- + { + int LRet ; + ++ init_globals(); + if( GFirstSem == 0 ) + { + if( IsGSemSemExist() ) +*************** +*** 187,193 **** + { + CloseHandle ( LHandle ) ; + } +! LHandle = CreateSemaphore(NULL, 0, 0x7FFFFFFF, LBuff) ; + if( LHandle == NULL ) + { + printf( "Creation de Semaphore \"Sem\" impossible\n" ) ; +--- 203,209 ---- + { + CloseHandle ( LHandle ) ; + } +! LHandle = CreateSemaphore(NULL, 0, 1, LBuff) ; + if( LHandle == NULL ) + { + printf( "Creation de Semaphore \"Sem\" impossible\n" ) ; +*************** +*** 357,371 **** + debug_printf("do_semop : return -EACCES\n"); + CYGWIN32_IPCNT_RETURN (-EACCES) ; + } +! ReleaseSemaphore(LHandle, sop->sem_op, &LVal) ; +! shareadrsem->current_nb[id].current_nb[sop->sem_num] += +! sop->sem_op ; + sem_deconnect() ; + } else { + if( sop->sem_flg == IPC_NOWAIT ) + { +! LRet = WaitForSingleObject(LHandle, 0) ; +! if( LRet == WAIT_TIMEOUT ) + { + debug_printf("do_semop : return -EAGAIN\n"); + CYGWIN32_IPCNT_RETURN (-EAGAIN) ; +--- 373,386 ---- + debug_printf("do_semop : return -EACCES\n"); + CYGWIN32_IPCNT_RETURN (-EACCES) ; + } +! shareadrsem->current_nb[id].current_nb[sop->sem_num] += +! sop->sem_op ; + sem_deconnect() ; ++ ReleaseSemaphore(LHandle, 1 , &LVal) ; + } else { + if( sop->sem_flg == IPC_NOWAIT ) + { +! if( sop->sem_op + shareadrsem->current_nb[id].current_nb[sop->sem_num] <0 ) + { + debug_printf("do_semop : return -EAGAIN\n"); + CYGWIN32_IPCNT_RETURN (-EAGAIN) ; +*************** +*** 375,390 **** + debug_printf("do_semop : return -EACCES\n"); + CYGWIN32_IPCNT_RETURN (-EACCES) ; + } +! shareadrsem->current_nb[id].current_nb[sop->sem_num] -= 1 ; + sem_deconnect() ; + } else { +! LRet = WaitForSingleObject(LHandle, INFINITE) ; + if (sem_connect() == 0) + { + debug_printf("do_semop : return -EACCES\n"); + CYGWIN32_IPCNT_RETURN (-EACCES) ; + } +! shareadrsem->current_nb[id].current_nb[sop->sem_num] -= 1 ; + sem_deconnect() ; + } + } +--- 390,407 ---- + debug_printf("do_semop : return -EACCES\n"); + CYGWIN32_IPCNT_RETURN (-EACCES) ; + } +! shareadrsem->current_nb[id].current_nb[sop->sem_num] += sop->sem_op; + sem_deconnect() ; + } else { +! while(sop->sem_op + shareadrsem->current_nb[id].current_nb[sop->sem_num] <0) +! LRet = WaitForSingleObject(LHandle, INFINITE) ; +! + if (sem_connect() == 0) + { + debug_printf("do_semop : return -EACCES\n"); + CYGWIN32_IPCNT_RETURN (-EACCES) ; + } +! shareadrsem->current_nb[id].current_nb[sop->sem_num] += sop->sem_op ; + sem_deconnect() ; + } + } +*************** +*** 435,441 **** + char LBuff[100] ; + HANDLE LHandle ; + long LPrevious ; +- int LIndex; + + debug_printf("semctl : semid=%X semnum=%X cmd=0x%02X arg=%p\n",semid,semnum,cmd,arg); + if (semid < 0 || semnum < 0 || cmd < 0) +--- 452,457 ---- +*************** +*** 568,589 **** + if( LHandle != NULL ) + { + if( arg.val > shareadrsem->current_nb[id].current_nb[semnum] ) +! { +! ReleaseSemaphore(LHandle, +! arg.val-shareadrsem->current_nb[id].current_nb[semnum], +! &LPrevious) ; +! } +! else if (arg.val < +! shareadrsem->current_nb[id].current_nb[semnum] ) +! { +! for( LIndex = arg.val; +! LIndex < shareadrsem->current_nb[id].current_nb[semnum]; +! LIndex++ ) +! { +! WaitForSingleObject(LHandle, 0) ; +! } +! } +! shareadrsem->current_nb[id].current_nb[semnum] = arg.val ; + } + debug_printf("semctl : SETVAL : return 0\n"); + CYGWIN32_IPCNT_RETURN_DECONNECT (0); +--- 584,591 ---- + if( LHandle != NULL ) + { + if( arg.val > shareadrsem->current_nb[id].current_nb[semnum] ) +! ReleaseSemaphore(LHandle,1,&LPrevious) ; +! shareadrsem->current_nb[id].current_nb[semnum] = arg.val ; + } + debug_printf("semctl : SETVAL : return 0\n"); + CYGWIN32_IPCNT_RETURN_DECONNECT (0); +*** ./shm.c.orig Fri Sep 17 12:46:24 1999 +--- ./shm.c Fri Sep 17 12:47:11 1999 +*************** +*** 59,64 **** +--- 59,81 ---- + static int GFirstShm = 0; /*PCPC*/ + static int GFdShm ; /*PCPC*/ + ++ /*****************************************/ ++ /* Initialization of static variables */ ++ /*****************************************/ ++ static pid_t GProcessId = 0; ++ static void init_globals(void) ++ { ++ pid_t pid; ++ ++ if (pid=getpid(), pid != GProcessId) ++ { ++ GFirstShm = 0; ++ shm_rss = shm_swp = max_shmid = 0; ++ shm_seq = 0; ++ GProcessId = pid; ++ } ++ } ++ + /************************************************************************/ + /* Demande d'acces a la zone partagee de gestion des shm */ + /************************************************************************/ +*************** +*** 82,87 **** +--- 99,105 ---- + { + int LRet ; + ++ init_globals(); + if( GFirstShm == 0 ) + { + if( IsGSemShmExist() ) + diff --git a/doc/README.BSDI b/doc/README.BSDI deleted file mode 100644 index 0392f26ee7d..00000000000 --- a/doc/README.BSDI +++ /dev/null @@ -1,31 +0,0 @@ -This outlines how to increase the number of shared memory buffers -supported by BSD/OS. By default, only 4MB of shared memory is supported -by BSDI. - -Bruce Momjian (pgman@candle.pha.pa.us) - ---------------------------------------------------------------------------- - -First, increase SHMMAXPGS by 1024 for every additional 4MB of shared -memory: - -/sys/sys/shm.h:69:#define SHMMAXPGS 1024 /* max hardware pages... - -The default setting of 1024 is for a maximum of 4MB of shared memory. - -Second, use bpatch to find the sysptsize value for the current kernel. -This is computed dynamically at bootup. - - $ bpatch -r sysptsize - 0x9 = 9 - -Next, change SYSPTSIZE to a hard-coded value. Use the bpatch value, -plus add 1 for every additional 4MB of shared memory you desire. - -/sys/i386/i386/i386_param.c:28:#define SYSPTSIZE 0 /* dynamically... - -sysptsize can not be changed by sysctl on the fly. - -This should clearly be easier to do on BSDI. I will add a BSDI FAQ for -PostgreSQL to cover this. One downside is that shared memory is not -pageable. It is locked in RAM. diff --git a/doc/README.NT b/doc/README.NT deleted file mode 100644 index e4542895063..00000000000 --- a/doc/README.NT +++ /dev/null @@ -1,367 +0,0 @@ -Installing PostgreSQL on NT: - ---------------------------------------------------------------------------- - -It can be done by done by typing configure, make and make install. - -1. Install the Cygwin package -2. Update to EGCS 1.1.2 - (This may be optional.) - ---------------------------------------------------------------------------- - - OPTIONAL - -1. Install the Andy Piper Tools (http://www.xemacs.freeserve.co.uk/) - (This may be optional.) - You need at least the crypt library (also available as - ftp://sourceware.cygnus.com/pub/cygwin/xfree/libcrypt-cygwin-b20.1.tar.bz2) - ---------------------------------------------------------------------------- - - CYGWIN32 INSTALLATION - -1. Download the Cygwin32 IPC Package by Ludovic LANGE - http://penguin.cz/~horak/cygwin32_ipc-1.03.tar.gz -2. Untar the package and follow the readme instructions. -3. Apply the patch at the end of this file to the cygipc sources - before compiling the library. -4. I tested 1.03. -5. I used the \cygwin-b20\h-i568-cygwin32\i586-cygwin32\lib and -\cygwin-b20\h-i568-cygwin32\i586-cygwin32\include\sys instead of the -/usr/local/lib and usr/local/include/sys. - -NOTE: -Also, the cygnus-bindir has to be placed in the path before the -NT-directories, because the sort.exe has to be taken for cygnus, not -NT. - ---------------------------------------------------------------------------- - - POSTGRESQL INSTALL WITH NT SPECIFICS - -1. Download the current version of PostgreSQL. -2. Untar the package. -3. Copy the files from \pgsql\src\win32 according to the readme file. -4. Edit \pgsql\src\template\cygwin32 if needed (I had to adjust the YFLAGS -path). -5. ./configure -6. make -7. create the directory /usr/local/pgsql manually: the mkdir cannot create a -directory 2 levels deep in one step. -8. make install -9. cd /usr/lical/pgsql/doc -10. make install -11. Set the environmental data -12. Initdb --username=jkr (do not run this command as administrator) - -13. Open a new Cygwin command prompt -14. Start "ipc-deamon&" (background proces) -15. Start "postmaster -i 2>&1 > /tmp/postgres.log &" (background proces) -16. Start "tail -f /tmp/postgres.log" to see the messages - -17. cd /usr/src/pgsql/src/test/regress -18. make all runtest - -All test should be run. - -NOTE: -By default, PostgreSQL clients like psql communicate using unix domain -sockets, which don't work on NT. Start the postmaster with -i, and -when connecting to the database from a client, set the PGHOST -environment variable to 'localhost' or supply the hostname on the -command line. - -Joost - -PS: If you still have problems you can mail to Dan Horak - who is the maintainer for the win32 port - ---------------------------------------------------------------------------- - -*** ./ipc-daemon.c.orig Tue Dec 01 00:04:24 1998 ---- ./ipc-daemon.c Fri Sep 24 13:34:16 1999 -*************** -*** 270,285 **** - { - itoa(100*id+Index, LBuff) ; - LHandle = OpenSemaphore(SEMAPHORE_ALL_ACCESS, FALSE, LBuff) ; -! while (LAdrSem->current_nb[id].current_nb[Index] > 0 ) -! { -! WaitForSingleObject(LHandle, 0) ; -! LAdrSem->current_nb[id].current_nb[Index]-- ; -! } -! CloseHandle(LHandle) ; - } - LAdrSem->semary[id] = IPC_UNUSED ; - LAdrSem->state[id] = 0 ; - } - else - { - for (Index = 0; Index < sma->sem_nsems; Index++) ---- 270,284 ---- - { - itoa(100*id+Index, LBuff) ; - LHandle = OpenSemaphore(SEMAPHORE_ALL_ACCESS, FALSE, LBuff) ; -! while (WaitForSingleObject(LHandle, 0) == WAIT_OBJECT_0) -! ; -! LAdrSem->current_nb[id].current_nb[Index] = 0; -! CloseHandle(LHandle) ; - } - LAdrSem->semary[id] = IPC_UNUSED ; - LAdrSem->state[id] = 0 ; - } -+ /* - else - { - for (Index = 0; Index < sma->sem_nsems; Index++) -*************** -*** 288,293 **** ---- 287,293 ---- - LHandle = OpenSemaphore(SEMAPHORE_ALL_ACCESS, FALSE, LBuff) ; - } - } -+ */ - } - } - -*** ./msg.c.orig Tue Dec 01 00:16:09 1998 ---- ./msg.c Fri Sep 17 12:50:50 1999 -*************** -*** 57,62 **** ---- 57,77 ---- - static int GFirstMsg = 0; /*PCPC*/ - static int GFdMsg ; /*PCPC*/ - -+ /*****************************************/ -+ /* Initialization of static variables */ -+ /*****************************************/ -+ static pid_t GProcessId = 0; -+ static void init_globals(void) -+ { -+ pid_t pid; -+ -+ if (pid=getpid(), pid != GProcessId) -+ { -+ GFirstMsg = 0; -+ msgbytes = msghdrs = msg_seq = used_queues = max_msqid = 0; -+ GProcessId = pid; -+ } -+ } - /************************************************************************/ - /* Demande d'acces a la zone partagee de gestion des semaphores */ - /************************************************************************/ -*************** -*** 79,84 **** ---- 94,100 ---- - { - int LRet ; - -+ init_globals(); - if( GFirstMsg == 0 ) - { - if( IsGSemMsgExist() ) -*** ./sem.c.orig Tue Dec 01 00:16:25 1998 ---- ./sem.c Fri Sep 17 12:47:11 1999 -*************** -*** 58,63 **** ---- 58,78 ---- - static int GFirstSem = 0; /*PCPC*/ - static int GFdSem ; /*PCPC*/ - -+ static pid_t GProcessId = 0; -+ -+ static void init_globals(void) -+ { -+ pid_t pid; -+ -+ if (pid=getpid(), pid != GProcessId) -+ { -+ GFirstSem = 0; -+ used_sems = used_semids = max_semid = 0; -+ sem_seq = 0; -+ GProcessId = pid; -+ } -+ } -+ - /************************************************************************/ - /* Demande d'acces a la zone partagee de gestion des semaphores */ - /************************************************************************/ -*************** -*** 77,82 **** ---- 92,98 ---- - { - int LRet ; - -+ init_globals(); - if( GFirstSem == 0 ) - { - if( IsGSemSemExist() ) -*************** -*** 187,193 **** - { - CloseHandle ( LHandle ) ; - } -! LHandle = CreateSemaphore(NULL, 0, 0x7FFFFFFF, LBuff) ; - if( LHandle == NULL ) - { - printf( "Creation de Semaphore \"Sem\" impossible\n" ) ; ---- 203,209 ---- - { - CloseHandle ( LHandle ) ; - } -! LHandle = CreateSemaphore(NULL, 0, 1, LBuff) ; - if( LHandle == NULL ) - { - printf( "Creation de Semaphore \"Sem\" impossible\n" ) ; -*************** -*** 357,371 **** - debug_printf("do_semop : return -EACCES\n"); - CYGWIN32_IPCNT_RETURN (-EACCES) ; - } -! ReleaseSemaphore(LHandle, sop->sem_op, &LVal) ; -! shareadrsem->current_nb[id].current_nb[sop->sem_num] += -! sop->sem_op ; - sem_deconnect() ; - } else { - if( sop->sem_flg == IPC_NOWAIT ) - { -! LRet = WaitForSingleObject(LHandle, 0) ; -! if( LRet == WAIT_TIMEOUT ) - { - debug_printf("do_semop : return -EAGAIN\n"); - CYGWIN32_IPCNT_RETURN (-EAGAIN) ; ---- 373,386 ---- - debug_printf("do_semop : return -EACCES\n"); - CYGWIN32_IPCNT_RETURN (-EACCES) ; - } -! shareadrsem->current_nb[id].current_nb[sop->sem_num] += -! sop->sem_op ; - sem_deconnect() ; -+ ReleaseSemaphore(LHandle, 1 , &LVal) ; - } else { - if( sop->sem_flg == IPC_NOWAIT ) - { -! if( sop->sem_op + shareadrsem->current_nb[id].current_nb[sop->sem_num] <0 ) - { - debug_printf("do_semop : return -EAGAIN\n"); - CYGWIN32_IPCNT_RETURN (-EAGAIN) ; -*************** -*** 375,390 **** - debug_printf("do_semop : return -EACCES\n"); - CYGWIN32_IPCNT_RETURN (-EACCES) ; - } -! shareadrsem->current_nb[id].current_nb[sop->sem_num] -= 1 ; - sem_deconnect() ; - } else { -! LRet = WaitForSingleObject(LHandle, INFINITE) ; - if (sem_connect() == 0) - { - debug_printf("do_semop : return -EACCES\n"); - CYGWIN32_IPCNT_RETURN (-EACCES) ; - } -! shareadrsem->current_nb[id].current_nb[sop->sem_num] -= 1 ; - sem_deconnect() ; - } - } ---- 390,407 ---- - debug_printf("do_semop : return -EACCES\n"); - CYGWIN32_IPCNT_RETURN (-EACCES) ; - } -! shareadrsem->current_nb[id].current_nb[sop->sem_num] += sop->sem_op; - sem_deconnect() ; - } else { -! while(sop->sem_op + shareadrsem->current_nb[id].current_nb[sop->sem_num] <0) -! LRet = WaitForSingleObject(LHandle, INFINITE) ; -! - if (sem_connect() == 0) - { - debug_printf("do_semop : return -EACCES\n"); - CYGWIN32_IPCNT_RETURN (-EACCES) ; - } -! shareadrsem->current_nb[id].current_nb[sop->sem_num] += sop->sem_op ; - sem_deconnect() ; - } - } -*************** -*** 435,441 **** - char LBuff[100] ; - HANDLE LHandle ; - long LPrevious ; -- int LIndex; - - debug_printf("semctl : semid=%X semnum=%X cmd=0x%02X arg=%p\n",semid,semnum,cmd,arg); - if (semid < 0 || semnum < 0 || cmd < 0) ---- 452,457 ---- -*************** -*** 568,589 **** - if( LHandle != NULL ) - { - if( arg.val > shareadrsem->current_nb[id].current_nb[semnum] ) -! { -! ReleaseSemaphore(LHandle, -! arg.val-shareadrsem->current_nb[id].current_nb[semnum], -! &LPrevious) ; -! } -! else if (arg.val < -! shareadrsem->current_nb[id].current_nb[semnum] ) -! { -! for( LIndex = arg.val; -! LIndex < shareadrsem->current_nb[id].current_nb[semnum]; -! LIndex++ ) -! { -! WaitForSingleObject(LHandle, 0) ; -! } -! } -! shareadrsem->current_nb[id].current_nb[semnum] = arg.val ; - } - debug_printf("semctl : SETVAL : return 0\n"); - CYGWIN32_IPCNT_RETURN_DECONNECT (0); ---- 584,591 ---- - if( LHandle != NULL ) - { - if( arg.val > shareadrsem->current_nb[id].current_nb[semnum] ) -! ReleaseSemaphore(LHandle,1,&LPrevious) ; -! shareadrsem->current_nb[id].current_nb[semnum] = arg.val ; - } - debug_printf("semctl : SETVAL : return 0\n"); - CYGWIN32_IPCNT_RETURN_DECONNECT (0); -*** ./shm.c.orig Fri Sep 17 12:46:24 1999 ---- ./shm.c Fri Sep 17 12:47:11 1999 -*************** -*** 59,64 **** ---- 59,81 ---- - static int GFirstShm = 0; /*PCPC*/ - static int GFdShm ; /*PCPC*/ - -+ /*****************************************/ -+ /* Initialization of static variables */ -+ /*****************************************/ -+ static pid_t GProcessId = 0; -+ static void init_globals(void) -+ { -+ pid_t pid; -+ -+ if (pid=getpid(), pid != GProcessId) -+ { -+ GFirstShm = 0; -+ shm_rss = shm_swp = max_shmid = 0; -+ shm_seq = 0; -+ GProcessId = pid; -+ } -+ } -+ - /************************************************************************/ - /* Demande d'acces a la zone partagee de gestion des shm */ - /************************************************************************/ -*************** -*** 82,87 **** ---- 99,105 ---- - { - int LRet ; - -+ init_globals(); - if( GFirstShm == 0 ) - { - if( IsGSemShmExist() ) - diff --git a/doc/TODO.detail/replication b/doc/TODO.detail/replication index d18f7db52d0..077a90bf09f 100644 --- a/doc/TODO.detail/replication +++ b/doc/TODO.detail/replication @@ -43,7 +43,7 @@ From owner-pgsql-hackers@hub.org Fri Dec 24 10:01:18 1999 Received: from renoir.op.net (root@renoir.op.net [207.29.195.4]) by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id LAA11295 for ; Fri, 24 Dec 1999 11:01:17 -0500 (EST) -Received: from hub.org (hub.org [216.126.84.1]) by renoir.op.net (o1/$Revision: 1.1 $) with ESMTP id KAA20310 for ; Fri, 24 Dec 1999 10:39:18 -0500 (EST) +Received: from hub.org (hub.org [216.126.84.1]) by renoir.op.net (o1/$Revision: 1.2 $) with ESMTP id KAA20310 for ; Fri, 24 Dec 1999 10:39:18 -0500 (EST) Received: from localhost (majordom@localhost) by hub.org (8.9.3/8.9.3) with SMTP id KAA61760; Fri, 24 Dec 1999 10:31:13 -0500 (EST) @@ -129,7 +129,7 @@ From owner-pgsql-hackers@hub.org Fri Dec 24 18:31:03 1999 Received: from renoir.op.net (root@renoir.op.net [207.29.195.4]) by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id TAA26244 for ; Fri, 24 Dec 1999 19:31:02 -0500 (EST) -Received: from hub.org (hub.org [216.126.84.1]) by renoir.op.net (o1/$Revision: 1.1 $) with ESMTP id TAA12730 for ; Fri, 24 Dec 1999 19:30:05 -0500 (EST) +Received: from hub.org (hub.org [216.126.84.1]) by renoir.op.net (o1/$Revision: 1.2 $) with ESMTP id TAA12730 for ; Fri, 24 Dec 1999 19:30:05 -0500 (EST) Received: from localhost (majordom@localhost) by hub.org (8.9.3/8.9.3) with SMTP id TAA57851; Fri, 24 Dec 1999 19:23:31 -0500 (EST) @@ -212,7 +212,7 @@ From owner-pgsql-hackers@hub.org Fri Dec 24 21:31:10 1999 Received: from renoir.op.net (root@renoir.op.net [207.29.195.4]) by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id WAA02578 for ; Fri, 24 Dec 1999 22:31:09 -0500 (EST) -Received: from hub.org (hub.org [216.126.84.1]) by renoir.op.net (o1/$Revision: 1.1 $) with ESMTP id WAA16641 for ; Fri, 24 Dec 1999 22:18:56 -0500 (EST) +Received: from hub.org (hub.org [216.126.84.1]) by renoir.op.net (o1/$Revision: 1.2 $) with ESMTP id WAA16641 for ; Fri, 24 Dec 1999 22:18:56 -0500 (EST) Received: from localhost (majordom@localhost) by hub.org (8.9.3/8.9.3) with SMTP id WAA89135; Fri, 24 Dec 1999 22:11:12 -0500 (EST) @@ -486,7 +486,7 @@ From owner-pgsql-hackers@hub.org Sun Dec 26 08:31:09 1999 Received: from renoir.op.net (root@renoir.op.net [207.29.195.4]) by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id JAA17976 for ; Sun, 26 Dec 1999 09:31:07 -0500 (EST) -Received: from hub.org (hub.org [216.126.84.1]) by renoir.op.net (o1/$Revision: 1.1 $) with ESMTP id JAA23337 for ; Sun, 26 Dec 1999 09:28:36 -0500 (EST) +Received: from hub.org (hub.org [216.126.84.1]) by renoir.op.net (o1/$Revision: 1.2 $) with ESMTP id JAA23337 for ; Sun, 26 Dec 1999 09:28:36 -0500 (EST) Received: from localhost (majordom@localhost) by hub.org (8.9.3/8.9.3) with SMTP id JAA90738; Sun, 26 Dec 1999 09:21:58 -0500 (EST) @@ -905,3 +905,100 @@ Sys Admin ************ +From owner-pgsql-hackers@hub.org Thu Dec 30 08:01:09 1999 +Received: from renoir.op.net (root@renoir.op.net [207.29.195.4]) + by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id JAA10317 + for ; Thu, 30 Dec 1999 09:01:08 -0500 (EST) +Received: from hub.org (hub.org [216.126.84.1]) by renoir.op.net (o1/$Revision: 1.2 $) with ESMTP id IAA02365 for ; Thu, 30 Dec 1999 08:37:10 -0500 (EST) +Received: from localhost (majordom@localhost) + by hub.org (8.9.3/8.9.3) with SMTP id IAA87902; + Thu, 30 Dec 1999 08:34:22 -0500 (EST) + (envelope-from owner-pgsql-hackers) +Received: by hub.org (bulk_mailer v1.5); Thu, 30 Dec 1999 08:32:24 -0500 +Received: (from majordom@localhost) + by hub.org (8.9.3/8.9.3) id IAA85771 + for pgsql-hackers-outgoing; Thu, 30 Dec 1999 08:31:27 -0500 (EST) + (envelope-from owner-pgsql-hackers@postgreSQL.org) +Received: from sandman.acadiau.ca (dcurrie@sandman.acadiau.ca [131.162.129.111]) + by hub.org (8.9.3/8.9.3) with ESMTP id IAA85234 + for ; Thu, 30 Dec 1999 08:31:10 -0500 (EST) + (envelope-from dcurrie@sandman.acadiau.ca) +Received: (from dcurrie@localhost) + by sandman.acadiau.ca (8.8.8/8.8.8/Debian/GNU) id GAA18698; + Thu, 30 Dec 1999 06:30:58 -0400 +From: Duane Currie +Message-Id: <199912301030.GAA18698@sandman.acadiau.ca> +Subject: Re: [HACKERS] database replication +In-Reply-To: from "DWalker@black-oak.com" at "Dec 24, 99 10:27:59 am" +To: DWalker@black-oak.com +Date: Thu, 30 Dec 1999 10:30:58 +0000 (AST) +Cc: pgsql-hackers@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL39 (25)] +MIME-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +Sender: owner-pgsql-hackers@postgresql.org +Status: OR + +Hi Guys, + +Now for one of my REALLY rare posts. +Having done a little bit of distributed data systems, I figured I'd +pitch in a couple cents worth. + +> 2) The replication system will need to add at least one field to each +> table in each database that needs to be re plicated.  This +> field will be a date/time stamp which identifies the " last +> update" of the record.  This field will be called PGR_TIME +> for la ck of a better name.  Because this field will be used +> from within programs and triggers it can be longer so as to not +> mistake it for a user field. + +I just started reading this thread, but I figured I'd throw in a couple +suggestions for distributed data control (a few idioms I've had to +deal with b4): + - Never use time (not reliable from system to system). Use + a version number of some sort that can stay consistent across + all replicas + + This way, if a system's time is or goes out of wack, it doesn't + cause your database to disintegrate, and it's easier to track + conflicts (see below. If using time, the algorithm gets + nightmarish) + + - On an insert, set to version 1 + + - On an update, version++ + + - On a delete, mark deleted, and add a delete stub somewhere for the + replicator process to deal with in sync'ing the databases. + + - If two records have the same version but different data, there's + a conflict. A few choices: + 1. Pick one as the correct one (yuck!! invisible data loss) + 2. Store both copies, pick one as current, and alert + database owner of the conflict, so they can deal with + it "manually." + 3. If possible, some conflicts can be merged. If a disjoint + set of fields were changed in each instance, these changes + may both be applied and the record merged. (Problem: + takes a lot more space. Requires a version number for + every field, or persistent storage of some old records. + However, this might help the "which fields changed" issue + you were talking about in #6) + + - A unique id across all systems should exist (or something that + effectively simulates a unique id. Maybe a composition of the + originating oid (from the insert) and the originating database + (oid of the database's record?) might do it. Store this as + an extra field in every record. + + (Two extra fieldss so far: 'unique id' and 'version') + +I do like your approach: triggers and a separate process. (Maintainable!! :) + +Anyway, just figured I'd throw in a few suggestions, +Duane + +************ + -- cgit v1.2.3