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
5aea4062
Commit
5aea4062
authored
Jul 13, 1998
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inline function, rename libpq variablees, change lrel to lockrel.
parent
8bac4ca8
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
164 additions
and
190 deletions
+164
-190
src/backend/libpq/be-dumpdata.c
src/backend/libpq/be-dumpdata.c
+3
-3
src/backend/libpq/portal.c
src/backend/libpq/portal.c
+6
-6
src/backend/storage/buffer/bufmgr.c
src/backend/storage/buffer/bufmgr.c
+4
-4
src/backend/storage/ipc/sinvaladt.c
src/backend/storage/ipc/sinvaladt.c
+2
-2
src/backend/storage/lmgr/lmgr.c
src/backend/storage/lmgr/lmgr.c
+70
-121
src/backend/storage/lmgr/multi.c
src/backend/storage/lmgr/multi.c
+16
-16
src/backend/storage/lmgr/single.c
src/backend/storage/lmgr/single.c
+7
-7
src/include/libpq/libpq.h
src/include/libpq/libpq.h
+3
-3
src/include/storage/buf_internals.h
src/include/storage/buf_internals.h
+4
-4
src/include/storage/lmgr.h
src/include/storage/lmgr.h
+35
-10
src/include/storage/multilev.h
src/include/storage/multilev.h
+5
-5
src/interfaces/libpq/fe-exec.c
src/interfaces/libpq/fe-exec.c
+5
-5
src/interfaces/libpq/libpq-fe.h
src/interfaces/libpq/libpq-fe.h
+3
-3
src/interfaces/odbc/pgtypes.c
src/interfaces/odbc/pgtypes.c
+1
-1
No files found.
src/backend/libpq/be-dumpdata.c
View file @
5aea4062
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-dumpdata.c,v 1.1
5 1998/03/30 16:46:29
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-dumpdata.c,v 1.1
6 1998/07/13 16:34:48
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -194,8 +194,8 @@ be_typeinit(PortalEntry *entry,
...
@@ -194,8 +194,8 @@ be_typeinit(PortalEntry *entry,
for
(
i
=
0
;
i
<
natts
;
++
i
)
for
(
i
=
0
;
i
<
natts
;
++
i
)
{
{
strncpy
(
group
->
types
[
i
].
name
,
attrs
[
i
]
->
attname
.
data
,
NAMEDATALEN
);
strncpy
(
group
->
types
[
i
].
name
,
attrs
[
i
]
->
attname
.
data
,
NAMEDATALEN
);
group
->
types
[
i
].
adt
id
=
attrs
[
i
]
->
atttypid
;
group
->
types
[
i
].
typ
id
=
attrs
[
i
]
->
atttypid
;
group
->
types
[
i
].
adtsize
=
attrs
[
i
]
->
attlen
;
group
->
types
[
i
].
typlen
=
attrs
[
i
]
->
attlen
;
}
}
}
}
}
}
...
...
src/backend/libpq/portal.c
View file @
5aea4062
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.1
4 1998/06/15 19:28:27
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.1
5 1998/07/13 16:34:48
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -327,7 +327,7 @@ PQftypeGroup(PortalBuffer *portal, int group_index, int field_number)
...
@@ -327,7 +327,7 @@ PQftypeGroup(PortalBuffer *portal, int group_index, int field_number)
if
((
gbp
=
pbuf_findGroup
(
portal
,
group_index
))
&&
if
((
gbp
=
pbuf_findGroup
(
portal
,
group_index
))
&&
in_range
(
"PQftypeGroup: field number"
,
field_number
,
0
,
gbp
->
no_fields
))
in_range
(
"PQftypeGroup: field number"
,
field_number
,
0
,
gbp
->
no_fields
))
return
(
gbp
->
types
[
field_number
].
adt
id
);
return
(
gbp
->
types
[
field_number
].
typ
id
);
return
(
-
1
);
return
(
-
1
);
}
}
...
@@ -348,7 +348,7 @@ PQfsizeGroup(PortalBuffer *portal, int group_index, int field_number)
...
@@ -348,7 +348,7 @@ PQfsizeGroup(PortalBuffer *portal, int group_index, int field_number)
if
((
gbp
=
pbuf_findGroup
(
portal
,
group_index
))
&&
if
((
gbp
=
pbuf_findGroup
(
portal
,
group_index
))
&&
in_range
(
"PQfsizeGroup: field number"
,
field_number
,
0
,
gbp
->
no_fields
))
in_range
(
"PQfsizeGroup: field number"
,
field_number
,
0
,
gbp
->
no_fields
))
return
(
gbp
->
types
[
field_number
].
adtsize
);
return
(
gbp
->
types
[
field_number
].
typlen
);
return
(
-
1
);
return
(
-
1
);
}
}
...
@@ -482,7 +482,7 @@ PQftype(PortalBuffer *portal, int tuple_index, int field_number)
...
@@ -482,7 +482,7 @@ PQftype(PortalBuffer *portal, int tuple_index, int field_number)
if
((
gbp
=
PQgroup
(
portal
,
tuple_index
))
&&
if
((
gbp
=
PQgroup
(
portal
,
tuple_index
))
&&
in_range
(
"PQftype: field number"
,
field_number
,
0
,
gbp
->
no_fields
))
in_range
(
"PQftype: field number"
,
field_number
,
0
,
gbp
->
no_fields
))
return
(
gbp
->
types
[
field_number
].
adt
id
);
return
(
gbp
->
types
[
field_number
].
typ
id
);
return
(
-
1
);
return
(
-
1
);
}
}
...
@@ -502,7 +502,7 @@ PQfsize(PortalBuffer *portal, int tuple_index, int field_number)
...
@@ -502,7 +502,7 @@ PQfsize(PortalBuffer *portal, int tuple_index, int field_number)
if
((
gbp
=
PQgroup
(
portal
,
tuple_index
))
&&
if
((
gbp
=
PQgroup
(
portal
,
tuple_index
))
&&
in_range
(
"PQfsize: field number"
,
field_number
,
0
,
gbp
->
no_fields
))
in_range
(
"PQfsize: field number"
,
field_number
,
0
,
gbp
->
no_fields
))
return
(
gbp
->
types
[
field_number
].
adtsize
);
return
(
gbp
->
types
[
field_number
].
typlen
);
return
(
-
1
);
return
(
-
1
);
}
}
...
...
src/backend/storage/buffer/bufmgr.c
View file @
5aea4062
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.3
8 1998/06/15 19:29:0
9 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.3
9 1998/07/13 16:34:4
9 momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -114,14 +114,14 @@ RelationGetBufferWithBuffer(Relation relation,
...
@@ -114,14 +114,14 @@ RelationGetBufferWithBuffer(Relation relation,
Buffer
buffer
)
Buffer
buffer
)
{
{
BufferDesc
*
bufHdr
;
BufferDesc
*
bufHdr
;
LRelId
lrelId
;
L
ock
RelId
lrelId
;
if
(
BufferIsValid
(
buffer
))
if
(
BufferIsValid
(
buffer
))
{
{
if
(
!
BufferIsLocal
(
buffer
))
if
(
!
BufferIsLocal
(
buffer
))
{
{
bufHdr
=
&
BufferDescriptors
[
buffer
-
1
];
bufHdr
=
&
BufferDescriptors
[
buffer
-
1
];
lrelId
=
RelationGetLRelId
(
relation
);
lrelId
=
RelationGetL
ock
RelId
(
relation
);
SpinAcquire
(
BufMgrLock
);
SpinAcquire
(
BufMgrLock
);
if
(
bufHdr
->
tag
.
blockNum
==
blockNumber
&&
if
(
bufHdr
->
tag
.
blockNum
==
blockNumber
&&
bufHdr
->
tag
.
relId
.
relId
==
lrelId
.
relId
&&
bufHdr
->
tag
.
relId
.
relId
==
lrelId
.
relId
&&
...
@@ -1282,7 +1282,7 @@ BufferGetRelation(Buffer buffer)
...
@@ -1282,7 +1282,7 @@ BufferGetRelation(Buffer buffer)
Assert
(
!
BufferIsLocal
(
buffer
));
/* not supported for local buffers */
Assert
(
!
BufferIsLocal
(
buffer
));
/* not supported for local buffers */
/* XXX should be a critical section */
/* XXX should be a critical section */
relid
=
LRelIdGetRelationId
(
BufferDescriptors
[
buffer
-
1
].
tag
.
relId
);
relid
=
L
ock
RelIdGetRelationId
(
BufferDescriptors
[
buffer
-
1
].
tag
.
relId
);
relation
=
RelationIdGetRelation
(
relid
);
relation
=
RelationIdGetRelation
(
relid
);
RelationDecrementReferenceCount
(
relation
);
RelationDecrementReferenceCount
(
relation
);
...
...
src/backend/storage/ipc/sinvaladt.c
View file @
5aea4062
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.1
1 1998/06/27 04:53:36
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.1
2 1998/07/13 16:34:49
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -85,7 +85,7 @@ SISetActiveProcess(SISeg *segInOutP, BackendId backendId)
...
@@ -85,7 +85,7 @@ SISetActiveProcess(SISeg *segInOutP, BackendId backendId)
int
int
SIBackendInit
(
SISeg
*
segInOutP
)
SIBackendInit
(
SISeg
*
segInOutP
)
{
{
LRelId
LtCreateRelId
();
L
ock
RelId
LtCreateRelId
();
TransactionId
LMITransactionIdCopy
();
TransactionId
LMITransactionIdCopy
();
Assert
(
MyBackendTag
>
0
);
Assert
(
MyBackendTag
>
0
);
...
...
src/backend/storage/lmgr/lmgr.c
View file @
5aea4062
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.1
2 1998/06/15 19:29:19
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.1
3 1998/07/13 16:34:50
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
#include "storage/bufmgr.h"
#include "storage/bufmgr.h"
#include "access/transam.h"
/* for AmiTransactionId */
#include "access/transam.h"
/* for AmiTransactionId */
static
void
L
RelIdAssign
(
LRelId
*
l
RelId
,
Oid
dbId
,
Oid
relId
);
static
void
L
ockRelIdAssign
(
LockRelId
*
lock
RelId
,
Oid
dbId
,
Oid
relId
);
/* ----------------
/* ----------------
*
*
...
@@ -68,68 +68,17 @@ static void LRelIdAssign(LRelId *lRelId, Oid dbId, Oid relId);
...
@@ -68,68 +68,17 @@ static void LRelIdAssign(LRelId *lRelId, Oid dbId, Oid relId);
extern
Oid
MyDatabaseId
;
extern
Oid
MyDatabaseId
;
static
LRelId
VariableRelationL
RelId
=
{
LockRelId
VariableRelationLock
RelId
=
{
RelOid_pg_variable
,
RelOid_pg_variable
,
InvalidOid
InvalidOid
};
};
/* ----------------
* RelationGetLRelId
* ----------------
*/
#ifdef LOCKDEBUG
#define LOCKDEBUG_10 \
elog(NOTICE, "RelationGetLRelId(%s) invalid lockInfo", \
RelationGetRelationName(relation));
#else
#define LOCKDEBUG_10
#endif
/* LOCKDEBUG */
/*
* RelationGetLRelId --
* Returns "lock" relation identifier for a relation.
*/
LRelId
RelationGetLRelId
(
Relation
relation
)
{
LockInfo
linfo
;
/* ----------------
* sanity checks
* ----------------
*/
Assert
(
RelationIsValid
(
relation
));
linfo
=
(
LockInfo
)
relation
->
lockInfo
;
/* ----------------
* initialize lock info if necessary
* ----------------
*/
if
(
!
LockInfoIsValid
(
linfo
))
{
LOCKDEBUG_10
;
RelationInitLockInfo
(
relation
);
linfo
=
(
LockInfo
)
relation
->
lockInfo
;
}
/* ----------------
* XXX hack to prevent problems during
* VARIABLE relation initialization
* ----------------
*/
if
(
strcmp
(
RelationGetRelationName
(
relation
)
->
data
,
VariableRelationName
)
==
0
)
return
(
VariableRelationLRelId
);
return
(
linfo
->
lRelId
);
}
/*
/*
* LRelIdGetDatabaseId --
* L
ock
RelIdGetDatabaseId --
* Returns database identifier for a "lock" relation identifier.
* Returns database identifier for a "lock" relation identifier.
*/
*/
/* ----------------
/* ----------------
* LRelIdGetDatabaseId
* L
ock
RelIdGetDatabaseId
*
*
* Note: The argument may not be correct, if it is not used soon
* Note: The argument may not be correct, if it is not used soon
* after it is created.
* after it is created.
...
@@ -137,21 +86,21 @@ RelationGetLRelId(Relation relation)
...
@@ -137,21 +86,21 @@ RelationGetLRelId(Relation relation)
*/
*/
#ifdef NOT_USED
#ifdef NOT_USED
Oid
Oid
L
RelIdGetDatabaseId
(
LRelId
l
RelId
)
L
ockRelIdGetDatabaseId
(
LockRelId
lock
RelId
)
{
{
return
(
lRelId
.
dbId
);
return
(
l
ock
RelId
.
dbId
);
}
}
#endif
#endif
/*
/*
* LRelIdGetRelationId --
* L
ock
RelIdGetRelationId --
* Returns relation identifier for a "lock" relation identifier.
* Returns relation identifier for a "lock" relation identifier.
*/
*/
Oid
Oid
L
RelIdGetRelationId
(
LRelId
l
RelId
)
L
ockRelIdGetRelationId
(
LockRelId
lock
RelId
)
{
{
return
(
lRelId
.
relId
);
return
(
l
ock
RelId
.
relId
);
}
}
/*
/*
...
@@ -169,15 +118,15 @@ DatabaseIdIsMyDatabaseId(Oid databaseId)
...
@@ -169,15 +118,15 @@ DatabaseIdIsMyDatabaseId(Oid databaseId)
#endif
#endif
/*
/*
* LRelIdContainsMyDatabaseId --
* L
ock
RelIdContainsMyDatabaseId --
* True iff "lock" relation identifier is valid in my present database.
* True iff "lock" relation identifier is valid in my present database.
*/
*/
#ifdef NOT_USED
#ifdef NOT_USED
bool
bool
L
RelIdContainsMyDatabaseId
(
LRelId
l
RelId
)
L
ockRelIdContainsMyDatabaseId
(
LockRelId
lock
RelId
)
{
{
return
(
bool
)
return
(
bool
)
(
!
OidIsValid
(
l
RelId
.
dbId
)
||
l
RelId
.
dbId
==
MyDatabaseId
);
(
!
OidIsValid
(
l
ockRelId
.
dbId
)
||
lock
RelId
.
dbId
==
MyDatabaseId
);
}
}
#endif
#endif
...
@@ -255,9 +204,9 @@ RelationInitLockInfo(Relation relation)
...
@@ -255,9 +204,9 @@ RelationInitLockInfo(Relation relation)
* ----------------
* ----------------
*/
*/
if
(
IsSharedSystemRelationName
(
relname
))
if
(
IsSharedSystemRelationName
(
relname
))
L
RelIdAssign
(
&
info
->
l
RelId
,
InvalidOid
,
relationid
);
L
ockRelIdAssign
(
&
info
->
lock
RelId
,
InvalidOid
,
relationid
);
else
else
L
RelIdAssign
(
&
info
->
l
RelId
,
MyDatabaseId
,
relationid
);
L
ockRelIdAssign
(
&
info
->
lock
RelId
,
MyDatabaseId
,
relationid
);
/* ----------------
/* ----------------
* store the transaction id in the lockInfo field
* store the transaction id in the lockInfo field
...
@@ -319,7 +268,7 @@ RelationDiscardLockInfo(Relation relation)
...
@@ -319,7 +268,7 @@ RelationDiscardLockInfo(Relation relation)
#ifdef LOCKDEBUGALL
#ifdef LOCKDEBUGALL
#define LOCKDEBUGALL_30 \
#define LOCKDEBUGALL_30 \
elog(DEBUG, "RelationSetLockForDescriptorOpen(%s[%d,%d]) called", \
elog(DEBUG, "RelationSetLockForDescriptorOpen(%s[%d,%d]) called", \
RelationGetRelationName(relation), l
RelId.dbId, l
RelId.relId)
RelationGetRelationName(relation), l
ockRelId.dbId, lock
RelId.relId)
#else
#else
#define LOCKDEBUGALL_30
#define LOCKDEBUGALL_30
#endif
/* LOCKDEBUGALL */
#endif
/* LOCKDEBUGALL */
...
@@ -351,7 +300,7 @@ RelationSetLockForDescriptorOpen(Relation relation)
...
@@ -351,7 +300,7 @@ RelationSetLockForDescriptorOpen(Relation relation)
#ifdef LOCKDEBUG
#ifdef LOCKDEBUG
#define LOCKDEBUG_40 \
#define LOCKDEBUG_40 \
elog(DEBUG, "RelationSetLockForRead(%s[%d,%d]) called", \
elog(DEBUG, "RelationSetLockForRead(%s[%d,%d]) called", \
RelationGetRelationName(relation), l
RelId.dbId, l
RelId.relId)
RelationGetRelationName(relation), l
ockRelId.dbId, lock
RelId.relId)
#else
#else
#define LOCKDEBUG_40
#define LOCKDEBUG_40
#endif
/* LOCKDEBUG */
#endif
/* LOCKDEBUG */
...
@@ -363,7 +312,7 @@ elog(DEBUG, "RelationSetLockForRead(%s[%d,%d]) called", \
...
@@ -363,7 +312,7 @@ elog(DEBUG, "RelationSetLockForRead(%s[%d,%d]) called", \
void
void
RelationSetLockForRead
(
Relation
relation
)
RelationSetLockForRead
(
Relation
relation
)
{
{
LockInfo
linfo
;
LockInfo
l
ock
info
;
/* ----------------
/* ----------------
* sanity checks
* sanity checks
...
@@ -383,15 +332,15 @@ RelationSetLockForRead(Relation relation)
...
@@ -383,15 +332,15 @@ RelationSetLockForRead(Relation relation)
if
(
!
LockInfoIsValid
(
relation
->
lockInfo
))
if
(
!
LockInfoIsValid
(
relation
->
lockInfo
))
{
{
RelationInitLockInfo
(
relation
);
RelationInitLockInfo
(
relation
);
linfo
=
(
LockInfo
)
relation
->
lockInfo
;
l
ock
info
=
(
LockInfo
)
relation
->
lockInfo
;
linfo
->
flags
|=
ReadRelationLock
;
l
ock
info
->
flags
|=
ReadRelationLock
;
MultiLockReln
(
linfo
,
READ_LOCK
);
MultiLockReln
(
l
ock
info
,
READ_LOCK
);
return
;
return
;
}
}
else
else
linfo
=
(
LockInfo
)
relation
->
lockInfo
;
l
ock
info
=
(
LockInfo
)
relation
->
lockInfo
;
MultiLockReln
(
linfo
,
READ_LOCK
);
MultiLockReln
(
l
ock
info
,
READ_LOCK
);
}
}
/* ----------------
/* ----------------
...
@@ -401,7 +350,7 @@ RelationSetLockForRead(Relation relation)
...
@@ -401,7 +350,7 @@ RelationSetLockForRead(Relation relation)
#ifdef LOCKDEBUG
#ifdef LOCKDEBUG
#define LOCKDEBUG_50 \
#define LOCKDEBUG_50 \
elog(DEBUG, "RelationUnsetLockForRead(%s[%d,%d]) called", \
elog(DEBUG, "RelationUnsetLockForRead(%s[%d,%d]) called", \
RelationGetRelationName(relation), l
RelId.dbId, l
RelId.relId)
RelationGetRelationName(relation), l
ockRelId.dbId, lock
RelId.relId)
#else
#else
#define LOCKDEBUG_50
#define LOCKDEBUG_50
#endif
/* LOCKDEBUG */
#endif
/* LOCKDEBUG */
...
@@ -413,7 +362,7 @@ elog(DEBUG, "RelationUnsetLockForRead(%s[%d,%d]) called", \
...
@@ -413,7 +362,7 @@ elog(DEBUG, "RelationUnsetLockForRead(%s[%d,%d]) called", \
void
void
RelationUnsetLockForRead
(
Relation
relation
)
RelationUnsetLockForRead
(
Relation
relation
)
{
{
LockInfo
linfo
;
LockInfo
l
ock
info
;
/* ----------------
/* ----------------
* sanity check
* sanity check
...
@@ -423,21 +372,21 @@ RelationUnsetLockForRead(Relation relation)
...
@@ -423,21 +372,21 @@ RelationUnsetLockForRead(Relation relation)
if
(
LockingDisabled
())
if
(
LockingDisabled
())
return
;
return
;
linfo
=
(
LockInfo
)
relation
->
lockInfo
;
l
ock
info
=
(
LockInfo
)
relation
->
lockInfo
;
/* ----------------
/* ----------------
* If we don't have lock info on the reln just go ahead and
* If we don't have lock info on the reln just go ahead and
* release it.
* release it.
* ----------------
* ----------------
*/
*/
if
(
!
LockInfoIsValid
(
linfo
))
if
(
!
LockInfoIsValid
(
l
ock
info
))
{
{
elog
(
ERROR
,
elog
(
ERROR
,
"Releasing a lock on %s with invalid lock information"
,
"Releasing a lock on %s with invalid lock information"
,
RelationGetRelationName
(
relation
));
RelationGetRelationName
(
relation
));
}
}
MultiReleaseReln
(
linfo
,
READ_LOCK
);
MultiReleaseReln
(
l
ock
info
,
READ_LOCK
);
}
}
/* ----------------
/* ----------------
...
@@ -447,7 +396,7 @@ RelationUnsetLockForRead(Relation relation)
...
@@ -447,7 +396,7 @@ RelationUnsetLockForRead(Relation relation)
#ifdef LOCKDEBUG
#ifdef LOCKDEBUG
#define LOCKDEBUG_60 \
#define LOCKDEBUG_60 \
elog(DEBUG, "RelationSetLockForWrite(%s[%d,%d]) called", \
elog(DEBUG, "RelationSetLockForWrite(%s[%d,%d]) called", \
RelationGetRelationName(relation), l
RelId.dbId, l
RelId.relId)
RelationGetRelationName(relation), l
ockRelId.dbId, lock
RelId.relId)
#else
#else
#define LOCKDEBUG_60
#define LOCKDEBUG_60
#endif
/* LOCKDEBUG */
#endif
/* LOCKDEBUG */
...
@@ -459,7 +408,7 @@ elog(DEBUG, "RelationSetLockForWrite(%s[%d,%d]) called", \
...
@@ -459,7 +408,7 @@ elog(DEBUG, "RelationSetLockForWrite(%s[%d,%d]) called", \
void
void
RelationSetLockForWrite
(
Relation
relation
)
RelationSetLockForWrite
(
Relation
relation
)
{
{
LockInfo
linfo
;
LockInfo
l
ock
info
;
/* ----------------
/* ----------------
* sanity checks
* sanity checks
...
@@ -479,15 +428,15 @@ RelationSetLockForWrite(Relation relation)
...
@@ -479,15 +428,15 @@ RelationSetLockForWrite(Relation relation)
if
(
!
LockInfoIsValid
(
relation
->
lockInfo
))
if
(
!
LockInfoIsValid
(
relation
->
lockInfo
))
{
{
RelationInitLockInfo
(
relation
);
RelationInitLockInfo
(
relation
);
linfo
=
(
LockInfo
)
relation
->
lockInfo
;
l
ock
info
=
(
LockInfo
)
relation
->
lockInfo
;
linfo
->
flags
|=
WriteRelationLock
;
l
ock
info
->
flags
|=
WriteRelationLock
;
MultiLockReln
(
linfo
,
WRITE_LOCK
);
MultiLockReln
(
l
ock
info
,
WRITE_LOCK
);
return
;
return
;
}
}
else
else
linfo
=
(
LockInfo
)
relation
->
lockInfo
;
l
ock
info
=
(
LockInfo
)
relation
->
lockInfo
;
MultiLockReln
(
linfo
,
WRITE_LOCK
);
MultiLockReln
(
l
ock
info
,
WRITE_LOCK
);
}
}
/* ----------------
/* ----------------
...
@@ -497,7 +446,7 @@ RelationSetLockForWrite(Relation relation)
...
@@ -497,7 +446,7 @@ RelationSetLockForWrite(Relation relation)
#ifdef LOCKDEBUG
#ifdef LOCKDEBUG
#define LOCKDEBUG_70 \
#define LOCKDEBUG_70 \
elog(DEBUG, "RelationUnsetLockForWrite(%s[%d,%d]) called", \
elog(DEBUG, "RelationUnsetLockForWrite(%s[%d,%d]) called", \
RelationGetRelationName(relation), l
RelId.dbId, lRelId.relId);
RelationGetRelationName(relation), l
ockRelId.dbId, lockRelId.relId)
#else
#else
#define LOCKDEBUG_70
#define LOCKDEBUG_70
#endif
/* LOCKDEBUG */
#endif
/* LOCKDEBUG */
...
@@ -509,7 +458,7 @@ elog(DEBUG, "RelationUnsetLockForWrite(%s[%d,%d]) called", \
...
@@ -509,7 +458,7 @@ elog(DEBUG, "RelationUnsetLockForWrite(%s[%d,%d]) called", \
void
void
RelationUnsetLockForWrite
(
Relation
relation
)
RelationUnsetLockForWrite
(
Relation
relation
)
{
{
LockInfo
linfo
;
LockInfo
l
ock
info
;
/* ----------------
/* ----------------
* sanity checks
* sanity checks
...
@@ -519,16 +468,16 @@ RelationUnsetLockForWrite(Relation relation)
...
@@ -519,16 +468,16 @@ RelationUnsetLockForWrite(Relation relation)
if
(
LockingDisabled
())
if
(
LockingDisabled
())
return
;
return
;
linfo
=
(
LockInfo
)
relation
->
lockInfo
;
l
ock
info
=
(
LockInfo
)
relation
->
lockInfo
;
if
(
!
LockInfoIsValid
(
linfo
))
if
(
!
LockInfoIsValid
(
l
ock
info
))
{
{
elog
(
ERROR
,
elog
(
ERROR
,
"Releasing a lock on %s with invalid lock information"
,
"Releasing a lock on %s with invalid lock information"
,
RelationGetRelationName
(
relation
));
RelationGetRelationName
(
relation
));
}
}
MultiReleaseReln
(
linfo
,
WRITE_LOCK
);
MultiReleaseReln
(
l
ock
info
,
WRITE_LOCK
);
}
}
/* ----------------
/* ----------------
...
@@ -538,10 +487,10 @@ RelationUnsetLockForWrite(Relation relation)
...
@@ -538,10 +487,10 @@ RelationUnsetLockForWrite(Relation relation)
#ifdef LOCKDEBUG
#ifdef LOCKDEBUG
#define LOCKDEBUG_80 \
#define LOCKDEBUG_80 \
elog(DEBUG, "RelationSetLockForTupleRead(%s[%d,%d], 0x%x) called", \
elog(DEBUG, "RelationSetLockForTupleRead(%s[%d,%d], 0x%x) called", \
RelationGetRelationName(relation), l
RelId.dbId, l
RelId.relId, \
RelationGetRelationName(relation), l
ockRelId.dbId, lock
RelId.relId, \
itemPointer)
itemPointer)
#define LOCKDEBUG_81 \
#define LOCKDEBUG_81 \
elog(DEBUG, "RelationSetLockForTupleRead() escalating")
;
elog(DEBUG, "RelationSetLockForTupleRead() escalating")
#else
#else
#define LOCKDEBUG_80
#define LOCKDEBUG_80
#define LOCKDEBUG_81
#define LOCKDEBUG_81
...
@@ -555,7 +504,7 @@ elog(DEBUG, "RelationSetLockForTupleRead(%s[%d,%d], 0x%x) called", \
...
@@ -555,7 +504,7 @@ elog(DEBUG, "RelationSetLockForTupleRead(%s[%d,%d], 0x%x) called", \
void
void
RelationSetLockForTupleRead
(
Relation
relation
,
ItemPointer
itemPointer
)
RelationSetLockForTupleRead
(
Relation
relation
,
ItemPointer
itemPointer
)
{
{
LockInfo
linfo
;
LockInfo
l
ock
info
;
TransactionId
curXact
;
TransactionId
curXact
;
/* ----------------
/* ----------------
...
@@ -576,71 +525,71 @@ RelationSetLockForTupleRead(Relation relation, ItemPointer itemPointer)
...
@@ -576,71 +525,71 @@ RelationSetLockForTupleRead(Relation relation, ItemPointer itemPointer)
if
(
!
LockInfoIsValid
(
relation
->
lockInfo
))
if
(
!
LockInfoIsValid
(
relation
->
lockInfo
))
{
{
RelationInitLockInfo
(
relation
);
RelationInitLockInfo
(
relation
);
linfo
=
(
LockInfo
)
relation
->
lockInfo
;
l
ock
info
=
(
LockInfo
)
relation
->
lockInfo
;
linfo
->
flags
|=
l
ock
info
->
flags
|=
IntentReadRelationLock
|
IntentReadRelationLock
|
IntentReadPageLock
|
IntentReadPageLock
|
ReadTupleLock
;
ReadTupleLock
;
MultiLockTuple
(
linfo
,
itemPointer
,
READ_LOCK
);
MultiLockTuple
(
l
ock
info
,
itemPointer
,
READ_LOCK
);
return
;
return
;
}
}
else
else
linfo
=
(
LockInfo
)
relation
->
lockInfo
;
l
ock
info
=
(
LockInfo
)
relation
->
lockInfo
;
/* ----------------
/* ----------------
* no need to set a lower granularity lock
* no need to set a lower granularity lock
* ----------------
* ----------------
*/
*/
curXact
=
GetCurrentTransactionId
();
curXact
=
GetCurrentTransactionId
();
if
((
linfo
->
flags
&
ReadRelationLock
)
&&
if
((
l
ock
info
->
flags
&
ReadRelationLock
)
&&
TransactionIdEquals
(
curXact
,
linfo
->
transactionIdData
))
TransactionIdEquals
(
curXact
,
l
ock
info
->
transactionIdData
))
return
;
return
;
/* ----------------
/* ----------------
* If we don't already have a tuple lock this transaction
* If we don't already have a tuple lock this transaction
* ----------------
* ----------------
*/
*/
if
(
!
((
linfo
->
flags
&
ReadTupleLock
)
&&
if
(
!
((
l
ock
info
->
flags
&
ReadTupleLock
)
&&
TransactionIdEquals
(
curXact
,
linfo
->
transactionIdData
)))
TransactionIdEquals
(
curXact
,
l
ock
info
->
transactionIdData
)))
{
{
linfo
->
flags
|=
l
ock
info
->
flags
|=
IntentReadRelationLock
|
IntentReadRelationLock
|
IntentReadPageLock
|
IntentReadPageLock
|
ReadTupleLock
;
ReadTupleLock
;
/* clear count */
/* clear count */
linfo
->
flags
&=
~
TupleLevelLockCountMask
;
l
ock
info
->
flags
&=
~
TupleLevelLockCountMask
;
}
}
else
else
{
{
if
(
TupleLevelLockLimit
==
(
TupleLevelLockCountMask
&
if
(
TupleLevelLockLimit
==
(
TupleLevelLockCountMask
&
linfo
->
flags
))
l
ock
info
->
flags
))
{
{
LOCKDEBUG_81
;
LOCKDEBUG_81
;
/* escalate */
/* escalate */
MultiLockReln
(
linfo
,
READ_LOCK
);
MultiLockReln
(
l
ock
info
,
READ_LOCK
);
/* clear count */
/* clear count */
linfo
->
flags
&=
~
TupleLevelLockCountMask
;
l
ock
info
->
flags
&=
~
TupleLevelLockCountMask
;
return
;
return
;
}
}
/* increment count */
/* increment count */
linfo
->
flags
=
l
ock
info
->
flags
=
(
linfo
->
flags
&
~
TupleLevelLockCountMask
)
|
(
l
ock
info
->
flags
&
~
TupleLevelLockCountMask
)
|
(
1
+
(
TupleLevelLockCountMask
&
linfo
->
flags
));
(
1
+
(
TupleLevelLockCountMask
&
l
ock
info
->
flags
));
}
}
TransactionIdStore
(
curXact
,
&
linfo
->
transactionIdData
);
TransactionIdStore
(
curXact
,
&
l
ock
info
->
transactionIdData
);
/* ----------------
/* ----------------
* Lock the tuple.
* Lock the tuple.
* ----------------
* ----------------
*/
*/
MultiLockTuple
(
linfo
,
itemPointer
,
READ_LOCK
);
MultiLockTuple
(
l
ock
info
,
itemPointer
,
READ_LOCK
);
}
}
#endif
#endif
...
@@ -652,7 +601,7 @@ RelationSetLockForTupleRead(Relation relation, ItemPointer itemPointer)
...
@@ -652,7 +601,7 @@ RelationSetLockForTupleRead(Relation relation, ItemPointer itemPointer)
#ifdef LOCKDEBUG
#ifdef LOCKDEBUG
#define LOCKDEBUG_90 \
#define LOCKDEBUG_90 \
elog(DEBUG, "RelationSetLockForReadPage(%s[%d,%d], @%d) called", \
elog(DEBUG, "RelationSetLockForReadPage(%s[%d,%d], @%d) called", \
RelationGetRelationName(relation), l
RelId.dbId, lRelId.relId, page);
RelationGetRelationName(relation), l
ockRelId.dbId, lockRelId.relId, page)
#else
#else
#define LOCKDEBUG_90
#define LOCKDEBUG_90
#endif
/* LOCKDEBUG */
#endif
/* LOCKDEBUG */
...
@@ -664,7 +613,7 @@ elog(DEBUG, "RelationSetLockForReadPage(%s[%d,%d], @%d) called", \
...
@@ -664,7 +613,7 @@ elog(DEBUG, "RelationSetLockForReadPage(%s[%d,%d], @%d) called", \
#ifdef LOCKDEBUG
#ifdef LOCKDEBUG
#define LOCKDEBUG_100 \
#define LOCKDEBUG_100 \
elog(DEBUG, "RelationSetLockForWritePage(%s[%d,%d], @%d) called", \
elog(DEBUG, "RelationSetLockForWritePage(%s[%d,%d], @%d) called", \
RelationGetRelationName(relation), l
RelId.dbId, lRelId.relId, page);
RelationGetRelationName(relation), l
ockRelId.dbId, lockRelId.relId, page)
#else
#else
#define LOCKDEBUG_100
#define LOCKDEBUG_100
#endif
/* LOCKDEBUG */
#endif
/* LOCKDEBUG */
...
@@ -686,7 +635,7 @@ RelationSetLockForWritePage(Relation relation,
...
@@ -686,7 +635,7 @@ RelationSetLockForWritePage(Relation relation,
return
;
return
;
/* ---------------
/* ---------------
* Make sure linfo is initialized
* Make sure l
ock
info is initialized
* ---------------
* ---------------
*/
*/
if
(
!
LockInfoIsValid
(
relation
->
lockInfo
))
if
(
!
LockInfoIsValid
(
relation
->
lockInfo
))
...
@@ -706,7 +655,7 @@ RelationSetLockForWritePage(Relation relation,
...
@@ -706,7 +655,7 @@ RelationSetLockForWritePage(Relation relation,
#ifdef LOCKDEBUG
#ifdef LOCKDEBUG
#define LOCKDEBUG_110 \
#define LOCKDEBUG_110 \
elog(DEBUG, "RelationUnsetLockForReadPage(%s[%d,%d], @%d) called", \
elog(DEBUG, "RelationUnsetLockForReadPage(%s[%d,%d], @%d) called", \
RelationGetRelationName(relation), l
RelId.dbId, l
RelId.relId, page)
RelationGetRelationName(relation), l
ockRelId.dbId, lock
RelId.relId, page)
#else
#else
#define LOCKDEBUG_110
#define LOCKDEBUG_110
#endif
/* LOCKDEBUG */
#endif
/* LOCKDEBUG */
...
@@ -718,7 +667,7 @@ elog(DEBUG, "RelationUnsetLockForReadPage(%s[%d,%d], @%d) called", \
...
@@ -718,7 +667,7 @@ elog(DEBUG, "RelationUnsetLockForReadPage(%s[%d,%d], @%d) called", \
#ifdef LOCKDEBUG
#ifdef LOCKDEBUG
#define LOCKDEBUG_120 \
#define LOCKDEBUG_120 \
elog(DEBUG, "RelationUnsetLockForWritePage(%s[%d,%d], @%d) called", \
elog(DEBUG, "RelationUnsetLockForWritePage(%s[%d,%d], @%d) called", \
RelationGetRelationName(relation), l
RelId.dbId, l
RelId.relId, page)
RelationGetRelationName(relation), l
ockRelId.dbId, lock
RelId.relId, page)
#else
#else
#define LOCKDEBUG_120
#define LOCKDEBUG_120
#endif
/* LOCKDEBUG */
#endif
/* LOCKDEBUG */
...
@@ -950,11 +899,11 @@ RelationUnsetLockForExtend(Relation relation)
...
@@ -950,11 +899,11 @@ RelationUnsetLockForExtend(Relation relation)
#endif
#endif
/*
/*
* Create an LRelid --- Why not just pass in a pointer to the storage?
* Create an L
ock
Relid --- Why not just pass in a pointer to the storage?
*/
*/
static
void
static
void
L
RelIdAssign
(
LRelId
*
l
RelId
,
Oid
dbId
,
Oid
relId
)
L
ockRelIdAssign
(
LockRelId
*
lock
RelId
,
Oid
dbId
,
Oid
relId
)
{
{
lRelId
->
dbId
=
dbId
;
l
ock
RelId
->
dbId
=
dbId
;
lRelId
->
relId
=
relId
;
l
ock
RelId
->
relId
=
relId
;
}
}
src/backend/storage/lmgr/multi.c
View file @
5aea4062
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/multi.c,v 1.
19 1998/06/30 02:33:3
1 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/multi.c,v 1.
20 1998/07/13 16:34:5
1 momjian Exp $
*
*
* NOTES:
* NOTES:
* (1) The lock.c module assumes that the caller here is doing
* (1) The lock.c module assumes that the caller here is doing
...
@@ -113,7 +113,7 @@ InitMultiLevelLocks()
...
@@ -113,7 +113,7 @@ InitMultiLevelLocks()
* Returns: TRUE if the lock can be set, FALSE otherwise.
* Returns: TRUE if the lock can be set, FALSE otherwise.
*/
*/
bool
bool
MultiLockReln
(
LockInfo
linfo
,
LOCKMODE
lockmode
)
MultiLockReln
(
LockInfo
l
ock
info
,
LOCKMODE
lockmode
)
{
{
LOCKTAG
tag
;
LOCKTAG
tag
;
...
@@ -122,8 +122,8 @@ MultiLockReln(LockInfo linfo, LOCKMODE lockmode)
...
@@ -122,8 +122,8 @@ MultiLockReln(LockInfo linfo, LOCKMODE lockmode)
* will return miss if the padding bytes aren't zero'd.
* will return miss if the padding bytes aren't zero'd.
*/
*/
MemSet
(
&
tag
,
0
,
sizeof
(
tag
));
MemSet
(
&
tag
,
0
,
sizeof
(
tag
));
tag
.
relId
=
l
info
->
l
RelId
.
relId
;
tag
.
relId
=
l
ockinfo
->
lock
RelId
.
relId
;
tag
.
dbId
=
l
info
->
l
RelId
.
dbId
;
tag
.
dbId
=
l
ockinfo
->
lock
RelId
.
dbId
;
return
(
MultiAcquire
(
MultiTableId
,
&
tag
,
lockmode
,
RELN_LEVEL
));
return
(
MultiAcquire
(
MultiTableId
,
&
tag
,
lockmode
,
RELN_LEVEL
));
}
}
...
@@ -136,7 +136,7 @@ MultiLockReln(LockInfo linfo, LOCKMODE lockmode)
...
@@ -136,7 +136,7 @@ MultiLockReln(LockInfo linfo, LOCKMODE lockmode)
* at the page and relation level.
* at the page and relation level.
*/
*/
bool
bool
MultiLockTuple
(
LockInfo
linfo
,
ItemPointer
tidPtr
,
LOCKMODE
lockmode
)
MultiLockTuple
(
LockInfo
l
ock
info
,
ItemPointer
tidPtr
,
LOCKMODE
lockmode
)
{
{
LOCKTAG
tag
;
LOCKTAG
tag
;
...
@@ -146,8 +146,8 @@ MultiLockTuple(LockInfo linfo, ItemPointer tidPtr, LOCKMODE lockmode)
...
@@ -146,8 +146,8 @@ MultiLockTuple(LockInfo linfo, ItemPointer tidPtr, LOCKMODE lockmode)
*/
*/
MemSet
(
&
tag
,
0
,
sizeof
(
tag
));
MemSet
(
&
tag
,
0
,
sizeof
(
tag
));
tag
.
relId
=
l
info
->
l
RelId
.
relId
;
tag
.
relId
=
l
ockinfo
->
lock
RelId
.
relId
;
tag
.
dbId
=
l
info
->
l
RelId
.
dbId
;
tag
.
dbId
=
l
ockinfo
->
lock
RelId
.
dbId
;
/* not locking any valid Tuple, just the page */
/* not locking any valid Tuple, just the page */
tag
.
tupleId
=
*
tidPtr
;
tag
.
tupleId
=
*
tidPtr
;
...
@@ -158,7 +158,7 @@ MultiLockTuple(LockInfo linfo, ItemPointer tidPtr, LOCKMODE lockmode)
...
@@ -158,7 +158,7 @@ MultiLockTuple(LockInfo linfo, ItemPointer tidPtr, LOCKMODE lockmode)
* same as above at page level
* same as above at page level
*/
*/
bool
bool
MultiLockPage
(
LockInfo
linfo
,
ItemPointer
tidPtr
,
LOCKMODE
lockmode
)
MultiLockPage
(
LockInfo
l
ock
info
,
ItemPointer
tidPtr
,
LOCKMODE
lockmode
)
{
{
LOCKTAG
tag
;
LOCKTAG
tag
;
...
@@ -178,8 +178,8 @@ MultiLockPage(LockInfo linfo, ItemPointer tidPtr, LOCKMODE lockmode)
...
@@ -178,8 +178,8 @@ MultiLockPage(LockInfo linfo, ItemPointer tidPtr, LOCKMODE lockmode)
* when we say lock the page we mean the 8k block. -Jeff 16 July 1991
* when we say lock the page we mean the 8k block. -Jeff 16 July 1991
* ----------------------------
* ----------------------------
*/
*/
tag
.
relId
=
l
info
->
l
RelId
.
relId
;
tag
.
relId
=
l
ockinfo
->
lock
RelId
.
relId
;
tag
.
dbId
=
l
info
->
l
RelId
.
dbId
;
tag
.
dbId
=
l
ockinfo
->
lock
RelId
.
dbId
;
BlockIdCopy
(
&
(
tag
.
tupleId
.
ip_blkid
),
&
(
tidPtr
->
ip_blkid
));
BlockIdCopy
(
&
(
tag
.
tupleId
.
ip_blkid
),
&
(
tidPtr
->
ip_blkid
));
return
(
MultiAcquire
(
MultiTableId
,
&
tag
,
lockmode
,
PAGE_LEVEL
));
return
(
MultiAcquire
(
MultiTableId
,
&
tag
,
lockmode
,
PAGE_LEVEL
));
}
}
...
@@ -302,7 +302,7 @@ MultiAcquire(LOCKMETHOD lockmethod,
...
@@ -302,7 +302,7 @@ MultiAcquire(LOCKMETHOD lockmethod,
*/
*/
#ifdef NOT_USED
#ifdef NOT_USED
bool
bool
MultiReleasePage
(
LockInfo
linfo
,
ItemPointer
tidPtr
,
LOCKMODE
lockmode
)
MultiReleasePage
(
LockInfo
l
ock
info
,
ItemPointer
tidPtr
,
LOCKMODE
lockmode
)
{
{
LOCKTAG
tag
;
LOCKTAG
tag
;
...
@@ -314,8 +314,8 @@ MultiReleasePage(LockInfo linfo, ItemPointer tidPtr, LOCKMODE lockmode)
...
@@ -314,8 +314,8 @@ MultiReleasePage(LockInfo linfo, ItemPointer tidPtr, LOCKMODE lockmode)
*/
*/
MemSet
(
&
tag
,
0
,
sizeof
(
LOCKTAG
));
MemSet
(
&
tag
,
0
,
sizeof
(
LOCKTAG
));
tag
.
relId
=
l
info
->
l
RelId
.
relId
;
tag
.
relId
=
l
ockinfo
->
lock
RelId
.
relId
;
tag
.
dbId
=
l
info
->
l
RelId
.
dbId
;
tag
.
dbId
=
l
ockinfo
->
lock
RelId
.
dbId
;
BlockIdCopy
(
&
(
tag
.
tupleId
.
ip_blkid
),
&
(
tidPtr
->
ip_blkid
));
BlockIdCopy
(
&
(
tag
.
tupleId
.
ip_blkid
),
&
(
tidPtr
->
ip_blkid
));
return
(
MultiRelease
(
MultiTableId
,
&
tag
,
lockmode
,
PAGE_LEVEL
));
return
(
MultiRelease
(
MultiTableId
,
&
tag
,
lockmode
,
PAGE_LEVEL
));
...
@@ -328,7 +328,7 @@ MultiReleasePage(LockInfo linfo, ItemPointer tidPtr, LOCKMODE lockmode)
...
@@ -328,7 +328,7 @@ MultiReleasePage(LockInfo linfo, ItemPointer tidPtr, LOCKMODE lockmode)
* ------------------
* ------------------
*/
*/
bool
bool
MultiReleaseReln
(
LockInfo
linfo
,
LOCKMODE
lockmode
)
MultiReleaseReln
(
LockInfo
l
ock
info
,
LOCKMODE
lockmode
)
{
{
LOCKTAG
tag
;
LOCKTAG
tag
;
...
@@ -339,8 +339,8 @@ MultiReleaseReln(LockInfo linfo, LOCKMODE lockmode)
...
@@ -339,8 +339,8 @@ MultiReleaseReln(LockInfo linfo, LOCKMODE lockmode)
* ------------------
* ------------------
*/
*/
MemSet
(
&
tag
,
0
,
sizeof
(
LOCKTAG
));
MemSet
(
&
tag
,
0
,
sizeof
(
LOCKTAG
));
tag
.
relId
=
l
info
->
l
RelId
.
relId
;
tag
.
relId
=
l
ockinfo
->
lock
RelId
.
relId
;
tag
.
dbId
=
l
info
->
l
RelId
.
dbId
;
tag
.
dbId
=
l
ockinfo
->
lock
RelId
.
dbId
;
return
(
MultiRelease
(
MultiTableId
,
&
tag
,
lockmode
,
RELN_LEVEL
));
return
(
MultiRelease
(
MultiTableId
,
&
tag
,
lockmode
,
RELN_LEVEL
));
}
}
...
...
src/backend/storage/lmgr/single.c
View file @
5aea4062
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/single.c,v 1.
7 1998/06/30 02:33:3
2 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/single.c,v 1.
8 1998/07/13 16:34:5
2 momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
* Returns: TRUE if the lock can be set, FALSE otherwise.
* Returns: TRUE if the lock can be set, FALSE otherwise.
*/
*/
bool
bool
SingleLockReln
(
LockInfo
linfo
,
LOCKMODE
lockmode
,
int
action
)
SingleLockReln
(
LockInfo
l
ock
info
,
LOCKMODE
lockmode
,
int
action
)
{
{
LOCKTAG
tag
;
LOCKTAG
tag
;
...
@@ -41,8 +41,8 @@ SingleLockReln(LockInfo linfo, LOCKMODE lockmode, int action)
...
@@ -41,8 +41,8 @@ SingleLockReln(LockInfo linfo, LOCKMODE lockmode, int action)
* will return miss if the padding bytes aren't zero'd.
* will return miss if the padding bytes aren't zero'd.
*/
*/
MemSet
(
&
tag
,
0
,
sizeof
(
tag
));
MemSet
(
&
tag
,
0
,
sizeof
(
tag
));
tag
.
relId
=
l
info
->
l
RelId
.
relId
;
tag
.
relId
=
l
ockinfo
->
lock
RelId
.
relId
;
tag
.
dbId
=
l
info
->
l
RelId
.
dbId
;
tag
.
dbId
=
l
ockinfo
->
lock
RelId
.
dbId
;
BlockIdSet
(
&
(
tag
.
tupleId
.
ip_blkid
),
InvalidBlockNumber
);
BlockIdSet
(
&
(
tag
.
tupleId
.
ip_blkid
),
InvalidBlockNumber
);
tag
.
tupleId
.
ip_posid
=
InvalidOffsetNumber
;
tag
.
tupleId
.
ip_posid
=
InvalidOffsetNumber
;
...
@@ -61,7 +61,7 @@ SingleLockReln(LockInfo linfo, LOCKMODE lockmode, int action)
...
@@ -61,7 +61,7 @@ SingleLockReln(LockInfo linfo, LOCKMODE lockmode, int action)
*
*
*/
*/
bool
bool
SingleLockPage
(
LockInfo
linfo
,
SingleLockPage
(
LockInfo
l
ock
info
,
ItemPointer
tidPtr
,
ItemPointer
tidPtr
,
LOCKMODE
lockmode
,
LOCKMODE
lockmode
,
int
action
)
int
action
)
...
@@ -73,8 +73,8 @@ SingleLockPage(LockInfo linfo,
...
@@ -73,8 +73,8 @@ SingleLockPage(LockInfo linfo,
* will return miss if the padding bytes aren't zero'd.
* will return miss if the padding bytes aren't zero'd.
*/
*/
MemSet
(
&
tag
,
0
,
sizeof
(
tag
));
MemSet
(
&
tag
,
0
,
sizeof
(
tag
));
tag
.
relId
=
l
info
->
l
RelId
.
relId
;
tag
.
relId
=
l
ockinfo
->
lock
RelId
.
relId
;
tag
.
dbId
=
l
info
->
l
RelId
.
dbId
;
tag
.
dbId
=
l
ockinfo
->
lock
RelId
.
dbId
;
BlockIdCopy
(
&
(
tag
.
tupleId
.
ip_blkid
),
&
(
tidPtr
->
ip_blkid
));
BlockIdCopy
(
&
(
tag
.
tupleId
.
ip_blkid
),
&
(
tidPtr
->
ip_blkid
));
tag
.
tupleId
.
ip_posid
=
InvalidOffsetNumber
;
tag
.
tupleId
.
ip_posid
=
InvalidOffsetNumber
;
...
...
src/include/libpq/libpq.h
View file @
5aea4062
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: libpq.h,v 1.1
7 1998/07/09 03:29:01 scrappy
Exp $
* $Id: libpq.h,v 1.1
8 1998/07/13 16:34:53 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -49,8 +49,8 @@ typedef struct
...
@@ -49,8 +49,8 @@ typedef struct
typedef
struct
TypeBlock
typedef
struct
TypeBlock
{
{
char
name
[
NAMEDATALEN
];
/* name of the attribute */
char
name
[
NAMEDATALEN
];
/* name of the attribute */
int
adtid
;
/* adt
id of the type */
int
typid
;
/* typ
id of the type */
int
adtsize
;
/* adtsize
of the type */
int
typlen
;
/* typlen
of the type */
}
TypeBlock
;
}
TypeBlock
;
/* ----------------
/* ----------------
...
...
src/include/storage/buf_internals.h
View file @
5aea4062
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: buf_internals.h,v 1.2
2 1998/06/15 18:40:01
momjian Exp $
* $Id: buf_internals.h,v 1.2
3 1998/07/13 16:34:55
momjian Exp $
*
*
* NOTE
* NOTE
* If BUFFERPAGE0 is defined, then 0 will be used as a
* If BUFFERPAGE0 is defined, then 0 will be used as a
...
@@ -51,7 +51,7 @@ typedef long **BufferBlock;
...
@@ -51,7 +51,7 @@ typedef long **BufferBlock;
struct
buftag
struct
buftag
{
{
LRelId
relId
;
L
ock
RelId
relId
;
BlockNumber
blockNum
;
/* blknum relative to begin of reln */
BlockNumber
blockNum
;
/* blknum relative to begin of reln */
};
};
...
@@ -65,14 +65,14 @@ struct buftag
...
@@ -65,14 +65,14 @@ struct buftag
#define INIT_BUFFERTAG(a,xx_reln,xx_blockNum) \
#define INIT_BUFFERTAG(a,xx_reln,xx_blockNum) \
( \
( \
(a)->blockNum = xx_blockNum, \
(a)->blockNum = xx_blockNum, \
(a)->relId = RelationGetLRelId(xx_reln) \
(a)->relId = RelationGetL
ock
RelId(xx_reln) \
)
)
#ifdef NOT_USED
#ifdef NOT_USED
#define COPY_BUFFERTAG(a,b) \
#define COPY_BUFFERTAG(a,b) \
( \
( \
(a)->blockNum = (b)->blockNum, \
(a)->blockNum = (b)->blockNum, \
LRelIdAssign(*(a),*(b)) \
L
ock
RelIdAssign(*(a),*(b)) \
)
)
#define EQUAL_BUFFERTAG(a,b) \
#define EQUAL_BUFFERTAG(a,b) \
...
...
src/include/storage/lmgr.h
View file @
5aea4062
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: lmgr.h,v 1.1
2 1998/06/30 02:33:32
momjian Exp $
* $Id: lmgr.h,v 1.1
3 1998/07/13 16:34:56
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -15,32 +15,57 @@
...
@@ -15,32 +15,57 @@
#include <storage/lock.h>
#include <storage/lock.h>
#include <utils/rel.h>
#include <utils/rel.h>
#include <catalog/catname.h>
/*
/*
* This was moved from pladt.h for the new lock manager. Want to obsolete
* This was moved from pladt.h for the new lock manager. Want to obsolete
* all of the old code.
* all of the old code.
*/
*/
typedef
struct
LRelId
typedef
struct
L
ock
RelId
{
{
Oid
relId
;
/* a relation identifier */
Oid
relId
;
/* a relation identifier */
Oid
dbId
;
/* a database identifier */
Oid
dbId
;
/* a database identifier */
}
LRelId
;
}
L
ock
RelId
;
typedef
struct
LockInfoData
typedef
struct
LockInfoData
{
{
bool
initialized
;
bool
initialized
;
L
RelId
l
RelId
;
L
ockRelId
lock
RelId
;
TransactionId
transactionIdData
;
TransactionId
transactionIdData
;
uint16
flags
;
uint16
flags
;
}
LockInfoData
;
}
LockInfoData
;
typedef
LockInfoData
*
LockInfo
;
typedef
LockInfoData
*
LockInfo
;
#define LockInfoIsValid(linfo) \
#define LockInfoIsValid(l
ock
info) \
((PointerIsValid(l
info)) && ((LockInfo) l
info)->initialized)
((PointerIsValid(l
ockinfo)) && ((LockInfo) lock
info)->initialized)
extern
LockRelId
VariableRelationLockRelId
;
extern
LRelId
RelationGetLRelId
(
Relation
relation
);
/*
extern
Oid
LRelIdGetRelationId
(
LRelId
lRelId
);
* RelationGetLockRelId --
* Returns "lock" relation identifier for a relation.
*/
/* ----------------
* final condition is a hack to prevent problems during
* VARIABLE relation initialization
* ----------------
*/
#define RelationGetLockRelId(relation) \
( \
AssertMacro(RelationIsValid(relation)), \
(!LockInfoIsValid((LockInfo)(relation)->lockInfo)) ? \
RelationInitLockInfo(relation) \
: \
(void)NULL, \
(strcmp(RelationGetRelationName(relation)->data, \
VariableRelationName) == 0) ? \
VariableRelationLockRelId \
: \
((LockInfo)(relation)->lockInfo)->lockRelId \
)
extern
Oid
LockRelIdGetRelationId
(
LockRelId
lockRelId
);
extern
void
RelationInitLockInfo
(
Relation
relation
);
extern
void
RelationInitLockInfo
(
Relation
relation
);
extern
void
RelationSetLockForDescriptorOpen
(
Relation
relation
);
extern
void
RelationSetLockForDescriptorOpen
(
Relation
relation
);
extern
void
RelationSetLockForRead
(
Relation
relation
);
extern
void
RelationSetLockForRead
(
Relation
relation
);
...
@@ -72,9 +97,9 @@ extern void RelationSetWIntentLock(Relation relation);
...
@@ -72,9 +97,9 @@ extern void RelationSetWIntentLock(Relation relation);
extern
void
RelationUnsetWIntentLock
(
Relation
relation
);
extern
void
RelationUnsetWIntentLock
(
Relation
relation
);
/* single.c */
/* single.c */
extern
bool
SingleLockReln
(
LockInfo
linfo
,
LOCKMODE
lockmode
,
int
action
);
extern
bool
SingleLockReln
(
LockInfo
l
ock
info
,
LOCKMODE
lockmode
,
int
action
);
extern
bool
extern
bool
SingleLockPage
(
LockInfo
linfo
,
ItemPointer
tidPtr
,
SingleLockPage
(
LockInfo
l
ock
info
,
ItemPointer
tidPtr
,
LOCKMODE
lockmode
,
int
action
);
LOCKMODE
lockmode
,
int
action
);
/* proc.c */
/* proc.c */
...
...
src/include/storage/multilev.h
View file @
5aea4062
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: multilev.h,v 1.1
0 1998/06/30 02:33:33
momjian Exp $
* $Id: multilev.h,v 1.1
1 1998/07/13 16:34:58
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -52,9 +52,9 @@ extern LOCKMETHOD ShortTermTableId;
...
@@ -52,9 +52,9 @@ extern LOCKMETHOD ShortTermTableId;
* function prototypes
* function prototypes
*/
*/
extern
LOCKMETHOD
InitMultiLevelLocks
(
void
);
extern
LOCKMETHOD
InitMultiLevelLocks
(
void
);
extern
bool
MultiLockReln
(
LockInfo
linfo
,
LOCKMODE
lockmode
);
extern
bool
MultiLockReln
(
LockInfo
l
ock
info
,
LOCKMODE
lockmode
);
extern
bool
MultiLockTuple
(
LockInfo
linfo
,
ItemPointer
tidPtr
,
LOCKMODE
lockmode
);
extern
bool
MultiLockTuple
(
LockInfo
l
ock
info
,
ItemPointer
tidPtr
,
LOCKMODE
lockmode
);
extern
bool
MultiLockPage
(
LockInfo
linfo
,
ItemPointer
tidPtr
,
LOCKMODE
lockmode
);
extern
bool
MultiLockPage
(
LockInfo
l
ock
info
,
ItemPointer
tidPtr
,
LOCKMODE
lockmode
);
extern
bool
MultiReleaseReln
(
LockInfo
linfo
,
LOCKMODE
lockmode
);
extern
bool
MultiReleaseReln
(
LockInfo
l
ock
info
,
LOCKMODE
lockmode
);
#endif
/* MULTILEV_H */
#endif
/* MULTILEV_H */
src/interfaces/libpq/fe-exec.c
View file @
5aea4062
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.5
8 1998/07/13 02:41:58
momjian Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.5
9 1998/07/13 16:35:00
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -497,12 +497,12 @@ getRowDescriptions(PGconn *conn)
...
@@ -497,12 +497,12 @@ getRowDescriptions(PGconn *conn)
for
(
i
=
0
;
i
<
nfields
;
i
++
)
for
(
i
=
0
;
i
<
nfields
;
i
++
)
{
{
char
typName
[
MAX_MESSAGE_LEN
];
char
typName
[
MAX_MESSAGE_LEN
];
int
adt
id
;
int
typ
id
;
int
typlen
;
int
typlen
;
int
atttypmod
=
-
1
;
int
atttypmod
=
-
1
;
if
(
pqGets
(
typName
,
MAX_MESSAGE_LEN
,
conn
)
||
if
(
pqGets
(
typName
,
MAX_MESSAGE_LEN
,
conn
)
||
pqGetInt
(
&
adt
id
,
4
,
conn
)
||
pqGetInt
(
&
typ
id
,
4
,
conn
)
||
pqGetInt
(
&
typlen
,
2
,
conn
)
||
pqGetInt
(
&
typlen
,
2
,
conn
)
||
pqGetInt
(
&
atttypmod
,
4
,
conn
))
pqGetInt
(
&
atttypmod
,
4
,
conn
))
{
{
...
@@ -510,7 +510,7 @@ getRowDescriptions(PGconn *conn)
...
@@ -510,7 +510,7 @@ getRowDescriptions(PGconn *conn)
return
EOF
;
return
EOF
;
}
}
result
->
attDescs
[
i
].
name
=
strdup
(
typName
);
result
->
attDescs
[
i
].
name
=
strdup
(
typName
);
result
->
attDescs
[
i
].
adtid
=
adt
id
;
result
->
attDescs
[
i
].
typid
=
typ
id
;
result
->
attDescs
[
i
].
typlen
=
(
short
)
typlen
;
result
->
attDescs
[
i
].
typlen
=
(
short
)
typlen
;
result
->
attDescs
[
i
].
atttypmod
=
atttypmod
;
result
->
attDescs
[
i
].
atttypmod
=
atttypmod
;
}
}
...
@@ -1272,7 +1272,7 @@ PQftype(PGresult *res, int field_num)
...
@@ -1272,7 +1272,7 @@ PQftype(PGresult *res, int field_num)
return
InvalidOid
;
return
InvalidOid
;
}
}
if
(
res
->
attDescs
)
if
(
res
->
attDescs
)
return
res
->
attDescs
[
field_num
].
adt
id
;
return
res
->
attDescs
[
field_num
].
typ
id
;
else
else
return
InvalidOid
;
return
InvalidOid
;
}
}
...
...
src/interfaces/libpq/libpq-fe.h
View file @
5aea4062
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: libpq-fe.h,v 1.3
3 1998/07/13 02:41:59
momjian Exp $
* $Id: libpq-fe.h,v 1.3
4 1998/07/13 16:35:02
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -76,8 +76,8 @@ extern "C"
...
@@ -76,8 +76,8 @@ extern "C"
typedef
struct
pgresAttDesc
typedef
struct
pgresAttDesc
{
{
char
*
name
;
/* type name */
char
*
name
;
/* type name */
Oid
adt
id
;
/* type id */
Oid
typ
id
;
/* type id */
short
adtsize
;
/* type size */
short
typlen
;
/* type size */
int
atttypmod
;
/* type-specific modifier info */
int
atttypmod
;
/* type-specific modifier info */
}
PGresAttDesc
;
}
PGresAttDesc
;
...
...
src/interfaces/odbc/pgtypes.c
View file @
5aea4062
...
@@ -223,7 +223,7 @@ mylog("getCharPrecision: type=%d, col=%d, unknown = %d\n", type,col,handle_unkno
...
@@ -223,7 +223,7 @@ mylog("getCharPrecision: type=%d, col=%d, unknown = %d\n", type,col,handle_unkno
if
(
stmt
->
manual_result
)
{
if
(
stmt
->
manual_result
)
{
flds
=
result
->
fields
;
flds
=
result
->
fields
;
if
(
flds
)
if
(
flds
)
return
flds
->
adtsize
[
col
];
return
flds
->
typlen
[
col
];
else
else
return
maxsize
;
return
maxsize
;
}
}
...
...
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