Re: [HACKERS] Open 6.5 items

From: Ole Gjerde <gjerde(at)icebox(dot)org>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Open 6.5 items
Date: 1999-05-17 06:21:18
Message-ID: Pine.LNX.4.05.9905170011260.26745-100000@snowman.icebox.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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);

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ole Gjerde 1999-05-17 06:26:24 Re: [HACKERS] sgmr* vs. md*
Previous Message Oleg Bartunov 1999-05-17 06:11:28 Re: [HACKERS] GEQO optimizer (was Re: Backend message type 0x44 arrived while idle)