summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorMichael P2011-02-02 08:12:58 +0000
committerPavan Deolasee2011-05-19 17:49:37 +0000
commite08eb37ced7b0d4416a9812432ed365f54aa5a08 (patch)
treed4a8cf5552724243b91d4c0b543a3f79ed0eddb2 /src/include
parent2e81ffec5df4a2a6c1a21973d81d84d7f5b5d6fc (diff)
CREATE TABLE: new distribution function MODULO
new catalogue is named pgxc_class. It has the following columns pcrelid - The OID of the added relation in pg_class pclocatortype - XC defines distribution types as a single character in locator.h The provided distribution type is stored here. Distribution types can be 'R' - Replicated 'H' - Based on a column's hash value 'N' - Based on round robin for all data nodes 'M' - Based on modulo of a column's value This new distribution type is added by this patch. Similarly G, S and C are also defined. pcattnum - The number of the column used for replication valid only for H and M - Zero for the rest This patch supports also copy and INSERT(SELECT). It does NOT SUPPPORT multiple INSERT. The following issues are remaining though: 1) Non-definition of distribution column in table makes a crash 2) Creation of an index on a column that is not the distribution column 3) Creation of a foreign key on distribution column 4) Distribution on another column other than unique makes a crash
Diffstat (limited to 'src/include')
-rw-r--r--src/include/nodes/primnodes.h3
-rw-r--r--src/include/parser/kwlist.h3
-rw-r--r--src/include/pgxc/locator.h8
3 files changed, 13 insertions, 1 deletions
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h
index 9a96ea6886..c5ca1e5d3c 100644
--- a/src/include/nodes/primnodes.h
+++ b/src/include/nodes/primnodes.h
@@ -1185,7 +1185,8 @@ typedef enum DistributionType
{
DISTTYPE_REPLICATION, /* Replicated */
DISTTYPE_HASH, /* Hash partitioned */
- DISTTYPE_ROUNDROBIN /* Round Robin */
+ DISTTYPE_ROUNDROBIN, /* Round Robin */
+ DISTTYPE_MODULO /* Modulo partitioned */
} DistributionType;
/*----------
diff --git a/src/include/parser/kwlist.h b/src/include/parser/kwlist.h
index dc6b96e3b5..d6e0aae515 100644
--- a/src/include/parser/kwlist.h
+++ b/src/include/parser/kwlist.h
@@ -242,6 +242,9 @@ PG_KEYWORD("maxvalue", MAXVALUE, UNRESERVED_KEYWORD)
PG_KEYWORD("minute", MINUTE_P, UNRESERVED_KEYWORD)
PG_KEYWORD("minvalue", MINVALUE, UNRESERVED_KEYWORD)
PG_KEYWORD("mode", MODE, UNRESERVED_KEYWORD)
+#ifdef PGXC
+PG_KEYWORD("modulo", MODULO, UNRESERVED_KEYWORD)
+#endif
PG_KEYWORD("month", MONTH_P, UNRESERVED_KEYWORD)
PG_KEYWORD("move", MOVE, UNRESERVED_KEYWORD)
PG_KEYWORD("name", NAME_P, UNRESERVED_KEYWORD)
diff --git a/src/include/pgxc/locator.h b/src/include/pgxc/locator.h
index 1bc894953f..5948faece6 100644
--- a/src/include/pgxc/locator.h
+++ b/src/include/pgxc/locator.h
@@ -21,6 +21,7 @@
#define LOCATOR_TYPE_SINGLE 'S'
#define LOCATOR_TYPE_RROBIN 'N'
#define LOCATOR_TYPE_CUSTOM 'C'
+#define LOCATOR_TYPE_MODULO 'M'
#define HASH_SIZE 4096
#define HASH_MASK 0x00000FFF;
@@ -107,4 +108,11 @@ extern List *GetAnyDataNode(void);
extern void RelationBuildLocator(Relation rel);
extern void FreeRelationLocInfo(RelationLocInfo *relationLocInfo);
+extern bool IsModuloDistributable(Oid col_type);
+extern char *GetRelationModuloColumn(RelationLocInfo * rel_loc_info);
+extern bool IsModuloColumn(RelationLocInfo *rel_loc_info, char *part_col_name);
+extern bool IsModuloColumnForRelId(Oid relid, char *part_col_name);
+extern char *GetRelationDistColumn(RelationLocInfo * rel_loc_info);
+extern bool IsDistColumnForRelId(Oid relid, char *part_col_name);
+
#endif /* LOCATOR_H */