Change mdtruncate to truncate and not unlink.
authorBruce Momjian <[email protected]>
Fri, 11 Jun 1999 02:39:43 +0000 (02:39 +0000)
committerBruce Momjian <[email protected]>
Fri, 11 Jun 1999 02:39:43 +0000 (02:39 +0000)
Hiroshi Inoue

src/backend/storage/smgr/md.c

index d8ea53f5c866f8c310f47d51f76a4b85f3a6b30d..4915ed0e85cce208d0fec7d7faa314d0b85a7141 100644 (file)
@@ -711,27 +711,14 @@ mdtruncate(Relation reln, int nblocks)
        MdfdVec    *v;
 
 #ifndef LET_OS_MANAGE_FILESIZE
-       int                     curnblk,
-                               i,
-                               oldsegno,
-                               newsegno;
-       char            fname[NAMEDATALEN];
-       char            tname[NAMEDATALEN + 10];
+       int                     curnblk;
 
        curnblk = mdnblocks(reln);
-       oldsegno = curnblk / RELSEG_SIZE;
-       newsegno = nblocks / RELSEG_SIZE;
-
-       StrNCpy(fname, RelationGetRelationName(reln)->data, NAMEDATALEN);
-
-       if (newsegno < oldsegno)
+       if (curnblk / RELSEG_SIZE > 0)
        {
-               for (i = (newsegno + 1);; i++)
-               {
-                       sprintf(tname, "%s.%d", fname, i);
-                       if (FileNameUnlink(tname) < 0)
-                               break;
-               }
+               elog(NOTICE, "Can't truncate multi-segments relation %s",
+                       reln->rd_rel->relname.data);
+               return curnblk;
        }
 #endif