Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit faf2193

Browse files
committed
fsync patch from openlink
1 parent d838e30 commit faf2193

File tree

4 files changed

+65
-7
lines changed

4 files changed

+65
-7
lines changed

src/backend/bootstrap/bootstrap.c

+22-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.1.1.1 1996/07/09 06:21:14 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.2 1996/07/15 19:21:59 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -136,6 +136,9 @@ static char *relname; /* current relation name */
136136
AttributeTupleForm attrtypes[MAXATTR]; /* points to attribute info */
137137
static char *values[MAXATTR]; /* cooresponding attribute values */
138138
int numattr; /* number of attributes for cur. rel */
139+
#ifdef OPENLINK_PATCHES
140+
extern int fsyncOff; /* do not fsync the database */
141+
#endif
139142

140143
#if defined(WIN32) || defined(PORTNAME_next)
141144
static jmp_buf Warn_restart;
@@ -198,9 +201,16 @@ void err()
198201
static void
199202
usage()
200203
{
204+
#ifdef OPENLINK_PATCHES
205+
fprintf(stderr,"Usage: postgres -boot [-d] [-C] [-F] [-O] [-Q] [-P portno] [dbName]\n");
206+
#else
201207
fprintf(stderr,"Usage: postgres -boot [-d] [-C] [-O] [-Q] [-P portno] [dbName]\n");
208+
#endif
202209
fprintf(stderr," d: debug mode\n");
203210
fprintf(stderr," C: disable version checking\n");
211+
#ifdef OPENLINK_PATCHES
212+
fprintf(stderr," F: turn off fsync\n");
213+
#endif
204214
fprintf(stderr," O: set BootstrapProcessing mode\n");
205215
fprintf(stderr," P portno: specify port number\n");
206216

@@ -256,8 +266,12 @@ BootstrapMain(int argc, char *argv[])
256266
Quiet = 0;
257267
Noversion = 0;
258268
dbName = NULL;
259-
269+
270+
#ifdef OPENLINK_PATCHES
271+
while ((flag = getopt(argc, argv, "dCOQP:F")) != EOF) {
272+
#else
260273
while ((flag = getopt(argc, argv, "dCOQP")) != EOF) {
274+
#endif
261275
switch (flag) {
262276
case 'd':
263277
DebugMode = 1; /* print out debuggin info while parsing */
@@ -274,6 +288,12 @@ BootstrapMain(int argc, char *argv[])
274288
case 'P':/* specify port */
275289
portFd = atoi(optarg);
276290
break;
291+
#ifdef OPENLINK_PATCHES
292+
case 'F':
293+
fsyncOff = 1;
294+
break;
295+
#endif
296+
break;
277297
default:
278298
usage();
279299
break;

src/backend/storage/file/fd.c

+10-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Copyright (c) 1994, Regents of the University of California
77
*
88
* IDENTIFICATION
9-
* $Id: fd.c,v 1.1.1.1 1996/07/09 06:21:55 scrappy Exp $
9+
* $Id: fd.c,v 1.2 1996/07/15 19:22:07 scrappy Exp $
1010
*
1111
* NOTES:
1212
*
@@ -191,6 +191,15 @@ static int FileAccess(File file);
191191
static File fileNameOpenFile(FileName fileName, int fileFlags, int fileMode);
192192
static char *filepath(char *filename);
193193

194+
#ifdef OPENLINK_PATCHES
195+
pg_fsync(fd)
196+
{
197+
extern int fsyncOff;
198+
return fsyncOff ? 0 : fsync(fd);
199+
}
200+
#define fsync pg_fsync
201+
#endif
202+
194203
#if defined(FDDEBUG)
195204
static void
196205
_dump_lru()

src/backend/storage/smgr/md.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.2 1996/07/09 06:35:38 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.3 1996/07/15 19:22:12 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -472,8 +472,12 @@ mdblindwrt(char *dbstr,
472472
status = SM_SUCCESS;
473473

474474
/* write and sync the block */
475+
#ifdef OPENLINK_PATCHES
476+
if (write(fd, buffer, BLCKSZ) != BLCKSZ || (pg_fsync(fd) < 0))
477+
#else
475478
if (write(fd, buffer, BLCKSZ) != BLCKSZ || fsync(fd) < 0)
476479
status = SM_FAIL;
480+
#endif
477481

478482
if (close(fd) < 0)
479483
status = SM_FAIL;

src/backend/tcop/postgres.c

+28-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.1.1.1 1996/07/09 06:22:00 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.2 1996/07/15 19:22:17 scrappy Exp $
1111
*
1212
* NOTES
1313
* this is the "main" module of the postgres backend and
@@ -93,6 +93,10 @@ CommandDest whereToSendOutput;
9393
extern int lockingOff;
9494
extern int NBuffers;
9595

96+
#ifdef OPENLINK_PATCHES
97+
int fsyncOff = 0;
98+
#endif
99+
96100
int dontExecute = 0;
97101
static int ShowStats;
98102
static bool IsEmptyQuery = false;
@@ -699,7 +703,11 @@ static void usage(char* progname)
699703
fprintf(stderr,
700704
"Usage: %s [-B nbufs] [-d lvl] ] [-f plantype] \t[-m portno] [\t -o filename]\n",
701705
progname);
706+
#ifdef OPENLINK_PATCHES
707+
fprintf(stderr,"\t[-P portno] [-t tracetype] [-x opttype] [-bCEiLFNopQSs] [dbname]\n");
708+
#else
702709
fprintf(stderr,"\t[-P portno] [-t tracetype] [-x opttype] [-bCEiLNopQSs] [dbname]\n");
710+
#endif
703711
fprintf(stderr, " b: consider bushy plan trees during optimization\n");
704712
fprintf(stderr, " B: set number of buffers in buffer pool\n");
705713
fprintf(stderr, " C: supress version info\n");
@@ -708,6 +716,9 @@ static void usage(char* progname)
708716
fprintf(stderr, " f: forbid plantype generation\n");
709717
fprintf(stderr, " i: don't execute the query, just show the plan tree\n");
710718
fprintf(stderr, " L: turn off locking\n");
719+
#ifdef OPENLINK_PATCHES
720+
fprintf(stderr, " F: turn off fsync\n");
721+
#endif
711722
fprintf(stderr, " m: set up a listening backend at portno to support multiple front-ends\n");
712723
fprintf(stderr, " M: start as postmaster\n");
713724
fprintf(stderr, " N: don't use newline as query delimiter\n");
@@ -804,7 +815,11 @@ PostgresMain(int argc, char *argv[])
804815
hostName = hostbuf;
805816
}
806817

818+
#ifdef OPENLINK_PATCHES
819+
while ((flag = getopt(argc, argv, "B:bCd:Ef:iLm:MNo:P:pQSst:x:F")) != EOF)
820+
#else
807821
while ((flag = getopt(argc, argv, "B:bCd:Ef:iLm:MNo:P:pQSst:x:")) != EOF)
822+
#endif
808823
switch (flag) {
809824

810825
case 'b':
@@ -888,7 +903,17 @@ PostgresMain(int argc, char *argv[])
888903
*/
889904
lockingOff = 1;
890905
break;
891-
906+
907+
#ifdef OPENLINK_PATCHES
908+
case 'F':
909+
/* --------------------
910+
* turn off fsync
911+
* --------------------
912+
*/
913+
fsyncOff = 1;
914+
break;
915+
#endif
916+
892917
case 'm':
893918
/* start up a listening backend that can respond to
894919
multiple front-ends. (Note: all the front-end connections
@@ -1195,7 +1220,7 @@ PostgresMain(int argc, char *argv[])
11951220
*/
11961221
if (IsUnderPostmaster == false) {
11971222
puts("\nPOSTGRES backend interactive interface");
1198-
puts("$Revision: 1.1.1.1 $ $Date: 1996/07/09 06:22:00 $");
1223+
puts("$Revision: 1.2 $ $Date: 1996/07/15 19:22:17 $");
11991224
}
12001225

12011226
/* ----------------

0 commit comments

Comments
 (0)