Add a CMake option to add the PostgreSQL source directory as a system
include for the build system. This will ensure that the PG source
include directory will end up in a generated `compile_commands.json`,
which can be used by language servers (e.g., clangd) to navigate from
the TimescaleDB source directly to the PostgreSQL source.
This will move the definitions of `debug_waitpoint_enable`,
`debug_waitpoint_disable`, and `debug_waitpoint_id` to always be
defined for debug builds and modify existing tests accordingly.
This means that it is no longer necessary to generate isolation test
files from templates (in most cases), and it will be straightforward to
use these functions in debug builds.
The debug utilities can be disabled by setting the option
`ENABLE_DEBUG_UTILS` to `OFF`.
The cmake call to "find_package(OpenSSL)" on windows may set the
variable OPENSSL_LIBRARIES to a non-standard list which might include
non path items such as "debug", "optimized". These non-standard
elements in the list would cause the link failure with error
"LNK1104".
Fix:
Check and retain only valid paths in OPENSSL_LIBRARIES list.
closes#407
Use explicit version checks to decide whether to define backported
RelationGetSmgr function or rely on the function being available.
This simplifies the cmake code a bit and make the backporting similar
to how we handle this for other functions.
We were using mismatched compiler and gcov, which led to either
segfaults or errors like "GCOV_TAG_COUNTER_ARCS mismatch". Add some
cmake code that tries to find the gcov that matches the compiler.
This should hopefully fix some of the mysterious missing coverage
problems that we've been experiencing for a while.
RelationGetSmgr was backported by upstream to the STABLE branches
but is not yet available in any released version so we cannot use
pg version to determine presence of RelationGetSmgr.
Look for the binary with exact version before looking for the
generic name to prevent failure when clang-format is lower then
required version but clang-format-14 exists.
The only configuration we're missing is the newline for braces after
case labels. The rest of the differences looks like bugs/omissions of
the version 8 that we use now.
Require clang-format-14 in cmake and use it in the CI check. We can't
support versions earlier than 14 because they have some
formatting differences that can't be configured.
When the build directory was not a child of the source directory
fetching the git information about the current commit would fail
leading to this information not being included in the executable
which in turn resulted in failing tests.
The commands for generating gitcommit.h need to be executed on every make
run and not on cmake run to detect branch switches, commit changes or local
modifications. That's why we add the commands in a custom target and run
them on every make run. We do the generation part in a temporary file
and only overwrite the actual file when the content is different to not
trigger unnecessary recompilations.
We parse apart the output of `pg_config --configure` to see whether or
not OpenSSL is enabled. This is a bit brittle; it has broken in the past
with the change from --with-openssl to --with-ssl, and upstream is
currently testing a change to the build system (Meson, which doesn't
rely on autotools during configuration) that is likely to further
interfere with this approach.
As an alternative, we can just look at the header files to get this
information. USE_OPENSSL is not defined in pg_config.h if SSL support
is not compiled in.
cmake > 3.10 is not packaged for some of the platforms we build
packages eg old ubuntu and debian version. Currently we modify
the CMakeLists.txt in those build environments and set the
minimum version to 3.10 already, which proofes that timescaledb
builds fine with cmake 3.10.
Add option `USE_TELEMETRY` that can be used to exclude telemetry from
the compile.
Telemetry-specific SQL is moved, which is only included when extension
is compiled with telemetry and the notice is changed so that the
message about telemetry is not printed when Telemetry is not compiled
in.
The following code is not compiled in when telemetry is not used:
- Cross-module functions for telemetry.
- Checks for telemetry job in job execution.
- GUC variables `telemetry_level` and `telemetry_cloud`.
Telemetry subsystem is not included when compiling without telemetry,
which requires some functions to be moved out of the telemetry
subsystem:
- Metadata handling is moved out of the telemetry module since it is
used not only with telemetry.
- UUID functions are moved into a separate module instead of being
part of the telemetry subsystem.
- Telemetry functions are either added or removed when updating from a
previous version.
Tests are updated to:
- Not use telemetry functions to get UUID or Metadata and instead use
the moved UUID and metadata functions.
- Not include telemetry information in tests that do not require it.
- Configuration files do not set telemetry variables when telemetry is
not compiled in.
- Replaced usage of telemetry functions in non-telemetry tests with
other sources of same information.
Fixes#3931
PG14 introduced an alternative way to specify for postgres to be
built with openssl support. --with-ssl=openssl may be used instead
of --with-openssl. This patch adjusts our openssl check to detect
both versions.
https://github.com/postgres/postgres/commit/fe61df7f82
Today was another time I used `#if PG14_LT` but forgot to include
compat.h, spent a good deal of time debugging this. This flag will
catch references to undefined macros.
This change makes the build fail on macos-* if clang-tidy detects any bugs.
This improves our process in two ways.
Firstly, currently we execute clang-tidy on macos-* but ignore the warnings.
As a result we waste CPU resources. Also, somebody who uses MacOS has to fix
the warnings manually while this could be done by the person who introduced
corresponding changes.
Secondly, running clang-tidy on a laptop is relatively expensive. This change
allows to disable clang-tidy locally and speed up the development process.
Some of the downgrade script files were only added to the release
branch and no downgrade path existed for downgrading from the 2.4.2
release to the 2.4.1 release.
Add the missing downgrade files for 2.4.x releases to the main
development branch.
Also, avoid generating downgrade scripts for old versions, so that
only the downgrade script for the current version is generated by
default. A new CMake option `GENERATE_OLD_DOWNGRADE_SCRIPTS` is added
to control this behavior. Note that `GENERATE_DOWNGRADE_SCRIPT` needs
to be `ON` for the new option to work.
The reason we want to keep the ability to generate old downgrade
scripts is to be able to fix bugs in old downgrade scripts.
If tools like `pg_regress` or `pg_isolation_regress` are not found, an
error is generated telling you that you need to disable the tests
explicitly using `REGRESS_CHECKS`. This is an inconvenience for the
user since in most cases you just want to build the system with what
you have.
This commit changes that by automatically disabling regression tests,
isolation tests, TAP tests, and formatting targets when tools cannot be
found, which means that users do not normally have to disable tests
explicitly. A notice is still printed that the targets are not added.
In addition, the commit adds an option `REQUIRE_ALL_TESTS` for the rare
case when you want to make sure that all tests are indeed executed (for
example, in CI runs), which by default is off.
The regex expected a trailing version like `-rc1` or `-dev` but only
the non-dash part was optional. This correct the regex to ensure that
the entire trailing part is optional.
During an update, it is not possible to run the downgrade scripts until
the release has been tagged, but the update scripts can be run. This
means that we need to split the previous version into two different
fields: one for running the update tests and one for running the
downgrade tests.
If `clang-format` is not found `CLANG_FORMAT` will be set to a false
value, which will prevent the `format` target from being defined if
`cmake-format` is not installed.
This commit fixes that by always creating a `format` target since
`clang-format` is always created even if `CLANG_FORMAT` is false.
We do not redefine `CLANG_FORMAT` to a non-false value since it is
expected to contain a path to an executable and if set to a true value
that is not a path it could be used in a way that leads to strange
errors.
This patch adds a new EXPERIMENTAL flag to cmake allowing skipping
the check for a compatible postgres version. It also adds macros
needed for PG14 support.
This commit add functions and code to generate a downgrade script from
the current version to the previous version. This requires execution
from a Git repository since it retrieves the prolog and epilog for the
"downgrade" file from the version given by `update_from_version` in the
`version.config` file.
The commit adds several CMake functions that simplifies the composition
of script files, but these are not used to generate the update scripts.
A potential improvement is to use the scripts to also generate the
update scripts.
This commit supports generating a downgrade script from the
current version to the previous version. Other versions are handled
using a variable containing file names of reverse update
scripts and the source and target version is extracted from the file
names, which is assumed to be of the form
`<source-version>--<target-version>.sql`.
In addition to adding support for generating downgrade scripts, the
commit adds a downgrade test file that tests a release in a similar way
to the update script and adds it as a workflow.
Add a workflow to check that CMake files are correctly formatted as
well as a custom target to format CMake files in the repository. This
commit also runs the formatting on all CMake files in the repository.
CMake now detects if the necessary prerequisites for running TAP
tests are installed on the local system. This includes perl
installation and other dependencies, such as the IPC::Run module and
prove binary.