From 7869f5e211a9cc508937484aecfd5f8ea235908b Mon Sep 17 00:00:00 2001 From: Alexander Kukushkin Date: Mon, 30 Jan 2023 10:29:08 +0100 Subject: [PATCH] Release 3.0.0 (#2545) * bump version * update release notes * removed 2.7, 3.4, 3.5, and 3.6 from supported versions in setup.py * switched GH actions back to ubuntu-latest, removed tests with 2.7 and 3.6, and added 3.11 * some little fixes in Citus documentation and behave tests --- .github/workflows/install_deps.py | 2 +- .github/workflows/tests.yaml | 46 ++++++++++------------------ README.rst | 2 +- docs/ENVIRONMENT.rst | 6 ++-- docs/SETTINGS.rst | 6 ++-- docs/index.rst | 2 +- docs/releases.rst | 50 +++++++++++++++++++++++++++++++ features/steps/citus.py | 4 +-- kubernetes/Dockerfile.citus | 2 +- patroni/version.py | 2 +- setup.py | 10 ++----- 11 files changed, 80 insertions(+), 52 deletions(-) diff --git a/.github/workflows/install_deps.py b/.github/workflows/install_deps.py index 130454d0..cf1842ec 100644 --- a/.github/workflows/install_deps.py +++ b/.github/workflows/install_deps.py @@ -19,7 +19,7 @@ def install_requirements(what): requirements = ['mock>=2.0.0', 'flake8', 'pytest', 'pytest-cov'] if what == 'all' else ['behave'] requirements += ['coverage'] # try to split tests between psycopg2 and psycopg3 - requirements += ['psycopg[binary]'] if sys.version_info >= (3, 6, 0) and\ + requirements += ['psycopg[binary]'] if sys.version_info > (3, 7, 0) and\ (sys.platform != 'darwin' or what == 'etcd3') else ['psycopg2-binary'] for r in read('requirements.txt').split('\n'): r = r.strip() diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index fd0d826a..41dbe83d 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -5,8 +5,6 @@ on: push: branches: - master - tags: - - v.* env: CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} @@ -14,7 +12,7 @@ env: jobs: unit: - runs-on: ${{ fromJson('{"ubuntu":"ubuntu-20.04","windows":"windows-latest","macos":"macos-latest"}')[matrix.os] }} + runs-on: ${{ matrix.os }}-latest strategy: fail-fast: false matrix: @@ -22,26 +20,6 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python 2.7 - uses: actions/setup-python@v4 - with: - python-version: 2.7 - if: matrix.os != 'windows' - - name: Install dependencies - run: python .github/workflows/install_deps.py - if: matrix.os != 'windows' - - name: Run tests and flake8 - run: python .github/workflows/run_tests.py - if: matrix.os != 'windows' - - - name: Set up Python 3.6 - uses: actions/setup-python@v4 - with: - python-version: 3.6 - - name: Install dependencies - run: python .github/workflows/install_deps.py - - name: Run tests and flake8 - run: python .github/workflows/run_tests.py - name: Set up Python 3.7 uses: actions/setup-python@v4 @@ -79,6 +57,15 @@ jobs: - name: Run tests and flake8 run: python .github/workflows/run_tests.py + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: 3.11 + - name: Install dependencies + run: python .github/workflows/install_deps.py + - name: Run tests and flake8 + run: python .github/workflows/run_tests.py + - name: Combine coverage run: python .github/workflows/run_tests.py combine @@ -93,7 +80,7 @@ jobs: run: python -m coveralls --service=github behave: - runs-on: ${{ fromJson('{"ubuntu":"ubuntu-20.04","windows":"windows-latest","macos":"macos-latest"}')[matrix.os] }} + runs-on: ${{ matrix.os }}-latest env: DCS: ${{ matrix.dcs }} ETCDVERSION: 3.4.23 @@ -102,20 +89,17 @@ jobs: fail-fast: false matrix: os: [ubuntu] - python-version: [2.7, 3.6, 3.9] + python-version: [3.7, '3.10'] dcs: [etcd, etcd3, consul, exhibitor, kubernetes, raft] - exclude: - - dcs: kubernetes - python-version: 2.7 include: - os: macos - python-version: 3.7 + python-version: 3.8 dcs: raft - os: macos - python-version: 3.8 + python-version: 3.9 dcs: etcd - os: macos - python-version: '3.10' + python-version: 3.11 dcs: etcd3 steps: diff --git a/README.rst b/README.rst index b1474592..0c1cc227 100644 --- a/README.rst +++ b/README.rst @@ -14,7 +14,7 @@ We call Patroni a "template" because it is far from being a one-size-fits-all or Currently supported PostgreSQL versions: 9.3 to 15. -**Note to Citus users**: Starting from 3.0 Patroni nicely integrates with `Citus `. Please check `Citus support `__ page for more information. +**Note to Citus users**: Starting from 3.0 Patroni nicely integrates with `Citus `__. Please check `Citus support `__ page for more information. **Note to Kubernetes users**: Patroni can run natively on top of Kubernetes. Take a look at the `Kubernetes `__ chapter of the Patroni documentation. diff --git a/docs/ENVIRONMENT.rst b/docs/ENVIRONMENT.rst index e98f49c6..f0c56227 100644 --- a/docs/ENVIRONMENT.rst +++ b/docs/ENVIRONMENT.rst @@ -35,7 +35,7 @@ Example: defining ``PATRONI_admin_PASSWORD=strongpasswd`` and ``PATRONI_admin_OP Citus ----- -Enables integration Patroni with :ref:`Citus `__. If configured, Patroni will take care of registering Citus worker nodes on the coordinator. You can find more information about Citus support :ref:`here `. +Enables integration Patroni with `Citus `__. If configured, Patroni will take care of registering Citus worker nodes on the coordinator. You can find more information about Citus support :ref:`here `. - **PATRONI\_CITUS\_GROUP**: the Citus group id, integer. Use ``0`` for coordinator and ``1``, ``2``, etc... for workers - **PATRONI\_CITUS\_DATABASE**: the database where ``citus`` extension should be created. Must be the same on the coordinator and all workers. Currently only one database is supported. @@ -118,8 +118,8 @@ Kubernetes - **PATRONI\_KUBERNETES\_PORTS**: (optional) if the Service object has the name for the port, the same name must appear in the Endpoint object, otherwise service won't work. For example, if your service is defined as ``{Kind: Service, spec: {ports: [{name: postgresql, port: 5432, targetPort: 5432}]}}``, then you have to set ``PATRONI_KUBERNETES_PORTS='[{"name": "postgresql", "port": 5432}]'`` and Patroni will use it for updating subsets of the leader Endpoint. This parameter is used only if `PATRONI_KUBERNETES_USE_ENDPOINTS` is set. - **PATRONI\_KUBERNETES\_CACERT**: (optional) Specifies the file with the CA_BUNDLE file with certificates of trusted CAs to use while verifying Kubernetes API SSL certs. If not provided, patroni will use the value provided by the ServiceAccount secret. -Raft ----- +Raft (deprecated) +----------------- - **PATRONI\_RAFT\_SELF\_ADDR**: ``ip:port`` to listen on for Raft connections. The ``self_addr`` must be accessible from other nodes of the cluster. If not set, the node will not participate in consensus. - **PATRONI\_RAFT\_BIND\_ADDR**: (optional) ``ip:port`` to listen on for Raft connections. If not specified the ``self_addr`` will be used. diff --git a/docs/SETTINGS.rst b/docs/SETTINGS.rst index 14e8cc0d..fae83030 100644 --- a/docs/SETTINGS.rst +++ b/docs/SETTINGS.rst @@ -116,7 +116,7 @@ Bootstrap configuration Citus ----- -Enables integration Patroni with :ref:`Citus `__. If configured, Patroni will take care of registering Citus worker nodes on the coordinator. You can find more information about Citus support :ref:`here `. +Enables integration Patroni with `Citus `__. If configured, Patroni will take care of registering Citus worker nodes on the coordinator. You can find more information about Citus support :ref:`here `. - **group**: the Citus group id, integer. Use ``0`` for coordinator and ``1``, ``2``, etc... for workers - **database**: the database where ``citus`` extension should be created. Must be the same on the coordinator and all workers. Currently only one database is supported. @@ -222,8 +222,8 @@ Kubernetes .. _raft_settings: -Raft ----- +Raft (deprecated) +----------------- - **self\_addr**: ``ip:port`` to listen on for Raft connections. The ``self_addr`` must be accessible from other nodes of the cluster. If not set, the node will not participate in consensus. - **bind\_addr**: (optional) ``ip:port`` to listen on for Raft connections. If not specified the ``self_addr`` will be used. - **partner\_addrs**: list of other Patroni nodes in the cluster in format: ['ip1:port', 'ip2:port', 'etc...'] diff --git a/docs/index.rst b/docs/index.rst index 9612b576..c0d35e44 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -12,7 +12,7 @@ We call Patroni a "template" because it is far from being a one-size-fits-all or Currently supported PostgreSQL versions: 9.3 to 15. -**Note to Citus users**: Starting from 3.0 Patroni nicely integrates with `Citus `. Please check :ref:`here ` page for more information. +**Note to Citus users**: Starting from 3.0 Patroni nicely integrates with `Citus `__. Please check :ref:`Citus support ` page for more information. **Note to Kubernetes users**: Patroni can run natively on top of Kubernetes. Take a look at the :ref:`Kubernetes ` chapter of the Patroni documentation. diff --git a/docs/releases.rst b/docs/releases.rst index a73a7b37..42d79975 100644 --- a/docs/releases.rst +++ b/docs/releases.rst @@ -3,6 +3,56 @@ Release notes ============= +Version 3.0.0 +------------- + +This version adds integration with `Citus `__ and makes it possible to survive temporary DCS outages without demoting primary. + +.. warning:: + - Version 3.0.0 is the last release supporting Python 2.7. Upcoming release will drop support of Python versions older than 3.7. + + - The RAFT support is deprecated. We will do our best to maintain it, but take neither guarantee nor responsibility for possible issues. + + - This version is the first step in getting rid of the "master", in favor of "primary". Upgrading to the next major release will work reliably only if you run at least 3.0.0. + + +**New features** + +- DCS failsafe mode (Alexander Kukushkin, Polina Bungina) + + If the feature is enabled it will allow Patroni cluster to survive temporary DCS outages. You can find more details in the :ref:`documentation `. + +- Citus support (Alexander, Polina, Jelte Fennema) + + Patroni enables easy deployment and management of `Citus `__ clusters with HA. Please check :ref:`here ` page for more information. + + +**Improvements** + +- Suppress recurring errors when dropping unknown but active replication slots (Michael Banck) + + Patroni will still write these logs, but only in DEBUG. + +- Run only one monitoring query per HA loop (Alexander) + + It wasn't the case if synchronous replication is enabled. + +- Keep only latest failed data directory (William Albertus Dembo) + + If bootstrap failed Patroni used to rename $PGDATA folder with timestamp suffix. From now on the suffix will be ``.failed`` and if such folder exists it is removed before renaming. + +- Improved check of synchronous replication connections (Alexander) + + When the new host is added to the ``synchronous_standby_names`` it will be set as synchronous in DCS only when it managed to catch up with the primary in addition to ``pg_stat_replication.sync_state = 'sync'``. + + +**Removed functionality** + +- Remove ``patronictl scaffold`` (Alexander) + + The only reason for having it was a hacky way of running standby clusters. + + Version 2.1.7 ------------- diff --git a/features/steps/citus.py b/features/steps/citus.py index 7f5a5b26..5144f466 100644 --- a/features/steps/citus.py +++ b/features/steps/citus.py @@ -105,8 +105,8 @@ def count_rows(context, name): @step("There is a transaction in progress on {name:w} changing pg_dist_node") def check_transaction(context, name): - cur = context.pctl.query(name, "SELECT xact_start FROM pg_stat_activity WHERE pid <> pg_backend_pid() AND state" - " = 'idle in transaction' AND query ~ 'citus_update_node' AND query ~ 'demoted'") + cur = context.pctl.query(name, "SELECT xact_start FROM pg_stat_activity WHERE pid <> pg_backend_pid()" + " AND state = 'idle in transaction' AND query ~ 'citus_update_node'") assert cur.rowcount == 1, "There is no idle in transaction updating pg_dist_node" context.xact_start = cur.fetchone()[0] diff --git a/kubernetes/Dockerfile.citus b/kubernetes/Dockerfile.citus index 44370dcc..103f89ff 100644 --- a/kubernetes/Dockerfile.citus +++ b/kubernetes/Dockerfile.citus @@ -13,7 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \ && curl https://install.citusdata.com/community/deb.sh | bash \ && apt-get -y install postgresql-15-citus-11.1 \ && pip3 install setuptools \ - && pip3 install 'git+https://github.com/zalando/patroni.git@feature/citus#egg=patroni[kubernetes]' \ + && pip3 install 'git+https://github.com/zalando/patroni.git#egg=patroni[kubernetes]' \ && PGHOME=/home/postgres \ && mkdir -p $PGHOME \ && chown postgres $PGHOME \ diff --git a/patroni/version.py b/patroni/version.py index bc6379c1..4eb28e38 100644 --- a/patroni/version.py +++ b/patroni/version.py @@ -1 +1 @@ -__version__ = '2.1.7' +__version__ = '3.0.0' diff --git a/setup.py b/setup.py index dd4bc75a..4fe52d2c 100644 --- a/setup.py +++ b/setup.py @@ -41,15 +41,12 @@ CLASSIFIERS = [ 'Operating System :: POSIX :: BSD :: FreeBSD', 'Operating System :: Microsoft :: Windows', 'Programming Language :: Python', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: Implementation :: CPython', ] @@ -160,7 +157,6 @@ def setup_package(version): classifiers=CLASSIFIERS, packages=find_packages(exclude=['tests', 'tests.*']), package_data={MAIN_PACKAGE: ["*.json"]}, - python_requires='>=2.7', install_requires=install_requires, extras_require=EXTRAS_REQUIRE, cmdclass=cmdclass, @@ -171,14 +167,12 @@ def setup_package(version): if __name__ == '__main__': old_modules = sys.modules.copy() try: - from patroni import check_psycopg, fatal + from patroni import check_psycopg from patroni.version import __version__ finally: sys.modules.clear() sys.modules.update(old_modules) - if sys.version_info < (2, 7, 0): - fatal('Patroni needs to be run with Python 2.7+') check_psycopg() setup_package(__version__)