提交 49970964 编写于 作者: A Ashwin Agrawal

Fix gp_pgdatabase__ function by including walrep state 'n'.

As part of commit efed2fcc new walrep state was
added 'n' (not-in-sync). The toolkit function gp_pgdatabase__() needs to be
modified as well to check for that state.

Original code not using #defines but direct characters like 's', 'c' makes it
very tricky find stuff in code. Hopefully, future chnages would be easy to spot
and make.
上级 6f940543
......@@ -107,17 +107,28 @@ gp_pgdatabase__(PG_FUNCTION_ARGS)
values[2] = UInt16GetDatum(db->segindex);
values[3] = BoolGetDatum(false);
if (db->status == 'u')
if (db->status == GP_SEGMENT_CONFIGURATION_STATUS_UP)
{
if (db->mode == 's' || db->mode == 'c')
#ifdef USE_SEGWALREP
if (db->mode == GP_SEGMENT_CONFIGURATION_MODE_INSYNC ||
db->mode == GP_SEGMENT_CONFIGURATION_MODE_NOTINSYNC)
{
values[3] = BoolGetDatum(true);
} else if (db->mode == 'r' && db->role == 'p')
}
#else
if (db->mode == GP_SEGMENT_CONFIGURATION_MODE_INSYNC ||
db->mode == GP_SEGMENT_CONFIGURATION_MODE_CHANGETRACKING)
{
values[3] = BoolGetDatum(true);
} else if (db->mode == GP_SEGMENT_CONFIGURATION_MODE_RESYNC &&
db->role == GP_SEGMENT_CONFIGURATION_ROLE_PRIMARY)
{
values[3] = BoolGetDatum(true);
}
#endif
}
values[4] = BoolGetDatum(db->preferred_role == 'p');
values[4] = BoolGetDatum(db->preferred_role ==
GP_SEGMENT_CONFIGURATION_ROLE_PRIMARY);
tuple = heap_form_tuple(funcctx->tuple_desc, values, nulls);
result = HeapTupleGetDatum(tuple);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册