From 430ffd05823af351a3b6a32eb3f4ab51b5b41dd5 Mon Sep 17 00:00:00 2001 From: openGaussDev Date: Wed, 9 Mar 2022 21:37:17 +0800 Subject: [PATCH] show Un-support feature for obs Offering: openGaussDev More detail: show Un-support feature for obs Match-id-522435bc1d43f361b9f5700de80584b3cc5637f5 --- .../storage/access/transam/xlogfuncs.cpp | 18 +++++++++++++++++- .../storage/replication/slotfuncs.cpp | 11 +++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/gausskernel/storage/access/transam/xlogfuncs.cpp b/src/gausskernel/storage/access/transam/xlogfuncs.cpp index a06072f89..83aa0d80a 100755 --- a/src/gausskernel/storage/access/transam/xlogfuncs.cpp +++ b/src/gausskernel/storage/access/transam/xlogfuncs.cpp @@ -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); } diff --git a/src/gausskernel/storage/replication/slotfuncs.cpp b/src/gausskernel/storage/replication/slotfuncs.cpp index 0622ed650..df287d0cd 100755 --- a/src/gausskernel/storage/replication/slotfuncs.cpp +++ b/src/gausskernel/storage/replication/slotfuncs.cpp @@ -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() {