Skip to content

Conversation

@liubog2008
Copy link
Member

Fix #6530

@github-actions github-actions bot added the v2 for operator v2 label Nov 4, 2025
@ti-chi-bot ti-chi-bot bot added the size/M label Nov 4, 2025
@liubog2008 liubog2008 force-pushed the liubo02/fix-no-inplace-update branch from ea02062 to 2d451fa Compare November 7, 2025 10:34
@ti-chi-bot ti-chi-bot bot added size/XL and removed size/M labels Nov 7, 2025
@codecov-commenter
Copy link

codecov-commenter commented Nov 10, 2025

Codecov Report

❌ Patch coverage is 82.25806% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 41.09%. Comparing base (06a65da) to head (1d4b2ed).

Additional details and impacted files
@@              Coverage Diff               @@
##           feature/v2    #6533      +/-   ##
==============================================
+ Coverage       40.99%   41.09%   +0.09%     
==============================================
  Files             366      366              
  Lines           20294    20328      +34     
==============================================
+ Hits             8320     8354      +34     
  Misses          11974    11974              
Flag Coverage Δ
unittest 41.09% <82.25%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: liubo02 <liubo02@pingcap.com>
@liubog2008 liubog2008 force-pushed the liubo02/fix-no-inplace-update branch from 75f5698 to 592dcef Compare November 10, 2025 04:06
@ti-chi-bot ti-chi-bot bot added size/L and removed size/XL labels Nov 10, 2025
Signed-off-by: liubo02 <liubo02@pingcap.com>
@fgksgf fgksgf requested a review from Copilot November 10, 2025 07:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the topology-aware update policy to distinguish between scale-in and update operations, and fixes pod deletion time tracking in E2E tests.

Key changes:

  • Introduces separate PolicyScaleIn() and PolicyUpdate() methods to handle different topology preferences for scaling in versus updating instances
  • Updates pod watcher to use the Kubernetes watch event type for more accurate deletion time tracking
  • Removes redundant WaitForInstanceListRecreated calls from E2E tests

Reviewed Changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/e2e/utils/waiter/pod.go Changes deletion time tracking to use watch.Deleted event instead of DeletionTimestamp for more accurate timing
tests/e2e/tiproxy/tiproxy.go Removes redundant WaitForInstanceListRecreated calls
tests/e2e/tidb/topology.go Removes redundant WaitForInstanceListRecreated calls
tests/e2e/tidb/tidb.go Removes redundant WaitForInstanceListRecreated calls
tests/e2e/framework/action/test.go Removes redundant WaitForInstanceListRecreated call
pkg/updater/policy/topology_test.go Adds test coverage for expectedUpdatePrefered field and separate PolicyUpdate assertions
pkg/updater/policy/topology.go Refactors TopologyPolicy interface to provide separate PolicyScaleIn() and PolicyUpdate() methods instead of a single Prefer method
pkg/updater/executor_test.go Updates test to match new Update signature and removes unused RecordedActions method
pkg/updater/executor.go Updates Update method signature to accept unavailable parameter and adds documentation
pkg/updater/builder.go Reorders policy priority to put PreferUnready and PreferNotRunning first
pkg/updater/actor.go Implements logic to handle unavailable parameter in Update method
pkg/controllers/*/tasks/updater.go Updates all controllers to use PolicyScaleIn() method; TiDBGroup and TiProxyGroup also add PolicyUpdate()
Comments suppressed due to low confidence (2)

pkg/controllers/tsogroup/tasks/updater.go:108

  • The TSO group updater is missing topoPolicy.PolicyUpdate() in its update prefer policies, while similar controllers (TiDBGroup and TiProxyGroup) include both NotLeaderPolicy() and topoPolicy.PolicyUpdate(). This inconsistency means TSO instances won't benefit from topology-aware update preferences during rolling updates.
			WithUpdatePreferPolicy(
				NotLeaderPolicy(),
			).

pkg/controllers/pdgroup/tasks/updater.go:107

  • The PD group updater is missing topoPolicy.PolicyUpdate() in its update prefer policies, while similar controllers (TiDBGroup and TiProxyGroup) include both NotLeaderPolicy() and topoPolicy.PolicyUpdate(). This inconsistency means PD instances won't benefit from topology-aware update preferences during rolling updates.
			WithUpdatePreferPolicy(
				NotLeaderPolicy(),
			).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

return nil
return fmt.Errorf("want to update an unavailable outdated, buut choosed %s is not", name)
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

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

Corrected spelling of 'buut' to 'but'.

Suggested change
return fmt.Errorf("want to update an unavailable outdated, buut choosed %s is not", name)
return fmt.Errorf("want to update an unavailable outdated, but choosed %s is not", name)

Copilot uses AI. Check for mistakes.
WithScaleInPreferPolicy(
topoPolicy,
topoPolicy.PolicyScaleIn(),
).
Copy link
Member

Choose a reason for hiding this comment

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

Add WithUpdatePreferPolicy for ticdc?

Signed-off-by: liubo02 <liubo02@pingcap.com>
Signed-off-by: liubo02 <liubo02@pingcap.com>
@ti-chi-bot ti-chi-bot bot added the lgtm label Nov 10, 2025
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Nov 10, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fgksgf

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Nov 10, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-11-10 09:37:42.473742077 +0000 UTC m=+694911.916771955: ☑️ agreed by fgksgf.

@ti-chi-bot ti-chi-bot bot added the approved label Nov 10, 2025
@ti-chi-bot ti-chi-bot bot merged commit c0099a5 into pingcap:feature/v2 Nov 10, 2025
9 checks passed
liubog2008 added a commit to liubog2008/tidb-operator that referenced this pull request Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants