show Un-support feature for obs

Offering: openGaussDev

More detail: show Un-support feature for obs

Match-id-522435bc1d43f361b9f5700de80584b3cc5637f5
This commit is contained in:
openGaussDev
2022-03-09 21:37:17 +08:00
committed by yanghao
parent 01d4a56856
commit 430ffd0582
2 changed files with 26 additions and 3 deletions

View File

@ -1705,6 +1705,7 @@ Datum gs_hadr_has_barrier_creator(PG_FUNCTION_ARGS)
*/
Datum gs_hadr_in_recovery(PG_FUNCTION_ARGS)
{
#ifndef ENABLE_LITE_MODE
if (!superuser() && !(isOperatoradmin(GetUserId()) && u_sess->attr.attr_security.operation_mode))
ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
(errmsg("Must be system admin or operator admin in operation mode to gs_hadr_has_barrier_creator."))));
@ -1712,7 +1713,9 @@ Datum gs_hadr_in_recovery(PG_FUNCTION_ARGS)
if (knl_g_get_redo_finish_status()) {
PG_RETURN_BOOL(false);
}
#else
FEATURE_ON_LITE_MODE_NOT_SUPPORTED();
#endif
PG_RETURN_BOOL(true);
}
@ -2009,6 +2012,7 @@ Datum gs_get_hadr_key_cn(PG_FUNCTION_ARGS)
Datum gs_streaming_dr_in_switchover(PG_FUNCTION_ARGS)
{
#ifndef ENABLE_LITE_MODE
if (!superuser() && !(isOperatoradmin(GetUserId()) && u_sess->attr.attr_security.operation_mode))
ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
(errmsg("Must be system admin or operator admin in operation mode to gs_streaming_dr_switchover."))));
@ -2027,12 +2031,16 @@ Datum gs_streaming_dr_in_switchover(PG_FUNCTION_ARGS)
RequestBarrier(barrier_id, NULL, true);
#else
CreateHadrSwitchoverBarrier();
#endif
#else
FEATURE_ON_LITE_MODE_NOT_SUPPORTED();
#endif
PG_RETURN_BOOL(true);
}
Datum gs_streaming_dr_service_truncation_check(PG_FUNCTION_ARGS)
{
#ifndef ENABLE_LITE_MODE
XLogRecPtr switchoverLsn = g_instance.streaming_dr_cxt.switchoverBarrierLsn;
XLogRecPtr flushLsn = InvalidXLogRecPtr;
bool isInteractionCompleted = false;
@ -2070,10 +2078,15 @@ Datum gs_streaming_dr_service_truncation_check(PG_FUNCTION_ARGS)
} else {
PG_RETURN_BOOL(false);
}
#else
FEATURE_ON_LITE_MODE_NOT_SUPPORTED();
PG_RETURN_BOOL(false);
#endif
}
Datum gs_streaming_dr_get_switchover_barrier(PG_FUNCTION_ARGS)
{
#ifndef ENABLE_LITE_MODE
if (!superuser() && !(isOperatoradmin(GetUserId()) && u_sess->attr.attr_security.operation_mode))
ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
(errmsg("Must be system admin or operator admin in operation mode to gs_streaming_dr_get_switchover_barrier."))));
@ -2115,6 +2128,9 @@ Datum gs_streaming_dr_get_switchover_barrier(PG_FUNCTION_ARGS)
PG_RETURN_BOOL(true);
}
}
#else
FEATURE_ON_LITE_MODE_NOT_SUPPORTED();
#endif
PG_RETURN_BOOL(false);
}

View File

@ -39,9 +39,11 @@
extern void *internal_load_library(const char *libname);
extern bool PMstateIsRun(void);
static void redo_slot_create(const ReplicationSlotPersistentData *slotInfo, char* extra_content = NULL);
#ifndef ENABLE_LITE_MODE
static XLogRecPtr create_physical_replication_slot_for_backup(const char* slot_name, bool is_dummy, char* extra);
static XLogRecPtr create_physical_replication_slot_for_archive(const char* slot_name, bool is_dummy, char* extra,
XLogRecPtr currFlushPtr = InvalidXLogRecPtr);
#endif
static void slot_advance(const char* slotname, XLogRecPtr &moveto, NameData &database, char *EndLsn, bool for_backup = false);
@ -259,6 +261,7 @@ Datum pg_create_physical_replication_slot(PG_FUNCTION_ARGS)
*/
Datum pg_create_physical_replication_slot_extern(PG_FUNCTION_ARGS)
{
#ifndef ENABLE_LITE_MODE
Name name = PG_GETARG_NAME(0);
bool isDummyStandby = PG_GETARG_BOOL(1);
XLogRecPtr currFlushPtr = InvalidXLogRecPtr;
@ -299,7 +302,6 @@ Datum pg_create_physical_replication_slot_extern(PG_FUNCTION_ARGS)
if (for_backup) {
restart_lsn = create_physical_replication_slot_for_backup(NameStr(*name), isDummyStandby, extra_content);
} else {
#ifndef ENABLE_LITE_MODE
if (isNeedRecycleXlog) {
ArchiveConfig* archive_config = formArchiveConfigFromStr(extra_content, false);
XLogRecPtr switchPtr = InvalidXLogRecPtr;
@ -318,7 +320,6 @@ Datum pg_create_physical_replication_slot_extern(PG_FUNCTION_ARGS)
}
currFlushPtr -= currFlushPtr % XLogSegSize;
ereport(LOG, (errmsg("create archive slot, start point %lu", currFlushPtr)));
#endif
restart_lsn = create_physical_replication_slot_for_archive(NameStr(*name), isDummyStandby, extra_content,
currFlushPtr);
}
@ -342,6 +343,10 @@ Datum pg_create_physical_replication_slot_extern(PG_FUNCTION_ARGS)
pfree_ext(extra_content);
PG_RETURN_DATUM(result);
#else
FEATURE_ON_LITE_MODE_NOT_SUPPORTED();
PG_RETURN_DATUM(0);
#endif
}
void create_logical_replication_slot(const Name name, Name plugin, bool isDummyStandby, Oid databaseId,
@ -1103,6 +1108,7 @@ bool is_archive_slot(ReplicationSlotPersistentData data)
return GET_SLOT_EXTRA_DATA_LENGTH(data) != 0;
}
#ifndef ENABLE_LITE_MODE
XLogRecPtr create_physical_replication_slot_for_archive(const char* slot_name, bool is_dummy, char* extra_content,
XLogRecPtr currFlushPtr)
{
@ -1169,6 +1175,7 @@ XLogRecPtr create_physical_replication_slot_for_backup(const char* slot_name, bo
return restart_lsn;
}
#endif
void init_instance_slot()
{