Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5da417f

Browse files
committed
Remove pointless const qualifiers from function arguments in the SSI code.
As Tom Lane pointed out, "const Relation foo" doesn't guarantee that you can't modify the data the "foo" pointer points to. It just means that you can't change the pointer to point to something else within the function, which is not very useful.
1 parent 503c730 commit 5da417f

File tree

2 files changed

+59
-61
lines changed

2 files changed

+59
-61
lines changed

src/backend/storage/lmgr/predicate.c

Lines changed: 46 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ static void ReleasePredXact(SERIALIZABLEXACT *sxact);
388388
static SERIALIZABLEXACT *FirstPredXact(void);
389389
static SERIALIZABLEXACT *NextPredXact(SERIALIZABLEXACT *sxact);
390390

391-
static bool RWConflictExists(const SERIALIZABLEXACT *reader, const SERIALIZABLEXACT *writer);
391+
static bool RWConflictExists(SERIALIZABLEXACT *reader, SERIALIZABLEXACT *writer);
392392
static void SetRWConflict(SERIALIZABLEXACT *reader, SERIALIZABLEXACT *writer);
393393
static void SetPossibleUnsafeConflict(SERIALIZABLEXACT *roXact, SERIALIZABLEXACT *activeXact);
394394
static void ReleaseRWConflict(RWConflict conflict);
@@ -404,27 +404,27 @@ static uint32 predicatelock_hash(const void *key, Size keysize);
404404
static void SummarizeOldestCommittedSxact(void);
405405
static Snapshot GetSafeSnapshot(Snapshot snapshot);
406406
static Snapshot RegisterSerializableTransactionInt(Snapshot snapshot);
407-
static bool PredicateLockExists(const PREDICATELOCKTARGETTAG *targettag);
408-
static bool GetParentPredicateLockTag(const PREDICATELOCKTARGETTAG *tag,
407+
static bool PredicateLockExists(PREDICATELOCKTARGETTAG *targettag);
408+
static bool GetParentPredicateLockTag(PREDICATELOCKTARGETTAG *tag,
409409
PREDICATELOCKTARGETTAG *parent);
410-
static bool CoarserLockCovers(const PREDICATELOCKTARGETTAG *newtargettag);
410+
static bool CoarserLockCovers(PREDICATELOCKTARGETTAG *newtargettag);
411411
static void RemoveScratchTarget(bool lockheld);
412412
static void RestoreScratchTarget(bool lockheld);
413413
static void RemoveTargetIfNoLongerUsed(PREDICATELOCKTARGET *target,
414414
uint32 targettaghash);
415-
static void DeleteChildTargetLocks(const PREDICATELOCKTARGETTAG *newtargettag);
416-
static int PredicateLockPromotionThreshold(const PREDICATELOCKTARGETTAG *tag);
417-
static bool CheckAndPromotePredicateLockRequest(const PREDICATELOCKTARGETTAG *reqtag);
418-
static void DecrementParentLocks(const PREDICATELOCKTARGETTAG *targettag);
419-
static void CreatePredicateLock(const PREDICATELOCKTARGETTAG *targettag,
415+
static void DeleteChildTargetLocks(PREDICATELOCKTARGETTAG *newtargettag);
416+
static int PredicateLockPromotionThreshold(PREDICATELOCKTARGETTAG *tag);
417+
static bool CheckAndPromotePredicateLockRequest(PREDICATELOCKTARGETTAG *reqtag);
418+
static void DecrementParentLocks(PREDICATELOCKTARGETTAG *targettag);
419+
static void CreatePredicateLock(PREDICATELOCKTARGETTAG *targettag,
420420
uint32 targettaghash,
421421
SERIALIZABLEXACT *sxact);
422422
static void DeleteLockTarget(PREDICATELOCKTARGET *target, uint32 targettaghash);
423-
static bool TransferPredicateLocksToNewTarget(const PREDICATELOCKTARGETTAG oldtargettag,
424-
const PREDICATELOCKTARGETTAG newtargettag,
423+
static bool TransferPredicateLocksToNewTarget(PREDICATELOCKTARGETTAG oldtargettag,
424+
PREDICATELOCKTARGETTAG newtargettag,
425425
bool removeOld);
426-
static void PredicateLockAcquire(const PREDICATELOCKTARGETTAG *targettag);
427-
static void DropAllPredicateLocksFromTable(const Relation relation,
426+
static void PredicateLockAcquire(PREDICATELOCKTARGETTAG *targettag);
427+
static void DropAllPredicateLocksFromTable(Relation relation,
428428
bool transfer);
429429
static void SetNewSxactGlobalXmin(void);
430430
static void ClearOldPredicateLocks(void);
@@ -433,7 +433,7 @@ static void ReleaseOneSerializableXact(SERIALIZABLEXACT *sxact, bool partial,
433433
static bool XidIsConcurrent(TransactionId xid);
434434
static void CheckTargetForConflictsIn(PREDICATELOCKTARGETTAG *targettag);
435435
static void FlagRWConflict(SERIALIZABLEXACT *reader, SERIALIZABLEXACT *writer);
436-
static void OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
436+
static void OnConflict_CheckForSerializationFailure(SERIALIZABLEXACT *reader,
437437
SERIALIZABLEXACT *writer);
438438

439439

@@ -601,7 +601,7 @@ NextPredXact(SERIALIZABLEXACT *sxact)
601601
* These functions manage primitive access to the RWConflict pool and lists.
602602
*/
603603
static bool
604-
RWConflictExists(const SERIALIZABLEXACT *reader, const SERIALIZABLEXACT *writer)
604+
RWConflictExists(SERIALIZABLEXACT *reader, SERIALIZABLEXACT *writer)
605605
{
606606
RWConflict conflict;
607607

@@ -1337,7 +1337,7 @@ PredicateLockShmemSize(void)
13371337
static uint32
13381338
predicatelock_hash(const void *key, Size keysize)
13391339
{
1340-
const PREDICATELOCKTAG *predicatelocktag = (const PREDICATELOCKTAG *) key;
1340+
PREDICATELOCKTAG *predicatelocktag = (PREDICATELOCKTAG *) key;
13411341
uint32 targethash;
13421342

13431343
Assert(keysize == sizeof(PREDICATELOCKTAG));
@@ -1699,7 +1699,7 @@ RegisterSerializableTransactionInt(Snapshot snapshot)
16991699
* Also store it for easy reference in MySerializableXact.
17001700
*/
17011701
void
1702-
RegisterPredicateLockingXid(const TransactionId xid)
1702+
RegisterPredicateLockingXid(TransactionId xid)
17031703
{
17041704
SERIALIZABLEXIDTAG sxidtag;
17051705
SERIALIZABLEXID *sxid;
@@ -1748,7 +1748,7 @@ RegisterPredicateLockingXid(const TransactionId xid)
17481748
* One use is to support proper behavior during GiST index vacuum.
17491749
*/
17501750
bool
1751-
PageIsPredicateLocked(const Relation relation, const BlockNumber blkno)
1751+
PageIsPredicateLocked(Relation relation, BlockNumber blkno)
17521752
{
17531753
PREDICATELOCKTARGETTAG targettag;
17541754
uint32 targettaghash;
@@ -1785,7 +1785,7 @@ PageIsPredicateLocked(const Relation relation, const BlockNumber blkno)
17851785
* acceptable!
17861786
*/
17871787
static bool
1788-
PredicateLockExists(const PREDICATELOCKTARGETTAG *targettag)
1788+
PredicateLockExists(PREDICATELOCKTARGETTAG *targettag)
17891789
{
17901790
LOCALPREDICATELOCK *lock;
17911791

@@ -1812,7 +1812,7 @@ PredicateLockExists(const PREDICATELOCKTARGETTAG *targettag)
18121812
* returns false if none exists.
18131813
*/
18141814
static bool
1815-
GetParentPredicateLockTag(const PREDICATELOCKTARGETTAG *tag,
1815+
GetParentPredicateLockTag(PREDICATELOCKTARGETTAG *tag,
18161816
PREDICATELOCKTARGETTAG *parent)
18171817
{
18181818
switch (GET_PREDICATELOCKTARGETTAG_TYPE(*tag))
@@ -1851,7 +1851,7 @@ GetParentPredicateLockTag(const PREDICATELOCKTARGETTAG *tag,
18511851
* negative, but it will never return a false positive.
18521852
*/
18531853
static bool
1854-
CoarserLockCovers(const PREDICATELOCKTARGETTAG *newtargettag)
1854+
CoarserLockCovers(PREDICATELOCKTARGETTAG *newtargettag)
18551855
{
18561856
PREDICATELOCKTARGETTAG targettag,
18571857
parenttag;
@@ -1952,7 +1952,7 @@ RemoveTargetIfNoLongerUsed(PREDICATELOCKTARGET *target, uint32 targettaghash)
19521952
* locks.
19531953
*/
19541954
static void
1955-
DeleteChildTargetLocks(const PREDICATELOCKTARGETTAG *newtargettag)
1955+
DeleteChildTargetLocks(PREDICATELOCKTARGETTAG *newtargettag)
19561956
{
19571957
SERIALIZABLEXACT *sxact;
19581958
PREDICATELOCK *predlock;
@@ -2029,7 +2029,7 @@ DeleteChildTargetLocks(const PREDICATELOCKTARGETTAG *newtargettag)
20292029
* entirely arbitrarily (and without benchmarking).
20302030
*/
20312031
static int
2032-
PredicateLockPromotionThreshold(const PREDICATELOCKTARGETTAG *tag)
2032+
PredicateLockPromotionThreshold(PREDICATELOCKTARGETTAG *tag)
20332033
{
20342034
switch (GET_PREDICATELOCKTARGETTAG_TYPE(*tag))
20352035
{
@@ -2063,7 +2063,7 @@ PredicateLockPromotionThreshold(const PREDICATELOCKTARGETTAG *tag)
20632063
* Returns true if a parent lock was acquired and false otherwise.
20642064
*/
20652065
static bool
2066-
CheckAndPromotePredicateLockRequest(const PREDICATELOCKTARGETTAG *reqtag)
2066+
CheckAndPromotePredicateLockRequest(PREDICATELOCKTARGETTAG *reqtag)
20672067
{
20682068
PREDICATELOCKTARGETTAG targettag,
20692069
nexttag,
@@ -2128,7 +2128,7 @@ CheckAndPromotePredicateLockRequest(const PREDICATELOCKTARGETTAG *reqtag)
21282128
* this information is no longer needed.
21292129
*/
21302130
static void
2131-
DecrementParentLocks(const PREDICATELOCKTARGETTAG *targettag)
2131+
DecrementParentLocks(PREDICATELOCKTARGETTAG *targettag)
21322132
{
21332133
PREDICATELOCKTARGETTAG parenttag,
21342134
nexttag;
@@ -2190,7 +2190,7 @@ DecrementParentLocks(const PREDICATELOCKTARGETTAG *targettag)
21902190
* PredicateLockAcquire for that.
21912191
*/
21922192
static void
2193-
CreatePredicateLock(const PREDICATELOCKTARGETTAG *targettag,
2193+
CreatePredicateLock(PREDICATELOCKTARGETTAG *targettag,
21942194
uint32 targettaghash,
21952195
SERIALIZABLEXACT *sxact)
21962196
{
@@ -2251,7 +2251,7 @@ CreatePredicateLock(const PREDICATELOCKTARGETTAG *targettag,
22512251
* any finer-grained locks covered by the new one.
22522252
*/
22532253
static void
2254-
PredicateLockAcquire(const PREDICATELOCKTARGETTAG *targettag)
2254+
PredicateLockAcquire(PREDICATELOCKTARGETTAG *targettag)
22552255
{
22562256
uint32 targettaghash;
22572257
bool found;
@@ -2310,7 +2310,7 @@ PredicateLockAcquire(const PREDICATELOCKTARGETTAG *targettag)
23102310
* Clear any finer-grained predicate locks this session has on the relation.
23112311
*/
23122312
void
2313-
PredicateLockRelation(const Relation relation, const Snapshot snapshot)
2313+
PredicateLockRelation(Relation relation, Snapshot snapshot)
23142314
{
23152315
PREDICATELOCKTARGETTAG tag;
23162316

@@ -2333,8 +2333,7 @@ PredicateLockRelation(const Relation relation, const Snapshot snapshot)
23332333
* Clear any finer-grained predicate locks this session has on the relation.
23342334
*/
23352335
void
2336-
PredicateLockPage(const Relation relation, const BlockNumber blkno,
2337-
const Snapshot snapshot)
2336+
PredicateLockPage(Relation relation, BlockNumber blkno, Snapshot snapshot)
23382337
{
23392338
PREDICATELOCKTARGETTAG tag;
23402339

@@ -2356,8 +2355,7 @@ PredicateLockPage(const Relation relation, const BlockNumber blkno,
23562355
* Skip if this is a temporary table.
23572356
*/
23582357
void
2359-
PredicateLockTuple(const Relation relation, const HeapTuple tuple,
2360-
const Snapshot snapshot)
2358+
PredicateLockTuple(Relation relation, HeapTuple tuple, Snapshot snapshot)
23612359
{
23622360
PREDICATELOCKTARGETTAG tag;
23632361
ItemPointer tid;
@@ -2495,8 +2493,8 @@ DeleteLockTarget(PREDICATELOCKTARGET *target, uint32 targettaghash)
24952493
* Caller must hold SerializablePredicateLockListLock.
24962494
*/
24972495
static bool
2498-
TransferPredicateLocksToNewTarget(const PREDICATELOCKTARGETTAG oldtargettag,
2499-
const PREDICATELOCKTARGETTAG newtargettag,
2496+
TransferPredicateLocksToNewTarget(PREDICATELOCKTARGETTAG oldtargettag,
2497+
PREDICATELOCKTARGETTAG newtargettag,
25002498
bool removeOld)
25012499
{
25022500
uint32 oldtargettaghash;
@@ -2712,7 +2710,7 @@ TransferPredicateLocksToNewTarget(const PREDICATELOCKTARGETTAG oldtargettag,
27122710
* transaction which executed DROP TABLE, the false condition will be useful.
27132711
*/
27142712
static void
2715-
DropAllPredicateLocksFromTable(const Relation relation, bool transfer)
2713+
DropAllPredicateLocksFromTable(Relation relation, bool transfer)
27162714
{
27172715
HASH_SEQ_STATUS seqstat;
27182716
PREDICATELOCKTARGET *oldtarget;
@@ -2908,7 +2906,7 @@ DropAllPredicateLocksFromTable(const Relation relation, bool transfer)
29082906
* relation to a single relation lock on the heap.
29092907
*/
29102908
void
2911-
TransferPredicateLocksToHeapRelation(const Relation relation)
2909+
TransferPredicateLocksToHeapRelation(Relation relation)
29122910
{
29132911
DropAllPredicateLocksFromTable(relation, true);
29142912
}
@@ -2929,8 +2927,8 @@ TransferPredicateLocksToHeapRelation(const Relation relation)
29292927
* which hold the locks getting in and noticing.
29302928
*/
29312929
void
2932-
PredicateLockPageSplit(const Relation relation, const BlockNumber oldblkno,
2933-
const BlockNumber newblkno)
2930+
PredicateLockPageSplit(Relation relation, BlockNumber oldblkno,
2931+
BlockNumber newblkno)
29342932
{
29352933
PREDICATELOCKTARGETTAG oldtargettag;
29362934
PREDICATELOCKTARGETTAG newtargettag;
@@ -3014,8 +3012,8 @@ PredicateLockPageSplit(const Relation relation, const BlockNumber oldblkno,
30143012
* occurs in the context of another transaction isolation level.
30153013
*/
30163014
void
3017-
PredicateLockPageCombine(const Relation relation, const BlockNumber oldblkno,
3018-
const BlockNumber newblkno)
3015+
PredicateLockPageCombine(Relation relation, BlockNumber oldblkno,
3016+
BlockNumber newblkno)
30193017
{
30203018
/*
30213019
* Page combines differ from page splits in that we ought to be able to
@@ -3086,7 +3084,7 @@ SetNewSxactGlobalXmin(void)
30863084
* holding locks.
30873085
*/
30883086
void
3089-
ReleasePredicateLocks(const bool isCommit)
3087+
ReleasePredicateLocks(bool isCommit)
30903088
{
30913089
bool needToClear;
30923090
RWConflict conflict,
@@ -3736,9 +3734,9 @@ XidIsConcurrent(TransactionId xid)
37363734
* currently no known reason to call this function from an index AM.
37373735
*/
37383736
void
3739-
CheckForSerializableConflictOut(const bool visible, const Relation relation,
3740-
const HeapTuple tuple, const Buffer buffer,
3741-
const Snapshot snapshot)
3737+
CheckForSerializableConflictOut(bool visible, Relation relation,
3738+
HeapTuple tuple, Buffer buffer,
3739+
Snapshot snapshot)
37423740
{
37433741
TransactionId xid;
37443742
SERIALIZABLEXIDTAG sxidtag;
@@ -4117,8 +4115,8 @@ CheckTargetForConflictsIn(PREDICATELOCKTARGETTAG *targettag)
41174115
* tuple itself.
41184116
*/
41194117
void
4120-
CheckForSerializableConflictIn(const Relation relation, const HeapTuple tuple,
4121-
const Buffer buffer)
4118+
CheckForSerializableConflictIn(Relation relation, HeapTuple tuple,
4119+
Buffer buffer)
41224120
{
41234121
PREDICATELOCKTARGETTAG targettag;
41244122

@@ -4202,7 +4200,7 @@ CheckForSerializableConflictIn(const Relation relation, const HeapTuple tuple,
42024200
* lead to some false positives, but it doesn't seem worth the trouble.)
42034201
*/
42044202
void
4205-
CheckTableForSerializableConflictIn(const Relation relation)
4203+
CheckTableForSerializableConflictIn(Relation relation)
42064204
{
42074205
HASH_SEQ_STATUS seqstat;
42084206
PREDICATELOCKTARGET *target;
@@ -4329,7 +4327,7 @@ FlagRWConflict(SERIALIZABLEXACT *reader, SERIALIZABLEXACT *writer)
43294327
*----------------------------------------------------------------------------
43304328
*/
43314329
static void
4332-
OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
4330+
OnConflict_CheckForSerializationFailure(SERIALIZABLEXACT *reader,
43334331
SERIALIZABLEXACT *writer)
43344332
{
43354333
bool failure;

src/include/storage/predicate.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,24 @@ extern Size PredicateLockShmemSize(void);
3939
extern void CheckPointPredicate(void);
4040

4141
/* predicate lock reporting */
42-
extern bool PageIsPredicateLocked(const Relation relation, const BlockNumber blkno);
42+
extern bool PageIsPredicateLocked(Relation relation, BlockNumber blkno);
4343

4444
/* predicate lock maintenance */
4545
extern Snapshot RegisterSerializableTransaction(Snapshot snapshot);
46-
extern void RegisterPredicateLockingXid(const TransactionId xid);
47-
extern void PredicateLockRelation(const Relation relation, const Snapshot snapshot);
48-
extern void PredicateLockPage(const Relation relation, const BlockNumber blkno, const Snapshot snapshot);
49-
extern void PredicateLockTuple(const Relation relation, const HeapTuple tuple, const Snapshot snapshot);
50-
extern void PredicateLockPageSplit(const Relation relation, const BlockNumber oldblkno, const BlockNumber newblkno);
51-
extern void PredicateLockPageCombine(const Relation relation, const BlockNumber oldblkno, const BlockNumber newblkno);
52-
extern void TransferPredicateLocksToHeapRelation(const Relation relation);
53-
extern void ReleasePredicateLocks(const bool isCommit);
46+
extern void RegisterPredicateLockingXid(TransactionId xid);
47+
extern void PredicateLockRelation(Relation relation, Snapshot snapshot);
48+
extern void PredicateLockPage(Relation relation, BlockNumber blkno, Snapshot snapshot);
49+
extern void PredicateLockTuple(Relation relation, HeapTuple tuple, Snapshot snapshot);
50+
extern void PredicateLockPageSplit(Relation relation, BlockNumber oldblkno, BlockNumber newblkno);
51+
extern void PredicateLockPageCombine(Relation relation, BlockNumber oldblkno, BlockNumber newblkno);
52+
extern void TransferPredicateLocksToHeapRelation(Relation relation);
53+
extern void ReleasePredicateLocks(bool isCommit);
5454

5555
/* conflict detection (may also trigger rollback) */
56-
extern void CheckForSerializableConflictOut(const bool valid, const Relation relation, const HeapTuple tuple,
57-
const Buffer buffer, const Snapshot snapshot);
58-
extern void CheckForSerializableConflictIn(const Relation relation, const HeapTuple tuple, const Buffer buffer);
59-
extern void CheckTableForSerializableConflictIn(const Relation relation);
56+
extern void CheckForSerializableConflictOut(bool valid, Relation relation, HeapTuple tuple,
57+
Buffer buffer, Snapshot snapshot);
58+
extern void CheckForSerializableConflictIn(Relation relation, HeapTuple tuple, Buffer buffer);
59+
extern void CheckTableForSerializableConflictIn(Relation relation);
6060

6161
/* final rollback checking */
6262
extern void PreCommit_CheckForSerializationFailure(void);

0 commit comments

Comments
 (0)