Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Pg14 support #5209

Merged
merged 104 commits into from
Sep 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
5aace9b
Enables Postgres 14 in configure
halilozanakgul Jul 29, 2021
7a27d7c
Adds copy of ruleutils_13.c as ruleutils_14.c
halilozanakgul Jul 29, 2021
1b6c834
Adds PG14 to version_compat.h and columnar_version_compat.h files
halilozanakgul Aug 10, 2021
63cdb4b
Adds AlterTableStmtObjType macro
halilozanakgul Aug 10, 2021
f933d2a
Includes defrem.h in index.c
halilozanakgul Aug 10, 2021
b790ecf
Introduces F_NEXTVAL_COMPAT macro
halilozanakgul Aug 11, 2021
4bc0c80
Adds index_delete_tuples instead of compute_xid_horizon_for_tuples
halilozanakgul Aug 11, 2021
3c10e0f
Introduces ROLE_MONITOR_COMPAT macro
halilozanakgul Aug 11, 2021
f8d3e50
Introduces STATUS_WAITING_COMPAT macro
halilozanakgul Aug 11, 2021
54ee938
Introduces getObjectTypeDescription_compat and getObjectIdentity_comp…
halilozanakgul Aug 11, 2021
347ae29
Introduces stats_compat macro for MemoryContextMethods->stats
halilozanakgul Aug 11, 2021
ebf1b7e
Introduces macros for functions that now have include_out_arguments a…
halilozanakgul Aug 12, 2021
37ae22c
Introduces macros for vacuum options
halilozanakgul Aug 12, 2021
8f34f84
Introduces IsReindexWithParam_compat macro
halilozanakgul Aug 13, 2021
35cfa5d
Introduces CopyFromState_compat macro
halilozanakgul Aug 13, 2021
db2d9af
Introduces BeginCopyFrom_compat macro
halilozanakgul Aug 13, 2021
5df6251
Removes CopyGetAttnums function definition for PG14
halilozanakgul Aug 11, 2021
82858ca
Introduces ProcessUtility macros for readOnlyTree parameter
halilozanakgul Aug 13, 2021
1d5053b
Removes support for old protocols in Copy functions from PG14
halilozanakgul Aug 14, 2021
e38b757
Fixes some indentation in ruleutils_14.c
halilozanakgul Aug 16, 2021
a710b3b
Removes some comments with printf %.*s format from ruleutils_14.c
halilozanakgul Aug 16, 2021
e642f6c
Removes support for postfix operators from ruleutils_14.c
halilozanakgul Aug 16, 2021
beb49f0
Updates AlternativeSubPlan comment in ruleutils_14.c
halilozanakgul Aug 16, 2021
69aa240
Adds for_each_from to ruleutils_14.c
halilozanakgul Aug 16, 2021
30f77b2
Fixes some appendStringInfos in ruleutils_14.c
halilozanakgul Aug 16, 2021
b4f7630
Updates F_ARRAY_UNNEST to F_UNNEST_ANYARRAY in ruleutils_14.c
halilozanakgul Aug 16, 2021
1cb865d
Adds SQL syntax function calls related changes to ruleutils_14.c
halilozanakgul Aug 16, 2021
d4874f5
Removes indexing.h header from ruleutils_14.c
halilozanakgul Aug 16, 2021
e72bd0c
Removes dependency.h from ruleutils_14.c
halilozanakgul Aug 16, 2021
71691ec
Adds HASH_STRINGS flag to ruleutils_14.c
halilozanakgul Aug 16, 2021
1174046
Adds bytea equivalents of ltrim() and rtrim() to ruleutils_14.c
halilozanakgul Aug 16, 2021
12b3c04
Adds SEARCH and CYCLE clauses to ruleutils_14.c
halilozanakgul Aug 16, 2021
5bb5385
Enhances cycle mark values at ruleutils_14.c
halilozanakgul Aug 16, 2021
af2853d
Adds GROUP BY DISTINCT to ruleutils_14.c
halilozanakgul Aug 16, 2021
c3f0528
Extends statistics on expressions in ruleutils_14.c
halilozanakgul Aug 16, 2021
f557bae
Adds JOIN ... USING alias to ruleutils_14.c
halilozanakgul Aug 16, 2021
131062d
Removes ModifyTable check from set_deparse_plan in ruleutils_14.c
halilozanakgul Aug 16, 2021
84f0be5
Adds EXTRACT cases to get_func_sql_syntax in ruleutils_14.c
halilozanakgul Aug 16, 2021
2990cfb
Adds SQL-standard function body support to ruleutils_14.c
halilozanakgul Aug 16, 2021
3b7bcf7
Adds missing include_out_argument parameter to func_get_detail in rul…
halilozanakgul Aug 16, 2021
86d9260
Uses lfirst_node in ruleutils_14.c
halilozanakgul Aug 16, 2021
b01e7e8
Pass NULL for plannerInfo as we don't generate PlaceHolderVars
halilozanakgul Aug 17, 2021
287706b
Introduces SetTuplestoreDestReceiverParams_compat macro
halilozanakgul Aug 17, 2021
898d3bb
Introduces proc_statusflags_compat macro
halilozanakgul Aug 17, 2021
cb3b76e
Introduces get_partition_parent_compat and RelationGetPartitionDesc_c…
halilozanakgul Aug 17, 2021
b644ac5
Introduces GetOldestNonRemovableTransactionId_compat macro
halilozanakgul Aug 17, 2021
fd2ca28
Introduces ExecSimpleRelationInsert_compat and modifyStateResultRelIn…
halilozanakgul Aug 18, 2021
b21a00e
Introduces index_insert_compat macro
halilozanakgul Aug 18, 2021
5930378
Renames shadowing ruleutils_14.c variables
halilozanakgul Aug 18, 2021
96833e2
Use HASH_STRINGS explicitly in hash functions
SaitTalhaNisanci Aug 18, 2021
29f5b99
Use empty string instead of NULL for queryString
SaitTalhaNisanci Aug 18, 2021
a1bfb4f
Fix unlimited copy size variable's value
SaitTalhaNisanci Aug 18, 2021
8ef94dc
Changes array_cat argument type from anyarray to anycompatiblearray
halilozanakgul Aug 18, 2021
abd3c10
Use oid_hash in write state management
SaitTalhaNisanci Aug 19, 2021
3f5c178
Remove VERBOSE output to make pg14 and pg13 output the same
SaitTalhaNisanci Aug 19, 2021
fb8671f
Change pg13 test to not differ with pg14 to avoid adding alternative …
SaitTalhaNisanci Aug 19, 2021
dc81cae
Turn off COSTS to avoid alternative output for pg14
SaitTalhaNisanci Aug 19, 2021
df9b714
Add some normalization rules for pg14
SaitTalhaNisanci Aug 19, 2021
256e7d1
Add alternative output for window_functions
SaitTalhaNisanci Aug 19, 2021
20c32a7
Add alternative output for multi_deparse_function
SaitTalhaNisanci Aug 19, 2021
9b6ce10
Removes password outputs from alter_role_propagation tests
halilozanakgul Aug 19, 2021
79d1b7d
add 14beta3 to CI
thanodnl Aug 19, 2021
f16d5e1
Introduces make_simple_restrictinfo_compat and pull_varnos_compat macros
halilozanakgul Aug 19, 2021
7823e49
Introduces pg_get_statisticsobj_worker_compat macro
halilozanakgul Aug 19, 2021
ca0d4c3
Includes pg_version_constants.h in columnar_version_compat.h
halilozanakgul Aug 19, 2021
375a1ad
Check if extversion is the same for seg extension
SaitTalhaNisanci Aug 20, 2021
6b65dbc
Add partition_wise_join to avoid big alternative output
SaitTalhaNisanci Aug 20, 2021
75fff14
Turn off VERBOSE to avoid alternative output
SaitTalhaNisanci Aug 20, 2021
f3fa133
Bind seg version to 1.3 in isolation_textension_commands
SaitTalhaNisanci Aug 20, 2021
aca2b8b
Add alternative output for isolation_master_update_node
SaitTalhaNisanci Aug 20, 2021
b632dd9
use pg14 image for pg upgrade tests
thanodnl Aug 20, 2021
9fc4c27
Readds deleted resultRelInfo changes for previos PG versions
halilozanakgul Aug 20, 2021
c31b0c2
Sets next_shard_id at partition_wise_join test
halilozanakgul Aug 20, 2021
cd402b6
Add alternative output for pg12 for window_functions
SaitTalhaNisanci Aug 21, 2021
7c0389a
Update propagate extension commands test for pg12
SaitTalhaNisanci Aug 21, 2021
d1c0403
Disable Query Idenfifier calculation in tests
SaitTalhaNisanci Aug 21, 2021
2656d88
Rewrite AppendColumnNames for Pg14
SaitTalhaNisanci Aug 23, 2021
e63302d
update error messages for libpq 14beta3
thanodnl Aug 23, 2021
e0faf34
turn off costs in columnar_indexes explain query
SaitTalhaNisanci Aug 24, 2021
e7607b6
Add a helper function to check explain has a single task
SaitTalhaNisanci Aug 24, 2021
96964ae
Turn off debug for one query to avoid adding an alternative output
SaitTalhaNisanci Aug 24, 2021
4b951a2
Add alternative output for multi-mx
SaitTalhaNisanci Aug 24, 2021
2fa1e5f
Use the default max_parallel_workers_per_gather for vanilla
SaitTalhaNisanci Aug 24, 2021
6ff609f
Add alternative output for data_types
SaitTalhaNisanci Aug 24, 2021
b16dadb
Avoid NOTICE message to avoid an alternative output with pg14
SaitTalhaNisanci Aug 24, 2021
bd501b4
Enable pg12-pg14 upgrade test
SaitTalhaNisanci Aug 24, 2021
a6c40eb
Fix multi_follower_dml
SaitTalhaNisanci Aug 25, 2021
c799d8c
add 14beta3 to CI
thanodnl Aug 19, 2021
307eb81
Fix failure for 1pc_copy_hash
SaitTalhaNisanci Aug 25, 2021
4e85d9f
Add empty pg14 sql file
SaitTalhaNisanci Aug 26, 2021
35a3f72
CHANGELOG: Allow REINDEX to change the tablespace of the new index
SaitTalhaNisanci Aug 26, 2021
6630378
Add option PROCESS_TOAST to VACUUM - PG14 #7cb3048 (#5219)
agedemenli Aug 31, 2021
c431bb2
Add support for "COPY dist/ref tables FROM" progress report
onderkalaci Aug 31, 2021
6fbdeb3
ALTER TABLE ... DETACH PARTITION ... CONCURRENTLY - PG14 #71f4c8c (#5…
agedemenli Sep 1, 2021
113d5d6
Adds support for column compression in table distribution
halilozanakgul Aug 31, 2021
1ff7186
Extended statistics on expressions - PG14 a4d75c8 (#5224)
agedemenli Sep 1, 2021
5844ab2
Support OUT parameters in procedure pushdown delegation
onderkalaci Sep 1, 2021
82a3b20
Fix flaky test
onderkalaci Sep 2, 2021
2b263f9
ALTER STATISTICS .. OWNER TO CURRENT_ROLE (#5225)
agedemenli Sep 2, 2021
2a2ebab
Add tests for jsonb subscripting (#5232)
SaitTalhaNisanci Sep 2, 2021
902af39
Add join alias tests (#5233)
SaitTalhaNisanci Sep 2, 2021
e1f5520
Adds propagation of ALTER TABLE .. ALTER COLUMN .. SET COMPRESSION ..
halilozanakgul Sep 1, 2021
0b67fcf
Fix style
SaitTalhaNisanci Aug 25, 2021
3ad3bbb
Apply latest version compat without conflicts
SaitTalhaNisanci Sep 3, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,10 @@ workflows:
name: build-13
pg_major: 13
image_tag: '13.4'
- build:
name: build-14
pg_major: 14
image_tag: '14beta3-dev202108191715'

- check-style
- check-sql-snapshots
Expand Down Expand Up @@ -600,13 +604,101 @@ workflows:
make: check-failure
requires: [build-13]

- test-citus:
name: 'test-14_check-multi'
pg_major: 14
image_tag: '14beta3-dev202108191715'
make: check-multi
requires: [build-14]
- test-citus:
name: 'test-14_check-multi-1'
pg_major: 14
image_tag: '14beta3-dev202108191715'
make: check-multi-1
requires: [build-14]
- test-citus:
name: 'test-14_check-mx'
pg_major: 14
image_tag: '14beta3-dev202108191715'
make: check-multi-mx
requires: [build-14]
- test-citus:
name: 'test-14_check-vanilla'
pg_major: 14
image_tag: '14beta3-dev202108191715'
make: check-vanilla
requires: [build-14]
- test-citus:
name: 'test-14_check-isolation'
pg_major: 14
image_tag: '14beta3-dev202108191715'
make: check-isolation
requires: [build-14]
- test-citus:
name: 'test-14_check-worker'
pg_major: 14
image_tag: '14beta3-dev202108191715'
make: check-worker
requires: [build-14]
- test-citus:
name: 'test-14_check-operations'
pg_major: 14
image_tag: '14beta3-dev202108191715'
make: check-operations
requires: [build-14]
- test-citus:
name: 'test-14_check-follower-cluster'
pg_major: 14
image_tag: '14beta3-dev202108191715'
make: check-follower-cluster
requires: [build-14]
- test-citus:
name: 'test-14_check-columnar'
pg_major: 14
image_tag: '14beta3-dev202108191715'
make: check-columnar
requires: [build-14]
- test-citus:
name: 'test-14_check-columnar-isolation'
pg_major: 14
image_tag: '14beta3-dev202108191715'
make: check-columnar-isolation
requires: [build-14]
- tap-test-citus:
name: 'test_14_tap-recovery'
pg_major: 14
image_tag: '14beta3-dev202108191715'
suite: recovery
requires: [build-14]
- test-citus:
name: 'test-14_check-failure'
pg_major: 14
image: citus/failtester
image_tag: '14beta3-dev202108191715'
make: check-failure
requires: [build-14]

- test-pg-upgrade:
name: 'test-12-13_check-pg-upgrade'
old_pg_major: 12
new_pg_major: 13
image_tag: '12.8-13.4'
requires: [build-12,build-13]

- test-pg-upgrade:
name: 'test-12-14_check-pg-upgrade'
old_pg_major: 12
new_pg_major: 14
image_tag: '12-13-14-dev202108191715'
requires: [build-12,build-14]

- test-pg-upgrade:
name: 'test-13-14_check-pg-upgrade'
old_pg_major: 13
new_pg_major: 14
image_tag: '12-13-14-dev202108191715'
requires: [build-13,build-14]

- test-citus-upgrade:
name: test-12_check-citus-upgrade
pg_major: 12
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ src/backend/distributed/utils/pg11_snprintf.c -citus-style
src/backend/distributed/deparser/ruleutils_11.c -citus-style
src/backend/distributed/deparser/ruleutils_12.c -citus-style
src/backend/distributed/deparser/ruleutils_13.c -citus-style
src/backend/distributed/deparser/ruleutils_14.c -citus-style
src/backend/distributed/commands/index_pg_source.c -citus-style

src/include/distributed/citus_nodes.h -citus-style
Expand Down
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -2555,7 +2555,7 @@ if test -z "$version_num"; then
as_fn_error $? "Could not detect PostgreSQL version from pg_config." "$LINENO" 5
fi

if test "$version_num" != '12' -a "$version_num" != '13'; then
if test "$version_num" != '12' -a "$version_num" != '13' -a "$version_num" != '14'; then
as_fn_error $? "Citus is not compatible with the detected PostgreSQL version ${version_num}." "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: building against PostgreSQL $version_num" >&5
Expand Down
2 changes: 1 addition & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ if test -z "$version_num"; then
AC_MSG_ERROR([Could not detect PostgreSQL version from pg_config.])
fi

if test "$version_num" != '12' -a "$version_num" != '13'; then
if test "$version_num" != '12' -a "$version_num" != '13' -a "$version_num" != '14'; then
AC_MSG_ERROR([Citus is not compatible with the detected PostgreSQL version ${version_num}.])
else
AC_MSG_NOTICE([building against PostgreSQL $version_num])
Expand Down
3 changes: 2 additions & 1 deletion src/backend/columnar/columnar_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "catalog/pg_type.h"
#include "distributed/pg_version_constants.h"
#include "distributed/tuplestore.h"
#include "distributed/version_compat.h"
#include "miscadmin.h"
#include "storage/fd.h"
#include "storage/smgr.h"
Expand Down Expand Up @@ -161,5 +162,5 @@ MemoryContextTotals(MemoryContext context, MemoryContextCounters *counters)
MemoryContextTotals(child, counters);
}

context->methods->stats(context, NULL, NULL, counters);
context->methods->stats_compat(context, NULL, NULL, counters, true);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: can use a variable for the true

}
24 changes: 20 additions & 4 deletions src/backend/columnar/columnar_metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ typedef struct
{
Relation rel;
EState *estate;
ResultRelInfo *resultRelInfo;
} ModifyState;

/* RowNumberLookupMode to be used in StripeMetadataLookupRowNumber */
Expand Down Expand Up @@ -1314,12 +1315,20 @@ StartModifyRelation(Relation rel)
{
EState *estate = create_estate_for_relation(rel);

#if PG_VERSION_NUM >= PG_VERSION_14
ResultRelInfo *resultRelInfo = makeNode(ResultRelInfo);
InitResultRelInfo(resultRelInfo, rel, 1, NULL, 0);
#else
ResultRelInfo *resultRelInfo = estate->es_result_relation_info;
#endif

/* ExecSimpleRelationInsert, ... require caller to open indexes */
ExecOpenIndices(estate->es_result_relation_info, false);
ExecOpenIndices(resultRelInfo, false);

ModifyState *modifyState = palloc(sizeof(ModifyState));
modifyState->rel = rel;
modifyState->estate = estate;
modifyState->resultRelInfo = resultRelInfo;

return modifyState;
}
Expand All @@ -1341,7 +1350,7 @@ InsertTupleAndEnforceConstraints(ModifyState *state, Datum *values, bool *nulls)
ExecStoreHeapTuple(tuple, slot, false);

/* use ExecSimpleRelationInsert to enforce constraints */
ExecSimpleRelationInsert(state->estate, slot);
ExecSimpleRelationInsert_compat(state->resultRelInfo, state->estate, slot);
}


Expand All @@ -1353,7 +1362,7 @@ static void
DeleteTupleAndEnforceConstraints(ModifyState *state, HeapTuple heapTuple)
{
EState *estate = state->estate;
ResultRelInfo *resultRelInfo = estate->es_result_relation_info;
ResultRelInfo *resultRelInfo = state->resultRelInfo;

ItemPointer tid = &(heapTuple->t_self);
simple_heap_delete(state->rel, tid);
Expand All @@ -1369,10 +1378,15 @@ DeleteTupleAndEnforceConstraints(ModifyState *state, HeapTuple heapTuple)
static void
FinishModifyRelation(ModifyState *state)
{
ExecCloseIndices(state->estate->es_result_relation_info);
ExecCloseIndices(state->resultRelInfo);

AfterTriggerEndQuery(state->estate);
#if PG_VERSION_NUM >= PG_VERSION_14
ExecCloseResultRelations(state->estate);
ExecCloseRangeTableRelations(state->estate);
#else
ExecCleanUpTriggerState(state->estate);
#endif
ExecResetTupleTable(state->estate->es_tupleTable, false);
FreeExecutorState(state->estate);

Expand Down Expand Up @@ -1401,12 +1415,14 @@ create_estate_for_relation(Relation rel)
rte->rellockmode = AccessShareLock;
ExecInitRangeTable(estate, list_make1(rte));

#if PG_VERSION_NUM < PG_VERSION_14
ResultRelInfo *resultRelInfo = makeNode(ResultRelInfo);
InitResultRelInfo(resultRelInfo, rel, 1, NULL, 0);

estate->es_result_relations = resultRelInfo;
estate->es_num_result_relations = 1;
estate->es_result_relation_info = resultRelInfo;
#endif

estate->es_output_cid = GetCurrentCommandId(true);

Expand Down
45 changes: 38 additions & 7 deletions src/backend/columnar/columnar_tableam.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ static void ColumnarTableAMObjectAccessHook(ObjectAccessType access, Oid classId
void *arg);
static void ColumnarProcessUtility(PlannedStmt *pstmt,
const char *queryString,
#if PG_VERSION_NUM >= PG_VERSION_14
bool readOnlyTree,
#endif
ProcessUtilityContext context,
ParamListInfo params,
struct QueryEnvironment *queryEnv,
Expand Down Expand Up @@ -634,6 +637,16 @@ columnar_tuple_satisfies_snapshot(Relation rel, TupleTableSlot *slot,
}


#if PG_VERSION_NUM >= PG_VERSION_14
static TransactionId
columnar_index_delete_tuples(Relation rel,
TM_IndexDeleteOp *delstate)
{
elog(ERROR, "columnar_index_delete_tuples not implemented");
}


#else
static TransactionId
columnar_compute_xid_horizon_for_tuples(Relation rel,
ItemPointerData *tids,
Expand All @@ -643,6 +656,9 @@ columnar_compute_xid_horizon_for_tuples(Relation rel,
}


#endif


static void
columnar_tuple_insert(Relation relation, TupleTableSlot *slot, CommandId cid,
int options, BulkInsertState bistate)
Expand Down Expand Up @@ -953,15 +969,15 @@ columnar_vacuum_rel(Relation rel, VacuumParams *params,
int elevel = (params->options & VACOPT_VERBOSE) ? INFO : DEBUG2;

/* this should have been resolved by vacuum.c until now */
Assert(params->truncate != VACOPT_TERNARY_DEFAULT);
Assert(params->truncate != VACOPTVALUE_UNSPECIFIED);

LogRelationStats(rel, elevel);

/*
* We don't have updates, deletes, or concurrent updates, so all we
* care for now is truncating the unused space at the end of storage.
*/
if (params->truncate == VACOPT_TERNARY_ENABLED)
if (params->truncate == VACOPTVALUE_ENABLED)
{
TruncateColumnar(rel, elevel);
}
Expand Down Expand Up @@ -1290,7 +1306,8 @@ columnar_index_build_range_scan(Relation columnarRelation,
if (!IsBootstrapProcessingMode() && !indexInfo->ii_Concurrent)
{
/* ignore lazy VACUUM's */
OldestXmin = GetOldestXmin(columnarRelation, PROCARRAY_FLAGS_VACUUM);
OldestXmin = GetOldestNonRemovableTransactionId_compat(columnarRelation,
PROCARRAY_FLAGS_VACUUM);
}

Snapshot snapshot = { 0 };
Expand Down Expand Up @@ -1636,8 +1653,8 @@ ColumnarReadMissingRowsIntoIndex(TableScanDesc scan, Relation indexRelation,
Relation columnarRelation = scan->rs_rd;
IndexUniqueCheck indexUniqueCheck =
indexInfo->ii_Unique ? UNIQUE_CHECK_YES : UNIQUE_CHECK_NO;
index_insert(indexRelation, indexValues, indexNulls, columnarItemPointer,
columnarRelation, indexUniqueCheck, indexInfo);
index_insert_compat(indexRelation, indexValues, indexNulls, columnarItemPointer,
columnarRelation, indexUniqueCheck, false, indexInfo);

validateIndexState->tups_inserted += 1;
}
Expand Down Expand Up @@ -1993,12 +2010,22 @@ ColumnarTableAMObjectAccessHook(ObjectAccessType access, Oid classId, Oid object
static void
ColumnarProcessUtility(PlannedStmt *pstmt,
const char *queryString,
#if PG_VERSION_NUM >= PG_VERSION_14
bool readOnlyTree,
#endif
ProcessUtilityContext context,
ParamListInfo params,
struct QueryEnvironment *queryEnv,
DestReceiver *dest,
QueryCompletionCompat *completionTag)
{
#if PG_VERSION_NUM >= PG_VERSION_14
if (readOnlyTree)
{
pstmt = copyObject(pstmt);
SaitTalhaNisanci marked this conversation as resolved.
Show resolved Hide resolved
}
#endif

Node *parsetree = pstmt->utilityStmt;

if (IsA(parsetree, IndexStmt))
Expand All @@ -2021,8 +2048,8 @@ ColumnarProcessUtility(PlannedStmt *pstmt,
RelationClose(rel);
}

PrevProcessUtilityHook(pstmt, queryString, context,
params, queryEnv, dest, completionTag);
PrevProcessUtilityHook_compat(pstmt, queryString, false, context,
params, queryEnv, dest, completionTag);
}


Expand Down Expand Up @@ -2096,7 +2123,11 @@ static const TableAmRoutine columnar_am_methods = {
.tuple_get_latest_tid = columnar_get_latest_tid,
.tuple_tid_valid = columnar_tuple_tid_valid,
.tuple_satisfies_snapshot = columnar_tuple_satisfies_snapshot,
#if PG_VERSION_NUM >= PG_VERSION_14
.index_delete_tuples = columnar_index_delete_tuples,
#else
.compute_xid_horizon_for_tuples = columnar_compute_xid_horizon_for_tuples,
#endif

.tuple_insert = columnar_tuple_insert,
.tuple_insert_speculative = columnar_tuple_insert_speculative,
Expand Down
4 changes: 3 additions & 1 deletion src/backend/columnar/write_state_management.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "access/tsmapi.h"
#if PG_VERSION_NUM >= 130000
#include "access/heaptoast.h"
#include "common/hashfn.h"
#else
#include "access/tuptoaster.h"
#endif
Expand Down Expand Up @@ -132,9 +133,10 @@ columnar_init_write_state(Relation relation, TupleDesc tupdesc,
"Column Store Write State Management Context",
ALLOCSET_DEFAULT_SIZES);
HASHCTL info;
uint32 hashFlags = (HASH_ELEM | HASH_CONTEXT);
uint32 hashFlags = (HASH_ELEM | HASH_FUNCTION | HASH_CONTEXT);
memset(&info, 0, sizeof(info));
info.keysize = sizeof(Oid);
info.hash = oid_hash;
info.entrysize = sizeof(WriteStateMapEntry);
info.hcxt = WriteStateContext;

Expand Down
Loading