Skip to content

maintainer: add mode information in barrier logs (#4412)#5236

Closed
ti-chi-bot wants to merge 1 commit into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-4412-to-release-8.5
Closed

maintainer: add mode information in barrier logs (#4412)#5236
ti-chi-bot wants to merge 1 commit into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-4412-to-release-8.5

Conversation

@ti-chi-bot

Copy link
Copy Markdown
Member

This is an automated cherry-pick of #4412

What problem does this PR solve?

Issue Number: close #4427

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Questions

Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?

Release note

Please refer to [Release Notes Language Style Guide](https://pingcap.github.io/tidb-dev-guide/contribute-to-tidb/release-notes-style-guide.html) to write a quality release note.

If you don't think this PR needs a release note then fill it with `None`.

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR. labels Jun 8, 2026
@ti-chi-bot

Copy link
Copy Markdown
Member Author

@hongyunyan This PR has conflicts, I have hold it.
Please resolve them or ask others to resolve them, then comment /unhold to remove the hold label.

@ti-chi-bot

ti-chi-bot Bot commented Jun 8, 2026

Copy link
Copy Markdown

@ti-chi-bot: ## If you want to know how to resolve it, please read the guide in TiDB Dev Guide.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot

ti-chi-bot Bot commented Jun 8, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign asddongmen for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found 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

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 36985224-e983-44ad-bab5-4f1f025062d9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ti-chi-bot

ti-chi-bot Bot commented Jun 8, 2026

Copy link
Copy Markdown

@ti-chi-bot: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-error-log-review 598aae1 link true /test pull-error-log-review

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request aims to add replication mode information to barrier logs in the maintainer package. However, the changes introduce several unresolved git conflict markers across both maintainer/barrier.go and maintainer/barrier_event.go. These conflicts include references to unsupported flush-related fields and methods that do not exist on this branch, which will cause compilation failures. The feedback correctly identifies these critical issues and provides instructions on how to resolve the conflicts by discarding the unsupported flush logic while retaining the replication mode integration.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread maintainer/barrier.go
Comment on lines +45 to +53
<<<<<<< HEAD
mode int64
=======
flushEnabled bool
// mode identifies which replication pipeline this barrier belongs to
// (common.DefaultMode or common.RedoMode). Barrier state, resend messages,
// and logs must stay in the same mode.
mode int64
>>>>>>> c1f39ed2e (maintainer: add mode information in barrier logs (#4412))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

There is an unresolved git conflict marker here. Since the flush logic is not supported on this branch and the corresponding fields are missing from BarrierEvent, we should resolve this conflict by keeping only the mode field and discarding flushEnabled.

	// mode identifies which replication pipeline this barrier belongs to
	// (common.DefaultMode or common.RedoMode). Barrier state, resend messages,
	// and logs must stay in the same mode.
	mode int64

Comment thread maintainer/barrier.go
Comment on lines +180 to +186
<<<<<<< HEAD
event = NewBlockEvent(common.NewChangefeedIDFromPB(resp.ChangefeedID), common.NewDispatcherIDFromPB(span.ID), b.spanController, b.operatorController, blockState, b.splitTableEnabled)
=======
event = NewBlockEvent(common.NewChangefeedIDFromPB(resp.ChangefeedID), common.NewDispatcherIDFromPB(span.ID), b.spanController, b.operatorController, blockState, b.splitTableEnabled, b.mode)
event.flushEnabled = b.flushEnabled
event.flushDispatcherAdvanced = !b.flushEnabled
>>>>>>> c1f39ed2e (maintainer: add mode information in barrier logs (#4412))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

Unresolved git conflict marker. Since flushEnabled and flushDispatcherAdvanced are not defined on BarrierEvent in this branch, we should resolve this conflict by only passing b.mode to NewBlockEvent and discarding the flush-related fields.

				event = NewBlockEvent(common.NewChangefeedIDFromPB(resp.ChangefeedID), common.NewDispatcherIDFromPB(span.ID), b.spanController, b.operatorController, blockState, b.splitTableEnabled, b.mode)

Comment thread maintainer/barrier.go
Comment on lines +443 to +449
<<<<<<< HEAD
event = NewBlockEvent(changefeedID, dispatcherID, b.spanController, b.operatorController, blockState, b.splitTableEnabled)
=======
event = NewBlockEvent(changefeedID, dispatcherID, b.spanController, b.operatorController, blockState, b.splitTableEnabled, b.mode)
event.flushEnabled = b.flushEnabled
event.flushDispatcherAdvanced = !b.flushEnabled
>>>>>>> c1f39ed2e (maintainer: add mode information in barrier logs (#4412))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

Unresolved git conflict marker. Resolve this by only passing b.mode to NewBlockEvent and discarding the unsupported flush fields.

		event = NewBlockEvent(changefeedID, dispatcherID, b.spanController, b.operatorController, blockState, b.splitTableEnabled, b.mode)

Comment thread maintainer/barrier.go
Comment on lines +461 to +476
<<<<<<< HEAD
if be.selected.Load() {
log.Info("all dispatchers reported event done, remove event",
zap.String("changefeed", be.cfID.Name()),
zap.Uint64("committs", be.commitTs))
// already selected a dispatcher to write, now all dispatchers reported the block event
b.blockedEvents.Delete(getEventKey(be.commitTs, be.isSyncPoint))
}
=======

log.Info("all dispatchers reported event done, remove event",
zap.String("changefeed", be.cfID.Name()),
zap.Uint64("committs", be.commitTs),
zap.Int64("mode", b.mode))
b.blockedEvents.Delete(getEventKey(be.commitTs, be.isSyncPoint))
>>>>>>> c1f39ed2e (maintainer: add mode information in barrier logs (#4412))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

Unresolved git conflict marker. Resolve this by keeping the original be.selected.Load() check while adding the mode field to the log message.

	if be.selected.Load() {
		log.Info("all dispatchers reported event done, remove event",
			zap.String("changefeed", be.cfID.Name()),
			zap.Uint64("committs", be.commitTs),
			zap.Int64("mode", b.mode))
		// already selected a dispatcher to write, now all dispatchers reported the block event
		b.blockedEvents.Delete(getEventKey(be.commitTs, be.isSyncPoint))
	}

Comment on lines +638 to +663
<<<<<<< HEAD
=======
// Phase 1 (Flush, storage split-table only): all influenced dispatchers flush pre-barrier DML first.
// This fence is required for storage sink when split-table is enabled: one table may span
// multiple dispatchers on different nodes, and pre-DDL DML must not overtake
// the writer's Action_Write.
if !be.flushDispatcherAdvanced {
msgs = be.sendFlushAction(mode)
if len(msgs) > 0 {
return msgs
}
// No influenced dispatcher needs Action_Flush (for example DB/ALL barriers with empty
// runtime influenced set like "DROP DATABASE IF EXISTS <db>" before any table exists).
// Advance flush phase immediately; otherwise the barrier can be stuck forever in phase 1.
be.flushDispatcherAdvanced = true
be.rangeChecker.Reset()
be.reportedDispatchers = make(map[common.DispatcherID]struct{})
be.lastResendTime = time.Now().Add(-20 * time.Second)
log.Info("barrier flush phase auto advanced due to empty influenced dispatchers",
zap.String("changefeed", be.cfID.Name()),
zap.Uint64("commitTs", be.commitTs),
zap.Bool("isSyncPoint", be.isSyncPoint),
zap.String("barrierType", be.blockedDispatchers.InfluenceType.String()),
zap.Int64("mode", be.mode))
}
>>>>>>> c1f39ed2e (maintainer: add mode information in barrier logs (#4412))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

Unresolved git conflict marker. Since the flush phase is not supported and does not compile, this entire block of code should be removed.

@hongyunyan hongyunyan closed this Jun 9, 2026
@ti-chi-bot ti-chi-bot Bot added cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-pick-approved Cherry pick PR approved by release team. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants