Skip to content

Commit

Permalink
Merge branch 'release-1.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmp85 committed Aug 29, 2015
2 parents 2b221d9 + ac35076 commit 7e6103f
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### pg_shard v1.2.2 (August 28, 2015) ###

* Changes default planner when running within CitusDB

### pg_shard v1.2.1 (July 30, 2015) ###

* Fixes update script bug triggered when running in CitusDB
Expand Down
4 changes: 2 additions & 2 deletions META.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "pg_shard",
"abstract": "Easy sharding for PostgreSQL",
"description": "Shards and replicates PostgreSQL tables for horizontal scale and high availability. Seamlessly distributes SQL statements, without requiring any application changes.",
"version": "1.2.1",
"version": "1.2.2",
"maintainer": "\"Jason Petersen\" <jason@citusdata.com>",
"license": "lgpl_3_0",
"prereqs": {
Expand All @@ -17,7 +17,7 @@
"abstract": "Easy sharding for PostgreSQL",
"file": "sql/pg_shard--1.2.sql",
"docfile": "README.md",
"version": "1.2.1"
"version": "1.2.2"
}
},
"release_status": "stable",
Expand Down
2 changes: 1 addition & 1 deletion doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ SELECT master_copy_shard_placement(12345, 'good_host', 5432, 'bad_host', 5432);

### Usage with CitusDB

When installed within CitusDB, `pg_shard` will use the distribution metadata catalogs provided by CitusDB. No special syncing step is necessary: your `pg_shard`-distributed tables will be visible to CitusDB and vice versa. Just ensure the `pg_shard.use_citusdb_select_logic` config variable is turned on and you'll be good to go!
When installed within CitusDB, `pg_shard` will use the distribution metadata catalogs provided by CitusDB. No special syncing step is necessary: your `pg_shard`-distributed tables will be visible to CitusDB and vice versa. Just ensure the `pg_shard.use_citusdb_select_logic` config variable is turned on (the default when running within CitusDB) and you'll be good to go!

## Look Under the Hood

Expand Down
8 changes: 8 additions & 0 deletions include/pg_shard.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,21 @@
#include "c.h"

#include "access/tupdesc.h"
#include "catalog/indexing.h"
#include "nodes/parsenodes.h"
#include "nodes/pg_list.h"
#include "nodes/plannodes.h"
#include "lib/stringinfo.h"
#include "utils/tuplestore.h"


/* detect when building against CitusDB */
#ifdef DistPartitionLogicalRelidIndexId
#define BUILT_AGAINST_CITUSDB true
#else
#define BUILT_AGAINST_CITUSDB false
#endif

/* prefix used for temporary tables created on the master node */
#define TEMPORARY_TABLE_PREFIX "pg_shard_temp_table"

Expand Down
4 changes: 2 additions & 2 deletions src/pg_shard.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ _PG_init(void)

DefineCustomBoolVariable("pg_shard.use_citusdb_select_logic",
"Informs pg_shard to use CitusDB's select logic", NULL,
&UseCitusDBSelectLogic, false, PGC_USERSET, 0, NULL,
NULL, NULL);
&UseCitusDBSelectLogic, BUILT_AGAINST_CITUSDB, PGC_USERSET,
0, NULL, NULL, NULL);

DefineCustomBoolVariable("pg_shard.log_distributed_statements",
"Logs each statement used in a distributed plan", NULL,
Expand Down
2 changes: 2 additions & 0 deletions test/expected/00-init.out
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
-- create extension
-- ===================================================================
CREATE EXTENSION pg_shard;
-- ensure the test DB defaults to pg_shard select logic
ALTER DATABASE :DBNAME SET pg_shard.use_citusdb_select_logic TO false;
-- create fake fdw for use in tests
CREATE FUNCTION fake_fdw_handler()
RETURNS fdw_handler
Expand Down
3 changes: 3 additions & 0 deletions test/sql/00-init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

CREATE EXTENSION pg_shard;

-- ensure the test DB defaults to pg_shard select logic
ALTER DATABASE :DBNAME SET pg_shard.use_citusdb_select_logic TO false;

-- create fake fdw for use in tests
CREATE FUNCTION fake_fdw_handler()
RETURNS fdw_handler
Expand Down

0 comments on commit 7e6103f

Please sign in to comment.