summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorAbbas2011-05-24 12:06:30 +0000
committerMichael P2011-05-26 00:56:39 +0000
commiteb593761cb84d35e63ee4af4adb804735e083ffa (patch)
treed17fb5232cfe902d7e2b511f5d495adf121cc2fc /src/include
parentc51655e2648efaaef0b9e73a11b3af56aef0c031 (diff)
This patch adds support for the following data types to be used as distribution key
INT8, INT2, OID, INT4, BOOL, INT2VECTOR, OIDVECTOR CHAR, NAME, TEXT, BPCHAR, BYTEA, VARCHAR FLOAT4, FLOAT8, NUMERIC, CASH ABSTIME, RELTIME, DATE, TIME, TIMESTAMP, TIMESTAMPTZ, INTERVAL, TIMETZ A new function compute_hash is added in the system which is used to compute hash of a any of the supported data types. The computed hash is used in the function GetRelationNodes to find the targeted data node. EXPLAIN for RemoteQuery has been modified to show the number of data nodes targeted for a certain query. This is essential to spot bugs in the optimizer in case it is targeting all nodes by mistake. In case of optimisations where comparison with a constant leads the optimiser to point to a single data node, there were a couple of mistakes in examine_conditions_walker. First it was not supporting RelabelType, which represents a "dummy" type coercion between two binary compatible datatypes. This was resulting in the optimization not working for varchar type for example. Secondly it was not catering for the case where the user specifies the condition such that the constant expression is written towards LHS and the variable towards the RHS of the = operator. i.e. 23 = a A number of test cases have been added in regression to make sure further enhancements do not break this functionality. This change has a sizeable impact on current regression tests in the following manner. 1. horology test case crashes the server and has been commented out in serial_schedule. 2. In money test case the planner optimizer wrongly kicks in to optimize this query SELECT m = '$123.01' FROM money_data; to point to a single data node. 3. There were a few un-necessary EXPLAINs in create_index test case. Since we have added support in EXPLAIN to show the number of data nodes targeted for RemoteQuery, this test case was producing output dependent on the cluster configuration. 4. In guc test case DROP ROLE temp_reset_user; results in ERROR: permission denied to drop role
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/hash.h4
-rw-r--r--src/include/pgxc/locator.h3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/include/access/hash.h b/src/include/access/hash.h
index 39337194e2..f6070d21e6 100644
--- a/src/include/access/hash.h
+++ b/src/include/access/hash.h
@@ -353,4 +353,8 @@ extern OffsetNumber _hash_binsearch_last(Page page, uint32 hash_value);
extern void hash_redo(XLogRecPtr lsn, XLogRecord *record);
extern void hash_desc(StringInfo buf, uint8 xl_info, char *rec);
+#ifdef PGXC
+extern Datum compute_hash(Oid type, Datum value, int *pErr);
+#endif
+
#endif /* HASH_H */
diff --git a/src/include/pgxc/locator.h b/src/include/pgxc/locator.h
index 9f669d92e0..9ee983c8cf 100644
--- a/src/include/pgxc/locator.h
+++ b/src/include/pgxc/locator.h
@@ -100,8 +100,7 @@ extern char ConvertToLocatorType(int disttype);
extern char *GetRelationHashColumn(RelationLocInfo *rel_loc_info);
extern RelationLocInfo *GetRelationLocInfo(Oid relid);
extern RelationLocInfo *CopyRelationLocInfo(RelationLocInfo *src_info);
-extern ExecNodes *GetRelationNodes(RelationLocInfo *rel_loc_info, long *partValue,
- RelationAccessType accessType);
+extern ExecNodes *GetRelationNodes(RelationLocInfo *rel_loc_info, Datum valueForDistCol, Oid typeOfValueForDistCol, RelationAccessType accessType);
extern bool IsHashColumn(RelationLocInfo *rel_loc_info, char *part_col_name);
extern bool IsHashColumnForRelId(Oid relid, char *part_col_name);
extern int GetRoundRobinNode(Oid relid);