mirror of
https://github.com/postgres/postgres.git
synced 2025-06-10 09:21:54 +03:00
fsync patch from openlink
This commit is contained in:
@ -7,7 +7,7 @@
|
|||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.1.1.1 1996/07/09 06:21:14 scrappy Exp $
|
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.2 1996/07/15 19:21:59 scrappy Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -136,6 +136,9 @@ static char *relname; /* current relation name */
|
|||||||
AttributeTupleForm attrtypes[MAXATTR]; /* points to attribute info */
|
AttributeTupleForm attrtypes[MAXATTR]; /* points to attribute info */
|
||||||
static char *values[MAXATTR]; /* cooresponding attribute values */
|
static char *values[MAXATTR]; /* cooresponding attribute values */
|
||||||
int numattr; /* number of attributes for cur. rel */
|
int numattr; /* number of attributes for cur. rel */
|
||||||
|
#ifdef OPENLINK_PATCHES
|
||||||
|
extern int fsyncOff; /* do not fsync the database */
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(WIN32) || defined(PORTNAME_next)
|
#if defined(WIN32) || defined(PORTNAME_next)
|
||||||
static jmp_buf Warn_restart;
|
static jmp_buf Warn_restart;
|
||||||
@ -198,9 +201,16 @@ void err()
|
|||||||
static void
|
static void
|
||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
|
#ifdef OPENLINK_PATCHES
|
||||||
|
fprintf(stderr,"Usage: postgres -boot [-d] [-C] [-F] [-O] [-Q] [-P portno] [dbName]\n");
|
||||||
|
#else
|
||||||
fprintf(stderr,"Usage: postgres -boot [-d] [-C] [-O] [-Q] [-P portno] [dbName]\n");
|
fprintf(stderr,"Usage: postgres -boot [-d] [-C] [-O] [-Q] [-P portno] [dbName]\n");
|
||||||
|
#endif
|
||||||
fprintf(stderr," d: debug mode\n");
|
fprintf(stderr," d: debug mode\n");
|
||||||
fprintf(stderr," C: disable version checking\n");
|
fprintf(stderr," C: disable version checking\n");
|
||||||
|
#ifdef OPENLINK_PATCHES
|
||||||
|
fprintf(stderr," F: turn off fsync\n");
|
||||||
|
#endif
|
||||||
fprintf(stderr," O: set BootstrapProcessing mode\n");
|
fprintf(stderr," O: set BootstrapProcessing mode\n");
|
||||||
fprintf(stderr," P portno: specify port number\n");
|
fprintf(stderr," P portno: specify port number\n");
|
||||||
|
|
||||||
@ -256,8 +266,12 @@ BootstrapMain(int argc, char *argv[])
|
|||||||
Quiet = 0;
|
Quiet = 0;
|
||||||
Noversion = 0;
|
Noversion = 0;
|
||||||
dbName = NULL;
|
dbName = NULL;
|
||||||
|
|
||||||
|
#ifdef OPENLINK_PATCHES
|
||||||
|
while ((flag = getopt(argc, argv, "dCOQP:F")) != EOF) {
|
||||||
|
#else
|
||||||
while ((flag = getopt(argc, argv, "dCOQP")) != EOF) {
|
while ((flag = getopt(argc, argv, "dCOQP")) != EOF) {
|
||||||
|
#endif
|
||||||
switch (flag) {
|
switch (flag) {
|
||||||
case 'd':
|
case 'd':
|
||||||
DebugMode = 1; /* print out debuggin info while parsing */
|
DebugMode = 1; /* print out debuggin info while parsing */
|
||||||
@ -274,6 +288,12 @@ BootstrapMain(int argc, char *argv[])
|
|||||||
case 'P':/* specify port */
|
case 'P':/* specify port */
|
||||||
portFd = atoi(optarg);
|
portFd = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
|
#ifdef OPENLINK_PATCHES
|
||||||
|
case 'F':
|
||||||
|
fsyncOff = 1;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
break;
|
break;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Id: fd.c,v 1.1.1.1 1996/07/09 06:21:55 scrappy Exp $
|
* $Id: fd.c,v 1.2 1996/07/15 19:22:07 scrappy Exp $
|
||||||
*
|
*
|
||||||
* NOTES:
|
* NOTES:
|
||||||
*
|
*
|
||||||
@ -191,6 +191,15 @@ static int FileAccess(File file);
|
|||||||
static File fileNameOpenFile(FileName fileName, int fileFlags, int fileMode);
|
static File fileNameOpenFile(FileName fileName, int fileFlags, int fileMode);
|
||||||
static char *filepath(char *filename);
|
static char *filepath(char *filename);
|
||||||
|
|
||||||
|
#ifdef OPENLINK_PATCHES
|
||||||
|
pg_fsync(fd)
|
||||||
|
{
|
||||||
|
extern int fsyncOff;
|
||||||
|
return fsyncOff ? 0 : fsync(fd);
|
||||||
|
}
|
||||||
|
#define fsync pg_fsync
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(FDDEBUG)
|
#if defined(FDDEBUG)
|
||||||
static void
|
static void
|
||||||
_dump_lru()
|
_dump_lru()
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.2 1996/07/09 06:35:38 scrappy Exp $
|
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.3 1996/07/15 19:22:12 scrappy Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -472,8 +472,12 @@ mdblindwrt(char *dbstr,
|
|||||||
status = SM_SUCCESS;
|
status = SM_SUCCESS;
|
||||||
|
|
||||||
/* write and sync the block */
|
/* write and sync the block */
|
||||||
|
#ifdef OPENLINK_PATCHES
|
||||||
|
if (write(fd, buffer, BLCKSZ) != BLCKSZ || (pg_fsync(fd) < 0))
|
||||||
|
#else
|
||||||
if (write(fd, buffer, BLCKSZ) != BLCKSZ || fsync(fd) < 0)
|
if (write(fd, buffer, BLCKSZ) != BLCKSZ || fsync(fd) < 0)
|
||||||
status = SM_FAIL;
|
status = SM_FAIL;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (close(fd) < 0)
|
if (close(fd) < 0)
|
||||||
status = SM_FAIL;
|
status = SM_FAIL;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.1.1.1 1996/07/09 06:22:00 scrappy Exp $
|
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.2 1996/07/15 19:22:17 scrappy Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* this is the "main" module of the postgres backend and
|
* this is the "main" module of the postgres backend and
|
||||||
@ -93,6 +93,10 @@ CommandDest whereToSendOutput;
|
|||||||
extern int lockingOff;
|
extern int lockingOff;
|
||||||
extern int NBuffers;
|
extern int NBuffers;
|
||||||
|
|
||||||
|
#ifdef OPENLINK_PATCHES
|
||||||
|
int fsyncOff = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
int dontExecute = 0;
|
int dontExecute = 0;
|
||||||
static int ShowStats;
|
static int ShowStats;
|
||||||
static bool IsEmptyQuery = false;
|
static bool IsEmptyQuery = false;
|
||||||
@ -699,7 +703,11 @@ static void usage(char* progname)
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Usage: %s [-B nbufs] [-d lvl] ] [-f plantype] \t[-m portno] [\t -o filename]\n",
|
"Usage: %s [-B nbufs] [-d lvl] ] [-f plantype] \t[-m portno] [\t -o filename]\n",
|
||||||
progname);
|
progname);
|
||||||
|
#ifdef OPENLINK_PATCHES
|
||||||
|
fprintf(stderr,"\t[-P portno] [-t tracetype] [-x opttype] [-bCEiLFNopQSs] [dbname]\n");
|
||||||
|
#else
|
||||||
fprintf(stderr,"\t[-P portno] [-t tracetype] [-x opttype] [-bCEiLNopQSs] [dbname]\n");
|
fprintf(stderr,"\t[-P portno] [-t tracetype] [-x opttype] [-bCEiLNopQSs] [dbname]\n");
|
||||||
|
#endif
|
||||||
fprintf(stderr, " b: consider bushy plan trees during optimization\n");
|
fprintf(stderr, " b: consider bushy plan trees during optimization\n");
|
||||||
fprintf(stderr, " B: set number of buffers in buffer pool\n");
|
fprintf(stderr, " B: set number of buffers in buffer pool\n");
|
||||||
fprintf(stderr, " C: supress version info\n");
|
fprintf(stderr, " C: supress version info\n");
|
||||||
@ -708,6 +716,9 @@ static void usage(char* progname)
|
|||||||
fprintf(stderr, " f: forbid plantype generation\n");
|
fprintf(stderr, " f: forbid plantype generation\n");
|
||||||
fprintf(stderr, " i: don't execute the query, just show the plan tree\n");
|
fprintf(stderr, " i: don't execute the query, just show the plan tree\n");
|
||||||
fprintf(stderr, " L: turn off locking\n");
|
fprintf(stderr, " L: turn off locking\n");
|
||||||
|
#ifdef OPENLINK_PATCHES
|
||||||
|
fprintf(stderr, " F: turn off fsync\n");
|
||||||
|
#endif
|
||||||
fprintf(stderr, " m: set up a listening backend at portno to support multiple front-ends\n");
|
fprintf(stderr, " m: set up a listening backend at portno to support multiple front-ends\n");
|
||||||
fprintf(stderr, " M: start as postmaster\n");
|
fprintf(stderr, " M: start as postmaster\n");
|
||||||
fprintf(stderr, " N: don't use newline as query delimiter\n");
|
fprintf(stderr, " N: don't use newline as query delimiter\n");
|
||||||
@ -804,7 +815,11 @@ PostgresMain(int argc, char *argv[])
|
|||||||
hostName = hostbuf;
|
hostName = hostbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef OPENLINK_PATCHES
|
||||||
|
while ((flag = getopt(argc, argv, "B:bCd:Ef:iLm:MNo:P:pQSst:x:F")) != EOF)
|
||||||
|
#else
|
||||||
while ((flag = getopt(argc, argv, "B:bCd:Ef:iLm:MNo:P:pQSst:x:")) != EOF)
|
while ((flag = getopt(argc, argv, "B:bCd:Ef:iLm:MNo:P:pQSst:x:")) != EOF)
|
||||||
|
#endif
|
||||||
switch (flag) {
|
switch (flag) {
|
||||||
|
|
||||||
case 'b':
|
case 'b':
|
||||||
@ -888,7 +903,17 @@ PostgresMain(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
lockingOff = 1;
|
lockingOff = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef OPENLINK_PATCHES
|
||||||
|
case 'F':
|
||||||
|
/* --------------------
|
||||||
|
* turn off fsync
|
||||||
|
* --------------------
|
||||||
|
*/
|
||||||
|
fsyncOff = 1;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case 'm':
|
case 'm':
|
||||||
/* start up a listening backend that can respond to
|
/* start up a listening backend that can respond to
|
||||||
multiple front-ends. (Note: all the front-end connections
|
multiple front-ends. (Note: all the front-end connections
|
||||||
@ -1195,7 +1220,7 @@ PostgresMain(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
if (IsUnderPostmaster == false) {
|
if (IsUnderPostmaster == false) {
|
||||||
puts("\nPOSTGRES backend interactive interface");
|
puts("\nPOSTGRES backend interactive interface");
|
||||||
puts("$Revision: 1.1.1.1 $ $Date: 1996/07/09 06:22:00 $");
|
puts("$Revision: 1.2 $ $Date: 1996/07/15 19:22:17 $");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
|
Reference in New Issue
Block a user