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

Commitabec4cb

Browse files
committed
compact_fsm_storage() does need to handle the case where a relation's
FSM data has to be both moved down and compressed. Per report fromDror Matalon.
1 parentd890c1d commitabec4cb

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

‎src/backend/storage/freespace/freespace.c

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/storage/freespace/freespace.c,v 1.23 2003/09/2900:05:25 petere Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/storage/freespace/freespace.c,v 1.24 2003/10/2917:36:57 tgl Exp $
1212
*
1313
*
1414
* NOTES:
@@ -1432,19 +1432,29 @@ compact_fsm_storage(void)
14321432

14331433
/*
14341434
* It's possible that we have to move data down, not up, if the
1435-
* allocations of previous rels expanded. Thisshould mean that
1435+
* allocations of previous rels expanded. Thisnormally means that
14361436
* our allocation expanded too (or at least got no worse), and
1437-
* ditto for later rels. So there should be room --- but we might
1438-
* have to push down following rels to make it. We don't want to
1439-
* do the push more than once, so pack everything against the end
1440-
* of the arena if so.
1437+
* ditto for later rels. So there should be room to move all our
1438+
* data down without dropping any --- but we might have to push down
1439+
* following rels to acquire the room. We don't want to do the push
1440+
* more than once, so pack everything against the end of the arena
1441+
* if so.
1442+
*
1443+
* In corner cases where roundoff has affected our allocation, it's
1444+
* possible that we have to move down and compress our data too.
1445+
* Since this case is extremely infrequent, we do not try to be smart
1446+
* about it --- we just drop pages from the end of the rel's data.
14411447
*/
14421448
if (newChunkIndex>oldChunkIndex)
14431449
{
14441450
intlimitChunkIndex;
14451451

14461452
if (newAllocPages<fsmrel->storedPages)
1447-
elog(PANIC,"can't juggle and compress too");
1453+
{
1454+
/* move and compress --- just drop excess pages */
1455+
fsmrel->storedPages=newAllocPages;
1456+
curChunks=fsm_current_chunks(fsmrel);
1457+
}
14481458
if (fsmrel->nextPhysical!=NULL)
14491459
limitChunkIndex=fsmrel->nextPhysical->firstChunk;
14501460
else
@@ -1459,7 +1469,7 @@ compact_fsm_storage(void)
14591469
else
14601470
limitChunkIndex=FreeSpaceMap->totalChunks;
14611471
if (newChunkIndex+curChunks>limitChunkIndex)
1462-
elog(PANIC,"insufficient room");
1472+
elog(PANIC,"insufficient room in FSM");
14631473
}
14641474
memmove(newLocation,oldLocation,curChunks*CHUNKBYTES);
14651475
}
@@ -1535,7 +1545,7 @@ push_fsm_rels_after(FSMRelation *afterRel)
15351545
if (newChunkIndex<oldChunkIndex)
15361546
{
15371547
/* trouble... */
1538-
elog(PANIC,"out ofroom");
1548+
elog(PANIC,"insufficientroom in FSM");
15391549
}
15401550
elseif (newChunkIndex>oldChunkIndex)
15411551
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp