minor fix of elevel in fd.c - Mailing list pgsql-patches

From Qingqing Zhou
Subject minor fix of elevel in fd.c
Date
Msg-id e6ivng$2oep$1@news.hub.org
Whole thread Raw
Responses Re: minor fix of elevel in fd.c
List 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)



pgsql-patches by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: The corresponding relminxid patch; try 1
Next
From: Tom Lane
Date:
Subject: Re: minor fix of elevel in fd.c