Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
c6b1ef8f
Commit
c6b1ef8f
authored
Jun 01, 2001
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for malloc failure.
parent
ddd96e1f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
51 deletions
+18
-51
src/backend/utils/cache/inval.c
src/backend/utils/cache/inval.c
+3
-47
src/backend/utils/init/miscinit.c
src/backend/utils/init/miscinit.c
+12
-3
src/backend/utils/misc/guc-file.l
src/backend/utils/misc/guc-file.l
+3
-1
No files found.
src/backend/utils/cache/inval.c
View file @
c6b1ef8f
...
...
@@ -34,7 +34,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.4
2 2001/03/22 03:59:57 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.4
3 2001/06/01 20:23:06 tgl
Exp $
*
* Note - this code is real crufty... badly needs a rewrite to improve
* readability and portability. (Shouldn't assume Oid == Index, for example)
...
...
@@ -53,7 +53,6 @@
/*
* private invalidation structures
*
*/
typedef
struct
InvalidationUserData
...
...
@@ -102,7 +101,6 @@ typedef InvalidationMessageData *InvalidationMessage;
/*
* variables and macros
*
*/
/*
...
...
@@ -152,7 +150,6 @@ static void InvalidationMessageRegisterSharedInvalid(InvalidationMessage message
/*
* InvalidationEntryAllocate
* Allocates an invalidation entry.
*
*/
static
InvalidationEntry
InvalidationEntryAllocate
(
uint16
size
)
...
...
@@ -161,6 +158,8 @@ InvalidationEntryAllocate(uint16 size)
entryDataP
=
(
InvalidationEntryData
*
)
malloc
(
sizeof
(
char
*
)
+
size
);
/* XXX alignment */
if
(
entryDataP
==
NULL
)
elog
(
ERROR
,
"Memory exhausted in InvalidationEntryAllocate"
);
entryDataP
->
nextP
=
NULL
;
return
(
Pointer
)
&
entryDataP
->
userData
;
}
...
...
@@ -169,7 +168,6 @@ InvalidationEntryAllocate(uint16 size)
* LocalInvalidRegister
* Link an invalidation entry into a chain of them. Really ugly
* coding here.
*
*/
static
LocalInvalid
LocalInvalidRegister
(
LocalInvalid
invalid
,
...
...
@@ -187,7 +185,6 @@ LocalInvalidRegister(LocalInvalid invalid,
* LocalInvalidInvalidate
* Processes, then frees all entries in a local cache
* invalidation list unless freemember parameter is false.
*
*/
static
void
LocalInvalidInvalidate
(
LocalInvalid
invalid
,
...
...
@@ -258,7 +255,6 @@ elog(DEBUG, "CacheIdRegisterLocalRollback(%d, %d, [%d, %d])", \
/*
* CacheIdRegisterSpecifiedLocalInvalid
*
*/
static
LocalInvalid
CacheIdRegisterSpecifiedLocalInvalid
(
LocalInvalid
invalid
,
...
...
@@ -270,14 +266,12 @@ CacheIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
/*
* debugging stuff
*
*/
CacheIdRegisterSpecifiedLocalInvalid_DEBUG1
;
/*
* create a message describing the system catalog tuple we wish to
* invalidate.
*
*/
message
=
(
InvalidationMessage
)
InvalidationEntryAllocate
(
sizeof
(
InvalidationMessageData
));
...
...
@@ -290,7 +284,6 @@ CacheIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
/*
* Add message to linked list of unprocessed messages.
*
*/
invalid
=
LocalInvalidRegister
(
invalid
,
(
InvalidationEntry
)
message
);
return
invalid
;
...
...
@@ -298,7 +291,6 @@ CacheIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
/*
* CacheIdRegisterLocalInvalid
*
*/
static
void
CacheIdRegisterLocalInvalid
(
int
cacheId
,
...
...
@@ -308,20 +300,17 @@ CacheIdRegisterLocalInvalid(int cacheId,
/*
* debugging stuff
*
*/
CacheIdRegisterLocalInvalid_DEBUG1
;
/*
* Add message to InvalidForall linked list.
*
*/
InvalidForall
=
CacheIdRegisterSpecifiedLocalInvalid
(
InvalidForall
,
cacheId
,
hashIndex
,
pointer
);
/*
* Add message to InvalidLocal linked list.
*
*/
InvalidLocal
=
CacheIdRegisterSpecifiedLocalInvalid
(
InvalidLocal
,
cacheId
,
hashIndex
,
pointer
);
...
...
@@ -329,7 +318,6 @@ CacheIdRegisterLocalInvalid(int cacheId,
/*
* CacheIdRegisterLocalRollback
*
*/
static
void
CacheIdRegisterLocalRollback
(
int
cacheId
,
...
...
@@ -339,13 +327,11 @@ CacheIdRegisterLocalRollback(int cacheId,
/*
* debugging stuff
*
*/
CacheIdRegisterLocalRollback_DEBUG1
;
/*
* Add message to RollbackStack linked list.
*
*/
RollbackStack
=
CacheIdRegisterSpecifiedLocalInvalid
(
RollbackStack
,
cacheId
,
hashIndex
,
pointer
);
...
...
@@ -353,7 +339,6 @@ CacheIdRegisterLocalRollback(int cacheId,
/*
* RelationIdRegisterSpecifiedLocalInvalid
*
*/
static
LocalInvalid
RelationIdRegisterSpecifiedLocalInvalid
(
LocalInvalid
invalid
,
...
...
@@ -363,7 +348,6 @@ RelationIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
/*
* debugging stuff
*
*/
#ifdef INVALIDDEBUG
elog
(
DEBUG
,
"RelationRegisterSpecifiedLocalInvalid(%u, %u)"
,
relationId
,
...
...
@@ -373,7 +357,6 @@ RelationIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
/*
* create a message describing the relation descriptor we wish to
* invalidate.
*
*/
message
=
(
InvalidationMessage
)
InvalidationEntryAllocate
(
sizeof
(
InvalidationMessageData
));
...
...
@@ -384,7 +367,6 @@ RelationIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
/*
* Add message to linked list of unprocessed messages.
*
*/
invalid
=
LocalInvalidRegister
(
invalid
,
(
InvalidationEntry
)
message
);
return
invalid
;
...
...
@@ -392,7 +374,6 @@ RelationIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
/*
* RelationIdRegisterLocalInvalid
*
*/
static
void
RelationIdRegisterLocalInvalid
(
Oid
relationId
,
Oid
objectId
)
...
...
@@ -400,7 +381,6 @@ RelationIdRegisterLocalInvalid(Oid relationId, Oid objectId)
/*
* debugging stuff
*
*/
#ifdef INVALIDDEBUG
elog
(
DEBUG
,
"RelationRegisterLocalInvalid(%u, %u)"
,
relationId
,
...
...
@@ -409,14 +389,12 @@ RelationIdRegisterLocalInvalid(Oid relationId, Oid objectId)
/*
* Add message to InvalidForall linked list.
*
*/
InvalidForall
=
RelationIdRegisterSpecifiedLocalInvalid
(
InvalidForall
,
relationId
,
objectId
);
/*
* Add message to InvalidLocal linked list.
*
*/
InvalidLocal
=
RelationIdRegisterSpecifiedLocalInvalid
(
InvalidLocal
,
relationId
,
objectId
);
...
...
@@ -424,7 +402,6 @@ RelationIdRegisterLocalInvalid(Oid relationId, Oid objectId)
/*
* RelationIdRegisterLocalRollback
*
*/
static
void
RelationIdRegisterLocalRollback
(
Oid
relationId
,
Oid
objectId
)
...
...
@@ -432,7 +409,6 @@ RelationIdRegisterLocalRollback(Oid relationId, Oid objectId)
/*
* debugging stuff
*
*/
#ifdef INVALIDDEBUG
elog
(
DEBUG
,
"RelationRegisterLocalRollback(%u, %u)"
,
relationId
,
...
...
@@ -441,7 +417,6 @@ RelationIdRegisterLocalRollback(Oid relationId, Oid objectId)
/*
* Add message to RollbackStack linked list.
*
*/
RollbackStack
=
RelationIdRegisterSpecifiedLocalInvalid
(
RollbackStack
,
relationId
,
objectId
);
...
...
@@ -453,7 +428,6 @@ RelationIdRegisterLocalRollback(Oid relationId, Oid objectId)
* This routine can invalidate a tuple in a system catalog cache
* or a cached relation descriptor. You pay your money and you
* take your chances...
*
*/
#ifdef INVALIDDEBUG
#define CacheIdInvalidate_DEBUG1 \
...
...
@@ -472,7 +446,6 @@ CacheIdInvalidate(Index cacheId,
/*
* assume that if the item pointer is valid, then we are invalidating
* an item in the specified system catalog cache.
*
*/
if
(
ItemPointerIsValid
(
pointer
))
{
...
...
@@ -485,7 +458,6 @@ CacheIdInvalidate(Index cacheId,
/*
* if the cacheId is the oid of any of the following system relations,
* then assume we are invalidating a relation descriptor
*
*/
if
(
cacheId
==
RelOid_pg_class
)
{
...
...
@@ -501,7 +473,6 @@ CacheIdInvalidate(Index cacheId,
/*
* Yow! the caller asked us to invalidate something else.
*
*/
elog
(
FATAL
,
"CacheIdInvalidate: cacheId=%d relation id?"
,
cacheId
);
}
...
...
@@ -512,7 +483,6 @@ CacheIdInvalidate(Index cacheId,
* This blows away all tuples in the system catalog caches and
* all the cached relation descriptors (and closes their files too).
* Relation descriptors that have positive refcounts are then rebuilt.
*
*/
static
void
ResetSystemCaches
(
void
)
...
...
@@ -523,7 +493,6 @@ ResetSystemCaches(void)
/*
* InvalidationMessageRegisterSharedInvalid
*
*/
#ifdef INVALIDDEBUG
#define InvalidationMessageRegisterSharedInvalid_DEBUG1 \
...
...
@@ -575,7 +544,6 @@ InvalidationMessageRegisterSharedInvalid(InvalidationMessage message)
/*
* InvalidationMessageCacheInvalidate
*
*/
#ifdef INVALIDDEBUG
#define InvalidationMessageCacheInvalidate_DEBUG1 \
...
...
@@ -624,7 +592,6 @@ InvalidationMessageCacheInvalidate(InvalidationMessage message)
/*
* PrepareToInvalidateRelationCache
*
*/
static
void
PrepareToInvalidateRelationCache
(
Relation
relation
,
...
...
@@ -636,13 +603,11 @@ PrepareToInvalidateRelationCache(Relation relation,
/*
* get the relation object id
*
*/
relationId
=
RelationGetRelid
(
relation
);
/*
* is it one of the ones we need to send an SI message for?
*
*/
if
(
relationId
==
RelOid_pg_class
)
objectId
=
tuple
->
t_data
->
t_oid
;
...
...
@@ -653,7 +618,6 @@ PrepareToInvalidateRelationCache(Relation relation,
/*
* register the relcache-invalidation action in the appropriate list
*
*/
Assert
(
PointerIsValid
(
function
));
...
...
@@ -674,7 +638,6 @@ DiscardInvalid(void)
/*
* debugging stuff
*
*/
#ifdef INVALIDDEBUG
elog
(
DEBUG
,
"DiscardInvalid called"
);
...
...
@@ -697,7 +660,6 @@ RegisterInvalid(bool send)
/*
* debugging stuff
*
*/
#ifdef INVALIDDEBUG
elog
(
DEBUG
,
"RegisterInvalid(%d) called"
,
send
);
...
...
@@ -705,7 +667,6 @@ RegisterInvalid(bool send)
/*
* Process and free the current list of inval messages.
*
*/
DiscardInvalidStack
(
&
InvalidLocal
);
...
...
@@ -741,7 +702,6 @@ ImmediateLocalInvalidation(bool send)
/*
* debugging stuff
*
*/
#ifdef INVALIDDEBUG
elog
(
DEBUG
,
"ImmediateLocalInvalidation(%d) called"
,
send
);
...
...
@@ -749,7 +709,6 @@ ImmediateLocalInvalidation(bool send)
/*
* Process and free the local list of inval messages.
*
*/
if
(
send
)
...
...
@@ -801,7 +760,6 @@ PrepareForTupleInvalidation(Relation relation, HeapTuple tuple,
/*
* sanity checks
*
*/
Assert
(
RelationIsValid
(
relation
));
Assert
(
HeapTupleIsValid
(
tuple
));
...
...
@@ -813,14 +771,12 @@ PrepareForTupleInvalidation(Relation relation, HeapTuple tuple,
* We only need to worry about invalidation for tuples that are in
* system relations; user-relation tuples are never in catcaches and
* can't affect the relcache either.
*
*/
if
(
!
IsSystemRelationName
(
NameStr
(
RelationGetForm
(
relation
)
->
relname
)))
return
;
/*
* debugging stuff
*
*/
PrepareForTupleInvalidation_DEBUG1
;
...
...
src/backend/utils/init/miscinit.c
View file @
c6b1ef8f
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.6
7 2001/05/18 17:49:52
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.6
8 2001/06/01 20:27:41
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -143,14 +143,18 @@ SetDataDir(const char *dir)
}
new
=
malloc
(
strlen
(
buf
)
+
1
+
strlen
(
dir
)
+
1
);
if
(
!
new
)
elog
(
FATAL
,
"out of memory"
);
sprintf
(
new
,
"%s/%s"
,
buf
,
dir
);
free
(
buf
);
}
else
{
new
=
strdup
(
dir
);
if
(
!
new
)
elog
(
FATAL
,
"out of memory"
);
}
if
(
!
new
)
elog
(
FATAL
,
"out of memory"
);
DataDir
=
new
;
}
...
...
@@ -278,10 +282,15 @@ SetCharSet()
{
map_file
=
(
char
*
)
malloc
((
strlen
(
DataDir
)
+
strlen
(
p
)
+
2
)
*
sizeof
(
char
));
if
(
!
map_file
)
elog
(
FATAL
,
"out of memory"
);
sprintf
(
map_file
,
"%s/%s"
,
DataDir
,
p
);
file
=
AllocateFile
(
map_file
,
PG_BINARY_R
);
if
(
file
==
NULL
)
{
free
(
map_file
);
return
;
}
eof
=
false
;
while
(
!
eof
)
{
...
...
src/backend/utils/misc/guc-file.l
View file @
c6b1ef8f
...
...
@@ -4,7 +4,7 @@
*
* Copyright 2000 by PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc-file.l,v 1.
6 2001/01/24 19:01:31 petere
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc-file.l,v 1.
7 2001/06/01 20:29:43 tgl
Exp $
*/
%{
...
...
@@ -324,6 +324,8 @@ GUC_scanstr(char *s)
len = strlen(s);
newStr = malloc(len + 1); /* string cannot get longer */
if (newStr == NULL)
elog(FATAL, "out of memory");
for (i = 0, j = 0; i < len; i++)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment