Allow citus size functions on replicated tables

pull/4309/head
Marco Slot 2020-12-03 16:31:40 +01:00
parent f164575524
commit 4098d33acb
3 changed files with 18 additions and 11 deletions

View File

@ -367,14 +367,6 @@ ErrorIfNotSuitableToGetSize(Oid relationId)
errmsg("cannot calculate the size because relation %s is not "
"distributed", escapedQueryString)));
}
if (IsCitusTableType(relationId, HASH_DISTRIBUTED) &&
!SingleReplicatedTable(relationId))
{
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot calculate the size because replication factor "
"is greater than 1")));
}
}

View File

@ -22,12 +22,25 @@ SELECT citus_total_relation_size('non_distributed_table');
ERROR: cannot calculate the size because relation 'non_distributed_table' is not distributed
DROP TABLE non_distributed_table;
-- Tests on distributed table with replication factor > 1
VACUUM (FULL) lineitem_hash_part;
SELECT citus_table_size('lineitem_hash_part');
ERROR: cannot calculate the size because replication factor is greater than 1
citus_table_size
---------------------------------------------------------------------
3801088
(1 row)
SELECT citus_relation_size('lineitem_hash_part');
ERROR: cannot calculate the size because replication factor is greater than 1
citus_relation_size
---------------------------------------------------------------------
3801088
(1 row)
SELECT citus_total_relation_size('lineitem_hash_part');
ERROR: cannot calculate the size because replication factor is greater than 1
citus_total_relation_size
---------------------------------------------------------------------
3801088
(1 row)
VACUUM (FULL) customer_copy_hash;
-- Tests on distributed tables with streaming replication.
SELECT citus_table_size('customer_copy_hash');

View File

@ -20,6 +20,8 @@ SELECT citus_total_relation_size('non_distributed_table');
DROP TABLE non_distributed_table;
-- Tests on distributed table with replication factor > 1
VACUUM (FULL) lineitem_hash_part;
SELECT citus_table_size('lineitem_hash_part');
SELECT citus_relation_size('lineitem_hash_part');
SELECT citus_total_relation_size('lineitem_hash_part');