mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
Change mdtruncate to truncate and not unlink.
Hiroshi Inoue
This commit is contained in:
parent
d852d31ea3
commit
3b9ef4d073
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.44 1999/05/25 16:11:30 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.45 1999/06/11 02:39:43 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -711,27 +711,14 @@ mdtruncate(Relation reln, int nblocks)
|
|||||||
MdfdVec *v;
|
MdfdVec *v;
|
||||||
|
|
||||||
#ifndef LET_OS_MANAGE_FILESIZE
|
#ifndef LET_OS_MANAGE_FILESIZE
|
||||||
int curnblk,
|
int curnblk;
|
||||||
i,
|
|
||||||
oldsegno,
|
|
||||||
newsegno;
|
|
||||||
char fname[NAMEDATALEN];
|
|
||||||
char tname[NAMEDATALEN + 10];
|
|
||||||
|
|
||||||
curnblk = mdnblocks(reln);
|
curnblk = mdnblocks(reln);
|
||||||
oldsegno = curnblk / RELSEG_SIZE;
|
if (curnblk / RELSEG_SIZE > 0)
|
||||||
newsegno = nblocks / RELSEG_SIZE;
|
|
||||||
|
|
||||||
StrNCpy(fname, RelationGetRelationName(reln)->data, NAMEDATALEN);
|
|
||||||
|
|
||||||
if (newsegno < oldsegno)
|
|
||||||
{
|
{
|
||||||
for (i = (newsegno + 1);; i++)
|
elog(NOTICE, "Can't truncate multi-segments relation %s",
|
||||||
{
|
reln->rd_rel->relname.data);
|
||||||
sprintf(tname, "%s.%d", fname, i);
|
return curnblk;
|
||||||
if (FileNameUnlink(tname) < 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user