130 Commits

Author SHA1 Message Date
Sven Klemm
1a5370643e Remove conditional for trusted in control file
All postgres versions supported by timescaledb support trusted
extensions so we do no longer need the conditional in the control file.
2024-04-24 15:29:03 +02:00
Alexander Kuzmenkov
2265c18baf
Report the PG version and path before complaining it's incorrect (#6634)
Helps to investigate errors where a wrong PG version gets picked.
2024-02-12 10:45:46 +00:00
Erik Nordström
c5fd41cd6b Add PG source dir to system includes
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.
2024-02-07 11:02:58 +01:00
Alexander Kuzmenkov
095504938d Re-enable clang-tidy in CI
Also fix the accumulated problems.
2024-01-15 13:57:36 +01:00
Sven Klemm
c5bed532ac Remove multinode tests
This tests removes all the multinode test files to remove the
burden to keep them update with PRs. The actual code will be removed
in followup PRs.
2023-12-11 16:37:55 +01:00
Jan Nidzwetzki
758029a2d5 Adjust required CMake version
Since a664e685cd, we are using the PREPEND statement in our CMake files,
which was added in CMake 3.15. This PR adjusts the required CMake
version.
2023-11-29 09:05:17 +01:00
Lakshmi Narayanan Sreethar
642970f014 PG16: Update query relation permission checking
PG16 moves the permission checking information out of the range table
entries into a new struct - RTEPermissionInfo. This commit updates
timescaledb to use the this new mechanism when compiling with PG16.

