diff options
| author | M S | 2010-08-23 03:53:55 +0000 |
|---|---|---|
| committer | Pavan Deolasee | 2011-05-19 16:45:14 +0000 |
| commit | bd68c7342a793aa6b7c8a835196e85bb127b2f5b (patch) | |
| tree | 77c623021e0f806e68e415c68cffc85ccebe1c93 /src/include | |
| parent | bd35da43a6a655c2acc067a241bbf63b6ef6a840 (diff) | |
Portal integration changes.
This integrates Postgres-XC code deeper into PostgreSQL.
The Extended Query Protocol can now be used, which means that
JDBC will now work. It also lays more groundwork for
supporting multi-step queries (cross-node joins).
Note that statements with parameters cannot yet
be prepared and executed, only those without parameters
will work.
Note also that this patch introduces additional performance
degradation because more processing occurs with
each request. We will be working to address these
issues in the coming weeks.
Written by Andrei Martsinchyk
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/commands/copy.h | 5 | ||||
| -rw-r--r-- | src/include/nodes/parsenodes.h | 5 | ||||
| -rw-r--r-- | src/include/pgxc/execRemote.h | 8 | ||||
| -rw-r--r-- | src/include/pgxc/locator.h | 6 | ||||
| -rw-r--r-- | src/include/pgxc/planner.h | 23 |
5 files changed, 16 insertions, 31 deletions
diff --git a/src/include/commands/copy.h b/src/include/commands/copy.h index 7a3054d90e..7e6edac9be 100644 --- a/src/include/commands/copy.h +++ b/src/include/commands/copy.h @@ -17,12 +17,7 @@ #include "nodes/parsenodes.h" #include "tcop/dest.h" -#ifdef PGXC -extern uint64 DoCopy(const CopyStmt *stmt, const char *queryString, bool exec_on_coord_portal); -extern bool IsCoordPortalCopy(const CopyStmt *stmt); -#else extern uint64 DoCopy(const CopyStmt *stmt, const char *queryString); -#endif extern DestReceiver *CreateCopyDestReceiver(void); diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index e0515ba95d..88ae12a2c6 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -146,6 +146,11 @@ typedef struct Query Node *setOperations; /* set-operation tree if this is top level of * a UNION/INTERSECT/EXCEPT query */ +#ifdef PGXC + /* need this info for PGXC Planner, may be temporary */ + char *sql_statement; /* original query */ + NodeTag nodeTag; /* node tag of top node of parse tree */ +#endif } Query; diff --git a/src/include/pgxc/execRemote.h b/src/include/pgxc/execRemote.h index e9b59ccbd9..b7faa7dd28 100644 --- a/src/include/pgxc/execRemote.h +++ b/src/include/pgxc/execRemote.h @@ -51,9 +51,7 @@ typedef struct RemoteQueryState int conn_count; /* count of active connections */ int current_conn; /* used to balance load when reading from connections */ CombineType combine_type; /* see CombineType enum */ - DestReceiver *dest; /* output destination */ int command_complete_count; /* count of received CommandComplete messages */ - uint64 row_count; /* how many rows affected by the query */ RequestType request_type; /* see RequestType enum */ TupleDesc tuple_desc; /* tuple descriptor to be referenced by emitted tuples */ int description_count; /* count of received RowDescription messages */ @@ -62,7 +60,6 @@ typedef struct RemoteQueryState char errorCode[5]; /* error code to send back to client */ char *errorMessage; /* error message to send back to client */ bool query_Done; /* query has been sent down to data nodes */ - char *completionTag; /* completion tag to present to caller */ char *msg; /* last data row message */ int msglen; /* length of the data row message */ /* @@ -76,6 +73,7 @@ typedef struct RemoteQueryState FmgrInfo *eqfunctions; /* functions to compare tuples */ MemoryContext tmp_ctx; /* separate context is needed to compare tuples */ FILE *copy_file; /* used if copy_dest == COPY_FILE */ + uint64 processed; /* count of data rows when running CopyOut */ } RemoteQueryState; /* Multinode Executor */ @@ -86,11 +84,13 @@ extern int DataNodeRollback(void); extern DataNodeHandle** DataNodeCopyBegin(const char *query, List *nodelist, Snapshot snapshot, bool is_from); extern int DataNodeCopyIn(char *data_row, int len, Exec_Nodes *exec_nodes, DataNodeHandle** copy_connections); extern uint64 DataNodeCopyOut(Exec_Nodes *exec_nodes, DataNodeHandle** copy_connections, FILE* copy_file); -extern uint64 DataNodeCopyFinish(DataNodeHandle** copy_connections, int primary_data_node, CombineType combine_type); +extern void DataNodeCopyFinish(DataNodeHandle** copy_connections, int primary_data_node, CombineType combine_type); +extern int ExecCountSlotsRemoteQuery(RemoteQuery *node); extern RemoteQueryState *ExecInitRemoteQuery(RemoteQuery *node, EState *estate, int eflags); extern TupleTableSlot* ExecRemoteQuery(RemoteQueryState *step); extern void ExecEndRemoteQuery(RemoteQueryState *step); +extern void ExecRemoteUtility(RemoteQuery *node); extern int handle_response(DataNodeHandle * conn, RemoteQueryState *combiner); extern bool FetchTuple(RemoteQueryState *combiner, TupleTableSlot *slot); diff --git a/src/include/pgxc/locator.h b/src/include/pgxc/locator.h index 5ead756e1c..7ae04746e8 100644 --- a/src/include/pgxc/locator.h +++ b/src/include/pgxc/locator.h @@ -44,7 +44,7 @@ typedef struct /* track if tables use pg_catalog */ -typedef enum +typedef enum { TABLE_USAGE_TYPE_NO_TABLE, TABLE_USAGE_TYPE_PGCATALOG, @@ -58,10 +58,10 @@ typedef enum * primarynodelist is for replicated table writes, where to execute first. * If it succeeds, only then should it be executed on nodelist. * primarynodelist should be set to NULL if not doing replicated write operations - */ + */ typedef struct { - List *primarynodelist; + List *primarynodelist; List *nodelist; char baselocatortype; TableUsageType tableusagetype; /* track pg_catalog usage */ diff --git a/src/include/pgxc/planner.h b/src/include/pgxc/planner.h index 47665b2341..bf8f2242fa 100644 --- a/src/include/pgxc/planner.h +++ b/src/include/pgxc/planner.h @@ -17,16 +17,14 @@ #include "fmgr.h" #include "lib/stringinfo.h" +#include "nodes/params.h" +#include "nodes/parsenodes.h" #include "nodes/plannodes.h" #include "nodes/primnodes.h" #include "pgxc/locator.h" #include "tcop/dest.h" -/* for Query_Plan.exec_loc_type can have these OR'ed*/ -#define EXEC_ON_COORD 0x1 -#define EXEC_ON_DATA_NODES 0x2 - typedef enum { COMBINE_TYPE_NONE, /* it is known that no row count, do not parse */ @@ -72,18 +70,6 @@ typedef struct } RemoteQuery; -/* - * The PGXC plan to execute. - * In the prototype this will be simple, and queryStepList will - * contain just one step. - */ -typedef struct -{ - int exec_loc_type; - List *query_step_list; /* List of QuerySteps */ -} Query_Plan; - - /* For handling simple aggregates (no group by present) * For now, only MAX will be supported. */ @@ -154,9 +140,8 @@ extern bool StrictStatementChecking; /* forbid SELECT even multi-node ORDER BY */ extern bool StrictSelectChecking; -extern Query_Plan *GetQueryPlan(Node *parsetree, const char *sql_statement, - List *querytree_list); -extern void FreeQueryPlan(Query_Plan *query_plan); +extern PlannedStmt *pgxc_planner(Query *query, int cursorOptions, + ParamListInfo boundParams); extern bool IsHashDistributable(Oid col_type); #endif /* PGXCPLANNER_H */ |
