Re: [HACKERS] Open 6.5 items - Mailing list pgsql-hackers

From Ole Gjerde
Subject Re: [HACKERS] Open 6.5 items
Date
Msg-id Pine.LNX.4.05.9905170011260.26745-100000@snowman.icebox.org
Whole thread Raw
In response to Open 6.5 items  (Bruce Momjian <maillist@candle.pha.pa.us>)
Responses Re: [HACKERS] Open 6.5 items  (Bruce Momjian <maillist@candle.pha.pa.us>)
List pgsql-hackers
On Sun, 16 May 1999, Bruce Momjian wrote:
> nodeResults.c and parse_clause.c give compiler warnings

No warnings on Redhat Linux 6.0 (Linux 2.2.7, egcs 1.1.2, glibc 2.1)

> DROP TABLE leaves INDEX file descriptor open

Shouldn't now.. index_destroy() gets called, which again calls smgrunlink.
It looks like smgrunlink closes all fds.

> DROP TABLE/RENAME TABLE doesn't remove extended files, *.1, *.2

This now works(with the patch from yesterday).

> Vacuum of tables >2 gigs - NOTICE:  Can't truncate multi-segments relation

This is actually more of a fundamental problem with mdtruncate.  It looks
like someone just didn't add support for multiple segments for truncation.

The following patch seems to do the right thing, for me at least.
It passed my tests, my data looks right(no data that shouldn't be in
there) and regression is ok.

Ole Gjerde

--- src/backend/storage/smgr/md.c    1999/04/05 22:25:11    1.42
+++ src/backend/storage/smgr/md.c    1999/05/17 06:23:23
@@ -711,15 +711,26 @@    MdfdVec    *v;#ifndef LET_OS_MANAGE_FILESIZE
-    int            curnblk;
+    int            curnblk,
+                    i,
+                    oldsegno,
+                    newsegno;
+    char        fname[NAMEDATALEN];
+    char        tname[NAMEDATALEN + 10];    curnblk = mdnblocks(reln);
-    if (curnblk / RELSEG_SIZE > 0)
-    {
-        elog(NOTICE, "Can't truncate multi-segments relation %s",
-             reln->rd_rel->relname.data);
-        return curnblk;
-    }
+    oldsegno = curnblk / RELSEG_SIZE;
+    newsegno = nblocks / RELSEG_SIZE;
+
+    StrNCpy(fname, RelationGetRelationName(reln)->data, NAMEDATALEN);
+
+    if (newsegno < oldsegno) {
+        for (i = (newsegno + 1);; i++) {
+            sprintf(tname, "%s.%d", fname, i);
+            if (FileNameUnlink(tname) < 0)
+                break;
+        }
+        }#endif    fd = RelationGetFile(reln);



pgsql-hackers by date:

Previous
From: Oleg Bartunov
Date:
Subject: Re: [HACKERS] GEQO optimizer (was Re: Backend message type 0x44 arrived while idle)
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Open 6.5 items