postgres/postgres@a61b1f74
postgres/postgres@b803b7d1
postgres/postgres@47bb9db7
2023-09-28 10:35:03 -03:00
Sven Klemm
e3437786ad Make multinode tests conditional
Since multinode tests take a long time to run we dont want to run
them in CI on individual PRs but only on nightly runs.
2023-08-30 15:32:42 +02:00
Mats Kindahl
71b0168ab7 Add debug utilities to debug builds
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`.
2023-08-14 14:42:47 +02:00
Lakshmi Narayanan Sreethar
81b520d3b5 Remove support for PG12
Remove support for compiling TimescaleDB code against PG12. PG12
specific macros and testfiles will be removed in a followup patch.
2023-07-25 16:00:18 +05:30
Jan Nidzwetzki
f172679022 Added perltidy make target
This patch introduces the make target 'perltidy' to format Perl files
with perltidy. In addition, calling perltidy is added to 'make format'.
2023-06-26 10:59:19 +02:00
Maheedhar PV
ca240c33ca Build failure on windows
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
2023-04-13 17:10:43 +05:30
Konstantina Skovola
8cccc375fb Add license information to extension description
Fixes #5436
2023-03-20 13:27:41 -03:00
Sven Klemm
217ba014a7 Use version checks to decide about RelationGetSmgr backporting
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.
2023-03-09 16:55:50 +01:00
Alexander Kuzmenkov
d00c1f3721 Fix some errors in processing of code coverage data
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.
2023-02-13 18:38:09 +04:00
Alexander Kuzmenkov
d2254cb5c5 Don't enable clang-tidy by default
This is aimed at developers. If we enable it by default, it confuses our
users and slows down the build for them.
2023-01-20 16:56:08 +04:00
Sven Klemm
1a806e2fde Check for presence of RelationGetSmgr
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.
2022-11-30 02:57:19 +01:00
Bharathy
89cede81bd Fix PG15 specific tests. 2022-11-21 16:09:42 +05:30
Alexander Kuzmenkov
840f144e09 Enable and fix -Wclobbered
The one in job_stat.c could probably lead to errors.
2022-11-01 18:01:26 +04:00
Sven Klemm
3d30f07bf4 Swap lookup order for clang-format
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.
2022-11-01 14:01:38 +01:00
Alexander Kuzmenkov
5b2d9d5a10 Enable -Wnewline-eof
It enforces the newline at end of file, which is required by the C
standard.
2022-10-28 20:16:30 +04:00
Alexander Kuzmenkov
9b157d5438 Don't use docker for clang-format
It's not something we normally do for the developer tools.
2022-10-27 16:06:58 +04:00
Alexander Kuzmenkov
313845a882 Enable -Wextra
Our code mostly has warnings about comparison with different
signedness.
2022-10-27 16:06:58 +04:00
Alexander Kuzmenkov
f862212c8c Add clang-tidy warning readability-inconsistent-declaration-parameter-name
Mostly cosmetic stuff. Matched to definition automatically with
--fix-notes.
2022-10-20 19:42:11 +04:00
Alexander Kuzmenkov
73c3d02ed2 Enable clang-tidy warning readability-misleading-indentation 2022-10-20 16:53:50 +04:00
Alexander Kuzmenkov
05ba1cf22f Add clang-tidy warning readability-suspicious-call-argument
Helps find accidentally swapped arguments, like in the recent
epoll_ctl() error.
2022-10-20 16:53:50 +04:00
Alexander Kuzmenkov
7758f5959c Update .clang-format for version 14
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.
2022-10-10 17:12:36 +03:00
Sven Klemm
bbfdcaccd5 Fix cmake when build directory not child of source directory
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.
2022-08-02 20:15:14 +02:00
Rafia Sabih
4ab158d729 Fix gitcommit.h generation
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.
2022-07-28 15:36:37 +02:00
Jacob Champion
1221977c9c Inspect pg_config.h for SSL support
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.
2022-06-21 10:52:18 -05:00
Alexander Kuzmenkov
a6b5f9002c More clear clang-tidy options
Enable a closed list of checks and treat everything as errors.
2022-05-26 13:51:36 +05:30
Sven Klemm
e101b3ea60 Set minimum required cmake version to 3.10
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.
2022-03-21 09:36:14 +01:00
Mats Kindahl
15d33f0624 Add option to compile without telemetry
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
2022-03-03 12:21:07 +01:00
Sven Klemm
c56b33d2e7 Fix openssl detection for PG14
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
2022-02-10 15:29:32 +01:00
Alexander Kuzmenkov
da5ee6fc41 Add -Wundef to compiler flags
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.
2021-12-16 20:52:22 +03:00
Aleksander Alekseev
0de4955ca5 Treat clang-tidy warnings as errors
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.
2021-11-18 18:47:46 +03:00
Erik Nordström
e02f48c19d Add missing downgrade script files
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.
2021-10-27 18:23:57 +02:00
Sven Klemm
2f7bb43fe0 No longer require -DEXPERIMENTAL for PG14
Change cmake to no longer require -DEXPERIMENTAL when building
against PG14. Run more PG14 tests (32bit, windows, sanitizer).
2021-10-14 02:14:37 +02:00
Mats Kindahl
c221c7845a Remove CMake debug printouts
Removing some debug printouts and moving some other status messages to
more appropriate locations.
2021-08-17 09:36:12 +02:00
Mats Kindahl
bff87a8e2b Disable tests by default if tools are not found
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.
2021-08-11 15:28:09 +02:00
Mats Kindahl
0e505dd553 Fix version modifier
The variable `VERSION_MOD` is used by `config.h`.
2021-07-05 09:59:15 +02:00
Mats Kindahl
072b9682c7 Fix regex that matches version
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.
2021-07-02 16:09:54 +02:00
Mats Kindahl
a58ebdb3b4 Split update and downgrade version
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.
2021-07-01 16:05:31 +02:00
Mats Kindahl
a3e8fd0497 Always define 'format' target
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.
2021-06-28 14:37:47 +02:00
Sven Klemm
51531e36d0 Allow building against PG14 and add it to CI
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.
2021-06-24 14:10:25 +02:00
Mats Kindahl
15b46818ea Generate downgrade script
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.
2021-06-24 11:10:25 +02:00
Sven Klemm
374decb5ac Don't skip default path when looking for prove 2021-06-22 09:47:21 +02:00
Mats Kindahl
71e8f13871 Add workflow and CMake support for formatting
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.
2021-06-17 22:52:29 +02:00
Erik Nordström
8e1273cd13 Detect TAP test prerequisites with CMake
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.
2021-06-05 12:08:21 +02:00
Sven Klemm
22ceabcb83 Remove PG11 specific test output files 2021-06-01 20:21:06 +02:00