Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit34f89cb

Browse files
committed
Fix oversight in recent patch to support multiple read positions in
tuplestore: in READFILE state tuplestore_select_read_pointer mustsave the current file seek position in the read pointer beingdeactivated.
1 parent742fd06 commit34f89cb

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

‎src/backend/utils/sort/tuplestore.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
* Portions Copyright (c) 1994, Regents of the University of California
4747
*
4848
* IDENTIFICATION
49-
* $PostgreSQL: pgsql/src/backend/utils/sort/tuplestore.c,v 1.41 2008/10/04 21:56:54 tgl Exp $
49+
* $PostgreSQL: pgsql/src/backend/utils/sort/tuplestore.c,v 1.42 2008/10/07 00:05:55 tgl Exp $
5050
*
5151
*-------------------------------------------------------------------------
5252
*/
@@ -434,25 +434,38 @@ tuplestore_end(Tuplestorestate *state)
434434
void
435435
tuplestore_select_read_pointer(Tuplestorestate*state,intptr)
436436
{
437-
TSReadPointer*readptr=&state->readptrs[ptr];
437+
TSReadPointer*readptr;
438+
TSReadPointer*oldptr;
438439

439440
Assert(ptr >=0&&ptr<state->readptrcount);
440441

441442
/* No work if already active */
442443
if (ptr==state->activeptr)
443444
return;
444445

446+
readptr=&state->readptrs[ptr];
447+
oldptr=&state->readptrs[state->activeptr];
448+
445449
switch (state->status)
446450
{
447451
caseTSS_INMEM:
448452
caseTSS_WRITEFILE:
449453
/* no work */
450454
break;
451455
caseTSS_READFILE:
456+
/*
457+
* First, save the current read position in the pointer about
458+
* to become inactive.
459+
*/
460+
if (!oldptr->eof_reached)
461+
BufFileTell(state->myfile,
462+
&oldptr->file,
463+
&oldptr->offset);
464+
452465
/*
453466
* We have to make the temp file's seek position equal to the
454-
* logical position of the read pointer. In eof_reached state,
455-
* that's the EOF, which we have available from the saved
467+
* logical position of thenewread pointer. In eof_reached
468+
*state,that's the EOF, which we have available from the saved
456469
* write position.
457470
*/
458471
if (readptr->eof_reached)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp