aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/lmgr
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-04-28 16:54:16 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2010-04-28 16:54:16 +0000
commit77acab75dfe2e4741c25c0cf550266caef1eebd2 (patch)
tree1a5d86661c9394e2e79ae038775e874395f24f59 /src/backend/storage/lmgr
parent5f70a04c56b69fff0f356abae3091eaa54038a5b (diff)
downloadpostgresql-77acab75dfe2e4741c25c0cf550266caef1eebd2.tar.gz
postgresql-77acab75dfe2e4741c25c0cf550266caef1eebd2.zip
Modify ShmemInitStruct and ShmemInitHash to throw errors internally,
rather than returning NULL for some-but-not-all failures as they used to. Remove now-redundant tests for NULL from call sites. We had to do something about this because many call sites were failing to check for NULL; and changing it like this seems a lot more useful and mistake-proof than adding checks to the call sites without them.
Diffstat (limited to 'src/backend/storage/lmgr')
-rw-r--r--src/backend/storage/lmgr/lock.c6
-rw-r--r--src/backend/storage/lmgr/proc.c17
2 files changed, 10 insertions, 13 deletions
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index b4a2a6b0e0d..b196174f6e1 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.196 2010/03/21 00:17:58 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.197 2010/04/28 16:54:16 tgl Exp $
*
* NOTES
* A lock table is a shared memory hash table. When
@@ -306,8 +306,6 @@ InitLocks(void)
max_table_size,
&info,
hash_flags);
- if (!LockMethodLockHash)
- elog(FATAL, "could not initialize lock hash table");
/* Assume an average of 2 holders per lock */
max_table_size *= 2;
@@ -328,8 +326,6 @@ InitLocks(void)
max_table_size,
&info,
hash_flags);
- if (!LockMethodProcLockHash)
- elog(FATAL, "could not initialize proclock hash table");
/*
* Allocate non-shared hash table for LOCALLOCK structs. This stores lock
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c
index 80775a4061f..97ba59a451d 100644
--- a/src/backend/storage/lmgr/proc.c
+++ b/src/backend/storage/lmgr/proc.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.217 2010/02/26 02:01:01 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.218 2010/04/28 16:54:16 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -756,21 +756,22 @@ AuxiliaryProcKill(int code, Datum arg)
/*
* ProcQueueAlloc -- alloc/attach to a shared memory process queue
*
- * Returns: a pointer to the queue or NULL
- * Side Effects: Initializes the queue if we allocated one
+ * Returns: a pointer to the queue
+ * Side Effects: Initializes the queue if it wasn't there before
*/
#ifdef NOT_USED
PROC_QUEUE *
-ProcQueueAlloc(char *name)
+ProcQueueAlloc(const char *name)
{
+ PROC_QUEUE *queue;
bool found;
- PROC_QUEUE *queue = (PROC_QUEUE *)
- ShmemInitStruct(name, sizeof(PROC_QUEUE), &found);
- if (!queue)
- return NULL;
+ queue = (PROC_QUEUE *)
+ ShmemInitStruct(name, sizeof(PROC_QUEUE), &found);
+
if (!found)
ProcQueueInit(queue);
+
return queue;
}
#endif