Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move from max( id ) to max( index ) for latest commit statuses (#30076) #30155

Merged
merged 2 commits into from
Mar 28, 2024

Commits on Mar 28, 2024

  1. Move from max( id ) to max( index ) for latest commit statuses (g…

    …o-gitea#30076)
    
    This PR replaces the use of `max( id )`, and instead using ``max(
    `index` )`` for determining the latest commit status. Building business
    logic over an `auto_increment` primary key like `id` is risky and
    there’re already plenty of discussions on the Internet.
    
    There‘s no guarantee for `auto_increment` values to be monotonic,
    especially upon failures or with a cluster. In the specific case, we met
    the problem of commit statuses being outdated when using TiDB as the
    database. As [being
    documented](https://docs.pingcap.com/tidb/stable/auto-increment),
    `auto_increment` values assigned to an `insert` statement will only be
    monotonic on a per server (node) basis.
    
    Closes go-gitea#30074.
    stevapple committed Mar 28, 2024
    Configuration menu
    Copy the full SHA
    91d503f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e808cf8 View commit details
    Browse the repository at this point in the history