Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
e319e679
Commit
e319e679
authored
15 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
Fix bogus initialization of KnownAssignedXids shared memory state ---
didn't work in EXEC_BACKEND case.
parent
8bfd1a88
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/storage/ipc/procarray.c
+34
-44
34 additions, 44 deletions
src/backend/storage/ipc/procarray.c
with
34 additions
and
44 deletions
src/backend/storage/ipc/procarray.c
+
34
−
44
View file @
e319e679
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.5
6
2010/01/16 1
0:05:50 sriggs
Exp $
* $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.5
7
2010/01/16 1
7:17:26 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -135,8 +135,6 @@ static void DisplayXidCache(void);
...
@@ -135,8 +135,6 @@ static void DisplayXidCache(void);
#endif
/* XIDCACHE_DEBUG */
#endif
/* XIDCACHE_DEBUG */
/* Primitives for KnownAssignedXids array handling for standby */
/* Primitives for KnownAssignedXids array handling for standby */
static
Size
KnownAssignedXidsShmemSize
(
int
size
);
static
void
KnownAssignedXidsInit
(
int
size
);
static
int
KnownAssignedXidsGet
(
TransactionId
*
xarray
,
TransactionId
xmax
);
static
int
KnownAssignedXidsGet
(
TransactionId
*
xarray
,
TransactionId
xmax
);
static
int
KnownAssignedXidsGetAndSetXmin
(
TransactionId
*
xarray
,
TransactionId
*
xmin
,
static
int
KnownAssignedXidsGetAndSetXmin
(
TransactionId
*
xarray
,
TransactionId
*
xmin
,
TransactionId
xmax
);
TransactionId
xmax
);
...
@@ -161,16 +159,19 @@ ProcArrayShmemSize(void)
...
@@ -161,16 +159,19 @@ ProcArrayShmemSize(void)
size
=
add_size
(
size
,
mul_size
(
sizeof
(
PGPROC
*
),
PROCARRAY_MAXPROCS
));
size
=
add_size
(
size
,
mul_size
(
sizeof
(
PGPROC
*
),
PROCARRAY_MAXPROCS
));
/*
/*
* During recovery processing we have a data structure called KnownAssignedXids,
* During recovery processing we have a data structure called
* created in shared memory. Local data structures are also created in various
* KnownAssignedXids, created in shared memory. Local data structures are
* backends during GetSnapshotData(), TransactionIdIsInProgress() and
* also created in various backends during GetSnapshotData(),
* GetRunningTransactionData(). All of the main structures created in those
* TransactionIdIsInProgress() and GetRunningTransactionData(). All of the
* functions must be identically sized, since we may at times copy the whole
* main structures created in those functions must be identically sized,
* of the data structures around. We refer to this as TOTAL_MAX_CACHED_SUBXIDS.
* since we may at times copy the whole of the data structures around. We
* refer to this size as TOTAL_MAX_CACHED_SUBXIDS.
*/
*/
#define TOTAL_MAX_CACHED_SUBXIDS ((PGPROC_MAX_CACHED_SUBXIDS + 1) * PROCARRAY_MAXPROCS)
#define TOTAL_MAX_CACHED_SUBXIDS ((PGPROC_MAX_CACHED_SUBXIDS + 1) * PROCARRAY_MAXPROCS)
if
(
XLogRequestRecoveryConnections
)
if
(
XLogRequestRecoveryConnections
)
size
=
add_size
(
size
,
KnownAssignedXidsShmemSize
(
TOTAL_MAX_CACHED_SUBXIDS
));
size
=
add_size
(
size
,
hash_estimate_size
(
TOTAL_MAX_CACHED_SUBXIDS
,
sizeof
(
TransactionId
)));
return
size
;
return
size
;
}
}
...
@@ -186,8 +187,8 @@ CreateSharedProcArray(void)
...
@@ -186,8 +187,8 @@ CreateSharedProcArray(void)
/* Create or attach to the ProcArray shared structure */
/* Create or attach to the ProcArray shared structure */
procArray
=
(
ProcArrayStruct
*
)
procArray
=
(
ProcArrayStruct
*
)
ShmemInitStruct
(
"Proc Array"
,
ShmemInitStruct
(
"Proc Array"
,
mul_size
(
sizeof
(
PGPROC
*
),
PROCARRAY_MAXPROCS
),
mul_size
(
sizeof
(
PGPROC
*
),
PROCARRAY_MAXPROCS
),
&
found
);
&
found
);
if
(
!
found
)
if
(
!
found
)
{
{
...
@@ -197,9 +198,28 @@ CreateSharedProcArray(void)
...
@@ -197,9 +198,28 @@ CreateSharedProcArray(void)
/* Normal processing */
/* Normal processing */
procArray
->
numProcs
=
0
;
procArray
->
numProcs
=
0
;
procArray
->
maxProcs
=
PROCARRAY_MAXPROCS
;
procArray
->
maxProcs
=
PROCARRAY_MAXPROCS
;
procArray
->
numKnownAssignedXids
=
0
;
procArray
->
maxKnownAssignedXids
=
TOTAL_MAX_CACHED_SUBXIDS
;
procArray
->
lastOverflowedXid
=
InvalidTransactionId
;
}
if
(
XLogRequestRecoveryConnections
)
if
(
XLogRequestRecoveryConnections
)
KnownAssignedXidsInit
(
TOTAL_MAX_CACHED_SUBXIDS
);
{
/* Create or attach to the KnownAssignedXids hash table */
HASHCTL
info
;
MemSet
(
&
info
,
0
,
sizeof
(
info
));
info
.
keysize
=
sizeof
(
TransactionId
);
info
.
entrysize
=
sizeof
(
TransactionId
);
info
.
hash
=
tag_hash
;
KnownAssignedXidsHash
=
ShmemInitHash
(
"KnownAssignedXids Hash"
,
TOTAL_MAX_CACHED_SUBXIDS
,
TOTAL_MAX_CACHED_SUBXIDS
,
&
info
,
HASH_ELEM
|
HASH_FUNCTION
);
if
(
!
KnownAssignedXidsHash
)
elog
(
FATAL
,
"could not initialize known assigned xids hash table"
);
}
}
}
}
...
@@ -2291,36 +2311,6 @@ ExpireOldKnownAssignedTransactionIds(TransactionId xid)
...
@@ -2291,36 +2311,6 @@ ExpireOldKnownAssignedTransactionIds(TransactionId xid)
* high availability. So we choose to implement as a hash table.
* high availability. So we choose to implement as a hash table.
*/
*/
static
Size
KnownAssignedXidsShmemSize
(
int
size
)
{
return
hash_estimate_size
(
size
,
sizeof
(
TransactionId
));
}
static
void
KnownAssignedXidsInit
(
int
size
)
{
HASHCTL
info
;
/* assume no locking is needed yet */
info
.
keysize
=
sizeof
(
TransactionId
);
info
.
entrysize
=
sizeof
(
TransactionId
);
info
.
hash
=
tag_hash
;
KnownAssignedXidsHash
=
ShmemInitHash
(
"KnownAssignedXids Hash"
,
size
,
size
,
&
info
,
HASH_ELEM
|
HASH_FUNCTION
);
if
(
!
KnownAssignedXidsHash
)
elog
(
FATAL
,
"could not initialize known assigned xids hash table"
);
procArray
->
numKnownAssignedXids
=
0
;
procArray
->
maxKnownAssignedXids
=
TOTAL_MAX_CACHED_SUBXIDS
;
procArray
->
lastOverflowedXid
=
InvalidTransactionId
;
}
/*
/*
* Add xids into KnownAssignedXids.
* Add xids into KnownAssignedXids.
*
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment