pingcap / pingcap/ticdc

eventservice: stabilize signal resolved table trigger test

Open Beginner friendly
#4,772 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component/test severity/minor type/bug
Dominant language
Go
Stars
56
Forks
63
Avg merge
2d 20h
Merged PRs (30d)
34

Description

Bug report

TestProcessTableTriggerDispatcherSendsSignalResolvedWhenNoForwardRangeAndNotInCommitStage is brittle and can look flaky when the surrounding implementation changes.

Background

The test is intended to verify the table trigger dispatcher behavior when there is no forward range and the changefeed is not in the syncpoint commit stage. In that case, the dispatcher should send a signal resolved event without advancing past the current watermark.

Problem

The current test couples that behavior to two unrelated implementation details:

  1. It assumes the dispatcher is still unhandshaked, so the first message must be a HandshakeEvent.
  2. It uses time.Now().Add(...) to bypass the resolved-ts rate limit, which makes the setup depend on wall clock timing instead of deterministic state.

Because of that, the test is validating more than its name suggests, and it becomes fragile under benign changes to handshake timing or resolved-ts throttling.

Expected behavior

The test should only assert the behavior it is named after:

  • a signal resolved event is emitted when there is no forward range
  • the resolved watermark stays at the current value
  • nextSyncPoint is unchanged
Suggested fix

Make the test deterministic by:

  • pre-marking the dispatcher as handshaked so handshake ordering is out of scope
  • using a zero lastSentResolvedTsTime to bypass the rate limit deterministically
  • asserting only the emitted resolved event and the relevant watermark state

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with TestProcessTableTriggerDispatcherSendsSignalResolvedWhenNoForwardRangeAndNotInCommitStage and the table trigger dispatcher setup. Make the test independent of handshake ordering and wall-clock timing, then verify that it emits the resolved event, preserves the current resolved watermark, and leaves nextSyncPoint unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
testing-qa
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.