Skip to content

Commit

Permalink
Remove HAS_TABLEAM config since we dropped pg11 support (#4862)
Browse files Browse the repository at this point in the history
* Remove HAS_TABLEAM config

* Drop columnar_ensure_objects_exist

* Not call columnar_ensure_objects_exist in citus_finish_pg_upgrade
  • Loading branch information
onurctirtir committed Apr 13, 2021
1 parent 716cc62 commit fe5c985
Show file tree
Hide file tree
Showing 21 changed files with 192 additions and 124 deletions.
2 changes: 0 additions & 2 deletions Makefile.global.in
Expand Up @@ -93,7 +93,5 @@ endif
override CPPFLAGS := @CPPFLAGS@ @CITUS_CPPFLAGS@ -I '${citus_abs_top_srcdir}/src/include' -I'${citus_top_builddir}/src/include' $(CPPFLAGS)
override LDFLAGS += @LDFLAGS@ @CITUS_LDFLAGS@

HAS_TABLEAM:=@HAS_TABLEAM@

# optional file with user defined, additional, rules
-include ${citus_abs_srcdir}/src/Makefile.custom
62 changes: 26 additions & 36 deletions configure
Expand Up @@ -622,7 +622,6 @@ ac_includes_default="\

ac_subst_vars='LTLIBOBJS
LIBOBJS
HAS_TABLEAM
HAS_DOTGIT
POSTGRES_BUILDDIR
POSTGRES_SRCDIR
Expand Down Expand Up @@ -4533,14 +4532,9 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
HAS_TABLEAM=yes
$as_echo "#define HAS_TABLEAM 1" >>confdefs.h
# Require lz4 & zstd only if we are compiling columnar
if test "$HAS_TABLEAM" == 'yes'; then
#
# LZ4
#
#
# LZ4
#
Expand All @@ -4567,8 +4561,8 @@ fi
if test "$with_lz4" = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LZ4_compress_default in -llz4" >&5
if test "$with_lz4" = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LZ4_compress_default in -llz4" >&5
$as_echo_n "checking for LZ4_compress_default in -llz4... " >&6; }
if ${ac_cv_lib_lz4_LZ4_compress_default+:} false; then :
$as_echo_n "(cached) " >&6
Expand Down Expand Up @@ -4613,27 +4607,27 @@ _ACEOF
else
as_fn_error $? "lz4 library not found
If you have lz4 installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-lz4 to disable lz4 support." "$LINENO" 5
If you have lz4 installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-lz4 to disable lz4 support." "$LINENO" 5
fi
ac_fn_c_check_header_mongrel "$LINENO" "lz4.h" "ac_cv_header_lz4_h" "$ac_includes_default"
ac_fn_c_check_header_mongrel "$LINENO" "lz4.h" "ac_cv_header_lz4_h" "$ac_includes_default"
if test "x$ac_cv_header_lz4_h" = xyes; then :
else
as_fn_error $? "lz4 header not found
If you have lz4 already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-lz4 to disable lz4 support." "$LINENO" 5
If you have lz4 already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-lz4 to disable lz4 support." "$LINENO" 5
fi
fi
fi
#
# ZSTD
#
#
# ZSTD
#
Expand All @@ -4660,8 +4654,8 @@ fi
if test "$with_zstd" = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ZSTD_decompress in -lzstd" >&5
if test "$with_zstd" = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ZSTD_decompress in -lzstd" >&5
$as_echo_n "checking for ZSTD_decompress in -lzstd... " >&6; }
if ${ac_cv_lib_zstd_ZSTD_decompress+:} false; then :
$as_echo_n "(cached) " >&6
Expand Down Expand Up @@ -4706,25 +4700,23 @@ _ACEOF
else
as_fn_error $? "zstd library not found
If you have zstd installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-zstd to disable zstd support." "$LINENO" 5
If you have zstd installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-zstd to disable zstd support." "$LINENO" 5
fi
ac_fn_c_check_header_mongrel "$LINENO" "zstd.h" "ac_cv_header_zstd_h" "$ac_includes_default"
ac_fn_c_check_header_mongrel "$LINENO" "zstd.h" "ac_cv_header_zstd_h" "$ac_includes_default"
if test "x$ac_cv_header_zstd_h" = xyes; then :
else
as_fn_error $? "zstd header not found
If you have zstd already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-zstd to disable zstd support." "$LINENO" 5
If you have zstd already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-zstd to disable zstd support." "$LINENO" 5
fi
fi
fi # test "$HAS_TABLEAM" == 'yes'
fi
Expand Down Expand Up @@ -4852,8 +4844,6 @@ POSTGRES_BUILDDIR="$POSTGRES_BUILDDIR"
HAS_DOTGIT="$HAS_DOTGIT"
HAS_TABLEAM="$HAS_TABLEAM"
ac_config_files="$ac_config_files Makefile.global"
Expand Down
82 changes: 37 additions & 45 deletions configure.in
Expand Up @@ -216,50 +216,43 @@ PGAC_ARG_REQ(with, reports-hostname, [HOSTNAME],
AC_DEFINE_UNQUOTED(REPORTS_BASE_URL, "$REPORTS_BASE_URL",
[Base URL for statistics collection and update checks])

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
#
# LZ4
#
PGAC_ARG_BOOL(with, lz4, yes,
[do not use lz4])
AC_SUBST(with_lz4)

if test "$with_lz4" = yes; then
AC_CHECK_LIB(lz4, LZ4_compress_default, [],
[AC_MSG_ERROR([lz4 library not found
If you have lz4 installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-lz4 to disable lz4 support.])])
AC_CHECK_HEADER(lz4.h, [], [AC_MSG_ERROR([lz4 header not found
If you have lz4 already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-lz4 to disable lz4 support.])])
fi

#
# ZSTD
#
PGAC_ARG_BOOL(with, zstd, yes,
[do not use zstd])
AC_SUBST(with_zstd)

if test "$with_zstd" = yes; then
AC_CHECK_LIB(zstd, ZSTD_decompress, [],
[AC_MSG_ERROR([zstd library not found
If you have zstd installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-zstd to disable zstd support.])])
AC_CHECK_HEADER(zstd.h, [], [AC_MSG_ERROR([zstd header not found
If you have zstd already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-zstd to disable zstd support.])])
fi

fi # test "$HAS_TABLEAM" == 'yes'
#
# LZ4
#
PGAC_ARG_BOOL(with, lz4, yes,
[do not use lz4])
AC_SUBST(with_lz4)

if test "$with_lz4" = yes; then
AC_CHECK_LIB(lz4, LZ4_compress_default, [],
[AC_MSG_ERROR([lz4 library not found
If you have lz4 installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-lz4 to disable lz4 support.])])
AC_CHECK_HEADER(lz4.h, [], [AC_MSG_ERROR([lz4 header not found
If you have lz4 already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-lz4 to disable lz4 support.])])
fi

#
# ZSTD
#
PGAC_ARG_BOOL(with, zstd, yes,
[do not use zstd])
AC_SUBST(with_zstd)

if test "$with_zstd" = yes; then
AC_CHECK_LIB(zstd, ZSTD_decompress, [],
[AC_MSG_ERROR([zstd library not found
If you have zstd installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-zstd to disable zstd support.])])
AC_CHECK_HEADER(zstd.h, [], [AC_MSG_ERROR([zstd header not found
If you have zstd already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-zstd to disable zstd support.])])
fi


PGAC_ARG_BOOL(with, security-flags, no,
Expand Down Expand Up @@ -296,7 +289,6 @@ AC_SUBST(CITUS_LDFLAGS, "$LIBS $CITUS_LDFLAGS")
AC_SUBST(POSTGRES_SRCDIR, "$POSTGRES_SRCDIR")
AC_SUBST(POSTGRES_BUILDDIR, "$POSTGRES_BUILDDIR")
AC_SUBST(HAS_DOTGIT, "$HAS_DOTGIT")
AC_SUBST(HAS_TABLEAM, "$HAS_TABLEAM")

AC_CONFIG_FILES([Makefile.global])
AC_CONFIG_HEADERS([src/include/citus_config.h] [src/include/citus_version.h])
Expand Down
4 changes: 0 additions & 4 deletions src/backend/columnar/columnar_customscan.c
Expand Up @@ -11,7 +11,6 @@
*/

#include "citus_version.h"
#if HAS_TABLEAM

#include "postgres.h"

Expand Down Expand Up @@ -495,6 +494,3 @@ ColumnarScan_ExplainCustomScan(CustomScanState *node, List *ancestors,
chunkGroupsFiltered, es);
}
}


#endif /* HAS_TABLEAM */
2 changes: 0 additions & 2 deletions src/backend/columnar/columnar_metadata.c
Expand Up @@ -1393,7 +1393,6 @@ columnar_relation_storageid(PG_FUNCTION_ARGS)
{
uint64 storageId = -1;

#if HAS_TABLEAM
Oid relationId = PG_GETARG_OID(0);
Relation relation = relation_open(relationId, AccessShareLock);
if (IsColumnarTableAmTable(relationId))
Expand All @@ -1406,7 +1405,6 @@ columnar_relation_storageid(PG_FUNCTION_ARGS)
}

relation_close(relation, AccessShareLock);
#endif

PG_RETURN_INT64(storageId);
}
4 changes: 0 additions & 4 deletions src/backend/columnar/columnar_tableam.c
@@ -1,5 +1,4 @@
#include "citus_version.h"
#if HAS_TABLEAM

#include "postgres.h"

Expand Down Expand Up @@ -1810,6 +1809,3 @@ alter_columnar_table_reset(PG_FUNCTION_ARGS)

PG_RETURN_VOID();
}


#endif
6 changes: 0 additions & 6 deletions src/backend/columnar/mod.c
Expand Up @@ -20,24 +20,18 @@
#include "columnar/columnar.h"
#include "columnar/mod.h"

