Skip to content

IGNITE-29177 Analyze and test the reliability of MDC historical rebalance mechanism - #13714

Open
EgorBaranovEnjoysTyping wants to merge 4 commits into
apache:masterfrom
EgorBaranovEnjoysTyping:IGNITE-29177
Open

EgorBaranovEnjoysTyping wants to merge 4 commits into
apache:masterfrom
EgorBaranovEnjoysTyping:IGNITE-29177

Conversation

@EgorBaranovEnjoysTyping

Copy link
Copy Markdown
Contributor

…ance mechanism

Thank you for submitting the pull request to the Apache Ignite.

In order to streamline the review of the contribution
we ask you to ensure the following steps have been taken:

The Contribution Checklist

  • There is a single JIRA ticket related to the pull request.
  • The web-link to the pull request is attached to the JIRA ticket.
  • The JIRA ticket has the Patch Available state.
  • The pull request body describes changes that have been made.
    The description explains WHAT and WHY was made instead of HOW.
  • The pull request title is treated as the final commit message.
    The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
  • A reviewer has been mentioned through the JIRA comments
    (see the Maintainers list)
  • The pull request has been checked by the Teamcity Bot and
    the green visa attached to the JIRA ticket (see tab PR Check at TC.Bot - Instance 1 or TC.Bot - Instance 2)

Notes

If you need any help, please email dev@ignite.apache.org or ask any advice on https://the-asf.slack.com #ignite channel.


. A full rebalance is used if the node has no local data for the partition (update counter is zero).
+
This applies both to a *new node joining for the first time* (it has no data on disk at all) and to a node that was *evicted from the baseline* and rejoined (its local partition data was invalidated). In both cases the full partition content must be downloaded from another node.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
This applies both to a *new node joining for the first time* (it has no data on disk at all) and to a node that was *evicted from the baseline* and rejoined (its local partition data was invalidated). In both cases the full partition content must be downloaded from another node.
This applies both to a *new node joining for the first time* (it has no data on disk at all) and to a node that was *removed from the baseline* and than added back (its local partition data was invalidated). In both cases the full partition content must be downloaded from another node.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

"Evicted" is the precise term in Ignite (cf. evictFromTopology). Also note the typo n the suggestion: "than" → "then".

Comment thread docs/_docs/data-rebalancing.adoc Outdated
In clusters with persistence, the baseline topology has to be changed manually (default behavior), or can be changed automatically when link:clustering/baseline-topology#baseline-topology-autoadjustment[automatic baseline adjustment] is enabled.
====

== Rebalance Strategy [[rebalance-strategy]]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
== Rebalance Strategy [[rebalance-strategy]]
== Rebalancing Strategy [[rebalance-strategy]]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

+
Example: a partition contains 100 entries. While the node was absent, 500 writes hit this partition. Downloading 500 delta entries is more expensive than just downloading all 100 entries → full rebalance.

. A full rebalance is used if the partition size is below the `historical.rebalance.threshold` (DMS property, default 500 entries), unless the `IGNITE_PREFER_WAL_REBALANCE` system property is set to `true`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
. A full rebalance is used if the partition size is below the `historical.rebalance.threshold` (DMS property, default 500 entries), unless the `IGNITE_PREFER_WAL_REBALANCE` system property is set to `true`.
. A full rebalance is used if the partition size is below the `historical.rebalance.threshold` (a property stored in Distributed MetaStorage, default 500 entries), unless the `IGNITE_PREFER_WAL_REBALANCE` system property is set to `true`.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's the standard abbreviation used throughout the codebase (DistributedMetaStorage,
GridDistributedMetastorageManager). Expanding it to "Distributed MetaStorage" (two words) would actually be incorrect — the canonical name is
"Distributed Meta Storage" (three words).


[NOTE]
====
If both nodes report the same update counter for a partition, no rebalance is performed for that partition.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
If both nodes report the same update counter for a partition, no rebalance is performed for that partition.
If both nodes report the same update counter for a partition, rebalance doesn't start for that partition.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The formal phrasing is preferred in documentation, and "performed" is more precise than "start"
(nothing starts, it simply doesn't happen).

Comment thread docs/_docs/data-rebalancing.adoc Outdated

[NOTE]
====
*Historical rebalance requires the delta to be present in the WAL of the source node.* If the WAL segments that contain the delta were already archived or deleted by the time the node rejoins — for example, the node was absent for a long time, or WAL history and archiving are configured with a small retention — the source node cannot read the delta. In that case Ignite does not lose data: the supplier detects the failure to iterate over the WAL, marks the last checkpoint as not applicable for WAL rebalance, marks the affected partitions as missed, and the node falls back to a *full rebalance*.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
*Historical rebalance requires the delta to be present in the WAL of the source node.* If the WAL segments that contain the delta were already archived or deleted by the time the node rejoins — for example, the node was absent for a long time, or WAL history and archiving are configured with a small retention — the source node cannot read the delta. In that case Ignite does not lose data: the supplier detects the failure to iterate over the WAL, marks the last checkpoint as not applicable for WAL rebalance, marks the affected partitions as missed, and the node falls back to a *full rebalance*.
*Historical rebalance requires the delta to be present in the WAL of the source node.* If the WAL segments that contain the delta were already archived or deleted by the time node lagged behind rejoins — for example, the node was absent for a long time, or WAL history and archiving are configured with a small retention — the source node cannot supply the delta. In that case Ignite does not lose data: the supplier detects the failure to iterate over the WAL, marks the last checkpoint as not applicable for WAL rebalance, marks the affected partitions as missed, and the node falls back to a *full rebalance*.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

keeping the original ("the node rejoins"); the context already makes it clear which node and that it was
behind. "cannot supply the delta" — done.

The `rebalanceDelay` (deprecated) setting also prevents a historical rebalance: when a delay is configured, the rebalance is scheduled outside of the partition map exchange context, and the historical path (which is tied to that context) is never taken — every partition is restored with a full rebalance regardless of the delta size and regardless of `IGNITE_PREFER_WAL_REBALANCE`.
====

In a link:clustering/multi-data-center[multi-data-center] setup, the preloader prefers a node from the same data center that holds a copy of the partition. If no such node is available, it falls back to a node from a remote data center. This behavior applies to both full and historical rebalance.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
In a link:clustering/multi-data-center[multi-data-center] setup, the preloader prefers a node from the same data center that holds a copy of the partition. If no such node is available, it falls back to a node from a remote data center. This behavior applies to both full and historical rebalance.
In a link:clustering/multi-data-center[multi-data-center] setup, the node demanding the data prefers a node from the same data center that holds a copy of the partition. If no such node is available, it falls back to a node from a remote data center. This behavior applies to both full and historical rebalance.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

"Preloader" is the actual component name in the codebase (GridDhtPreloader). The node doesn't "prefer"
anything; the preloader mechanism does.

public void testHistoricalRebalanceCrossDC() throws Exception {
checkHistoricalRebalance(true);
}

/**
* Verifies that no rebalance demand is sent when a node restarts without any

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Verifies that no rebalance demand is sent when a node restarts without any
* Verifies that no rebalance request is sent when a node restarts without any

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is the protocol-level term used throughout the codebase (GridDhtPartitionDemandMessage) and in
the documentation itself.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A lot of duplicated code shared between tests: start few nodes, activate nodes, create cache config, create cache, populate cache. Is it possible to extract at least some of these scenarios into separate methods?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

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.

2 participants