Skip to content

Commit

Permalink
Drop postgres 11 support
Browse files Browse the repository at this point in the history
  • Loading branch information
SaitTalhaNisanci committed Mar 25, 2021
1 parent 7081690 commit 03832f3
Show file tree
Hide file tree
Showing 149 changed files with 1,136 additions and 17,424 deletions.
73 changes: 6 additions & 67 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ jobs:
make -C src/test/regress \
check-citus-upgrade \
bindir=/usr/lib/postgresql/${PG_MAJOR}/bin \
citus-pre-tar=/install-pg11-citus${citus_version}.tar \
citus-pre-tar=/install-pg${PG_MAJOR}-citus${citus_version}.tar \
citus-post-tar=/home/circleci/project/install-$PG_MAJOR.tar; \
done;
Expand All @@ -210,7 +210,7 @@ jobs:
make -C src/test/regress \
check-citus-upgrade-mixed \
bindir=/usr/lib/postgresql/${PG_MAJOR}/bin \
citus-pre-tar=/install-pg11-citus${citus_version}.tar \
citus-pre-tar=/install-pg${PG_MAJOR}-citus${citus_version}.tar \
citus-post-tar=/home/circleci/project/install-$PG_MAJOR.tar; \
done;
no_output_timeout: 2m
Expand Down Expand Up @@ -426,10 +426,6 @@ workflows:
ignore:
- /release-[0-9]+\.[0-9]+.*/ # match with releaseX.Y.*

- build:
name: build-11
pg_major: 11
image_tag: '11.9'
- build:
name: build-12
pg_major: 12
Expand All @@ -442,56 +438,6 @@ workflows:
- check-style
- check-sql-snapshots

- test-citus:
name: 'test-11_check-multi'
pg_major: 11
image_tag: '11.9'
make: check-multi
requires: [build-11]
- test-citus:
name: 'test-11_check-mx'
pg_major: 11
image_tag: '11.9'
make: check-multi-mx
requires: [build-11]
- test-citus:
name: 'test-11_check-vanilla'
pg_major: 11
image_tag: '11.9'
make: check-vanilla
requires: [build-11]
- test-citus:
name: 'test-11_check-isolation'
pg_major: 11
image_tag: '11.9'
make: check-isolation
requires: [build-11]
- test-citus:
name: 'test-11_check-worker'
pg_major: 11
image_tag: '11.9'
make: check-worker
requires: [build-11]
- test-citus:
name: 'test-11_check-operations'
pg_major: 11
image_tag: '11.9'
make: check-operations
requires: [build-11]
- test-citus:
name: 'test-11_check-follower-cluster'
pg_major: 11
image_tag: '11.9'
make: check-follower-cluster
requires: [build-11]
- test-citus:
name: 'test-11_check-failure'
pg_major: 11
image: citus/failtester
image_tag: '11.9'
make: check-failure
requires: [build-11]

- test-citus:
name: 'test-12_check-multi'
pg_major: 12
Expand Down Expand Up @@ -628,13 +574,6 @@ workflows:
make: check-failure
requires: [build-13]

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

- test-pg-upgrade:
name: 'test-12-13_check-pg-upgrade'
old_pg_major: 12
Expand All @@ -643,10 +582,10 @@ workflows:
requires: [build-12,build-13]

- test-citus-upgrade:
name: test-11_check-citus-upgrade
pg_major: 11
image_tag: '11.9'
requires: [build-11]
name: test-12_check-citus-upgrade
pg_major: 12
image_tag: '12.4'
requires: [build-12]