#ifdef HAS_TABLEAM
#include "columnar/columnar_tableam.h"
#endif

void
columnar_init(void)
{
columnar_init_gucs();
#ifdef HAS_TABLEAM
columnar_tableam_init();
#endif
}


void
columnar_fini(void)
{
#if HAS_TABLEAM
columnar_tableam_finish();
#endif
}
4 changes: 4 additions & 0 deletions src/backend/columnar/sql/columnar--10.0-3--10.1-1.sql
Expand Up @@ -16,3 +16,7 @@ ALTER TABLE columnar.chunk_group DROP CONSTRAINT chunk_group_storage_id_fkey;
$$;
END IF;
END$proc$;

-- since we dropped pg11 support, we don't need to worry about missing
-- columnar objects when upgrading postgres
DROP FUNCTION citus_internal.columnar_ensure_objects_exist();
Expand Up @@ -8,3 +8,6 @@ REFERENCES columnar.chunk_group(storage_id, stripe_num, chunk_group_num) ON DELE
ALTER TABLE columnar.chunk_group
ADD FOREIGN KEY (storage_id, stripe_num)
REFERENCES columnar.stripe(storage_id, stripe_num) ON DELETE CASCADE;

-- define columnar_ensure_objects_exist again
#include "../udfs/columnar_ensure_objects_exist/10.0-1.sql"
7 changes: 0 additions & 7 deletions src/backend/columnar/write_state_management.c
Expand Up @@ -4,7 +4,6 @@
#include "postgres.h"
#include "columnar/columnar.h"

#if HAS_TABLEAM

#include <math.h>

Expand Down Expand Up @@ -378,18 +377,12 @@ PendingWritesInUpperTransactions(Oid relfilenode, SubTransactionId currentSubXid
}


#endif

/*
* GetWriteContextForDebug exposes WriteStateContext for debugging
* purposes.
*/
extern MemoryContext
GetWriteContextForDebug(void)
{
#if HAS_TABLEAM
return WriteStateContext;
#else
return NULL;
#endif
}
2 changes: 0 additions & 2 deletions src/backend/distributed/commands/alter_table.c
Expand Up @@ -682,7 +682,6 @@ ConvertTable(TableConversionState *con)
}

/* set columnar options */
#if HAS_TABLEAM
if (con->accessMethod == NULL && con->originalAccessMethod &&
strcmp(con->originalAccessMethod, "columnar") == 0)
{
Expand All @@ -702,7 +701,6 @@ ConvertTable(TableConversionState *con)

ExecuteQueryViaSPI(columnarOptionsSql, SPI_OK_SELECT);
}
#endif

con->newRelationId = get_relname_relid(con->tempName, con->schemaId);

Expand Down
1 change: 1 addition & 0 deletions src/backend/distributed/sql/citus--10.0-3--10.1-1.sql
Expand Up @@ -2,3 +2,4 @@

#include "../../columnar/sql/columnar--10.0-3--10.1-1.sql"
#include "udfs/create_distributed_table/10.1-1.sql";
#include "udfs/citus_finish_pg_upgrade/10.1-1.sql"
Expand Up @@ -15,3 +15,5 @@ COMMENT ON FUNCTION create_distributed_table(table_name regclass,
distribution_type citus.distribution_type,
colocate_with text)
IS 'creates a distributed table';

#include "../udfs/citus_finish_pg_upgrade/10.0-1.sql"

0 comments on commit fe5c985

Please sign in to comment.