mirror of https://github.com/citusdata/citus.git
more
parent
e989e5b00e
commit
45804c0e5d
|
@ -54,6 +54,9 @@
|
|||
#include "distributed/transaction_management.h"
|
||||
#include "distributed/worker_manager.h"
|
||||
|
||||
/* Config variables managed via guc */
|
||||
bool EnableSingleShardTableMultiNodePlacement = false;
|
||||
|
||||
|
||||
/* declarations for dynamic loading */
|
||||
PG_FUNCTION_INFO_V1(master_create_worker_shards);
|
||||
|
@ -165,7 +168,8 @@ CreateShardsWithRoundRobinPolicy(Oid distributedTableId, int32 shardCount,
|
|||
char shardStorageType = ShardStorageType(distributedTableId);
|
||||
|
||||
int64 shardOffset = 0;
|
||||
if (shardCount == 1 && shardStorageType == SHARD_STORAGE_TABLE)
|
||||
if (EnableSingleShardTableMultiNodePlacement && shardCount == 1
|
||||
&& shardStorageType == SHARD_STORAGE_TABLE)
|
||||
{
|
||||
/* For single shard distributed tables, use the colocationId to offset
|
||||
* where the shard is placed.
|
||||
|
|
|
@ -86,6 +86,7 @@
|
|||
#include "distributed/multi_router_planner.h"
|
||||
#include "distributed/multi_server_executor.h"
|
||||
#include "distributed/pg_dist_partition.h"
|
||||
#include "distributed/pg_dist_shard.h"
|
||||
#include "distributed/placement_connection.h"
|
||||
#include "distributed/priority.h"
|
||||
#include "distributed/query_pushdown_planning.h"
|
||||
|
@ -1462,6 +1463,17 @@ RegisterCitusConfigVariables(void)
|
|||
GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
DefineCustomBoolVariable(
|
||||
"citus.enable_single_shard_table_multi_node_placement",
|
||||
gettext_noop("Enables placement of single shard distributed tables in"
|
||||
" all nodes of the cluster"),
|
||||
NULL,
|
||||
&EnableSingleShardTableMultiNodePlacement,
|
||||
false,
|
||||
PGC_USERSET,
|
||||
GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
DefineCustomBoolVariable(
|
||||
"citus.enable_statistics_collection",
|
||||
gettext_noop("Enables sending basic usage statistics to Citus."),
|
||||
|
|
|
@ -59,5 +59,6 @@ typedef FormData_pg_dist_shard *Form_pg_dist_shard;
|
|||
#define SHARD_STORAGE_TABLE 't'
|
||||
#define SHARD_STORAGE_VIRTUAL 'v'
|
||||
|
||||
extern bool EnableSingleShardTableMultiNodePlacement;
|
||||
|
||||
#endif /* PG_DIST_SHARD_H */
|
||||
|
|
|
@ -468,6 +468,7 @@ DROP TABLE temp_table;
|
|||
DROP TABLE shard_count_table_3;
|
||||
-- test shard count 1 placement with colocate none.
|
||||
-- create a base table instance
|
||||
set citus.enable_single_hash_repartition_joins to on;
|
||||
CREATE TABLE shard_count_table_1_inst_1 (a int);
|
||||
SELECT create_distributed_table('shard_count_table_1_inst_1', 'a', shard_count:=1, colocate_with:='none');
|
||||
create_distributed_table
|
||||
|
|
|
@ -294,6 +294,7 @@ DROP TABLE shard_count_table_3;
|
|||
|
||||
-- test shard count 1 placement with colocate none.
|
||||
-- create a base table instance
|
||||
set citus.enable_single_hash_repartition_joins to on;
|
||||
CREATE TABLE shard_count_table_1_inst_1 (a int);
|
||||
SELECT create_distributed_table('shard_count_table_1_inst_1', 'a', shard_count:=1, colocate_with:='none');
|
||||
|
||||
|
|
Loading…
Reference in New Issue