Citus lib is now able to load & error out

"trying to store a minimal tuple into wrong type of slot"
read_write_etc
Philip Dubé 2019-07-12 22:15:46 +00:00
parent 44fa6cc2db
commit 8c67ed352c
9 changed files with 413 additions and 3759 deletions

View File

@ -37,6 +37,7 @@
#include "parser/parse_type.h"
#if PG_VERSION_NUM >= 120000
#include "optimizer/optimizer.h"
#include "optimizer/plancat.h"
#else
#include "optimizer/cost.h"
#endif
@ -1331,6 +1332,11 @@ AdjustReadIntermediateResultCost(RangeTblEntry *rangeTableEntry, RelOptInfo *rel
double rowSizeEstimate = 0;
double rowCountEstimate = 0.;
double ioCost = 0.;
#if PG_VERSION_NUM >= 120000
QualCost funcCost = { 0., 0. };
#else
double funcCost = 0.;
#endif
if (rangeTableEntry->rtekind != RTE_FUNCTION ||
list_length(rangeTableEntry->functions) != 1)
@ -1417,9 +1423,19 @@ AdjustReadIntermediateResultCost(RangeTblEntry *rangeTableEntry, RelOptInfo *rel
rowSizeEstimate += 1;
}
/* add the cost of parsing a column */
rowCost += get_func_cost(inputFunctionId) * cpu_operator_cost;
#if PG_VERSION_NUM >= 120000
add_function_cost(NULL, inputFunctionId, NULL, &funcCost);
#else
funcCost += get_func_cost(inputFunctionId);
#endif
}
#if PG_VERSION_NUM >= 120000
rowCost += funcCost.per_tuple * cpu_operator_cost;
#else
rowCost += funcCost * cpu_operator_cost;
#endif
/* estimate the number of rows based on the file size and estimated row size */
rowCountEstimate = Max(1, (double) resultSize / rowSizeEstimate);

View File

@ -41,10 +41,17 @@
#include "distributed/pg_dist_partition.h"
#include "distributed/shardinterval_utils.h"
#include "distributed/shard_pruning.h"
#if PG_VERSION_NUM >= 120000
#include "nodes/makefuncs.h"
#endif
#include "nodes/nodeFuncs.h"
#include "nodes/parsenodes.h"
#include "nodes/pg_list.h"
#if PG_VERSION_NUM >= 120000
#include "optimizer/optimizer.h"
#else
#include "optimizer/clauses.h"
#endif
bool EnableFastPathRouterPlanner = true;

View File

@ -15,7 +15,11 @@
#include "distributed/multi_master_planner.h"
#include "nodes/plannodes.h"
#if PG_VERSION_NUM >= 120000
#include "optimizer/optimizer.h"
#else
#include "optimizer/tlist.h"
#endif
/*

View File

@ -25,9 +25,13 @@
#include "distributed/multi_physical_planner.h"
#include "distributed/resource_lock.h"
#include "distributed/shard_pruning.h"
#if PG_VERSION_NUM >= 120000
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#endif
#include "nodes/nodes.h"
#include "nodes/pg_list.h"
#include "nodes/primnodes.h"
#include "nodes/nodes.h"
#include "optimizer/clauses.h"
#include "utils/array.h"
#include "utils/palloc.h"

View File

@ -309,10 +309,13 @@ GetRangeTblKind(RangeTblEntry *rte)
case RTE_JOIN:
case RTE_VALUES:
case RTE_CTE:
{
rteKind = (CitusRTEKind) rte->rtekind;
break;
}
#if PG_VERSION_NUM >= 120000
case RTE_RESULT:
#endif
{
rteKind = (CitusRTEKind) rte->rtekind;
break;
}
case RTE_FUNCTION:
{

View File

@ -17,6 +17,9 @@
#endif
#include "access/htup_details.h"
#include "access/stratnum.h"
#if PG_VERSION_NUM >= 120000
#include "access/table.h"
#endif
#include "catalog/pg_constraint.h"
#include "distributed/foreign_key_relationship.h"
#include "distributed/hash_helpers.h"

File diff suppressed because it is too large Load Diff

View File

@ -21,6 +21,13 @@
#include "access/genam.h"
#endif
#include "access/htup_details.h"
#if PG_VERSION_NUM >= 120000
#include "access/table.h"
#define heap_beginscan_catalog table_beginscan_catalog
#define TableHeapScanDesc TableScanDesc
#else
#define TableHeapScanDesc HeapScanDesc
#endif
#include "access/xact.h"
#include "catalog/dependency.h"
#include "catalog/pg_namespace.h"
@ -265,7 +272,7 @@ Datum
worker_cleanup_job_schema_cache(PG_FUNCTION_ARGS)
{
Relation pgNamespace = NULL;
HeapScanDesc scanDescriptor = NULL;
TableHeapScanDesc scanDescriptor = NULL;
ScanKey scanKey = NULL;
int scanKeyCount = 0;
HeapTuple heapTuple = NULL;

View File

@ -51,13 +51,12 @@ typedef enum CitusRTEKind
CITUS_RTE_SUBQUERY = RTE_SUBQUERY, /* subquery in FROM */
CITUS_RTE_JOIN = RTE_JOIN, /* join */
CITUS_RTE_FUNCTION = RTE_FUNCTION, /* function in FROM */
#if (PG_VERSION_NUM >= 100000)
CITUS_RTE_TABLEFUNC = RTE_TABLEFUNC, /* TableFunc(.., column list) */
#endif
CITUS_RTE_VALUES = RTE_VALUES, /* VALUES (<exprlist>), (<exprlist>), ... */
CITUS_RTE_CTE = RTE_CTE, /* common table expr (WITH list element) */
#if (PG_VERSION_NUM >= 100000)
CITUS_RTE_NAMEDTUPLESTORE = RTE_NAMEDTUPLESTORE, /* tuplestore, e.g. for triggers */
#if (PG_VERSION_NUM >= 120000)
CITUS_RTE_RESULT = RTE_RESULT, /* RTE represents an empty FROM clause */
#endif
CITUS_RTE_SHARD,
CITUS_RTE_REMOTE_QUERY