Skip to content

PHOENIX-8106 Region move tests should turn off the balancer - #2738

Open
apurtell wants to merge 3 commits into
apache:masterfrom
apurtell:PHOENIX-8106
Open

apurtell wants to merge 3 commits into
apache:masterfrom
apurtell:PHOENIX-8106

Conversation

@apurtell

@apurtell apurtell commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

The tests that move regions fail now and then in CI. One test sees one guidepost too few. Another gets a table-exists error when it creates a new table. The cause is the HBase balancer, which moves regions at any time. A balancer move can make a major compaction skip a region, so that region keeps its old guideposts. A move of the catalog table during table creation makes the client retry fail. PHOENIX-8086 fixes that product window separately.

This change is test-only. The base class turns off the balancer before each test. A separate per-test method does this, because several subclasses hide the shared setup method. The explicit region moves in the tests still run.

🤖 Generated with Claude Code

The region move tests move regions on their own schedule. The balancer also
moves regions. A balancer move can drop an admin compaction request, so a
region skips its compaction and the test sees stale guideposts. A balancer
move can also move SYSTEM.CATALOG during DDL. The base class now turns off
the balancer before each test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The balancing-disable fixture runs after table and index creation, leaving the first parameter set exposed to a catalog-move race unless balancing is also disabled immediately after driver setup.

1 open issue
What changed in this PR

This test-only change reduces balancer-related flakiness in Phoenix’s region-move integration tests while preserving deliberate region moves.

Changes:

  • Adds an inherited @Before fixture that disables automatic balancing.
  • Uses a distinct fixture name so subclasses that hide doSetup still inherit it.
File Description
phoenix-core/​src/​it/​java/​org/​apache/​phoenix/​end2end/​ParallelStatsDisabledWithRegionMovesIT.java Adds and documents the per-test balancer-disabling fixture.

Review effort: Balanced

props.put(QueryServices.PHOENIX_POST_DUMMY_PROCESS,
TestScanningResultPostDummyResultCaller.class.getName());
props.put(PHOENIX_INDEX_CDC_CONSUMER_ENABLED, Boolean.toString(false));
setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));

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.

Fixed in 146a28f. The class setup now turns the balancer off right after the cluster starts, before any per-parameter setup creates tables, and the per-test hook stays for the subclass that replaces the class setup. The aggregate and upsert-select region move suites pass with this change.

(Claude Code)

The per-test hook runs after the per-parameter setup, which already
creates tables and indexes. The class setup now turns the balancer off
right after the cluster starts. The per-test hook stays for the subclass
that replaces the class setup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@apurtell
apurtell requested a balanced review from Copilot December 4, 2026 03:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

The parameter setup of the query suites creates tables before the
per-test hook runs, and one subclass replaces the class setup. The
parameter setup now turns the balancer off first, so the first
parameter set also creates its tables with the balancer off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@apurtell

apurtell commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Self-review (Claude Code, pr-review-toolkit) — Copilot could not review this PR because of a review quota limit, so this is an automated self-review in its place.

Important issues

  • phoenix-core/src/it/java/org/apache/phoenix/end2end/AggregateQueryWithRegionMoves2IT.java:116 — This class has its own class setup, which hides the parent setup where the balancer is now turned off. It still inherits the per-parameter table and index creation from BaseQueryWithRegionMovesIT.initTables (line 72). That creation runs before any per-test method, so the first parameter set still does its DDL with the balancer on. This is the same catalog-move window that the earlier review round fixed for the sibling class. The smallest fix is to turn the balancer off at the top of initTables. That one call covers both aggregate query suites, whichever class setup runs.

Strengths

  • The change is small and touches only tests. The description gives a clear root cause, and the tests still make their own region moves.
  • The per-test hook is non-static and has its own name. Subclasses that hide the static setup cannot hide it, so it reaches every subclass.
  • The synchronous balancer switch lets a balance run that is already in progress finish before the test continues.
  • It uses the shared admin from the test utility and does not close it.
  • The new comments are short, design-level prose.

Recommendation: changes needed (one line, to close the first-parameter gap above).

🤖 Generated with Claude Code

@apurtell

apurtell commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Precommit note: the failures in this run are not related to this change. Each one is a known problem on master.

(Claude Code)

@apurtell

apurtell commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Response to the self-review (Claude Code):

  • Balancer during parameter setup. Fixed in aba29ce. The table and index setup for each parameter set now turns the balancer off before it creates the tables. Parameter setup runs before the per-test hook, and one subclass replaces the class setup, so this covers both aggregate query suites whichever class setup runs.
  • A local docker run on HBase 2.5 passed both suites: AggregateQueryWithRegionMovesIT and AggregateQueryWithRegionMoves2IT, 48 tests with 0 failures.

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