pgd node part
=============

Synopsis
--------

The ``pgd node part`` command removes a PGD node from an active cluster,
initiating the parting operation.

The behavior of this command is conditional based on the cluster’s Raft
protocol version:

1. **Raft protocol version 6003 and above**

In this scenario, all PGD nodes in the cluster are running version
Version 6.4 or above.

The system immediately renames the node to its UUID and continues the
complex parting operation in the background. This action allows you to
rename the node’s original name before the whole operation completes.

After the initial part command returns, use the node’s UUID-based name
to track the progress of the parting node.

The ``--no-wait`` option is deprecated in this scenario.

1. **Raft protocol version below 6003**

In this scenario, not every PGD node in the cluster is running PGD
version Version 6.4 or above.

By default, the command waits for the entire part operation to complete.
If you use ``--no-wait`` , the system schedules the part operation in
the background and immediately returns an advisory message, without
waiting for completion.

Users and roles
^^^^^^^^^^^^^^^

Requires the ``bdr_superuser`` role. See :ref:`User roles <User roles>`  .

Syntax
------

.. code:: plaintext

   pgd node <NODE_NAME> part [OPTIONS]

Where ``<NODE_NAME>`` is the name of the node to be parted.

Options
-------

The following options are available for the ``pgd node part`` command:

.. csv-table::
  :header: Option,Description,Note
  :widths: 12,25,15
  :align: left
  :class: longtable

  --no-wait,"Schedule the part operation in the background and immediately return, without waiting for the operation to complete.",Used for Raft version below 6003

See `Global Options <https://www.enterprisedb.com/docs/pgd/latest/reference/cli/command_ref/#global-options>`_  .

Examples
--------

Part a node (Raft protocol version 6003 and above)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code:: shell

   pgd node pgd-a1 part
   __OUTPUT__
   Starting a part node operation for node: pgd-a1
   This may take some time, please wait...
   NOTICE:  node pgd-a1 renamed to a867d475-7177-533a-a5b7-44badb2dfe4b and removal started in the background
   DETAIL:  node is parting nodegroup topgroup (51455156). node name pgd-a1 can be reused if required.

Part a node with ``--no-wait`` option (Raft protocol version below 6003)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code:: shell

   pgd node pgd-a1 part --no-wait
   __OUTPUT__
   Starting a part node operation for node: pgd-a1
   This may take some time, please wait...
   NOTICE:  node pgd-a1 removal started in the background
   DETAIL:  node is parting nodegroup topgroup (51455156)

Part a node without ``--no-wait`` option (Raft protocol version below 6003)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code:: shell

   pgd node pgd-a1 part
   __OUTPUT__
   Starting a part node operation for node: pgd-a1
   This may take some time, please wait...
   NOTICE: Node pgd-a1 has been removed from the BDR group
