Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitad9bb1b

Browse files
knizhnikkelvich
authored andcommitted
Fix definitions of SQL functions
1 parent5f7a3ec commitad9bb1b

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

‎bgwpool.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,14 @@ size_t BgwPoolGetQueueSize(BgwPool* pool)
109109

110110
voidBgwPoolExecute(BgwPool*pool,void*work,size_tsize)
111111
{
112-
Assert(size+4 <=pool->size);
112+
if (size+4>pool->size) {
113+
/*
114+
* Size of work is larger than size of shared buffer:
115+
* run it immediately
116+
*/
117+
pool->executor(0,work,size);
118+
return;
119+
}
113120

114121
SpinLockAcquire(&pool->lock);
115122
while (true) {

‎multimaster--1.0.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ AS 'MODULE_PATHNAME','mtm_get_snapshot'
2424
LANGUAGE C;
2525

2626

27-
CREATETYPEmtm.node_state(idinteger, disabled bool, disconnected bool, catchUpboolean, slotLagbigint, connStrtext);
27+
CREATETYPEmtm.node_stateAS(idinteger, disabled bool, disconnected bool, catchUpbool, slotLagbigint, connStrtext);
2828

2929
CREATEFUNCTIONmtm.get_nodes_state() RETURNS SETOFmtm.node_state
3030
AS'MODULE_PATHNAME','mtm_get_nodes_state'
3131
LANGUAGE C;
3232

33-
CREATETYPEmtm.cluster_state(statustext, disabledNodeMaskbigint, disconnectedNodeMaskbigint, catchUpNodeMaskbigint, nNodesinteger, nActiveQueriesinteger, queueSizebigint);
33+
CREATETYPEmtm.cluster_stateAS(statustext, disabledNodeMaskbigint, disconnectedNodeMaskbigint, catchUpNodeMaskbigint, nNodesinteger, nActiveQueriesinteger, queueSizebigint);
3434

3535
CREATEFUNCTIONmtm.get_cluster_state() RETURNSmtm.cluster_state
3636
AS'MODULE_PATHNAME','mtm_get_cluster_state'

‎multimaster.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ MtmBeginTransaction(MtmCurrentTrans* x)
523523
if (x->isDistributed&&dtm->status!=MTM_ONLINE) {
524524
/* reject all user's transactions at offline cluster */
525525
MtmUnlock();
526-
elog(ERROR,"Multimaster node is not online");
526+
elog(ERROR,"Multimaster node is not online: current status %s",MtmNodeStatusMnem[dtm->status]);
527527
}
528528
x->containsDML= false;
529529
x->isPrepared= false;
@@ -1159,7 +1159,7 @@ void MtmReceiverStarted(int nodeId)
11591159
BIT_SET(dtm->pglogicalNodeMask,nodeId-1);
11601160
if (++dtm->nReceivers==dtm->nNodes-1) {
11611161
Assert(dtm->status==MTM_CONNECTED);
1162-
MtmSwitchClusterMode(MTM_OFFLINE);
1162+
MtmSwitchClusterMode(MTM_ONLINE);
11631163
}
11641164
}
11651165
SpinLockRelease(&dtm->spinlock);
@@ -1293,6 +1293,7 @@ mtm_get_nodes_state(PG_FUNCTION_ARGS)
12931293
MtmGetNodeStateCtx*usrfctx;
12941294
MemoryContextoldcontext;
12951295
char*p;
1296+
int64lag;
12961297
boolis_first_call=SRF_IS_FIRSTCALL();
12971298

12981299
if (is_first_call) {
@@ -1315,7 +1316,9 @@ mtm_get_nodes_state(PG_FUNCTION_ARGS)
13151316
usrfctx->values[1]=BoolGetDatum(BIT_CHECK(dtm->disabledNodeMask,usrfctx->nodeId-1));
13161317
usrfctx->values[2]=BoolGetDatum(BIT_CHECK(dtm->connectivityMask,usrfctx->nodeId-1));
13171318
usrfctx->values[3]=BoolGetDatum(BIT_CHECK(dtm->nodeLockerMask,usrfctx->nodeId-1));
1318-
usrfctx->values[4]=Int64GetDatum(MtmGetSlotLag(usrfctx->nodeId));
1319+
lag=MtmGetSlotLag(usrfctx->nodeId);
1320+
usrfctx->values[4]=Int64GetDatum(lag);
1321+
usrfctx->nulls[4]=lag<0;
13191322
p=strchr(usrfctx->connStrPtr,',');
13201323
if (p!=NULL) {
13211324
*p++='\0';
@@ -1333,7 +1336,6 @@ mtm_get_cluster_state(PG_FUNCTION_ARGS)
13331336
TupleDescdesc;
13341337
Datumvalues[7];
13351338
boolnulls[7]= {false};
1336-
13371339
get_call_result_type(fcinfo,NULL,&desc);
13381340

13391341
values[0]=CStringGetTextDatum(MtmNodeStatusMnem[dtm->status]);

‎pglogical_receiver.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,8 @@ pglogical_receiver_main(Datum main_arg)
331331
if (rc&WL_POSTMASTER_DEATH)
332332
proc_exit(1);
333333

334-
if (ds->status!=MTM_ONLINE&& (ds->status!=MTM_RECOVERY||ds->recoverySlot!=args->remote_node)) {
335-
ereport(LOG, (errmsg("%s: terminating WAL receiver because nodeis switched to %s mode",worker_proc,MtmNodeStatusMnem[ds->status])));
334+
if (ds->status==MTM_OFFLINE|| (ds->status==MTM_RECOVERY&&ds->recoverySlot!=args->remote_node)) {
335+
ereport(LOG, (errmsg("%s: terminating WAL receiver because nodewas switched to %s mode",worker_proc,MtmNodeStatusMnem[ds->status])));
336336
proc_exit(0);
337337
}
338338

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp