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

Commit 7e15bcd

Browse files
committed
Dead code elimination
1 parent b76fb4c commit 7e15bcd

File tree

1 file changed

+0
-153
lines changed

1 file changed

+0
-153
lines changed

multimaster.c

Lines changed: 0 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ PG_FUNCTION_INFO_V1(mtm_referee_poll);
143143
PG_FUNCTION_INFO_V1(mtm_broadcast_table);
144144
PG_FUNCTION_INFO_V1(mtm_copy_table);
145145

146-
static Snapshot MtmGetSnapshot(Snapshot snapshot);
147146
static void MtmInitialize(void);
148147
static void MtmXactCallback(XactEvent event, void *arg);
149148
static void MtmBeginTransaction(MtmCurrentTrans* x);
@@ -154,13 +153,10 @@ static void MtmPreCommitPreparedTransaction(MtmCurrentTrans* x);
154153
static void MtmEndTransaction(MtmCurrentTrans* x, bool commit);
155154
static bool MtmTwoPhaseCommit(MtmCurrentTrans* x);
156155

157-
static TransactionId MtmGetOldestXmin(Relation rel, int flags);
158-
//static bool MtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot);
159156
static void MtmAdjustOldestXid(void);
160157

161158
static bool MtmDetectGlobalDeadLock(PGPROC* proc);
162159
static void MtmAddSubtransactions(MtmTransState* ts, TransactionId* subxids, int nSubxids);
163-
static char const* MtmGetName(void);
164160
static size_t MtmGetTransactionStateSize(void);
165161
static void MtmSerializeTransactionState(void* ctx);
166162
static void MtmDeserializeTransactionState(void* ctx);
@@ -503,10 +499,6 @@ csn_t MtmSyncClock(csn_t global_csn)
503499
/*
504500
* Distribute transaction manager functions
505501
*/
506-
static char const* MtmGetName(void)
507-
{
508-
return MULTIMASTER_NAME;
509-
}
510502

511503
static size_t
512504
MtmGetTransactionStateSize(void)
@@ -620,151 +612,6 @@ void MtmSetSnapshot(csn_t globalSnapshot)
620612
MtmUnlock();
621613
}
622614

623-
624-
Snapshot MtmGetSnapshot(Snapshot snapshot)
625-
{
626-
snapshot = GetSnapshotData(snapshot);
627-
if (XactIsoLevel == XACT_READ_COMMITTED && MtmTx.snapshot != INVALID_CSN) {
628-
MtmTx.snapshot = MtmGetCurrentTime();
629-
if (TransactionIdIsValid(GetCurrentTransactionIdIfAny())) {
630-
LogLogicalMessage("S", (char*)&MtmTx.snapshot, sizeof(MtmTx.snapshot), true);
631-
}
632-
}
633-
// RecentGlobalDataXmin = RecentGlobalXmin = Mtm->oldestXid;
634-
return snapshot;
635-
}
636-
637-
638-
TransactionId MtmGetOldestXmin(Relation rel, int flags)
639-
{
640-
TransactionId xmin = GetOldestXmin(rel, flags); /* consider all backends */
641-
// if (TransactionIdIsValid(xmin)) {
642-
// MtmLock(LW_EXCLUSIVE);
643-
// xmin = MtmAdjustOldestXid(xmin);
644-
// MtmUnlock();
645-
// }
646-
return xmin;
647-
}
648-
649-
// bool MtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
650-
// {
651-
// #if TRACE_SLEEP_TIME
652-
// static timestamp_t firstReportTime;
653-
// static timestamp_t prevReportTime;
654-
// static timestamp_t totalSleepTime;
655-
// static timestamp_t maxSleepTime;
656-
// #endif
657-
// timestamp_t delay = MIN_WAIT_TIMEOUT;
658-
// int i;
659-
// #if DEBUG_LEVEL > 1
660-
// timestamp_t start = MtmGetSystemTime();
661-
// #endif
662-
663-
// Assert(xid != InvalidTransactionId);
664-
665-
// if (!MtmUseDtm || TransactionIdPrecedes(xid, Mtm->oldestXid)) {
666-
// return PgXidInMVCCSnapshot(xid, snapshot);
667-
// }
668-
// MtmLock(LW_SHARED);
669-
670-
// #if TRACE_SLEEP_TIME
671-
// if (firstReportTime == 0) {
672-
// firstReportTime = MtmGetCurrentTime();
673-
// }
674-
// #endif
675-
676-
// for (i = 0; i < MAX_WAIT_LOOPS; i++)
677-
// {
678-
// csn_t csn;
679-
// RepOriginId reporigin_id;
680-
// MtmTransState* ts = (MtmTransState*)hash_search(MtmXid2State, &xid, HASH_FIND, NULL);
681-
// if (ts != NULL /*&& ts->status != TRANSACTION_STATUS_IN_PROGRESS*/)
682-
// {
683-
684-
// if (ts->status == TRANSACTION_STATUS_UNKNOWN || ts->status == TRANSACTION_STATUS_IN_PROGRESS)
685-
// csn = ts->csn;
686-
// else
687-
// TransactionIdGetCommitTsData(xid, &csn, &reporigin_id);
688-
689-
// if (ts->csn != csn && ts->status != TRANSACTION_STATUS_ABORTED)
690-
// {
691-
// MTM_LOG1("WOW! %d: tuple with xid=%lld(csn=%ld / %ld) woes in snapshot %ld (s=%d)", MyProcPid, (long64)xid, csn, ts->csn, MtmTx.snapshot, ts->status);
692-
// }
693-
694-
// if (csn > MtmTx.snapshot) {
695-
// MTM_LOG4("%d: tuple with xid=%lld(csn=%lld) is invisible in snapshot %lld",
696-
// MyProcPid, (long64)xid, ts->csn, MtmTx.snapshot);
697-
// #if DEBUG_LEVEL > 1
698-
// if (MtmGetSystemTime() - start > USECS_PER_SEC) {
699-
// MTM_ELOG(WARNING, "Backend %d waits for transaction %s (%llu) status %lld usecs", MyProcPid, ts->gid, (long64)xid, MtmGetSystemTime() - start);
700-
// }
701-
// #endif
702-
// MtmUnlock();
703-
// return true;
704-
// }
705-
// if (ts->status == TRANSACTION_STATUS_UNKNOWN)
706-
// {
707-
// MTM_LOG3("%d: wait for in-doubt transaction %u in snapshot %llu", MyProcPid, xid, MtmTx.snapshot);
708-
// MtmUnlock();
709-
// #if TRACE_SLEEP_TIME
710-
// {
711-
// timestamp_t delta, now = MtmGetCurrentTime();
712-
// #endif
713-
// MtmSleep(delay);
714-
// #if TRACE_SLEEP_TIME
715-
// delta = MtmGetCurrentTime() - now;
716-
// totalSleepTime += delta;
717-
// if (delta > maxSleepTime) {
718-
// maxSleepTime = delta;
719-
// }
720-
// if (now > prevReportTime + USECS_PER_SEC*10) {
721-
// prevReportTime = now;
722-
// if (firstReportTime == 0) {
723-
// firstReportTime = now;
724-
// } else {
725-
// MTM_LOG3("Snapshot sleep %llu of %llu usec (%f%%), maximum=%llu", totalSleepTime, now - firstReportTime, totalSleepTime*100.0/(now - firstReportTime), maxSleepTime);
726-
// }
727-
// }
728-
// }
729-
// #endif
730-
// if (delay*2 <= MAX_WAIT_TIMEOUT) {
731-
// delay *= 2;
732-
// }
733-
// MtmLock(LW_SHARED);
734-
// }
735-
// else
736-
// {
737-
// bool invisible = ts->status != TRANSACTION_STATUS_COMMITTED;
738-
// MTM_LOG4("%d: tuple with xid=%lld(csn= %lld) is %s in snapshot %lld",
739-
// MyProcPid, (long64)xid, ts->csn, invisible ? "rollbacked" : "committed", MtmTx.snapshot);
740-
// MtmUnlock();
741-
// #if DEBUG_LEVEL > 1
742-
// if (MtmGetSystemTime() - start > USECS_PER_SEC) {
743-
// MTM_ELOG(WARNING, "Backend %d waits for %s transaction %s (%llu) %lld usecs", MyProcPid, invisible ? "rollbacked" : "committed",
744-
// ts->gid, (long64)xid, MtmGetSystemTime() - start);
745-
// }
746-
// #endif
747-
// return invisible;
748-
// }
749-
// }
750-
// else
751-
// {
752-
// MTM_LOG4("%d: visibility check is skipped for transaction %llu in snapshot %llu", MyProcPid, (long64)xid, MtmTx.snapshot);
753-
// MtmUnlock();
754-
// return PgXidInMVCCSnapshot(xid, snapshot);
755-
// }
756-
// }
757-
// MtmUnlock();
758-
// #if DEBUG_LEVEL > 1
759-
// MTM_ELOG(ERROR, "Failed to get status of XID %llu in %lld usec", (long64)xid, MtmGetSystemTime() - start);
760-
// #else
761-
// MTM_ELOG(ERROR, "Failed to get status of XID %llu", (long64)xid);
762-
// #endif
763-
// return true;
764-
// }
765-
766-
767-
768615
/*
769616
* There can be different oldest XIDs at different cluster node.
770617
* We collect oldest CSNs from all nodes and choose minimum from them.

0 commit comments

Comments
 (0)