Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@bimboterminator1
Copy link
Member

@bimboterminator1 bimboterminator1 commented Dec 15, 2025

Add basic support of resource planning

This patch implements the following changes:

  1. The support of IP addresses in 'target-hosts, add-hosts, remove-hosts' is
    added. Their validation requires hostname resolution, thus, the HostResolver()
    class is added in rebalance_commons.py Without validation we may face the case
    when passed through options IP address corresponds to existing host but is
    interpreted by ggrebalance as a new one.

  2. The support hosts files is added.

  3. The target directories handling is reworked. TemplateParser() class is added
    to support several placeholders. Now if 'target-datadirs' options is not passed
    all moves will choose default template directories as target ones.

  4. The port planning is added in simple form (since doing network communication
    is overhead here) via PortAllocator() class. It forms per host per segment type
    port patterns and assigns them incrementally to moves.

  5. The storage estimation is implemented. DiskUsage, DiskFree commands are used.
    The source datadirs and tablespaces are taken into account and validation of
    available space is provided.

Corresponding unit tests are added for basic scenarios.

@whitehawk

This comment was marked as resolved.

@whitehawk

This comment was marked as resolved.

strategy)
return (conf, host_mapping)

class PortAllocator:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to add unit tests for the PortAllocator.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add them later, after handling the KnightMurloc's comment with removed hosts

@whitehawk

This comment was marked as resolved.

@bimboterminator1
Copy link
Member Author

bimboterminator1 commented Dec 18, 2025

If I try to launch ggrebalance via following commands (tested in docker cluster with 3 segment hosts)

That's the issue of DiskFree command mostly. If the dir does not exist it errors out when reaching the root. Also the unexistent directory is chosen because of ADR for 3.1.22 where it written:
So, when planner will need this information, datadirs on new hosts will be created based on templates. Existing datadirs on existing hosts will become source datadirs, templates on existing hosts will be used for creating new directories, if new segment(s) are moved to this host.
Its a question for discussion and nothing stops us from handling it separately

@whitehawk

This comment was marked as resolved.

@KnightMurloc
Copy link

Are there any tablespace tests?

@bimboterminator1
Copy link
Member Author

Are there any tablespace tests?

Only a couple unit tests in test_unit_resources.

@bimboterminator1
Copy link
Member Author

Now corresponding filesystems at target hosts are considered when tablespaces are validated

@bimboterminator1 bimboterminator1 merged commit 4b13164 into feature/ADBDEV-6608 Dec 29, 2025
1 check passed
@bimboterminator1 bimboterminator1 deleted the ADBDEV-8748 branch December 29, 2025 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants