mirror of
https://github.com/postgres/postgres.git
synced 2025-06-11 20:28:21 +03:00
Undo overly enthusiastic de-const-ification.
s/const//g wasn't exactly what I was suggesting here ... parameter declarations of the form "const structtype *param" are good and useful, so put those occurrences back. Likewise, avoid casting away the const in a "const void *" parameter.
This commit is contained in:
@ -388,7 +388,7 @@ static void ReleasePredXact(SERIALIZABLEXACT *sxact);
|
|||||||
static SERIALIZABLEXACT *FirstPredXact(void);
|
static SERIALIZABLEXACT *FirstPredXact(void);
|
||||||
static SERIALIZABLEXACT *NextPredXact(SERIALIZABLEXACT *sxact);
|
static SERIALIZABLEXACT *NextPredXact(SERIALIZABLEXACT *sxact);
|
||||||
|
|
||||||
static bool RWConflictExists(SERIALIZABLEXACT *reader, SERIALIZABLEXACT *writer);
|
static bool RWConflictExists(const SERIALIZABLEXACT *reader, const SERIALIZABLEXACT *writer);
|
||||||
static void SetRWConflict(SERIALIZABLEXACT *reader, SERIALIZABLEXACT *writer);
|
static void SetRWConflict(SERIALIZABLEXACT *reader, SERIALIZABLEXACT *writer);
|
||||||
static void SetPossibleUnsafeConflict(SERIALIZABLEXACT *roXact, SERIALIZABLEXACT *activeXact);
|
static void SetPossibleUnsafeConflict(SERIALIZABLEXACT *roXact, SERIALIZABLEXACT *activeXact);
|
||||||
static void ReleaseRWConflict(RWConflict conflict);
|
static void ReleaseRWConflict(RWConflict conflict);
|
||||||
@ -404,26 +404,26 @@ static uint32 predicatelock_hash(const void *key, Size keysize);
|
|||||||
static void SummarizeOldestCommittedSxact(void);
|
static void SummarizeOldestCommittedSxact(void);
|
||||||
static Snapshot GetSafeSnapshot(Snapshot snapshot);
|
static Snapshot GetSafeSnapshot(Snapshot snapshot);
|
||||||
static Snapshot RegisterSerializableTransactionInt(Snapshot snapshot);
|
static Snapshot RegisterSerializableTransactionInt(Snapshot snapshot);
|
||||||
static bool PredicateLockExists(PREDICATELOCKTARGETTAG *targettag);
|
static bool PredicateLockExists(const PREDICATELOCKTARGETTAG *targettag);
|
||||||
static bool GetParentPredicateLockTag(PREDICATELOCKTARGETTAG *tag,
|
static bool GetParentPredicateLockTag(const PREDICATELOCKTARGETTAG *tag,
|
||||||
PREDICATELOCKTARGETTAG *parent);
|
PREDICATELOCKTARGETTAG *parent);
|
||||||
static bool CoarserLockCovers(PREDICATELOCKTARGETTAG *newtargettag);
|
static bool CoarserLockCovers(const PREDICATELOCKTARGETTAG *newtargettag);
|
||||||
static void RemoveScratchTarget(bool lockheld);
|
static void RemoveScratchTarget(bool lockheld);
|
||||||
static void RestoreScratchTarget(bool lockheld);
|
static void RestoreScratchTarget(bool lockheld);
|
||||||
static void RemoveTargetIfNoLongerUsed(PREDICATELOCKTARGET *target,
|
static void RemoveTargetIfNoLongerUsed(PREDICATELOCKTARGET *target,
|
||||||
uint32 targettaghash);
|
uint32 targettaghash);
|
||||||
static void DeleteChildTargetLocks(PREDICATELOCKTARGETTAG *newtargettag);
|
static void DeleteChildTargetLocks(const PREDICATELOCKTARGETTAG *newtargettag);
|
||||||
static int PredicateLockPromotionThreshold(PREDICATELOCKTARGETTAG *tag);
|
static int PredicateLockPromotionThreshold(const PREDICATELOCKTARGETTAG *tag);
|
||||||
static bool CheckAndPromotePredicateLockRequest(PREDICATELOCKTARGETTAG *reqtag);
|
static bool CheckAndPromotePredicateLockRequest(const PREDICATELOCKTARGETTAG *reqtag);
|
||||||
static void DecrementParentLocks(PREDICATELOCKTARGETTAG *targettag);
|
static void DecrementParentLocks(const PREDICATELOCKTARGETTAG *targettag);
|
||||||
static void CreatePredicateLock(PREDICATELOCKTARGETTAG *targettag,
|
static void CreatePredicateLock(const PREDICATELOCKTARGETTAG *targettag,
|
||||||
uint32 targettaghash,
|
uint32 targettaghash,
|
||||||
SERIALIZABLEXACT *sxact);
|
SERIALIZABLEXACT *sxact);
|
||||||
static void DeleteLockTarget(PREDICATELOCKTARGET *target, uint32 targettaghash);
|
static void DeleteLockTarget(PREDICATELOCKTARGET *target, uint32 targettaghash);
|
||||||
static bool TransferPredicateLocksToNewTarget(PREDICATELOCKTARGETTAG oldtargettag,
|
static bool TransferPredicateLocksToNewTarget(PREDICATELOCKTARGETTAG oldtargettag,
|
||||||
PREDICATELOCKTARGETTAG newtargettag,
|
PREDICATELOCKTARGETTAG newtargettag,
|
||||||
bool removeOld);
|
bool removeOld);
|
||||||
static void PredicateLockAcquire(PREDICATELOCKTARGETTAG *targettag);
|
static void PredicateLockAcquire(const PREDICATELOCKTARGETTAG *targettag);
|
||||||
static void DropAllPredicateLocksFromTable(Relation relation,
|
static void DropAllPredicateLocksFromTable(Relation relation,
|
||||||
bool transfer);
|
bool transfer);
|
||||||
static void SetNewSxactGlobalXmin(void);
|
static void SetNewSxactGlobalXmin(void);
|
||||||
@ -433,7 +433,7 @@ static void ReleaseOneSerializableXact(SERIALIZABLEXACT *sxact, bool partial,
|
|||||||
static bool XidIsConcurrent(TransactionId xid);
|
static bool XidIsConcurrent(TransactionId xid);
|
||||||
static void CheckTargetForConflictsIn(PREDICATELOCKTARGETTAG *targettag);
|
static void CheckTargetForConflictsIn(PREDICATELOCKTARGETTAG *targettag);
|
||||||
static void FlagRWConflict(SERIALIZABLEXACT *reader, SERIALIZABLEXACT *writer);
|
static void FlagRWConflict(SERIALIZABLEXACT *reader, SERIALIZABLEXACT *writer);
|
||||||
static void OnConflict_CheckForSerializationFailure(SERIALIZABLEXACT *reader,
|
static void OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
|
||||||
SERIALIZABLEXACT *writer);
|
SERIALIZABLEXACT *writer);
|
||||||
|
|
||||||
|
|
||||||
@ -601,7 +601,7 @@ NextPredXact(SERIALIZABLEXACT *sxact)
|
|||||||
* These functions manage primitive access to the RWConflict pool and lists.
|
* These functions manage primitive access to the RWConflict pool and lists.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
RWConflictExists(SERIALIZABLEXACT *reader, SERIALIZABLEXACT *writer)
|
RWConflictExists(const SERIALIZABLEXACT *reader, const SERIALIZABLEXACT *writer)
|
||||||
{
|
{
|
||||||
RWConflict conflict;
|
RWConflict conflict;
|
||||||
|
|
||||||
@ -1337,7 +1337,7 @@ PredicateLockShmemSize(void)
|
|||||||
static uint32
|
static uint32
|
||||||
predicatelock_hash(const void *key, Size keysize)
|
predicatelock_hash(const void *key, Size keysize)
|
||||||
{
|
{
|
||||||
PREDICATELOCKTAG *predicatelocktag = (PREDICATELOCKTAG *) key;
|
const PREDICATELOCKTAG *predicatelocktag = (const PREDICATELOCKTAG *) key;
|
||||||
uint32 targethash;
|
uint32 targethash;
|
||||||
|
|
||||||
Assert(keysize == sizeof(PREDICATELOCKTAG));
|
Assert(keysize == sizeof(PREDICATELOCKTAG));
|
||||||
@ -1785,7 +1785,7 @@ PageIsPredicateLocked(Relation relation, BlockNumber blkno)
|
|||||||
* acceptable!
|
* acceptable!
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
PredicateLockExists(PREDICATELOCKTARGETTAG *targettag)
|
PredicateLockExists(const PREDICATELOCKTARGETTAG *targettag)
|
||||||
{
|
{
|
||||||
LOCALPREDICATELOCK *lock;
|
LOCALPREDICATELOCK *lock;
|
||||||
|
|
||||||
@ -1812,7 +1812,7 @@ PredicateLockExists(PREDICATELOCKTARGETTAG *targettag)
|
|||||||
* returns false if none exists.
|
* returns false if none exists.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
GetParentPredicateLockTag(PREDICATELOCKTARGETTAG *tag,
|
GetParentPredicateLockTag(const PREDICATELOCKTARGETTAG *tag,
|
||||||
PREDICATELOCKTARGETTAG *parent)
|
PREDICATELOCKTARGETTAG *parent)
|
||||||
{
|
{
|
||||||
switch (GET_PREDICATELOCKTARGETTAG_TYPE(*tag))
|
switch (GET_PREDICATELOCKTARGETTAG_TYPE(*tag))
|
||||||
@ -1851,7 +1851,7 @@ GetParentPredicateLockTag(PREDICATELOCKTARGETTAG *tag,
|
|||||||
* negative, but it will never return a false positive.
|
* negative, but it will never return a false positive.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
CoarserLockCovers(PREDICATELOCKTARGETTAG *newtargettag)
|
CoarserLockCovers(const PREDICATELOCKTARGETTAG *newtargettag)
|
||||||
{
|
{
|
||||||
PREDICATELOCKTARGETTAG targettag,
|
PREDICATELOCKTARGETTAG targettag,
|
||||||
parenttag;
|
parenttag;
|
||||||
@ -1952,7 +1952,7 @@ RemoveTargetIfNoLongerUsed(PREDICATELOCKTARGET *target, uint32 targettaghash)
|
|||||||
* locks.
|
* locks.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
DeleteChildTargetLocks(PREDICATELOCKTARGETTAG *newtargettag)
|
DeleteChildTargetLocks(const PREDICATELOCKTARGETTAG *newtargettag)
|
||||||
{
|
{
|
||||||
SERIALIZABLEXACT *sxact;
|
SERIALIZABLEXACT *sxact;
|
||||||
PREDICATELOCK *predlock;
|
PREDICATELOCK *predlock;
|
||||||
@ -2029,7 +2029,7 @@ DeleteChildTargetLocks(PREDICATELOCKTARGETTAG *newtargettag)
|
|||||||
* entirely arbitrarily (and without benchmarking).
|
* entirely arbitrarily (and without benchmarking).
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
PredicateLockPromotionThreshold(PREDICATELOCKTARGETTAG *tag)
|
PredicateLockPromotionThreshold(const PREDICATELOCKTARGETTAG *tag)
|
||||||
{
|
{
|
||||||
switch (GET_PREDICATELOCKTARGETTAG_TYPE(*tag))
|
switch (GET_PREDICATELOCKTARGETTAG_TYPE(*tag))
|
||||||
{
|
{
|
||||||
@ -2063,7 +2063,7 @@ PredicateLockPromotionThreshold(PREDICATELOCKTARGETTAG *tag)
|
|||||||
* Returns true if a parent lock was acquired and false otherwise.
|
* Returns true if a parent lock was acquired and false otherwise.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
CheckAndPromotePredicateLockRequest(PREDICATELOCKTARGETTAG *reqtag)
|
CheckAndPromotePredicateLockRequest(const PREDICATELOCKTARGETTAG *reqtag)
|
||||||
{
|
{
|
||||||
PREDICATELOCKTARGETTAG targettag,
|
PREDICATELOCKTARGETTAG targettag,
|
||||||
nexttag,
|
nexttag,
|
||||||
@ -2128,7 +2128,7 @@ CheckAndPromotePredicateLockRequest(PREDICATELOCKTARGETTAG *reqtag)
|
|||||||
* this information is no longer needed.
|
* this information is no longer needed.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
DecrementParentLocks(PREDICATELOCKTARGETTAG *targettag)
|
DecrementParentLocks(const PREDICATELOCKTARGETTAG *targettag)
|
||||||
{
|
{
|
||||||
PREDICATELOCKTARGETTAG parenttag,
|
PREDICATELOCKTARGETTAG parenttag,
|
||||||
nexttag;
|
nexttag;
|
||||||
@ -2190,7 +2190,7 @@ DecrementParentLocks(PREDICATELOCKTARGETTAG *targettag)
|
|||||||
* PredicateLockAcquire for that.
|
* PredicateLockAcquire for that.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CreatePredicateLock(PREDICATELOCKTARGETTAG *targettag,
|
CreatePredicateLock(const PREDICATELOCKTARGETTAG *targettag,
|
||||||
uint32 targettaghash,
|
uint32 targettaghash,
|
||||||
SERIALIZABLEXACT *sxact)
|
SERIALIZABLEXACT *sxact)
|
||||||
{
|
{
|
||||||
@ -2251,7 +2251,7 @@ CreatePredicateLock(PREDICATELOCKTARGETTAG *targettag,
|
|||||||
* any finer-grained locks covered by the new one.
|
* any finer-grained locks covered by the new one.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
PredicateLockAcquire(PREDICATELOCKTARGETTAG *targettag)
|
PredicateLockAcquire(const PREDICATELOCKTARGETTAG *targettag)
|
||||||
{
|
{
|
||||||
uint32 targettaghash;
|
uint32 targettaghash;
|
||||||
bool found;
|
bool found;
|
||||||
@ -2613,14 +2613,13 @@ TransferPredicateLocksToNewTarget(PREDICATELOCKTARGETTAG oldtargettag,
|
|||||||
Assert(found);
|
Assert(found);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
newpredlock = (PREDICATELOCK *)
|
newpredlock = (PREDICATELOCK *)
|
||||||
hash_search_with_hash_value
|
hash_search_with_hash_value(PredicateLockHash,
|
||||||
(PredicateLockHash,
|
&newpredlocktag,
|
||||||
&newpredlocktag,
|
PredicateLockHashCodeFromTargetHashCode(&newpredlocktag,
|
||||||
PredicateLockHashCodeFromTargetHashCode(&newpredlocktag,
|
newtargettaghash),
|
||||||
newtargettaghash),
|
HASH_ENTER_NULL,
|
||||||
HASH_ENTER_NULL, &found);
|
&found);
|
||||||
if (!newpredlock)
|
if (!newpredlock)
|
||||||
{
|
{
|
||||||
/* Out of shared memory. Undo what we've done so far. */
|
/* Out of shared memory. Undo what we've done so far. */
|
||||||
@ -2856,12 +2855,12 @@ DropAllPredicateLocksFromTable(Relation relation, bool transfer)
|
|||||||
newpredlocktag.myTarget = heaptarget;
|
newpredlocktag.myTarget = heaptarget;
|
||||||
newpredlocktag.myXact = oldXact;
|
newpredlocktag.myXact = oldXact;
|
||||||
newpredlock = (PREDICATELOCK *)
|
newpredlock = (PREDICATELOCK *)
|
||||||
hash_search_with_hash_value
|
hash_search_with_hash_value(PredicateLockHash,
|
||||||
(PredicateLockHash,
|
&newpredlocktag,
|
||||||
&newpredlocktag,
|
PredicateLockHashCodeFromTargetHashCode(&newpredlocktag,
|
||||||
PredicateLockHashCodeFromTargetHashCode(&newpredlocktag,
|
heaptargettaghash),
|
||||||
heaptargettaghash),
|
HASH_ENTER,
|
||||||
HASH_ENTER, &found);
|
&found);
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
SHMQueueInsertBefore(&(heaptarget->predicateLocks),
|
SHMQueueInsertBefore(&(heaptarget->predicateLocks),
|
||||||
@ -4327,7 +4326,7 @@ FlagRWConflict(SERIALIZABLEXACT *reader, SERIALIZABLEXACT *writer)
|
|||||||
*----------------------------------------------------------------------------
|
*----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
OnConflict_CheckForSerializationFailure(SERIALIZABLEXACT *reader,
|
OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
|
||||||
SERIALIZABLEXACT *writer)
|
SERIALIZABLEXACT *writer)
|
||||||
{
|
{
|
||||||
bool failure;
|
bool failure;
|
||||||
|
Reference in New Issue
Block a user