Skip site navigation (1) Skip section navigation (2)

minor fix of elevel in fd.c

From: "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>
To: pgsql-patches(at)postgresql(dot)org
Subject: minor fix of elevel in fd.c
Date: 2006-06-12 05:56:48
Message-ID: e6ivng$2oep$1@news.hub.org (view raw or flat)
Thread:
Lists: pgsql-patches
AllocateFile() and AllocateDir() should return the control to the caller
since we might want to upgrade the elevel.

BTW: Seems this premature-elog-error problem (we talked about it in an old
thread and fix the dynahash code) also exists in some other places (e.g. the
assign_hook functions), but not sure if those deserve a fix.

Regards,
Qingqing

---

Index: src/backend/storage/file/fd.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/storage/file/fd.c,v
retrieving revision 1.128
diff -c -r1.128 fd.c
*** src/backend/storage/file/fd.c       30 May 2006 13:04:59 -0000
1.128
--- src/backend/storage/file/fd.c       12 Jun 2006 05:43:00 -0000
***************
*** 1251,1257 ****
         */
        if (numAllocatedDescs >= MAX_ALLOCATED_DESCS ||
                numAllocatedDescs >= max_safe_fds - 1)
!               elog(ERROR, "too many private files demanded");

  TryAgain:
        if ((file = fopen(name, mode)) != NULL)
--- 1251,1261 ----
         */
        if (numAllocatedDescs >= MAX_ALLOCATED_DESCS ||
                numAllocatedDescs >= max_safe_fds - 1)
!       {
!               errno = 0;
!               elog(LOG, "too many private files demanded");
!               return NULL;
!       }

  TryAgain:
        if ((file = fopen(name, mode)) != NULL)
***************
*** 1366,1372 ****
         */
        if (numAllocatedDescs >= MAX_ALLOCATED_DESCS ||
                numAllocatedDescs >= max_safe_fds - 1)
!               elog(ERROR, "too many private dirs demanded");

  TryAgain:
        if ((dir = opendir(dirname)) != NULL)
--- 1370,1380 ----
         */
        if (numAllocatedDescs >= MAX_ALLOCATED_DESCS ||
                numAllocatedDescs >= max_safe_fds - 1)
!       {
!               errno = 0;
!               elog(LOG, "too many private dirs demanded");
!               return NULL;
!       }

  TryAgain:
        if ((dir = opendir(dirname)) != NULL)



Responses

pgsql-patches by date

Next:From: Tom LaneDate: 2006-06-12 13:47:21
Subject: Re: minor fix of elevel in fd.c
Previous:From: Tom LaneDate: 2006-06-12 01:31:32
Subject: Re: Non-transactional pg_class, try 2

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group