Skip to content

fix (DMS): widen FC_Replicas RepID to BIGINT - #8842

Open
fstagni wants to merge 1 commit into
DIRACGrid:integrationfrom
fstagni:91_bigintRepID
Open

fstagni wants to merge 1 commit into
DIRACGrid:integrationfrom
fstagni:91_bigintRepID

Conversation

@fstagni

@fstagni fstagni commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

BEGINRELEASENOTES

*DMS
CHANGE: FileCatalogDB - FC_Replicas.RepID and FC_ReplicaInfo.RepID widened to BIGINT to avoid AUTO_INCREMENT exhaustion

*deployment

USE FileCatalogDB;
ALTER TABLE FC_Replicas MODIFY COLUMN RepID BIGINT NOT NULL AUTO_INCREMENT, ALGORITHM=COPY;
ALTER TABLE FC_ReplicaInfo MODIFY COLUMN RepID BIGINT NOT NULL AUTO_INCREMENT, ALGORITHM=COPY;

ENDRELEASENOTES

Summary

FC_Replicas.RepID was a signed INT (max 2147483647). InnoDB AUTO_INCREMENT values are never reused - not after DELETE, rollback, or failed/duplicate inserts - and the DFC churns them heavily (re-registrations attempting inserts that fail on the UNIQUE (FileID,SEID) key, replica migrations), so the counter runs ahead of the live row count until inserts start failing on large catalogs.

 CREATE TABLE FC_Replicas (
-    RepID INT AUTO_INCREMENT PRIMARY KEY,
+    RepID BIGINT AUTO_INCREMENT PRIMARY KEY,
 CREATE TABLE FC_ReplicaInfo (
-    RepID INTEGER NOT NULL AUTO_INCREMENT,
+    RepID BIGINT NOT NULL AUTO_INCREMENT,

The same change is applied to the reference schema in FileCatalogWithFkAndPsDB.sql.

Evidence

Exercised on a production instance (dbod-dfc, FileCatalogDB):

ALTER TABLE FC_Replicas
  MODIFY COLUMN RepID BIGINT NOT NULL AUTO_INCREMENT,
  ALGORITHM=COPY;

ALGORITHM=COPY is mandatory: data-type changes are not eligible for INPLACE/INSTANT, so this rebuilds the table and blocks concurrent DML for its duration. On very large FC_Replicas tables, pt-online-schema-change/gh-ost can be used instead. FC_ReplicaInfo.RepID stores the same IDs and must be widened too, otherwise it will start failing once RepID crosses 2^31.

Merge Danger

Door: two-way

Reverting the code change is trivial. Widening INT to BIGINT on live databases is not reversible without another table rebuild, but it is strictly safe: no values are lost, and existing INT-typed consumers of RepID receive a wider type transparently.

Blast Radius: FileCatalogDB schema

FC_Replicas.RepID was a signed INT, which can be exhausted on large
catalogs because AUTO_INCREMENT values are never reused (also on failed
or duplicate inserts). Widen RepID to BIGINT in FileCatalogDB and
FileCatalogWithFkAndPsDB, and keep FC_ReplicaInfo.RepID consistent.
@fstagni fstagni changed the title [for minor release] fix (DMS): widen FC_Replicas RepID to BIGINT fix (DMS): widen FC_Replicas RepID to BIGINT Oct 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant