提交 00e00b9c 编写于 作者: H Heikki Linnakangas

Remove unused function.

I think this is some kind of a debugging function, but since it's not
exposed in pg_proc.h, there's no easy way to use it. Seems better to just
remove it, than try to expose it.
上级 1db7cd41
......@@ -931,109 +931,3 @@ LogDistributedSnapshotInfo(Snapshot snapshot, const char *prefix)
elog(LOG, "%s}", message);
}
struct mpp_xid_map_entry {
pid_t pid;
TransactionId global;
TransactionId local;
};
struct mpp_xid_map {
int size;
int cur;
struct mpp_xid_map_entry map[1];
};
/*
* mpp_global_xid_map
*/
Datum
mpp_global_xid_map(PG_FUNCTION_ARGS)
{
FuncCallContext *funcctx;
struct mpp_xid_map *ctx;
bool nulls[3];
int i, j;
if (SRF_IS_FIRSTCALL())
{
TupleDesc tupdesc;
MemoryContext oldcontext;
volatile SharedSnapshotStruct *arrayP = sharedSnapshotArray;
/* create a function context for cross-call persistence */
funcctx = SRF_FIRSTCALL_INIT();
/*
* switch to memory context appropriate for multiple function calls
*/
oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
/* build tupdesc for result tuples */
/* this had better match pg_locks view in system_views.sql */
tupdesc = CreateTemplateTupleDesc(3, false);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "pid",
INT4OID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "localxid",
XIDOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 3, "globalxid",
XIDOID, -1, 0);
funcctx->tuple_desc = BlessTupleDesc(tupdesc);
/* figure out how many slots we need */
ctx = (struct mpp_xid_map *)palloc0(sizeof(struct mpp_xid_map) +
arrayP->maxSlots * sizeof(struct mpp_xid_map_entry));
j = 0;
LWLockAcquire(SharedSnapshotLock, LW_EXCLUSIVE);
for (i = 0; i < arrayP->maxSlots; i++)
{
SharedSnapshotSlot *testSlot = &arrayP->slots[i];
if (testSlot->slotid != -1)
{
ctx->map[j].pid = testSlot->pid;
ctx->map[j].local = testSlot->xid;
ctx->map[j].global = testSlot->QDxid;
j++;
}
}
LWLockRelease(SharedSnapshotLock);
ctx->size = j;
funcctx->user_fctx = (void *)ctx;
MemoryContextSwitchTo(oldcontext);
}
funcctx = SRF_PERCALL_SETUP();
ctx = (struct mpp_xid_map *)funcctx->user_fctx;
MemSet(nulls, false, sizeof(nulls));
while (ctx->cur < ctx->size)
{
Datum values[3];
HeapTuple tuple;
Datum result;
/*
* Form tuple with appropriate data.
*/
MemSet(values, 0, sizeof(values));
values[0] = Int32GetDatum(ctx->map[ctx->cur].pid);
values[1] = TransactionIdGetDatum(ctx->map[ctx->cur].local);
values[2] = TransactionIdGetDatum(ctx->map[ctx->cur].global);
ctx->cur++;
tuple = heap_form_tuple(funcctx->tuple_desc, values, nulls);
result = HeapTupleGetDatum(tuple);
SRF_RETURN_NEXT(funcctx, result);
}
SRF_RETURN_DONE(funcctx);
}
......@@ -1096,9 +1096,6 @@ extern Datum pg_prepared_statement(PG_FUNCTION_ARGS);
/* utils/mmgr/portalmem.c */
extern Datum pg_cursor(PG_FUNCTION_ARGS);
/* tqual.c */
extern Datum mpp_global_xid_map(PG_FUNCTION_ARGS);
/* utils/resscheduler/resqueue.c */
extern Datum pg_resqueue_status(PG_FUNCTION_ARGS);
extern Datum pg_resqueue_status_kv(PG_FUNCTION_ARGS);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册