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

From Bruce Momjian
Subject Re: [HACKERS] Open 6.5 items
Date
Msg-id 199905170639.CAA01971@candle.pha.pa.us
Whole thread Raw
In response to Re: [HACKERS] Open 6.5 items  (Ole Gjerde <gjerde@icebox.org>)
List pgsql-hackers
List updated.  Patch applied.  Thanks.


> 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);
> 
> 


--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Ole Gjerde
Date:
Subject: Re: [HACKERS] Open 6.5 items
Next
From: Ole Gjerde
Date:
Subject: Re: [HACKERS] sgmr* vs. md*