Gitea shows outdated commit status with distributed DB backend (eg. TiDB) #12729

Closed
opened 2025-11-02 10:19:19 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @stevapple on GitHub (Mar 25, 2024).

Description

Gitea doesn’t always show the latest commit status (i.e. being outdated) if you use some distributed database as backend. An auto_increment primary key, though being expected to bump at a step of 1 at every INSERT, may be designed to bump independently on each nodes.

We should update commit_status.go to use the (max(`index`), repo_id, sha) triple to determine the latest commit status, instead of relying on max(id).

Gitea Version

1.21.9

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

I’m running Gitea on a Kubernetes cluster, which also hosts Woodpecker CI v2.3.0 and TiDB v7.5.1. Gitea uses TiDB (through mysql) as backend and Woodpecker uses Gitea as forge.

The problem was originally identified as “randomly dropping commit status on either Woodpecker, Gitea and TiDB side”, but after digging into the database it turns out that all commit statuses were there.

Database

MySQL/MariaDB

Originally created by @stevapple on GitHub (Mar 25, 2024). ### Description Gitea doesn’t always show the latest commit status (i.e. being outdated) if you use some distributed database as backend. An `auto_increment` primary key, though being expected to bump at a step of 1 at every `INSERT`, may be designed to bump independently on each nodes. We should update `commit_status.go` to use the ``(max(`index`), repo_id, sha)`` triple to determine the latest commit status, instead of relying on `max(id)`. ### Gitea Version 1.21.9 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? I’m running Gitea on a Kubernetes cluster, which also hosts Woodpecker CI v2.3.0 and TiDB v7.5.1. Gitea uses TiDB (through `mysql`) as backend and Woodpecker uses Gitea as forge. The problem was originally identified as “randomly dropping commit status on either Woodpecker, Gitea and TiDB side”, but after digging into the database it turns out that all commit statuses were there. ### Database MySQL/MariaDB
GiteaMirror added the type/bug label 2025-11-02 10:19:19 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12729