we supress notice log during looking up function oid to not break pg vanilla tests. (#6082)

pull/6111/head
aykut-bozkurt 2022-08-01 10:14:35 +03:00 committed by GitHub
parent 5490c85f49
commit f372e93d22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 53 additions and 1 deletions

View File

@ -32,6 +32,7 @@
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
#include "commands/extension.h"
#include "distributed/citus_depended_object.h"
#include "distributed/citus_ruleutils.h"
#include "distributed/citus_safe_lib.h"
#include "distributed/colocation_utils.h"
@ -1438,7 +1439,17 @@ CreateFunctionStmtObjectAddress(Node *node, bool missing_ok)
}
}
return FunctionToObjectAddress(objectType, objectWithArgs, missing_ok);
int OldClientMinMessage = client_min_messages;
/* suppress NOTICE if running under pg vanilla tests */
SetLocalClientMinMessagesIfRunningPGTests(WARNING);
List *funcAddresses = FunctionToObjectAddress(objectType, objectWithArgs, missing_ok);
/* set it back */
SetLocalClientMinMessagesIfRunningPGTests(OldClientMinMessage);
return funcAddresses;
}

View File

@ -595,6 +595,21 @@ StartupCitusBackend(void)
}
/*
* GetCurrentClientMinMessageLevelName returns the name of the
* the GUC client_min_messages for its specified value.
*/
const char *
GetClientMinMessageLevelNameForValue(int minMessageLevel)
{
struct config_enum record = { 0 };
record.options = log_level_options;
const char *clientMinMessageLevelName = config_enum_lookup_by_value(&record,
minMessageLevel);
return clientMinMessageLevelName;
}
/*
* RegisterConnectionCleanup cleans up any resources left at the end of the
* session. We prefer to cleanup before shared memory exit to make sure that

View File

@ -33,6 +33,8 @@
#include "distributed/citus_depended_object.h"
#include "distributed/metadata_cache.h"
#include "distributed/listutils.h"
#include "distributed/log_utils.h"
#include "distributed/shared_library_init.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "nodes/parsenodes.h"
@ -76,6 +78,27 @@ SetLocalHideCitusDependentObjectsDisabledWhenAlreadyEnabled(void)
}
/*
* SetLocalClientMinMessagesIfRunningPGTests sets client_min_message locally to the given value
* if EnableUnsupportedFeatureMessages is set to false.
*/
void
SetLocalClientMinMessagesIfRunningPGTests(int clientMinMessageLevel)
{
if (EnableUnsupportedFeatureMessages)
{
return;
}
const char *clientMinMessageLevelName = GetClientMinMessageLevelNameForValue(
clientMinMessageLevel);
set_config_option("client_min_messages", clientMinMessageLevelName,
(superuser() ? PGC_SUSET : PGC_USERSET), PGC_S_SESSION,
GUC_ACTION_LOCAL, true, 0, false);
}
/*
* HideCitusDependentObjectsOnQueriesOfPgMetaTables adds a NOT is_citus_depended_object(oid, oid) expr
* to the quals of meta class RTEs that we are interested in.

View File

@ -17,6 +17,8 @@
extern bool HideCitusDependentObjects;
extern void SetLocalClientMinMessagesIfRunningPGTests(int
clientMinMessageLevel);
extern void SetLocalHideCitusDependentObjectsDisabledWhenAlreadyEnabled(void);
extern bool HideCitusDependentObjectsOnQueriesOfPgMetaTables(Node *node, void *context);
extern bool IsPgLocksTable(RangeTblEntry *rte);

View File

@ -23,5 +23,6 @@ extern IsColumnarTableAmTable_type extern_IsColumnarTableAmTable;
extern ReadColumnarOptions_type extern_ReadColumnarOptions;
extern void StartupCitusBackend(void);
extern const char * GetClientMinMessageLevelNameForValue(int minMessageLevel);
#endif /* SHARED_LIBRARY_INIT_H */