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

Commit db3c4c3

Browse files
committed
Split 'BufFile' routines out of fd.c into a new module, buffile.c. Extend
BufFile so that it handles multi-segment temporary files transparently. This allows sorts and hashes to work with data exceeding 2Gig (or whatever the local limit on file size is). Change psort.c to use relative seeks instead of absolute seeks for backwards scanning, so that it won't fail when the data volume exceeds 2Gig.
1 parent c3ac9f0 commit db3c4c3

File tree

12 files changed

+707
-318
lines changed

12 files changed

+707
-318
lines changed

src/backend/executor/nodeHash.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Copyright (c) 1994, Regents of the University of California
77
*
88
*
9-
* $Id: nodeHash.c,v 1.38 1999/07/17 20:16:58 momjian Exp $
9+
* $Id: nodeHash.c,v 1.39 1999/10/13 15:02:25 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -75,12 +75,7 @@ ExecHash(Hash *node)
7575
* ----------------
7676
*/
7777
for (i = 0; i < nbatch; i++)
78-
{
79-
File tfile = OpenTemporaryFile();
80-
81-
Assert(tfile >= 0);
82-
hashtable->innerBatchFile[i] = BufFileCreate(tfile);
83-
}
78+
hashtable->innerBatchFile[i] = BufFileCreateTemp();
8479
}
8580

8681
/* ----------------

src/backend/executor/nodeHashjoin.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.26 1999/07/17 20:16:58 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.27 1999/10/13 15:02:25 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -129,12 +129,7 @@ ExecHashJoin(HashJoin *node)
129129
* ----------------
130130
*/
131131
for (i = 0; i < hashtable->nbatch; i++)
132-
{
133-
File tfile = OpenTemporaryFile();
134-
135-
Assert(tfile >= 0);
136-
hashtable->outerBatchFile[i] = BufFileCreate(tfile);
137-
}
132+
hashtable->outerBatchFile[i] = BufFileCreateTemp();
138133
}
139134
else if (hashtable == NULL)
140135
return NULL;
@@ -551,13 +546,12 @@ ExecHashJoinNewBatch(HashJoinState *hjstate)
551546
* Rewind inner and outer batch files for this batch, so that we can
552547
* start reading them.
553548
*/
554-
if (BufFileSeek(hashtable->outerBatchFile[newbatch - 1], 0L,
555-
SEEK_SET) != 0L)
549+
if (BufFileSeek(hashtable->outerBatchFile[newbatch - 1], 0, 0L, SEEK_SET))
556550
elog(ERROR, "Failed to rewind hash temp file");
557551

558552
innerFile = hashtable->innerBatchFile[newbatch - 1];
559553

560-
if (BufFileSeek(innerFile, 0L, SEEK_SET) != 0L)
554+
if (BufFileSeek(innerFile, 0, 0L, SEEK_SET))
561555
elog(ERROR, "Failed to rewind hash temp file");
562556

563557
/*

src/backend/storage/file/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for storage/file
55
#
66
# IDENTIFICATION
7-
# $Header: /cvsroot/pgsql/src/backend/storage/file/Makefile,v 1.5 1998/04/06 00:25:05 momjian Exp $
7+
# $Header: /cvsroot/pgsql/src/backend/storage/file/Makefile,v 1.6 1999/10/13 15:02:29 tgl Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -13,7 +13,7 @@ include ../../../Makefile.global
1313

1414
CFLAGS += -I../..
1515

16-
OBJS = fd.o
16+
OBJS = fd.o buffile.o
1717

1818
all: SUBSYS.o
1919

0 commit comments

Comments
 (0)