- ch_benchmark:
requires: [build-13]
Expand Down
11 changes: 2 additions & 9 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -2556,7 +2556,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" != '11' -a "$version_num" != '12' -a "$version_num" != '13'; then
if test "$version_num" != '12' -a "$version_num" != '13'; 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 Expand Up @@ -4533,16 +4533,9 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
if test "$version_num" != '11'; then
HAS_TABLEAM=yes
HAS_TABLEAM=yes
$as_echo "#define HAS_TABLEAM 1" >>confdefs.h
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: postgres version does not support table access methods" >&5
$as_echo "$as_me: postgres version does not support table access methods" >&6;}
fi;
# Require lz4 & zstd only if we are compiling columnar
if test "$HAS_TABLEAM" == 'yes'; then
#
Expand Down
10 changes: 3 additions & 7 deletions 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" != '11' -a "$version_num" != '12' -a "$version_num" != '13'; then
if test "$version_num" != '12' -a "$version_num" != '13'; 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 Expand Up @@ -216,12 +216,8 @@ PGAC_ARG_REQ(with, reports-hostname, [HOSTNAME],
AC_DEFINE_UNQUOTED(REPORTS_BASE_URL, "$REPORTS_BASE_URL",
[Base URL for statistics collection and update checks])

if test "$version_num" != '11'; then
HAS_TABLEAM=yes
AC_DEFINE([HAS_TABLEAM], 1, [Define to 1 to build with table access method support, pg12 and up])
else
AC_MSG_NOTICE([postgres version does not support table access methods])
fi;
HAS_TABLEAM=yes
AC_DEFINE([HAS_TABLEAM], 1, [Define to 1 to build with table access method support, pg12 and up])

# Require lz4 & zstd only if we are compiling columnar
if test "$HAS_TABLEAM" == 'yes'; then
Expand Down
20 changes: 6 additions & 14 deletions src/backend/columnar/columnar_compression.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,8 @@ DecompressBuffer(StringInfo buffer,

case COMPRESSION_PG_LZ:
{
StringInfo decompressedBuffer = NULL;
uint32 compressedDataSize = VARSIZE(buffer->data) - COLUMNAR_COMPRESS_HDRSZ;
uint32 decompressedDataSize = COLUMNAR_COMPRESS_RAWSIZE(buffer->data);
int32 decompressedByteCount = 0;

if (compressedDataSize + COLUMNAR_COMPRESS_HDRSZ != buffer->len)
{
Expand All @@ -240,25 +238,19 @@ DecompressBuffer(StringInfo buffer,

char *decompressedData = palloc0(decompressedDataSize);

#if PG_VERSION_NUM >= 120000
decompressedByteCount = pglz_decompress(COLUMNAR_COMPRESS_RAWDATA(
buffer->data),
compressedDataSize, decompressedData,
decompressedDataSize, true);
#else
decompressedByteCount = pglz_decompress(COLUMNAR_COMPRESS_RAWDATA(
buffer->data),
compressedDataSize, decompressedData,
decompressedDataSize);
#endif
int32 decompressedByteCount = pglz_decompress(COLUMNAR_COMPRESS_RAWDATA(
buffer->data),
compressedDataSize,
decompressedData,
decompressedDataSize, true);

if (decompressedByteCount < 0)
{
ereport(ERROR, (errmsg("cannot decompress the buffer"),
errdetail("compressed data is corrupted")));
}

decompressedBuffer = palloc0(sizeof(StringInfoData));
StringInfo decompressedBuffer = palloc0(sizeof(StringInfoData));
decompressedBuffer->data = decompressedData;
decompressedBuffer->len = decompressedDataSize;
decompressedBuffer->maxlen = decompressedDataSize;
Expand Down
7 changes: 1 addition & 6 deletions src/backend/columnar/columnar_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,9 @@ PG_FUNCTION_INFO_V1(column_store_memory_stats);
Datum
column_store_memory_stats(PG_FUNCTION_ARGS)
{
TupleDesc tupleDescriptor = NULL;
const int resultColumnCount = 3;

#if PG_VERSION_NUM >= PG_VERSION_12
tupleDescriptor = CreateTemplateTupleDesc(resultColumnCount);
#else
tupleDescriptor = CreateTemplateTupleDesc(resultColumnCount, false);
#endif
TupleDesc tupleDescriptor = CreateTemplateTupleDesc(resultColumnCount);

TupleDescInitEntry(tupleDescriptor, (AttrNumber) 1, "TopMemoryContext",
INT8OID, -1, 0);
Expand Down
20 changes: 1 addition & 19 deletions src/backend/columnar/columnar_metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -1067,15 +1067,10 @@ InsertTupleAndEnforceConstraints(ModifyState *state, Datum *values, bool *nulls)
TupleDesc tupleDescriptor = RelationGetDescr(state->rel);
HeapTuple tuple = heap_form_tuple(tupleDescriptor, values, nulls);

#if PG_VERSION_NUM >= 120000
TupleTableSlot *slot = ExecInitExtraTupleSlot(state->estate, tupleDescriptor,
&TTSOpsHeapTuple);

ExecStoreHeapTuple(tuple, slot, false);
#else
TupleTableSlot *slot = ExecInitExtraTupleSlot(state->estate, tupleDescriptor);
ExecStoreTuple(tuple, slot, InvalidBuffer, false);
#endif

/* use ExecSimpleRelationInsert to enforce constraints */
ExecSimpleRelationInsert(state->estate, slot);
Expand Down Expand Up @@ -1127,20 +1122,16 @@ FinishModifyRelation(ModifyState *state)
static EState *
create_estate_for_relation(Relation rel)
{
ResultRelInfo *resultRelInfo;

EState *estate = CreateExecutorState();

RangeTblEntry *rte = makeNode(RangeTblEntry);
rte->rtekind = RTE_RELATION;
rte->relid = RelationGetRelid(rel);
rte->relkind = rel->rd_rel->relkind;
#if PG_VERSION_NUM >= 120000
rte->rellockmode = AccessShareLock;
ExecInitRangeTable(estate, list_make1(rte));
#endif

resultRelInfo = makeNode(ResultRelInfo);
ResultRelInfo *resultRelInfo = makeNode(ResultRelInfo);
InitResultRelInfo(resultRelInfo, rel, 1, NULL, 0);

estate->es_result_relations = resultRelInfo;
Expand All @@ -1149,15 +1140,6 @@ create_estate_for_relation(Relation rel)

estate->es_output_cid = GetCurrentCommandId(true);

#if PG_VERSION_NUM < 120000

/* Triggers might need a slot */
if (resultRelInfo->ri_TrigDesc)
{
estate->es_trig_tuple_slot = ExecInitExtraTupleSlot(estate, NULL);
}
#endif

/* Prepare to catch AFTER triggers. */
AfterTriggerBeginQuery();

Expand Down
5 changes: 1 addition & 4 deletions src/backend/columnar/columnar_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@
#include "commands/defrem.h"
#include "distributed/listutils.h"
#include "nodes/makefuncs.h"
#if PG_VERSION_NUM >= 120000
#include "nodes/nodeFuncs.h"
#include "optimizer/optimizer.h"
#else
#include "optimizer/clauses.h"
#include "optimizer/predtest.h"
#endif
#include "optimizer/restrictinfo.h"
#include "storage/fd.h"
#include "utils/guc.h"
#include "utils/memutils.h"
Expand Down
9 changes: 0 additions & 9 deletions src/backend/distributed/commands/alter_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,6 @@ AlterDistributedTable(TableConversionParameters *params)
TableConversionReturn *
AlterTableSetAccessMethod(TableConversionParameters *params)
{
#if PG_VERSION_NUM < PG_VERSION_12
ereport(ERROR, (errmsg("table access methods are not supported "
"for Postgres versions earlier than 12")));
#endif

EnsureRelationExists(params->relationId);
EnsureTableOwner(params->relationId);

Expand Down Expand Up @@ -963,7 +958,6 @@ CreateTableConversion(TableConversionParameters *params)
BuildDistributionKeyFromColumnName(relation, con->distributionColumn);

con->originalAccessMethod = NULL;
#if PG_VERSION_NUM >= PG_VERSION_12
if (!PartitionedTable(con->relationId))
{
HeapTuple amTuple = SearchSysCache1(AMOID, ObjectIdGetDatum(
Expand All @@ -977,7 +971,6 @@ CreateTableConversion(TableConversionParameters *params)
con->originalAccessMethod = NameStr(amForm->amname);
ReleaseSysCache(amTuple);
}
#endif


con->colocatedTableList = NIL;
Expand Down Expand Up @@ -1296,12 +1289,10 @@ GetNonGeneratedStoredColumnNameList(Oid relationId)
continue;
}

#if PG_VERSION_NUM >= 120000
if (currentColumn->attgenerated == ATTRIBUTE_GENERATED_STORED)
{
continue;
}
#endif

const char *quotedColumnName = quote_identifier(NameStr(currentColumn->attname));
nonStoredColumnNameList = lappend(nonStoredColumnNameList,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@

#include "distributed/pg_version_constants.h"

#if (PG_VERSION_NUM < PG_VERSION_12)
#include "access/htup_details.h"
#endif
#include "access/xact.h"
#include "catalog/pg_constraint.h"
#include "distributed/commands/utility_hook.h"
Expand Down
Loading

0 comments on commit 03832f3

Please sign in to comment.