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
3643248a
Commit
3643248a
authored
Nov 27, 1996
by
Vadim B. Mikheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TransactionIdIsInProgress is here now and gives quality answer
by scanning PROC structures of all running backend.
parent
47312ec1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
1 deletion
+41
-1
src/backend/storage/ipc/shmem.c
src/backend/storage/ipc/shmem.c
+41
-1
No files found.
src/backend/storage/ipc/shmem.c
View file @
3643248a
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.
6 1996/11/10 03:02:27 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.
7 1996/11/27 07:20:07 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -64,6 +64,7 @@
#include "storage/ipc.h"
#include "storage/shmem.h"
#include "storage/spin.h"
#include "storage/proc.h"
#include "utils/dynahash.h"
#include "utils/hsearch.h"
...
...
@@ -559,4 +560,43 @@ ShmemInitStruct(char *name, unsigned long size, bool *foundPtr)
}
/*
* TransactionIdIsInProgress -- is given transaction running by some backend
*
* Strange place for this func, but we have to lookup process data structures
* for all running backends. - vadim 11/26/96
*/
bool
TransactionIdIsInProgress
(
TransactionId
xid
)
{
BindingEnt
*
result
;
PROC
*
proc
;
Assert
(
BindingTable
);
SpinAcquire
(
BindingLock
);
(
void
)
hash_seq
((
HTAB
*
)
NULL
);
while
(
(
result
=
(
BindingEnt
*
)
hash_seq
(
BindingTable
))
!=
NULL
)
{
if
(
result
==
(
BindingEnt
*
)
TRUE
)
{
SpinRelease
(
BindingLock
);
return
(
false
);
}
if
(
result
->
location
==
INVALID_OFFSET
||
strncmp
(
result
->
key
,
"PID "
,
4
)
!=
0
)
continue
;
proc
=
(
PROC
*
)
MAKE_PTR
(
result
->
location
);
if
(
proc
->
xid
==
xid
)
{
SpinRelease
(
BindingLock
);
return
(
true
);
}
}
SpinRelease
(
BindingLock
);
elog
(
WARN
,
"TransactionIdIsInProgress: BindingTable corrupted"
);
return
(
false
);
}
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