Move test UDF under test folder

pull/2229/head
Onder Kalaci 2018-06-20 10:35:43 +03:00
parent 7a75c2ed31
commit 7762d81cba
4 changed files with 51 additions and 34 deletions

View File

@ -68,6 +68,7 @@ OBJS = src/backend/distributed/shared_library_init.o \
src/backend/distributed/test/partitioning_utils.o \
src/backend/distributed/test/progress_utils.o \
src/backend/distributed/test/prune_shard_list.o \
src/backend/distributed/test/sequential_execution.o \
src/backend/distributed/transaction/backend_data.o \
src/backend/distributed/transaction/distributed_deadlock_detection.o \
src/backend/distributed/transaction/lock_graph.o \

View File

@ -48,43 +48,9 @@ int MultiShardConnectionType = PARALLEL_CONNECTION;
/* local function forward declarations */
static void SetLocalMultiShardModifyModeToSequential(void);
static Relation StubRelation(TupleDesc tupleDescriptor);
/* exports for SQL callable functions */
PG_FUNCTION_INFO_V1(set_local_multi_shard_modify_mode_to_sequential);
/*
* set_local_multi_shard_modify_mode_to_sequential is a SQL
* interface for testing SetLocalMultiShardModifyModeToSequential().
*/
Datum
set_local_multi_shard_modify_mode_to_sequential(PG_FUNCTION_ARGS)
{
SetLocalMultiShardModifyModeToSequential();
PG_RETURN_VOID();
}
/*
* SetLocalMultiShardModifyModeToSequential simply a C interface for
* setting the following:
* SET LOCAL citus.multi_shard_modify_mode = 'sequential';
*/
static void
SetLocalMultiShardModifyModeToSequential()
{
WarnNoTransactionChain(true, "SET LOCAL");
set_config_option("citus.multi_shard_modify_mode", "sequential",
(superuser() ? PGC_SUSET : PGC_USERSET), PGC_S_SESSION,
GUC_ACTION_LOCAL, true, 0, false);
}
/*
* ReturnTupleFromTuplestore reads the next tuple from the tuple store of the
* given Citus scan node and returns it. It returns null if all tuples are read
@ -334,3 +300,19 @@ ExecutePlanIntoDestReceiver(PlannedStmt *queryPlan, ParamListInfo params,
#endif
PortalDrop(portal, false);
}
/*
* SetLocalMultiShardModifyModeToSequential simply a C interface for
* setting the following:
* SET LOCAL citus.multi_shard_modify_mode = 'sequential';
*/
void
SetLocalMultiShardModifyModeToSequential()
{
WarnNoTransactionChain(true, "SET LOCAL");
set_config_option("citus.multi_shard_modify_mode", "sequential",
(superuser() ? PGC_SUSET : PGC_USERSET), PGC_S_SESSION,
GUC_ACTION_LOCAL, true, 0, false);
}

View File

@ -0,0 +1,33 @@
/*-------------------------------------------------------------------------
*
* test/src/sequential_execution.c
*
* This file contains functions to test setting citus.multi_shard_modify_mode
* GUC.
*
* Copyright (c) 2018, Citus Data, Inc.
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "fmgr.h"
#include "distributed/multi_executor.h"
/* exports for SQL callable functions */
PG_FUNCTION_INFO_V1(set_local_multi_shard_modify_mode_to_sequential);
/*
* set_local_multi_shard_modify_mode_to_sequential is a SQL
* interface for testing SetLocalMultiShardModifyModeToSequential().
*/
Datum
set_local_multi_shard_modify_mode_to_sequential(PG_FUNCTION_ARGS)
{
SetLocalMultiShardModifyModeToSequential();
PG_RETURN_VOID();
}

View File

@ -39,6 +39,7 @@ extern void ExecuteQueryIntoDestReceiver(Query *query, ParamListInfo params,
DestReceiver *dest);
extern void ExecutePlanIntoDestReceiver(PlannedStmt *queryPlan, ParamListInfo params,
DestReceiver *dest);
extern void SetLocalMultiShardModifyModeToSequential(void);
#endif /* MULTI_EXECUTOR_H */