vitess.io/vitess@v0.16.2/go/vt/sidecardb/doc.go (about)

     1  /*
     2  Copyright 2023 The Vitess Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package sidecardb
    18  
    19  /*
    20  
    21  The sidecardb module is used to create and upgrade the sidecar database schema on tablet init. The sidecar database
    22  is named `_vt`.
    23  
    24  The schema subdirectory has subdirectories, categorized by module, with one file per table in _vt. Each has the latest
    25  schema for each table in _vt (in the form of a create table statement).
    26  
    27  sidecardb uses the schemadiff module in Vitess to reach the desired schema for each table.
    28  
    29  Note:
    30  
    31  The `if not exists` in the schema files should not be needed since we only create tables in the sidecar database if they don't exist.
    32  However, during development, we came across some Vitess flows like backup restore on replicas where the database
    33  already had the tables but mysql replication also found these `create`s
    34  in the primary's binlog causing the replica tablet to halt since it could not execute the duplicate create.
    35  
    36  We did fix these flows and hence ideally this **should never happen**, but as an abundance of caution
    37  I have left it in now for operational reasons, so that we paper over any bugs for now.
    38  We can remove it in v17 or v18 once the schema init is stable and we have done more testing.
    39  
    40  */