Decreasing MariaDB Xpand's device1 Size


The device1 file in MariaDB Xpand is used for all database data, undo logs, temporary tables, Binlogs, and Xpand system objects. Xpand ensures that the device1 file is the same size on all nodes of the deployment. Once the optimum size of the device1 file is derived, it rarely requires change.

To increase the size of the device1 file, see ALTER CLUSTER RESIZE DEVICES

To reduce the size of the device1 file deployment-wide, follow these instructions. This may be necessary when upgrading to Xpand 7.5 or greater on a deployment that is already at or near capacity or for workloads that utilize large sorts or aggregates.

The following procedure is meant to be completed on one Xpand node at a time. If you have space within your deployment, you may complete the cycle on more than one Xpand node at a time. For both Xpand topologies, the procedure must be performed using the Xpand nodes.

  1. Verify, set initial global:

    MariaDB Xpand's device_auto_resize_to_largest system variable controls how device1 files are consistently sized throughout your deployment. Ensure that this is initially set to false so it does not interfere with this process.

    Verify that the initial setting of device_auto_resize_to_largest is false

    SHOW GLOBAL VARIABLES LIKE 'device_auto_resize_to_largest';

    Set the global to FALSE, if necessary.

    Run this only if needed:

    SET GLOBAL device_auto_resize_to_largest = FALSE;
  2. Softfail an node or nodes, if your deployment has enough free space.

  3. Remove old device1 file:

    After the Xpand node(s) have been softfailed and removed from the deployment, run the following from a command line prompt. This will result in a group change.


    These commands will format the Xpand node to its default state and remove all the data.

    Run these commands on each Xpand node that was softfailed

    $ sudo rm /data/clustrix/pnid
    $ sudo systemctl stop clustrix
    $ sudo systemctl start clustrix
  4. Re-add the Xpand node to the deployment:

    Use this syntax from the MariaDB client to create a default device1 file. This will result in a group change.

    Run this from an Xpand node other than the Xpand node(s) just softfailed:

  5. Resize device1:

    Resize the device1 file on each Xpand node added above by using the following control port command:

    Run this command on each Xpand node whose IP was added to the deployment

    $ sudo nc localhost 2048
    $ sudo device resize deviceid size

    For example, this sets the size for the first (and only) device of the system (device1), to 800 GiB on the Xpand node to which you are connected. Do this on each Xpand node added above.

    $ device resize 1 800g


    It is recommended that you leave 50 - 100 GiB of free or work space available on each drive. This is site-specific and MariaDB Support can provide guidelines for your specific workload.

  6. Rebalance data:

    The Rebalancer will automatically distribute data to the reconfigured Xpand node(s). If your deployment has enough free space, you do not need to wait for this operation to finish before continuing.

  7. Repeat for all Xpand nodes:

    Repeat steps 2-6 until all Xpand nodes of the deployment have had their device1 file decreased.

  8. Set global for future use:

    Once the procedure is complete on all Xpand nodes and the device1 files have been reduced in size, set the global variable device_auto_resize_to_largest to TRUE. This ensures that all future Xpand nodes added to the deployment will have their device1 files sized the same.


    Do not set this global to TRUE until all Xpand nodes in the deployment have completed this process.

    Run this on one Xpand node after all device1 files have been decreased

    SET GLOBAL device_auto_resize_to_largest = 'TRUE';