static SERIALIZABLEXACT *FirstPredXact(void);
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 SetPossibleUnsafeConflict(SERIALIZABLEXACT *roXact, SERIALIZABLEXACT *activeXact);
static void ReleaseRWConflict(RWConflict conflict);
static void SummarizeOldestCommittedSxact(void);
static Snapshot GetSafeSnapshot(Snapshot snapshot);
static Snapshot RegisterSerializableTransactionInt(Snapshot snapshot);
-static bool PredicateLockExists(PREDICATELOCKTARGETTAG *targettag);
-static bool GetParentPredicateLockTag(PREDICATELOCKTARGETTAG *tag,
+static bool PredicateLockExists(const PREDICATELOCKTARGETTAG *targettag);
+static bool GetParentPredicateLockTag(const PREDICATELOCKTARGETTAG *tag,
PREDICATELOCKTARGETTAG *parent);
-static bool CoarserLockCovers(PREDICATELOCKTARGETTAG *newtargettag);
+static bool CoarserLockCovers(const PREDICATELOCKTARGETTAG *newtargettag);
static void RemoveScratchTarget(bool lockheld);
static void RestoreScratchTarget(bool lockheld);
static void RemoveTargetIfNoLongerUsed(PREDICATELOCKTARGET *target,
uint32 targettaghash);
-static void DeleteChildTargetLocks(PREDICATELOCKTARGETTAG *newtargettag);
-static int PredicateLockPromotionThreshold(PREDICATELOCKTARGETTAG *tag);
-static bool CheckAndPromotePredicateLockRequest(PREDICATELOCKTARGETTAG *reqtag);
-static void DecrementParentLocks(PREDICATELOCKTARGETTAG *targettag);
-static void CreatePredicateLock(PREDICATELOCKTARGETTAG *targettag,
+static void DeleteChildTargetLocks(const PREDICATELOCKTARGETTAG *newtargettag);
+static int PredicateLockPromotionThreshold(const PREDICATELOCKTARGETTAG *tag);
+static bool CheckAndPromotePredicateLockRequest(const PREDICATELOCKTARGETTAG *reqtag);
+static void DecrementParentLocks(const PREDICATELOCKTARGETTAG *targettag);
+static void CreatePredicateLock(const PREDICATELOCKTARGETTAG *targettag,
uint32 targettaghash,
SERIALIZABLEXACT *sxact);
static void DeleteLockTarget(PREDICATELOCKTARGET *target, uint32 targettaghash);
static bool TransferPredicateLocksToNewTarget(PREDICATELOCKTARGETTAG oldtargettag,
PREDICATELOCKTARGETTAG newtargettag,
bool removeOld);
-static void PredicateLockAcquire(PREDICATELOCKTARGETTAG *targettag);
+static void PredicateLockAcquire(const PREDICATELOCKTARGETTAG *targettag);
static void DropAllPredicateLocksFromTable(Relation relation,
bool transfer);
static void SetNewSxactGlobalXmin(void);
static bool XidIsConcurrent(TransactionId xid);
static void CheckTargetForConflictsIn(PREDICATELOCKTARGETTAG *targettag);
static void FlagRWConflict(SERIALIZABLEXACT *reader, SERIALIZABLEXACT *writer);
-static void OnConflict_CheckForSerializationFailure(SERIALIZABLEXACT *reader,
+static void OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
SERIALIZABLEXACT *writer);
* These functions manage primitive access to the RWConflict pool and lists.
*/
static bool
-RWConflictExists(SERIALIZABLEXACT *reader, SERIALIZABLEXACT *writer)
+RWConflictExists(const SERIALIZABLEXACT *reader, const SERIALIZABLEXACT *writer)
{
RWConflict conflict;
static uint32
predicatelock_hash(const void *key, Size keysize)
{
- PREDICATELOCKTAG *predicatelocktag = (PREDICATELOCKTAG *) key;
+ const PREDICATELOCKTAG *predicatelocktag = (const PREDICATELOCKTAG *) key;
uint32 targethash;
Assert(keysize == sizeof(PREDICATELOCKTAG));
* acceptable!
*/
static bool
-PredicateLockExists(PREDICATELOCKTARGETTAG *targettag)
+PredicateLockExists(const PREDICATELOCKTARGETTAG *targettag)
{
LOCALPREDICATELOCK *lock;
* returns false if none exists.
*/
static bool
-GetParentPredicateLockTag(PREDICATELOCKTARGETTAG *tag,
+GetParentPredicateLockTag(const PREDICATELOCKTARGETTAG *tag,
PREDICATELOCKTARGETTAG *parent)
{
switch (GET_PREDICATELOCKTARGETTAG_TYPE(*tag))
* negative, but it will never return a false positive.
*/
static bool
-CoarserLockCovers(PREDICATELOCKTARGETTAG *newtargettag)
+CoarserLockCovers(const PREDICATELOCKTARGETTAG *newtargettag)
{
PREDICATELOCKTARGETTAG targettag,
parenttag;
* locks.
*/
static void
-DeleteChildTargetLocks(PREDICATELOCKTARGETTAG *newtargettag)
+DeleteChildTargetLocks(const PREDICATELOCKTARGETTAG *newtargettag)
{
SERIALIZABLEXACT *sxact;
PREDICATELOCK *predlock;
* entirely arbitrarily (and without benchmarking).
*/
static int
-PredicateLockPromotionThreshold(PREDICATELOCKTARGETTAG *tag)
+PredicateLockPromotionThreshold(const PREDICATELOCKTARGETTAG *tag)
{
switch (GET_PREDICATELOCKTARGETTAG_TYPE(*tag))
{
* Returns true if a parent lock was acquired and false otherwise.
*/
static bool
-CheckAndPromotePredicateLockRequest(PREDICATELOCKTARGETTAG *reqtag)
+CheckAndPromotePredicateLockRequest(const PREDICATELOCKTARGETTAG *reqtag)
{
PREDICATELOCKTARGETTAG targettag,
nexttag,
* this information is no longer needed.
*/
static void
-DecrementParentLocks(PREDICATELOCKTARGETTAG *targettag)
+DecrementParentLocks(const PREDICATELOCKTARGETTAG *targettag)
{
PREDICATELOCKTARGETTAG parenttag,
nexttag;
* PredicateLockAcquire for that.
*/
static void
-CreatePredicateLock(PREDICATELOCKTARGETTAG *targettag,
+CreatePredicateLock(const PREDICATELOCKTARGETTAG *targettag,
uint32 targettaghash,
SERIALIZABLEXACT *sxact)
{
* any finer-grained locks covered by the new one.
*/
static void
-PredicateLockAcquire(PREDICATELOCKTARGETTAG *targettag)
+PredicateLockAcquire(const PREDICATELOCKTARGETTAG *targettag)
{
uint32 targettaghash;
bool found;
Assert(found);
}
-
newpredlock = (PREDICATELOCK *)
- hash_search_with_hash_value
- (PredicateLockHash,
- &newpredlocktag,
- PredicateLockHashCodeFromTargetHashCode(&newpredlocktag,
- newtargettaghash),
- HASH_ENTER_NULL, &found);
+ hash_search_with_hash_value(PredicateLockHash,
+ &newpredlocktag,
+ PredicateLockHashCodeFromTargetHashCode(&newpredlocktag,
+ newtargettaghash),
+ HASH_ENTER_NULL,
+ &found);
if (!newpredlock)
{
/* Out of shared memory. Undo what we've done so far. */
newpredlocktag.myTarget = heaptarget;
newpredlocktag.myXact = oldXact;
newpredlock = (PREDICATELOCK *)
- hash_search_with_hash_value
- (PredicateLockHash,
- &newpredlocktag,
- PredicateLockHashCodeFromTargetHashCode(&newpredlocktag,
- heaptargettaghash),
- HASH_ENTER, &found);
+ hash_search_with_hash_value(PredicateLockHash,
+ &newpredlocktag,
+ PredicateLockHashCodeFromTargetHashCode(&newpredlocktag,
+ heaptargettaghash),
+ HASH_ENTER,
+ &found);
if (!found)
{
SHMQueueInsertBefore(&(heaptarget->predicateLocks),
*----------------------------------------------------------------------------
*/
static void
-OnConflict_CheckForSerializationFailure(SERIALIZABLEXACT *reader,
+OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
SERIALIZABLEXACT *writer)
{
bool failure;