vitessio / vitess

Vitess is a database clustering system for horizontal scaling of MySQL.
http://vitess.io
Apache License 2.0
18.71k stars 2.1k forks source link

Task: unify internal vitess table name formats #14582

Open shlomi-noach opened 1 year ago

shlomi-noach commented 1 year ago

Today, Vitess recognizes these formats as internal names:

GC table names

Online DDL table names

As well as pt-osc names like _table_old or __table_old. We ignore pt-osc names for the sake of this discussion.

In the list above we have two different format types, and three different lengths of tables. Compare:

_vt_HOLD_6ace8bcef73211ea87e9f875a4d24e90_20200915120410
_vt_PURGE_6ace8bcef73211ea87e9f875a4d24e90_20200915120410
_84371a37_6153_11eb_9917_f875a4d24e90_20210128122816_vrepl

The latter, longest table name, is 58 characters long. This leaves no room for default foreign key name suffix such as _ibfk_1. See https://github.com/vitessio/vitess/issues/14570.

We want to unify the internal naming format like so:

Suggested format

The following is a 56 character length format:

_vt_hld_6ace8bcef73211ea87e9f875a4d24e90_20200915120410_
_vt_prg_6ace8bcef73211ea87e9f875a4d24e90_20200915120410_
_vt_evc_6ace8bcef73211ea87e9f875a4d24e90_20200915120410_
_vt_drp_6ace8bcef73211ea87e9f875a4d24e90_20200915120410_
_vt_vrp_6ace8bcef73211ea87e9f875a4d24e90_20200915120410_
_vt_gho_6ace8bcef73211ea87e9f875a4d24e90_20200915120410_
_vt_ghc_6ace8bcef73211ea87e9f875a4d24e90_20200915120410_
_vt_del_6ace8bcef73211ea87e9f875a4d24e90_20200915120410_

where:

The prefix _vt_ suggests that this might be a vitess table, before we even validate the exact format. The suffix _ suggests this might be a vitess table, again before we fully validate.

Two version rollout

This will have to rollout over multiple versions:

The reason why we have to split this over 19 and 20 is that if we create e.g. a _vt_drp_... table in a PRIMARY, and the replica does not yet recognize that as a DROP table, then if the replica gets promoted as a new PRIMARY it will not handle the table correctly.

shlomi-noach commented 2 months ago

version 21 or later: stop recognizing the old formats.

Postponing the hard removal, keeping the soft removal of old format for a while longer (new tables created in new format, but old format is still respected).