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
bc3991c1
Commit
bc3991c1
authored
Aug 20, 2005
by
Tatsuo Ishii
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add BackendXidGetPid().
parent
f57e3f4c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
2 deletions
+41
-2
src/backend/storage/ipc/procarray.c
src/backend/storage/ipc/procarray.c
+39
-1
src/include/storage/procarray.h
src/include/storage/procarray.h
+2
-1
No files found.
src/backend/storage/ipc/procarray.c
View file @
bc3991c1
...
...
@@ -23,7 +23,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.
4 2005/07/31 17:19:18 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.
5 2005/08/20 01:26:36 ishii
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -685,6 +685,44 @@ BackendPidGetProc(int pid)
return
result
;
}
/*
* BackendXidGetPid -- get a backend's pid given its XID
*
* Returns 0 if not found or it's a prepared transaction. Note that
* it is up to the caller to be sure that the question remains
* meaningful for long enough for the answer to be used ...
*
* Only main transaction Ids are considered. This function is mainly
* useful for determining what backend owns a lock.
*/
int
BackendXidGetPid
(
TransactionId
xid
)
{
int
result
=
0
;
ProcArrayStruct
*
arrayP
=
procArray
;
int
index
;
if
(
xid
==
InvalidTransactionId
)
/* never match invalid xid */
return
0
;
LWLockAcquire
(
ProcArrayLock
,
LW_SHARED
);
for
(
index
=
0
;
index
<
arrayP
->
numProcs
;
index
++
)
{
PGPROC
*
proc
=
arrayP
->
procs
[
index
];
if
(
proc
->
xid
==
xid
)
{
result
=
proc
->
pid
;
break
;
}
}
LWLockRelease
(
ProcArrayLock
);
return
result
;
}
/*
* IsBackendPid -- is a given pid a running backend
*/
...
...
src/include/storage/procarray.h
View file @
bc3991c1
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/storage/procarray.h,v 1.
3 2005/07/31 17:19:22 tgl
Exp $
* $PostgreSQL: pgsql/src/include/storage/procarray.h,v 1.
4 2005/08/20 01:26:29 ishii
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -27,6 +27,7 @@ extern bool TransactionIdIsActive(TransactionId xid);
extern
TransactionId
GetOldestXmin
(
bool
allDbs
);
extern
PGPROC
*
BackendPidGetProc
(
int
pid
);
extern
int
BackendXidGetPid
(
TransactionId
xid
);
extern
bool
IsBackendPid
(
int
pid
);
extern
bool
DatabaseHasActiveBackends
(
Oid
databaseId
,
bool
ignoreMyself
);
...
...
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