tests: TestNextGenMetering rejects valid zero-second task durations

Open Beginner friendly
#71,098 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
databases, testing

Research direction

Start with TestNextGenMetering in tests/realtikvtest/importintotest4 and compare its duration polling assertion with the analogous fix in tests/realtikvtest/addindextest2. Review pkg/dxf/framework/handle/handle.go to confirm the integer duration behavior, then run the focused test; it is done when valid completed tasks with zero-second durations satisfy the assertion without a timeout.

Written by the indexing model from the issue text.

Description

component/test severity/minor type/bug

Bug Report

1. Minimal reproduce step (Required)

TestNextGenMetering in tests/realtikvtest/importintotest4 asserts that duration_seconds > 0 for a small three-row import. Consider a successful task whose recorded start/end duration is less than one second.

Production code in pkg/dxf/framework/handle/handle.go calculates the value as int64(task.StateUpdateTime.Sub(task.CreateTime).Seconds()), which truncates a positive sub-second duration to zero.

2. What did you expect to see? (Required)

The metering assertion accepts a non-negative integer duration, including zero. The analogous assertion in tests/realtikvtest/addindextest2 was fixed in #68453.

3. What did you see instead (Required)

Severity: minor. The zero-second boundary follows from the integer-duration calculation, but no matching failure or high-probability triggering has been established for this test in CI. A full local NextGen run has not been performed.

A valid zero value cannot satisfy the polling condition, so the assertion will time out after 30 seconds. Waiting longer does not change the duration of an already completed task.

This is a code-confirmed boundary condition; a full local NextGen reproduction is not available. The separate nil-pointer polling issue is already covered by #69217 and is outside this issue's scope.

4. What is your TiDB version? (Required)

TiDB master at 8bccb81a1c0a81d33ebca76545e465535e374870, NextGen test path.

Dominant language
Go
Stars
40.6k
Forks
6.2k
Avg merge
3d 3h
Merged PRs (30d)
168

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.

More from pingcap/tidb

All issues in pingcap/tidb

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.